diff --git a/api/cosmos/bridge/v1/bridge.pulsar.go b/api/cosmos/bridge/v1/bridge.pulsar.go new file mode 100644 index 00000000..685931a7 --- /dev/null +++ b/api/cosmos/bridge/v1/bridge.pulsar.go @@ -0,0 +1,862 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package bridgev1 + +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 ( + md_Params protoreflect.MessageDescriptor + fd_Params_authorized_contract protoreflect.FieldDescriptor + fd_Params_hyperlane_mailbox protoreflect.FieldDescriptor + fd_Params_base_domain_id protoreflect.FieldDescriptor + fd_Params_enabled protoreflect.FieldDescriptor + fd_Params_max_transfer_amount protoreflect.FieldDescriptor +) + +func init() { + file_cosmos_bridge_v1_bridge_proto_init() + md_Params = File_cosmos_bridge_v1_bridge_proto.Messages().ByName("Params") + fd_Params_authorized_contract = md_Params.Fields().ByName("authorized_contract") + fd_Params_hyperlane_mailbox = md_Params.Fields().ByName("hyperlane_mailbox") + fd_Params_base_domain_id = md_Params.Fields().ByName("base_domain_id") + fd_Params_enabled = md_Params.Fields().ByName("enabled") + fd_Params_max_transfer_amount = md_Params.Fields().ByName("max_transfer_amount") +} + +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_cosmos_bridge_v1_bridge_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.AuthorizedContract != "" { + value := protoreflect.ValueOfString(x.AuthorizedContract) + if !f(fd_Params_authorized_contract, value) { + return + } + } + if x.HyperlaneMailbox != "" { + value := protoreflect.ValueOfString(x.HyperlaneMailbox) + if !f(fd_Params_hyperlane_mailbox, value) { + return + } + } + if x.BaseDomainId != uint32(0) { + value := protoreflect.ValueOfUint32(x.BaseDomainId) + if !f(fd_Params_base_domain_id, value) { + return + } + } + if x.Enabled != false { + value := protoreflect.ValueOfBool(x.Enabled) + if !f(fd_Params_enabled, value) { + return + } + } + if x.MaxTransferAmount != "" { + value := protoreflect.ValueOfString(x.MaxTransferAmount) + if !f(fd_Params_max_transfer_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_Params) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "cosmos.bridge.v1.Params.authorized_contract": + return x.AuthorizedContract != "" + case "cosmos.bridge.v1.Params.hyperlane_mailbox": + return x.HyperlaneMailbox != "" + case "cosmos.bridge.v1.Params.base_domain_id": + return x.BaseDomainId != uint32(0) + case "cosmos.bridge.v1.Params.enabled": + return x.Enabled != false + case "cosmos.bridge.v1.Params.max_transfer_amount": + return x.MaxTransferAmount != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.bridge.v1.Params")) + } + panic(fmt.Errorf("message cosmos.bridge.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 "cosmos.bridge.v1.Params.authorized_contract": + x.AuthorizedContract = "" + case "cosmos.bridge.v1.Params.hyperlane_mailbox": + x.HyperlaneMailbox = "" + case "cosmos.bridge.v1.Params.base_domain_id": + x.BaseDomainId = uint32(0) + case "cosmos.bridge.v1.Params.enabled": + x.Enabled = false + case "cosmos.bridge.v1.Params.max_transfer_amount": + x.MaxTransferAmount = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.bridge.v1.Params")) + } + panic(fmt.Errorf("message cosmos.bridge.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 "cosmos.bridge.v1.Params.authorized_contract": + value := x.AuthorizedContract + return protoreflect.ValueOfString(value) + case "cosmos.bridge.v1.Params.hyperlane_mailbox": + value := x.HyperlaneMailbox + return protoreflect.ValueOfString(value) + case "cosmos.bridge.v1.Params.base_domain_id": + value := x.BaseDomainId + return protoreflect.ValueOfUint32(value) + case "cosmos.bridge.v1.Params.enabled": + value := x.Enabled + return protoreflect.ValueOfBool(value) + case "cosmos.bridge.v1.Params.max_transfer_amount": + value := x.MaxTransferAmount + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.bridge.v1.Params")) + } + panic(fmt.Errorf("message cosmos.bridge.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 "cosmos.bridge.v1.Params.authorized_contract": + x.AuthorizedContract = value.Interface().(string) + case "cosmos.bridge.v1.Params.hyperlane_mailbox": + x.HyperlaneMailbox = value.Interface().(string) + case "cosmos.bridge.v1.Params.base_domain_id": + x.BaseDomainId = uint32(value.Uint()) + case "cosmos.bridge.v1.Params.enabled": + x.Enabled = value.Bool() + case "cosmos.bridge.v1.Params.max_transfer_amount": + x.MaxTransferAmount = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.bridge.v1.Params")) + } + panic(fmt.Errorf("message cosmos.bridge.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 "cosmos.bridge.v1.Params.authorized_contract": + panic(fmt.Errorf("field authorized_contract of message cosmos.bridge.v1.Params is not mutable")) + case "cosmos.bridge.v1.Params.hyperlane_mailbox": + panic(fmt.Errorf("field hyperlane_mailbox of message cosmos.bridge.v1.Params is not mutable")) + case "cosmos.bridge.v1.Params.base_domain_id": + panic(fmt.Errorf("field base_domain_id of message cosmos.bridge.v1.Params is not mutable")) + case "cosmos.bridge.v1.Params.enabled": + panic(fmt.Errorf("field enabled of message cosmos.bridge.v1.Params is not mutable")) + case "cosmos.bridge.v1.Params.max_transfer_amount": + panic(fmt.Errorf("field max_transfer_amount of message cosmos.bridge.v1.Params is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.bridge.v1.Params")) + } + panic(fmt.Errorf("message cosmos.bridge.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 "cosmos.bridge.v1.Params.authorized_contract": + return protoreflect.ValueOfString("") + case "cosmos.bridge.v1.Params.hyperlane_mailbox": + return protoreflect.ValueOfString("") + case "cosmos.bridge.v1.Params.base_domain_id": + return protoreflect.ValueOfUint32(uint32(0)) + case "cosmos.bridge.v1.Params.enabled": + return protoreflect.ValueOfBool(false) + case "cosmos.bridge.v1.Params.max_transfer_amount": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.bridge.v1.Params")) + } + panic(fmt.Errorf("message cosmos.bridge.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 cosmos.bridge.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 + l = len(x.AuthorizedContract) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.HyperlaneMailbox) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.BaseDomainId != 0 { + n += 1 + runtime.Sov(uint64(x.BaseDomainId)) + } + if x.Enabled { + n += 2 + } + l = len(x.MaxTransferAmount) + 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.MaxTransferAmount) > 0 { + i -= len(x.MaxTransferAmount) + copy(dAtA[i:], x.MaxTransferAmount) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.MaxTransferAmount))) + i-- + dAtA[i] = 0x2a + } + if x.Enabled { + i-- + if x.Enabled { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x20 + } + if x.BaseDomainId != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.BaseDomainId)) + i-- + dAtA[i] = 0x18 + } + if len(x.HyperlaneMailbox) > 0 { + i -= len(x.HyperlaneMailbox) + copy(dAtA[i:], x.HyperlaneMailbox) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.HyperlaneMailbox))) + i-- + dAtA[i] = 0x12 + } + if len(x.AuthorizedContract) > 0 { + i -= len(x.AuthorizedContract) + copy(dAtA[i:], x.AuthorizedContract) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.AuthorizedContract))) + 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 AuthorizedContract", 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.AuthorizedContract = 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 HyperlaneMailbox", 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.HyperlaneMailbox = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field BaseDomainId", wireType) + } + x.BaseDomainId = 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.BaseDomainId |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Enabled", 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.Enabled = bool(v != 0) + case 5: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field MaxTransferAmount", 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.MaxTransferAmount = 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: cosmos/bridge/v1/bridge.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 x/bridge module parameters. +type Params struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // authorized_contract is the hex EVM address of the authorized bridge contract. + AuthorizedContract string `protobuf:"bytes,1,opt,name=authorized_contract,json=authorizedContract,proto3" json:"authorized_contract,omitempty"` + // hyperlane_mailbox is the hex EVM address of the Hyperlane Mailbox. + HyperlaneMailbox string `protobuf:"bytes,2,opt,name=hyperlane_mailbox,json=hyperlaneMailbox,proto3" json:"hyperlane_mailbox,omitempty"` + // base_domain_id is the Hyperlane domain ID for Base (default 8453). + BaseDomainId uint32 `protobuf:"varint,3,opt,name=base_domain_id,json=baseDomainId,proto3" json:"base_domain_id,omitempty"` + // enabled indicates whether the bridge is active. + Enabled bool `protobuf:"varint,4,opt,name=enabled,proto3" json:"enabled,omitempty"` + // max_transfer_amount is the maximum amount per transfer. + MaxTransferAmount string `protobuf:"bytes,5,opt,name=max_transfer_amount,json=maxTransferAmount,proto3" json:"max_transfer_amount,omitempty"` +} + +func (x *Params) Reset() { + *x = Params{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_bridge_v1_bridge_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_cosmos_bridge_v1_bridge_proto_rawDescGZIP(), []int{0} +} + +func (x *Params) GetAuthorizedContract() string { + if x != nil { + return x.AuthorizedContract + } + return "" +} + +func (x *Params) GetHyperlaneMailbox() string { + if x != nil { + return x.HyperlaneMailbox + } + return "" +} + +func (x *Params) GetBaseDomainId() uint32 { + if x != nil { + return x.BaseDomainId + } + return 0 +} + +func (x *Params) GetEnabled() bool { + if x != nil { + return x.Enabled + } + return false +} + +func (x *Params) GetMaxTransferAmount() string { + if x != nil { + return x.MaxTransferAmount + } + return "" +} + +var File_cosmos_bridge_v1_bridge_proto protoreflect.FileDescriptor + +var file_cosmos_bridge_v1_bridge_proto_rawDesc = []byte{ + 0x0a, 0x1d, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, 0x72, 0x69, 0x64, 0x67, 0x65, 0x2f, + 0x76, 0x31, 0x2f, 0x62, 0x72, 0x69, 0x64, 0x67, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, + 0x10, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x72, 0x69, 0x64, 0x67, 0x65, 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, 0x22, 0x93, 0x03, 0x0a, 0x06, 0x50, + 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x4d, 0x0a, 0x13, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, + 0x7a, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x42, 0x1c, 0xea, 0xde, 0x1f, 0x13, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, + 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, + 0x52, 0x12, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x43, 0x6f, 0x6e, 0x74, + 0x72, 0x61, 0x63, 0x74, 0x12, 0x47, 0x0a, 0x11, 0x68, 0x79, 0x70, 0x65, 0x72, 0x6c, 0x61, 0x6e, + 0x65, 0x5f, 0x6d, 0x61, 0x69, 0x6c, 0x62, 0x6f, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, + 0x1a, 0xea, 0xde, 0x1f, 0x11, 0x68, 0x79, 0x70, 0x65, 0x72, 0x6c, 0x61, 0x6e, 0x65, 0x5f, 0x6d, + 0x61, 0x69, 0x6c, 0x62, 0x6f, 0x78, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x10, 0x68, 0x79, 0x70, + 0x65, 0x72, 0x6c, 0x61, 0x6e, 0x65, 0x4d, 0x61, 0x69, 0x6c, 0x62, 0x6f, 0x78, 0x12, 0x3d, 0x0a, + 0x0e, 0x62, 0x61, 0x73, 0x65, 0x5f, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x5f, 0x69, 0x64, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x0d, 0x42, 0x17, 0xea, 0xde, 0x1f, 0x0e, 0x62, 0x61, 0x73, 0x65, 0x5f, + 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x5f, 0x69, 0x64, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x0c, + 0x62, 0x61, 0x73, 0x65, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x49, 0x64, 0x12, 0x2a, 0x0a, 0x07, + 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x42, 0x10, 0xea, + 0xde, 0x1f, 0x07, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, + 0x07, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x12, 0x69, 0x0a, 0x13, 0x6d, 0x61, 0x78, 0x5f, + 0x74, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, 0x5f, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, + 0x05, 0x20, 0x01, 0x28, 0x09, 0x42, 0x39, 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, 0xea, 0xde, 0x1f, 0x13, 0x6d, 0x61, 0x78, 0x5f, 0x74, 0x72, 0x61, 0x6e, + 0x73, 0x66, 0x65, 0x72, 0x5f, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, + 0x52, 0x11, 0x6d, 0x61, 0x78, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, 0x41, 0x6d, 0x6f, + 0x75, 0x6e, 0x74, 0x3a, 0x1b, 0x8a, 0xe7, 0xb0, 0x2a, 0x16, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x2f, 0x78, 0x2f, 0x62, 0x72, 0x69, 0x64, 0x67, 0x65, 0x2f, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, + 0x42, 0xb1, 0x01, 0x0a, 0x14, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, + 0x62, 0x72, 0x69, 0x64, 0x67, 0x65, 0x2e, 0x76, 0x31, 0x42, 0x0b, 0x42, 0x72, 0x69, 0x64, 0x67, + 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x2f, 0x62, 0x72, 0x69, 0x64, 0x67, 0x65, 0x2f, 0x76, 0x31, 0x3b, 0x62, 0x72, 0x69, 0x64, + 0x67, 0x65, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x42, 0x58, 0xaa, 0x02, 0x10, 0x43, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x2e, 0x42, 0x72, 0x69, 0x64, 0x67, 0x65, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x10, + 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x42, 0x72, 0x69, 0x64, 0x67, 0x65, 0x5c, 0x56, 0x31, + 0xe2, 0x02, 0x1c, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x42, 0x72, 0x69, 0x64, 0x67, 0x65, + 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, + 0x02, 0x12, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x42, 0x72, 0x69, 0x64, 0x67, 0x65, + 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_cosmos_bridge_v1_bridge_proto_rawDescOnce sync.Once + file_cosmos_bridge_v1_bridge_proto_rawDescData = file_cosmos_bridge_v1_bridge_proto_rawDesc +) + +func file_cosmos_bridge_v1_bridge_proto_rawDescGZIP() []byte { + file_cosmos_bridge_v1_bridge_proto_rawDescOnce.Do(func() { + file_cosmos_bridge_v1_bridge_proto_rawDescData = protoimpl.X.CompressGZIP(file_cosmos_bridge_v1_bridge_proto_rawDescData) + }) + return file_cosmos_bridge_v1_bridge_proto_rawDescData +} + +var file_cosmos_bridge_v1_bridge_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_cosmos_bridge_v1_bridge_proto_goTypes = []interface{}{ + (*Params)(nil), // 0: cosmos.bridge.v1.Params +} +var file_cosmos_bridge_v1_bridge_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_cosmos_bridge_v1_bridge_proto_init() } +func file_cosmos_bridge_v1_bridge_proto_init() { + if File_cosmos_bridge_v1_bridge_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_cosmos_bridge_v1_bridge_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_cosmos_bridge_v1_bridge_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_cosmos_bridge_v1_bridge_proto_goTypes, + DependencyIndexes: file_cosmos_bridge_v1_bridge_proto_depIdxs, + MessageInfos: file_cosmos_bridge_v1_bridge_proto_msgTypes, + }.Build() + File_cosmos_bridge_v1_bridge_proto = out.File + file_cosmos_bridge_v1_bridge_proto_rawDesc = nil + file_cosmos_bridge_v1_bridge_proto_goTypes = nil + file_cosmos_bridge_v1_bridge_proto_depIdxs = nil +} diff --git a/api/cosmos/bridge/v1/genesis.pulsar.go b/api/cosmos/bridge/v1/genesis.pulsar.go new file mode 100644 index 00000000..005aec97 --- /dev/null +++ b/api/cosmos/bridge/v1/genesis.pulsar.go @@ -0,0 +1,750 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package bridgev1 + +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 ( + md_GenesisState protoreflect.MessageDescriptor + fd_GenesisState_params protoreflect.FieldDescriptor + fd_GenesisState_total_minted protoreflect.FieldDescriptor + fd_GenesisState_total_burned protoreflect.FieldDescriptor +) + +func init() { + file_cosmos_bridge_v1_genesis_proto_init() + md_GenesisState = File_cosmos_bridge_v1_genesis_proto.Messages().ByName("GenesisState") + fd_GenesisState_params = md_GenesisState.Fields().ByName("params") + fd_GenesisState_total_minted = md_GenesisState.Fields().ByName("total_minted") + fd_GenesisState_total_burned = md_GenesisState.Fields().ByName("total_burned") +} + +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_cosmos_bridge_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 x.TotalMinted != "" { + value := protoreflect.ValueOfString(x.TotalMinted) + if !f(fd_GenesisState_total_minted, value) { + return + } + } + if x.TotalBurned != "" { + value := protoreflect.ValueOfString(x.TotalBurned) + if !f(fd_GenesisState_total_burned, 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 "cosmos.bridge.v1.GenesisState.params": + return x.Params != nil + case "cosmos.bridge.v1.GenesisState.total_minted": + return x.TotalMinted != "" + case "cosmos.bridge.v1.GenesisState.total_burned": + return x.TotalBurned != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.bridge.v1.GenesisState")) + } + panic(fmt.Errorf("message cosmos.bridge.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 "cosmos.bridge.v1.GenesisState.params": + x.Params = nil + case "cosmos.bridge.v1.GenesisState.total_minted": + x.TotalMinted = "" + case "cosmos.bridge.v1.GenesisState.total_burned": + x.TotalBurned = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.bridge.v1.GenesisState")) + } + panic(fmt.Errorf("message cosmos.bridge.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 "cosmos.bridge.v1.GenesisState.params": + value := x.Params + return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "cosmos.bridge.v1.GenesisState.total_minted": + value := x.TotalMinted + return protoreflect.ValueOfString(value) + case "cosmos.bridge.v1.GenesisState.total_burned": + value := x.TotalBurned + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.bridge.v1.GenesisState")) + } + panic(fmt.Errorf("message cosmos.bridge.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 "cosmos.bridge.v1.GenesisState.params": + x.Params = value.Message().Interface().(*Params) + case "cosmos.bridge.v1.GenesisState.total_minted": + x.TotalMinted = value.Interface().(string) + case "cosmos.bridge.v1.GenesisState.total_burned": + x.TotalBurned = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.bridge.v1.GenesisState")) + } + panic(fmt.Errorf("message cosmos.bridge.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 "cosmos.bridge.v1.GenesisState.params": + if x.Params == nil { + x.Params = new(Params) + } + return protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + case "cosmos.bridge.v1.GenesisState.total_minted": + panic(fmt.Errorf("field total_minted of message cosmos.bridge.v1.GenesisState is not mutable")) + case "cosmos.bridge.v1.GenesisState.total_burned": + panic(fmt.Errorf("field total_burned of message cosmos.bridge.v1.GenesisState is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.bridge.v1.GenesisState")) + } + panic(fmt.Errorf("message cosmos.bridge.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 "cosmos.bridge.v1.GenesisState.params": + m := new(Params) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "cosmos.bridge.v1.GenesisState.total_minted": + return protoreflect.ValueOfString("") + case "cosmos.bridge.v1.GenesisState.total_burned": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.bridge.v1.GenesisState")) + } + panic(fmt.Errorf("message cosmos.bridge.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 cosmos.bridge.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)) + } + l = len(x.TotalMinted) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.TotalBurned) + 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().(*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.TotalBurned) > 0 { + i -= len(x.TotalBurned) + copy(dAtA[i:], x.TotalBurned) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.TotalBurned))) + i-- + dAtA[i] = 0x1a + } + if len(x.TotalMinted) > 0 { + i -= len(x.TotalMinted) + copy(dAtA[i:], x.TotalMinted) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.TotalMinted))) + 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 TotalMinted", 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.TotalMinted = 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 TotalBurned", 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.TotalBurned = 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: cosmos/bridge/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 bridge module's genesis state. +type GenesisState struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // params defines all the parameters of the bridge module. + Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` + // total_minted is the cumulative tokens minted via bridge. + TotalMinted string `protobuf:"bytes,2,opt,name=total_minted,json=totalMinted,proto3" json:"total_minted,omitempty"` + // total_burned is the cumulative tokens burned via bridge. + TotalBurned string `protobuf:"bytes,3,opt,name=total_burned,json=totalBurned,proto3" json:"total_burned,omitempty"` +} + +func (x *GenesisState) Reset() { + *x = GenesisState{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_bridge_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_cosmos_bridge_v1_genesis_proto_rawDescGZIP(), []int{0} +} + +func (x *GenesisState) GetParams() *Params { + if x != nil { + return x.Params + } + return nil +} + +func (x *GenesisState) GetTotalMinted() string { + if x != nil { + return x.TotalMinted + } + return "" +} + +func (x *GenesisState) GetTotalBurned() string { + if x != nil { + return x.TotalBurned + } + return "" +} + +var File_cosmos_bridge_v1_genesis_proto protoreflect.FileDescriptor + +var file_cosmos_bridge_v1_genesis_proto_rawDesc = []byte{ + 0x0a, 0x1e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, 0x72, 0x69, 0x64, 0x67, 0x65, 0x2f, + 0x76, 0x31, 0x2f, 0x67, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x12, 0x10, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x72, 0x69, 0x64, 0x67, 0x65, 0x2e, + 0x76, 0x31, 0x1a, 0x11, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2f, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1d, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, 0x72, + 0x69, 0x64, 0x67, 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x62, 0x72, 0x69, 0x64, 0x67, 0x65, 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, 0x22, 0xcf, 0x01, 0x0a, 0x0c, 0x47, + 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x3b, 0x0a, 0x06, 0x70, + 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x72, 0x69, 0x64, 0x67, 0x65, 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, 0x40, 0x0a, 0x0c, 0x74, 0x6f, 0x74, 0x61, + 0x6c, 0x5f, 0x6d, 0x69, 0x6e, 0x74, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x1d, + 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, 0x52, 0x0b, 0x74, + 0x6f, 0x74, 0x61, 0x6c, 0x4d, 0x69, 0x6e, 0x74, 0x65, 0x64, 0x12, 0x40, 0x0a, 0x0c, 0x74, 0x6f, + 0x74, 0x61, 0x6c, 0x5f, 0x62, 0x75, 0x72, 0x6e, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, + 0x42, 0x1d, 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, 0x52, + 0x0b, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x42, 0x75, 0x72, 0x6e, 0x65, 0x64, 0x42, 0xb2, 0x01, 0x0a, + 0x14, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x72, 0x69, 0x64, + 0x67, 0x65, 0x2e, 0x76, 0x31, 0x42, 0x0c, 0x47, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x50, 0x72, + 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, + 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, + 0x72, 0x69, 0x64, 0x67, 0x65, 0x2f, 0x76, 0x31, 0x3b, 0x62, 0x72, 0x69, 0x64, 0x67, 0x65, 0x76, + 0x31, 0xa2, 0x02, 0x03, 0x43, 0x42, 0x58, 0xaa, 0x02, 0x10, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x2e, 0x42, 0x72, 0x69, 0x64, 0x67, 0x65, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x10, 0x43, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x5c, 0x42, 0x72, 0x69, 0x64, 0x67, 0x65, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x1c, + 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x42, 0x72, 0x69, 0x64, 0x67, 0x65, 0x5c, 0x56, 0x31, + 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x12, 0x43, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x42, 0x72, 0x69, 0x64, 0x67, 0x65, 0x3a, 0x3a, 0x56, + 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_cosmos_bridge_v1_genesis_proto_rawDescOnce sync.Once + file_cosmos_bridge_v1_genesis_proto_rawDescData = file_cosmos_bridge_v1_genesis_proto_rawDesc +) + +func file_cosmos_bridge_v1_genesis_proto_rawDescGZIP() []byte { + file_cosmos_bridge_v1_genesis_proto_rawDescOnce.Do(func() { + file_cosmos_bridge_v1_genesis_proto_rawDescData = protoimpl.X.CompressGZIP(file_cosmos_bridge_v1_genesis_proto_rawDescData) + }) + return file_cosmos_bridge_v1_genesis_proto_rawDescData +} + +var file_cosmos_bridge_v1_genesis_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_cosmos_bridge_v1_genesis_proto_goTypes = []interface{}{ + (*GenesisState)(nil), // 0: cosmos.bridge.v1.GenesisState + (*Params)(nil), // 1: cosmos.bridge.v1.Params +} +var file_cosmos_bridge_v1_genesis_proto_depIdxs = []int32{ + 1, // 0: cosmos.bridge.v1.GenesisState.params:type_name -> cosmos.bridge.v1.Params + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] 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_cosmos_bridge_v1_genesis_proto_init() } +func file_cosmos_bridge_v1_genesis_proto_init() { + if File_cosmos_bridge_v1_genesis_proto != nil { + return + } + file_cosmos_bridge_v1_bridge_proto_init() + if !protoimpl.UnsafeEnabled { + file_cosmos_bridge_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_cosmos_bridge_v1_genesis_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_cosmos_bridge_v1_genesis_proto_goTypes, + DependencyIndexes: file_cosmos_bridge_v1_genesis_proto_depIdxs, + MessageInfos: file_cosmos_bridge_v1_genesis_proto_msgTypes, + }.Build() + File_cosmos_bridge_v1_genesis_proto = out.File + file_cosmos_bridge_v1_genesis_proto_rawDesc = nil + file_cosmos_bridge_v1_genesis_proto_goTypes = nil + file_cosmos_bridge_v1_genesis_proto_depIdxs = nil +} diff --git a/api/cosmos/bridge/v1/query.pulsar.go b/api/cosmos/bridge/v1/query.pulsar.go new file mode 100644 index 00000000..c2f7fab8 --- /dev/null +++ b/api/cosmos/bridge/v1/query.pulsar.go @@ -0,0 +1,2109 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package bridgev1 + +import ( + _ "cosmossdk.io/api/amino" + 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_cosmos_bridge_v1_query_proto_init() + md_QueryParamsRequest = File_cosmos_bridge_v1_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_cosmos_bridge_v1_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: cosmos.bridge.v1.QueryParamsRequest")) + } + panic(fmt.Errorf("message cosmos.bridge.v1.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: cosmos.bridge.v1.QueryParamsRequest")) + } + panic(fmt.Errorf("message cosmos.bridge.v1.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: cosmos.bridge.v1.QueryParamsRequest")) + } + panic(fmt.Errorf("message cosmos.bridge.v1.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: cosmos.bridge.v1.QueryParamsRequest")) + } + panic(fmt.Errorf("message cosmos.bridge.v1.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: cosmos.bridge.v1.QueryParamsRequest")) + } + panic(fmt.Errorf("message cosmos.bridge.v1.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: cosmos.bridge.v1.QueryParamsRequest")) + } + panic(fmt.Errorf("message cosmos.bridge.v1.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 cosmos.bridge.v1.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_cosmos_bridge_v1_query_proto_init() + md_QueryParamsResponse = File_cosmos_bridge_v1_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_cosmos_bridge_v1_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 "cosmos.bridge.v1.QueryParamsResponse.params": + return x.Params != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.bridge.v1.QueryParamsResponse")) + } + panic(fmt.Errorf("message cosmos.bridge.v1.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 "cosmos.bridge.v1.QueryParamsResponse.params": + x.Params = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.bridge.v1.QueryParamsResponse")) + } + panic(fmt.Errorf("message cosmos.bridge.v1.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 "cosmos.bridge.v1.QueryParamsResponse.params": + value := x.Params + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.bridge.v1.QueryParamsResponse")) + } + panic(fmt.Errorf("message cosmos.bridge.v1.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 "cosmos.bridge.v1.QueryParamsResponse.params": + x.Params = value.Message().Interface().(*Params) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.bridge.v1.QueryParamsResponse")) + } + panic(fmt.Errorf("message cosmos.bridge.v1.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 "cosmos.bridge.v1.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: cosmos.bridge.v1.QueryParamsResponse")) + } + panic(fmt.Errorf("message cosmos.bridge.v1.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 "cosmos.bridge.v1.QueryParamsResponse.params": + m := new(Params) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.bridge.v1.QueryParamsResponse")) + } + panic(fmt.Errorf("message cosmos.bridge.v1.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 cosmos.bridge.v1.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, + } +} + +var ( + md_QueryBridgeStatusRequest protoreflect.MessageDescriptor +) + +func init() { + file_cosmos_bridge_v1_query_proto_init() + md_QueryBridgeStatusRequest = File_cosmos_bridge_v1_query_proto.Messages().ByName("QueryBridgeStatusRequest") +} + +var _ protoreflect.Message = (*fastReflection_QueryBridgeStatusRequest)(nil) + +type fastReflection_QueryBridgeStatusRequest QueryBridgeStatusRequest + +func (x *QueryBridgeStatusRequest) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryBridgeStatusRequest)(x) +} + +func (x *QueryBridgeStatusRequest) slowProtoReflect() protoreflect.Message { + mi := &file_cosmos_bridge_v1_query_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_QueryBridgeStatusRequest_messageType fastReflection_QueryBridgeStatusRequest_messageType +var _ protoreflect.MessageType = fastReflection_QueryBridgeStatusRequest_messageType{} + +type fastReflection_QueryBridgeStatusRequest_messageType struct{} + +func (x fastReflection_QueryBridgeStatusRequest_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryBridgeStatusRequest)(nil) +} +func (x fastReflection_QueryBridgeStatusRequest_messageType) New() protoreflect.Message { + return new(fastReflection_QueryBridgeStatusRequest) +} +func (x fastReflection_QueryBridgeStatusRequest_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryBridgeStatusRequest +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_QueryBridgeStatusRequest) Descriptor() protoreflect.MessageDescriptor { + return md_QueryBridgeStatusRequest +} + +// 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_QueryBridgeStatusRequest) Type() protoreflect.MessageType { + return _fastReflection_QueryBridgeStatusRequest_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_QueryBridgeStatusRequest) New() protoreflect.Message { + return new(fastReflection_QueryBridgeStatusRequest) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_QueryBridgeStatusRequest) Interface() protoreflect.ProtoMessage { + return (*QueryBridgeStatusRequest)(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_QueryBridgeStatusRequest) 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_QueryBridgeStatusRequest) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.bridge.v1.QueryBridgeStatusRequest")) + } + panic(fmt.Errorf("message cosmos.bridge.v1.QueryBridgeStatusRequest 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_QueryBridgeStatusRequest) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.bridge.v1.QueryBridgeStatusRequest")) + } + panic(fmt.Errorf("message cosmos.bridge.v1.QueryBridgeStatusRequest 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_QueryBridgeStatusRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.bridge.v1.QueryBridgeStatusRequest")) + } + panic(fmt.Errorf("message cosmos.bridge.v1.QueryBridgeStatusRequest 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_QueryBridgeStatusRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.bridge.v1.QueryBridgeStatusRequest")) + } + panic(fmt.Errorf("message cosmos.bridge.v1.QueryBridgeStatusRequest 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_QueryBridgeStatusRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.bridge.v1.QueryBridgeStatusRequest")) + } + panic(fmt.Errorf("message cosmos.bridge.v1.QueryBridgeStatusRequest 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_QueryBridgeStatusRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.bridge.v1.QueryBridgeStatusRequest")) + } + panic(fmt.Errorf("message cosmos.bridge.v1.QueryBridgeStatusRequest 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_QueryBridgeStatusRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in cosmos.bridge.v1.QueryBridgeStatusRequest", 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_QueryBridgeStatusRequest) 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_QueryBridgeStatusRequest) 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_QueryBridgeStatusRequest) 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_QueryBridgeStatusRequest) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*QueryBridgeStatusRequest) + 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().(*QueryBridgeStatusRequest) + 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().(*QueryBridgeStatusRequest) + 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: QueryBridgeStatusRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryBridgeStatusRequest: 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_QueryBridgeStatusResponse protoreflect.MessageDescriptor + fd_QueryBridgeStatusResponse_enabled protoreflect.FieldDescriptor + fd_QueryBridgeStatusResponse_total_minted protoreflect.FieldDescriptor + fd_QueryBridgeStatusResponse_total_burned protoreflect.FieldDescriptor + fd_QueryBridgeStatusResponse_authorized_contract protoreflect.FieldDescriptor +) + +func init() { + file_cosmos_bridge_v1_query_proto_init() + md_QueryBridgeStatusResponse = File_cosmos_bridge_v1_query_proto.Messages().ByName("QueryBridgeStatusResponse") + fd_QueryBridgeStatusResponse_enabled = md_QueryBridgeStatusResponse.Fields().ByName("enabled") + fd_QueryBridgeStatusResponse_total_minted = md_QueryBridgeStatusResponse.Fields().ByName("total_minted") + fd_QueryBridgeStatusResponse_total_burned = md_QueryBridgeStatusResponse.Fields().ByName("total_burned") + fd_QueryBridgeStatusResponse_authorized_contract = md_QueryBridgeStatusResponse.Fields().ByName("authorized_contract") +} + +var _ protoreflect.Message = (*fastReflection_QueryBridgeStatusResponse)(nil) + +type fastReflection_QueryBridgeStatusResponse QueryBridgeStatusResponse + +func (x *QueryBridgeStatusResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryBridgeStatusResponse)(x) +} + +func (x *QueryBridgeStatusResponse) slowProtoReflect() protoreflect.Message { + mi := &file_cosmos_bridge_v1_query_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_QueryBridgeStatusResponse_messageType fastReflection_QueryBridgeStatusResponse_messageType +var _ protoreflect.MessageType = fastReflection_QueryBridgeStatusResponse_messageType{} + +type fastReflection_QueryBridgeStatusResponse_messageType struct{} + +func (x fastReflection_QueryBridgeStatusResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryBridgeStatusResponse)(nil) +} +func (x fastReflection_QueryBridgeStatusResponse_messageType) New() protoreflect.Message { + return new(fastReflection_QueryBridgeStatusResponse) +} +func (x fastReflection_QueryBridgeStatusResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryBridgeStatusResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_QueryBridgeStatusResponse) Descriptor() protoreflect.MessageDescriptor { + return md_QueryBridgeStatusResponse +} + +// 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_QueryBridgeStatusResponse) Type() protoreflect.MessageType { + return _fastReflection_QueryBridgeStatusResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_QueryBridgeStatusResponse) New() protoreflect.Message { + return new(fastReflection_QueryBridgeStatusResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_QueryBridgeStatusResponse) Interface() protoreflect.ProtoMessage { + return (*QueryBridgeStatusResponse)(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_QueryBridgeStatusResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Enabled != false { + value := protoreflect.ValueOfBool(x.Enabled) + if !f(fd_QueryBridgeStatusResponse_enabled, value) { + return + } + } + if x.TotalMinted != "" { + value := protoreflect.ValueOfString(x.TotalMinted) + if !f(fd_QueryBridgeStatusResponse_total_minted, value) { + return + } + } + if x.TotalBurned != "" { + value := protoreflect.ValueOfString(x.TotalBurned) + if !f(fd_QueryBridgeStatusResponse_total_burned, value) { + return + } + } + if x.AuthorizedContract != "" { + value := protoreflect.ValueOfString(x.AuthorizedContract) + if !f(fd_QueryBridgeStatusResponse_authorized_contract, 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_QueryBridgeStatusResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "cosmos.bridge.v1.QueryBridgeStatusResponse.enabled": + return x.Enabled != false + case "cosmos.bridge.v1.QueryBridgeStatusResponse.total_minted": + return x.TotalMinted != "" + case "cosmos.bridge.v1.QueryBridgeStatusResponse.total_burned": + return x.TotalBurned != "" + case "cosmos.bridge.v1.QueryBridgeStatusResponse.authorized_contract": + return x.AuthorizedContract != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.bridge.v1.QueryBridgeStatusResponse")) + } + panic(fmt.Errorf("message cosmos.bridge.v1.QueryBridgeStatusResponse 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_QueryBridgeStatusResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "cosmos.bridge.v1.QueryBridgeStatusResponse.enabled": + x.Enabled = false + case "cosmos.bridge.v1.QueryBridgeStatusResponse.total_minted": + x.TotalMinted = "" + case "cosmos.bridge.v1.QueryBridgeStatusResponse.total_burned": + x.TotalBurned = "" + case "cosmos.bridge.v1.QueryBridgeStatusResponse.authorized_contract": + x.AuthorizedContract = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.bridge.v1.QueryBridgeStatusResponse")) + } + panic(fmt.Errorf("message cosmos.bridge.v1.QueryBridgeStatusResponse 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_QueryBridgeStatusResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "cosmos.bridge.v1.QueryBridgeStatusResponse.enabled": + value := x.Enabled + return protoreflect.ValueOfBool(value) + case "cosmos.bridge.v1.QueryBridgeStatusResponse.total_minted": + value := x.TotalMinted + return protoreflect.ValueOfString(value) + case "cosmos.bridge.v1.QueryBridgeStatusResponse.total_burned": + value := x.TotalBurned + return protoreflect.ValueOfString(value) + case "cosmos.bridge.v1.QueryBridgeStatusResponse.authorized_contract": + value := x.AuthorizedContract + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.bridge.v1.QueryBridgeStatusResponse")) + } + panic(fmt.Errorf("message cosmos.bridge.v1.QueryBridgeStatusResponse 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_QueryBridgeStatusResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "cosmos.bridge.v1.QueryBridgeStatusResponse.enabled": + x.Enabled = value.Bool() + case "cosmos.bridge.v1.QueryBridgeStatusResponse.total_minted": + x.TotalMinted = value.Interface().(string) + case "cosmos.bridge.v1.QueryBridgeStatusResponse.total_burned": + x.TotalBurned = value.Interface().(string) + case "cosmos.bridge.v1.QueryBridgeStatusResponse.authorized_contract": + x.AuthorizedContract = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.bridge.v1.QueryBridgeStatusResponse")) + } + panic(fmt.Errorf("message cosmos.bridge.v1.QueryBridgeStatusResponse 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_QueryBridgeStatusResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.bridge.v1.QueryBridgeStatusResponse.enabled": + panic(fmt.Errorf("field enabled of message cosmos.bridge.v1.QueryBridgeStatusResponse is not mutable")) + case "cosmos.bridge.v1.QueryBridgeStatusResponse.total_minted": + panic(fmt.Errorf("field total_minted of message cosmos.bridge.v1.QueryBridgeStatusResponse is not mutable")) + case "cosmos.bridge.v1.QueryBridgeStatusResponse.total_burned": + panic(fmt.Errorf("field total_burned of message cosmos.bridge.v1.QueryBridgeStatusResponse is not mutable")) + case "cosmos.bridge.v1.QueryBridgeStatusResponse.authorized_contract": + panic(fmt.Errorf("field authorized_contract of message cosmos.bridge.v1.QueryBridgeStatusResponse is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.bridge.v1.QueryBridgeStatusResponse")) + } + panic(fmt.Errorf("message cosmos.bridge.v1.QueryBridgeStatusResponse 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_QueryBridgeStatusResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.bridge.v1.QueryBridgeStatusResponse.enabled": + return protoreflect.ValueOfBool(false) + case "cosmos.bridge.v1.QueryBridgeStatusResponse.total_minted": + return protoreflect.ValueOfString("") + case "cosmos.bridge.v1.QueryBridgeStatusResponse.total_burned": + return protoreflect.ValueOfString("") + case "cosmos.bridge.v1.QueryBridgeStatusResponse.authorized_contract": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.bridge.v1.QueryBridgeStatusResponse")) + } + panic(fmt.Errorf("message cosmos.bridge.v1.QueryBridgeStatusResponse 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_QueryBridgeStatusResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in cosmos.bridge.v1.QueryBridgeStatusResponse", 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_QueryBridgeStatusResponse) 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_QueryBridgeStatusResponse) 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_QueryBridgeStatusResponse) 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_QueryBridgeStatusResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*QueryBridgeStatusResponse) + 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.Enabled { + n += 2 + } + l = len(x.TotalMinted) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.TotalBurned) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.AuthorizedContract) + 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().(*QueryBridgeStatusResponse) + 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.AuthorizedContract) > 0 { + i -= len(x.AuthorizedContract) + copy(dAtA[i:], x.AuthorizedContract) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.AuthorizedContract))) + i-- + dAtA[i] = 0x22 + } + if len(x.TotalBurned) > 0 { + i -= len(x.TotalBurned) + copy(dAtA[i:], x.TotalBurned) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.TotalBurned))) + i-- + dAtA[i] = 0x1a + } + if len(x.TotalMinted) > 0 { + i -= len(x.TotalMinted) + copy(dAtA[i:], x.TotalMinted) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.TotalMinted))) + i-- + dAtA[i] = 0x12 + } + if x.Enabled { + i-- + if x.Enabled { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + 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().(*QueryBridgeStatusResponse) + 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: QueryBridgeStatusResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryBridgeStatusResponse: 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 Enabled", 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.Enabled = bool(v != 0) + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field TotalMinted", 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.TotalMinted = 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 TotalBurned", 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.TotalBurned = 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 AuthorizedContract", 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.AuthorizedContract = 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: cosmos/bridge/v1/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 defines the request type for querying x/bridge parameters. +type QueryParamsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *QueryParamsRequest) Reset() { + *x = QueryParamsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_bridge_v1_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_cosmos_bridge_v1_query_proto_rawDescGZIP(), []int{0} +} + +// QueryParamsResponse defines the response type for querying x/bridge parameters. +type QueryParamsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // params define the bridge module parameters. + Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` +} + +func (x *QueryParamsResponse) Reset() { + *x = QueryParamsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_bridge_v1_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_cosmos_bridge_v1_query_proto_rawDescGZIP(), []int{1} +} + +func (x *QueryParamsResponse) GetParams() *Params { + if x != nil { + return x.Params + } + return nil +} + +// QueryBridgeStatusRequest defines the request type for querying bridge status. +type QueryBridgeStatusRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *QueryBridgeStatusRequest) Reset() { + *x = QueryBridgeStatusRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_bridge_v1_query_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryBridgeStatusRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryBridgeStatusRequest) ProtoMessage() {} + +// Deprecated: Use QueryBridgeStatusRequest.ProtoReflect.Descriptor instead. +func (*QueryBridgeStatusRequest) Descriptor() ([]byte, []int) { + return file_cosmos_bridge_v1_query_proto_rawDescGZIP(), []int{2} +} + +// QueryBridgeStatusResponse returns the current bridge status and statistics. +type QueryBridgeStatusResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // enabled indicates whether the bridge is active. + Enabled bool `protobuf:"varint,1,opt,name=enabled,proto3" json:"enabled,omitempty"` + // total_minted is the cumulative tokens minted via bridge. + TotalMinted string `protobuf:"bytes,2,opt,name=total_minted,json=totalMinted,proto3" json:"total_minted,omitempty"` + // total_burned is the cumulative tokens burned via bridge. + TotalBurned string `protobuf:"bytes,3,opt,name=total_burned,json=totalBurned,proto3" json:"total_burned,omitempty"` + // authorized_contract is the hex EVM address of the authorized bridge contract. + AuthorizedContract string `protobuf:"bytes,4,opt,name=authorized_contract,json=authorizedContract,proto3" json:"authorized_contract,omitempty"` +} + +func (x *QueryBridgeStatusResponse) Reset() { + *x = QueryBridgeStatusResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_bridge_v1_query_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryBridgeStatusResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryBridgeStatusResponse) ProtoMessage() {} + +// Deprecated: Use QueryBridgeStatusResponse.ProtoReflect.Descriptor instead. +func (*QueryBridgeStatusResponse) Descriptor() ([]byte, []int) { + return file_cosmos_bridge_v1_query_proto_rawDescGZIP(), []int{3} +} + +func (x *QueryBridgeStatusResponse) GetEnabled() bool { + if x != nil { + return x.Enabled + } + return false +} + +func (x *QueryBridgeStatusResponse) GetTotalMinted() string { + if x != nil { + return x.TotalMinted + } + return "" +} + +func (x *QueryBridgeStatusResponse) GetTotalBurned() string { + if x != nil { + return x.TotalBurned + } + return "" +} + +func (x *QueryBridgeStatusResponse) GetAuthorizedContract() string { + if x != nil { + return x.AuthorizedContract + } + return "" +} + +var File_cosmos_bridge_v1_query_proto protoreflect.FileDescriptor + +var file_cosmos_bridge_v1_query_proto_rawDesc = []byte{ + 0x0a, 0x1c, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, 0x72, 0x69, 0x64, 0x67, 0x65, 0x2f, + 0x76, 0x31, 0x2f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x10, + 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x72, 0x69, 0x64, 0x67, 0x65, 0x2e, 0x76, 0x31, + 0x1a, 0x11, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2f, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x1a, 0x1d, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, 0x72, 0x69, 0x64, + 0x67, 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x62, 0x72, 0x69, 0x64, 0x67, 0x65, 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, 0x22, 0x14, 0x0a, 0x12, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, + 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x52, 0x0a, 0x13, + 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x3b, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x72, 0x69, + 0x64, 0x67, 0x65, 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, + 0x22, 0x1a, 0x0a, 0x18, 0x51, 0x75, 0x65, 0x72, 0x79, 0x42, 0x72, 0x69, 0x64, 0x67, 0x65, 0x53, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0xea, 0x01, 0x0a, + 0x19, 0x51, 0x75, 0x65, 0x72, 0x79, 0x42, 0x72, 0x69, 0x64, 0x67, 0x65, 0x53, 0x74, 0x61, 0x74, + 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x65, 0x6e, + 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x65, 0x6e, 0x61, + 0x62, 0x6c, 0x65, 0x64, 0x12, 0x40, 0x0a, 0x0c, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, 0x6d, 0x69, + 0x6e, 0x74, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x1d, 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, 0x52, 0x0b, 0x74, 0x6f, 0x74, 0x61, 0x6c, + 0x4d, 0x69, 0x6e, 0x74, 0x65, 0x64, 0x12, 0x40, 0x0a, 0x0c, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, + 0x62, 0x75, 0x72, 0x6e, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x1d, 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, 0x52, 0x0b, 0x74, 0x6f, 0x74, + 0x61, 0x6c, 0x42, 0x75, 0x72, 0x6e, 0x65, 0x64, 0x12, 0x2f, 0x0a, 0x13, 0x61, 0x75, 0x74, 0x68, + 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x12, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, + 0x64, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x32, 0x93, 0x02, 0x0a, 0x05, 0x51, 0x75, + 0x65, 0x72, 0x79, 0x12, 0x77, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x24, 0x2e, + 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x72, 0x69, 0x64, 0x67, 0x65, 0x2e, 0x76, 0x31, + 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x25, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x72, 0x69, + 0x64, 0x67, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, + 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x20, 0x82, 0xd3, 0xe4, 0x93, + 0x02, 0x1a, 0x12, 0x18, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, 0x72, 0x69, 0x64, + 0x67, 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x90, 0x01, 0x0a, + 0x0c, 0x42, 0x72, 0x69, 0x64, 0x67, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x2a, 0x2e, + 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x72, 0x69, 0x64, 0x67, 0x65, 0x2e, 0x76, 0x31, + 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x42, 0x72, 0x69, 0x64, 0x67, 0x65, 0x53, 0x74, 0x61, 0x74, + 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2b, 0x2e, 0x63, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x2e, 0x62, 0x72, 0x69, 0x64, 0x67, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x51, 0x75, 0x65, + 0x72, 0x79, 0x42, 0x72, 0x69, 0x64, 0x67, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x27, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x21, 0x12, 0x1f, + 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, 0x72, 0x69, 0x64, 0x67, 0x65, 0x2f, 0x76, + 0x31, 0x2f, 0x62, 0x72, 0x69, 0x64, 0x67, 0x65, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x42, + 0xb0, 0x01, 0x0a, 0x14, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, + 0x72, 0x69, 0x64, 0x67, 0x65, 0x2e, 0x76, 0x31, 0x42, 0x0a, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, + 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, + 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, + 0x62, 0x72, 0x69, 0x64, 0x67, 0x65, 0x2f, 0x76, 0x31, 0x3b, 0x62, 0x72, 0x69, 0x64, 0x67, 0x65, + 0x76, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x42, 0x58, 0xaa, 0x02, 0x10, 0x43, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x2e, 0x42, 0x72, 0x69, 0x64, 0x67, 0x65, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x10, 0x43, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x42, 0x72, 0x69, 0x64, 0x67, 0x65, 0x5c, 0x56, 0x31, 0xe2, 0x02, + 0x1c, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x42, 0x72, 0x69, 0x64, 0x67, 0x65, 0x5c, 0x56, + 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x12, + 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x42, 0x72, 0x69, 0x64, 0x67, 0x65, 0x3a, 0x3a, + 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_cosmos_bridge_v1_query_proto_rawDescOnce sync.Once + file_cosmos_bridge_v1_query_proto_rawDescData = file_cosmos_bridge_v1_query_proto_rawDesc +) + +func file_cosmos_bridge_v1_query_proto_rawDescGZIP() []byte { + file_cosmos_bridge_v1_query_proto_rawDescOnce.Do(func() { + file_cosmos_bridge_v1_query_proto_rawDescData = protoimpl.X.CompressGZIP(file_cosmos_bridge_v1_query_proto_rawDescData) + }) + return file_cosmos_bridge_v1_query_proto_rawDescData +} + +var file_cosmos_bridge_v1_query_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_cosmos_bridge_v1_query_proto_goTypes = []interface{}{ + (*QueryParamsRequest)(nil), // 0: cosmos.bridge.v1.QueryParamsRequest + (*QueryParamsResponse)(nil), // 1: cosmos.bridge.v1.QueryParamsResponse + (*QueryBridgeStatusRequest)(nil), // 2: cosmos.bridge.v1.QueryBridgeStatusRequest + (*QueryBridgeStatusResponse)(nil), // 3: cosmos.bridge.v1.QueryBridgeStatusResponse + (*Params)(nil), // 4: cosmos.bridge.v1.Params +} +var file_cosmos_bridge_v1_query_proto_depIdxs = []int32{ + 4, // 0: cosmos.bridge.v1.QueryParamsResponse.params:type_name -> cosmos.bridge.v1.Params + 0, // 1: cosmos.bridge.v1.Query.Params:input_type -> cosmos.bridge.v1.QueryParamsRequest + 2, // 2: cosmos.bridge.v1.Query.BridgeStatus:input_type -> cosmos.bridge.v1.QueryBridgeStatusRequest + 1, // 3: cosmos.bridge.v1.Query.Params:output_type -> cosmos.bridge.v1.QueryParamsResponse + 3, // 4: cosmos.bridge.v1.Query.BridgeStatus:output_type -> cosmos.bridge.v1.QueryBridgeStatusResponse + 3, // [3:5] is the sub-list for method output_type + 1, // [1:3] 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_cosmos_bridge_v1_query_proto_init() } +func file_cosmos_bridge_v1_query_proto_init() { + if File_cosmos_bridge_v1_query_proto != nil { + return + } + file_cosmos_bridge_v1_bridge_proto_init() + if !protoimpl.UnsafeEnabled { + file_cosmos_bridge_v1_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_cosmos_bridge_v1_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 + } + } + file_cosmos_bridge_v1_query_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QueryBridgeStatusRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_cosmos_bridge_v1_query_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QueryBridgeStatusResponse); 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_cosmos_bridge_v1_query_proto_rawDesc, + NumEnums: 0, + NumMessages: 4, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_cosmos_bridge_v1_query_proto_goTypes, + DependencyIndexes: file_cosmos_bridge_v1_query_proto_depIdxs, + MessageInfos: file_cosmos_bridge_v1_query_proto_msgTypes, + }.Build() + File_cosmos_bridge_v1_query_proto = out.File + file_cosmos_bridge_v1_query_proto_rawDesc = nil + file_cosmos_bridge_v1_query_proto_goTypes = nil + file_cosmos_bridge_v1_query_proto_depIdxs = nil +} diff --git a/api/cosmos/bridge/v1/query_grpc.pb.go b/api/cosmos/bridge/v1/query_grpc.pb.go new file mode 100644 index 00000000..0e1aa78d --- /dev/null +++ b/api/cosmos/bridge/v1/query_grpc.pb.go @@ -0,0 +1,150 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc (unknown) +// source: cosmos/bridge/v1/query.proto + +package bridgev1 + +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.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + Query_Params_FullMethodName = "/cosmos.bridge.v1.Query/Params" + Query_BridgeStatus_FullMethodName = "/cosmos.bridge.v1.Query/BridgeStatus" +) + +// 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. +type QueryClient interface { + // Params queries the parameters of x/bridge module. + Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) + // BridgeStatus queries the current bridge status and statistics. + BridgeStatus(ctx context.Context, in *QueryBridgeStatusRequest, opts ...grpc.CallOption) (*QueryBridgeStatusResponse, 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) { + out := new(QueryParamsResponse) + err := c.cc.Invoke(ctx, Query_Params_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) BridgeStatus(ctx context.Context, in *QueryBridgeStatusRequest, opts ...grpc.CallOption) (*QueryBridgeStatusResponse, error) { + out := new(QueryBridgeStatusResponse) + err := c.cc.Invoke(ctx, Query_BridgeStatus_FullMethodName, in, out, opts...) + 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 +type QueryServer interface { + // Params queries the parameters of x/bridge module. + Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) + // BridgeStatus queries the current bridge status and statistics. + BridgeStatus(context.Context, *QueryBridgeStatusRequest) (*QueryBridgeStatusResponse, error) + mustEmbedUnimplementedQueryServer() +} + +// UnimplementedQueryServer must be embedded to have forward compatible implementations. +type UnimplementedQueryServer struct { +} + +func (UnimplementedQueryServer) Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") +} +func (UnimplementedQueryServer) BridgeStatus(context.Context, *QueryBridgeStatusRequest) (*QueryBridgeStatusResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method BridgeStatus not implemented") +} +func (UnimplementedQueryServer) mustEmbedUnimplementedQueryServer() {} + +// 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) { + 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) +} + +func _Query_BridgeStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryBridgeStatusRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).BridgeStatus(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Query_BridgeStatus_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).BridgeStatus(ctx, req.(*QueryBridgeStatusRequest)) + } + 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: "cosmos.bridge.v1.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Params", + Handler: _Query_Params_Handler, + }, + { + MethodName: "BridgeStatus", + Handler: _Query_BridgeStatus_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "cosmos/bridge/v1/query.proto", +} diff --git a/api/cosmos/bridge/v1/tx.pulsar.go b/api/cosmos/bridge/v1/tx.pulsar.go new file mode 100644 index 00000000..f04b8c53 --- /dev/null +++ b/api/cosmos/bridge/v1/tx.pulsar.go @@ -0,0 +1,2049 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package bridgev1 + +import ( + _ "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 ( + md_MsgUpdateParams protoreflect.MessageDescriptor + fd_MsgUpdateParams_authority protoreflect.FieldDescriptor + fd_MsgUpdateParams_params protoreflect.FieldDescriptor +) + +func init() { + file_cosmos_bridge_v1_tx_proto_init() + md_MsgUpdateParams = File_cosmos_bridge_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_cosmos_bridge_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 "cosmos.bridge.v1.MsgUpdateParams.authority": + return x.Authority != "" + case "cosmos.bridge.v1.MsgUpdateParams.params": + return x.Params != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.bridge.v1.MsgUpdateParams")) + } + panic(fmt.Errorf("message cosmos.bridge.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 "cosmos.bridge.v1.MsgUpdateParams.authority": + x.Authority = "" + case "cosmos.bridge.v1.MsgUpdateParams.params": + x.Params = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.bridge.v1.MsgUpdateParams")) + } + panic(fmt.Errorf("message cosmos.bridge.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 "cosmos.bridge.v1.MsgUpdateParams.authority": + value := x.Authority + return protoreflect.ValueOfString(value) + case "cosmos.bridge.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: cosmos.bridge.v1.MsgUpdateParams")) + } + panic(fmt.Errorf("message cosmos.bridge.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 "cosmos.bridge.v1.MsgUpdateParams.authority": + x.Authority = value.Interface().(string) + case "cosmos.bridge.v1.MsgUpdateParams.params": + x.Params = value.Message().Interface().(*Params) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.bridge.v1.MsgUpdateParams")) + } + panic(fmt.Errorf("message cosmos.bridge.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 "cosmos.bridge.v1.MsgUpdateParams.params": + if x.Params == nil { + x.Params = new(Params) + } + return protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + case "cosmos.bridge.v1.MsgUpdateParams.authority": + panic(fmt.Errorf("field authority of message cosmos.bridge.v1.MsgUpdateParams is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.bridge.v1.MsgUpdateParams")) + } + panic(fmt.Errorf("message cosmos.bridge.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 "cosmos.bridge.v1.MsgUpdateParams.authority": + return protoreflect.ValueOfString("") + case "cosmos.bridge.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: cosmos.bridge.v1.MsgUpdateParams")) + } + panic(fmt.Errorf("message cosmos.bridge.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 cosmos.bridge.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_cosmos_bridge_v1_tx_proto_init() + md_MsgUpdateParamsResponse = File_cosmos_bridge_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_cosmos_bridge_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: cosmos.bridge.v1.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message cosmos.bridge.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: cosmos.bridge.v1.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message cosmos.bridge.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: cosmos.bridge.v1.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message cosmos.bridge.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: cosmos.bridge.v1.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message cosmos.bridge.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: cosmos.bridge.v1.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message cosmos.bridge.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: cosmos.bridge.v1.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message cosmos.bridge.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 cosmos.bridge.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_MsgSetAuthorizedContract protoreflect.MessageDescriptor + fd_MsgSetAuthorizedContract_authority protoreflect.FieldDescriptor + fd_MsgSetAuthorizedContract_contract_address protoreflect.FieldDescriptor +) + +func init() { + file_cosmos_bridge_v1_tx_proto_init() + md_MsgSetAuthorizedContract = File_cosmos_bridge_v1_tx_proto.Messages().ByName("MsgSetAuthorizedContract") + fd_MsgSetAuthorizedContract_authority = md_MsgSetAuthorizedContract.Fields().ByName("authority") + fd_MsgSetAuthorizedContract_contract_address = md_MsgSetAuthorizedContract.Fields().ByName("contract_address") +} + +var _ protoreflect.Message = (*fastReflection_MsgSetAuthorizedContract)(nil) + +type fastReflection_MsgSetAuthorizedContract MsgSetAuthorizedContract + +func (x *MsgSetAuthorizedContract) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgSetAuthorizedContract)(x) +} + +func (x *MsgSetAuthorizedContract) slowProtoReflect() protoreflect.Message { + mi := &file_cosmos_bridge_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_MsgSetAuthorizedContract_messageType fastReflection_MsgSetAuthorizedContract_messageType +var _ protoreflect.MessageType = fastReflection_MsgSetAuthorizedContract_messageType{} + +type fastReflection_MsgSetAuthorizedContract_messageType struct{} + +func (x fastReflection_MsgSetAuthorizedContract_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgSetAuthorizedContract)(nil) +} +func (x fastReflection_MsgSetAuthorizedContract_messageType) New() protoreflect.Message { + return new(fastReflection_MsgSetAuthorizedContract) +} +func (x fastReflection_MsgSetAuthorizedContract_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgSetAuthorizedContract +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgSetAuthorizedContract) Descriptor() protoreflect.MessageDescriptor { + return md_MsgSetAuthorizedContract +} + +// 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_MsgSetAuthorizedContract) Type() protoreflect.MessageType { + return _fastReflection_MsgSetAuthorizedContract_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgSetAuthorizedContract) New() protoreflect.Message { + return new(fastReflection_MsgSetAuthorizedContract) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgSetAuthorizedContract) Interface() protoreflect.ProtoMessage { + return (*MsgSetAuthorizedContract)(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_MsgSetAuthorizedContract) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Authority != "" { + value := protoreflect.ValueOfString(x.Authority) + if !f(fd_MsgSetAuthorizedContract_authority, value) { + return + } + } + if x.ContractAddress != "" { + value := protoreflect.ValueOfString(x.ContractAddress) + if !f(fd_MsgSetAuthorizedContract_contract_address, 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_MsgSetAuthorizedContract) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "cosmos.bridge.v1.MsgSetAuthorizedContract.authority": + return x.Authority != "" + case "cosmos.bridge.v1.MsgSetAuthorizedContract.contract_address": + return x.ContractAddress != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.bridge.v1.MsgSetAuthorizedContract")) + } + panic(fmt.Errorf("message cosmos.bridge.v1.MsgSetAuthorizedContract 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_MsgSetAuthorizedContract) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "cosmos.bridge.v1.MsgSetAuthorizedContract.authority": + x.Authority = "" + case "cosmos.bridge.v1.MsgSetAuthorizedContract.contract_address": + x.ContractAddress = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.bridge.v1.MsgSetAuthorizedContract")) + } + panic(fmt.Errorf("message cosmos.bridge.v1.MsgSetAuthorizedContract 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_MsgSetAuthorizedContract) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "cosmos.bridge.v1.MsgSetAuthorizedContract.authority": + value := x.Authority + return protoreflect.ValueOfString(value) + case "cosmos.bridge.v1.MsgSetAuthorizedContract.contract_address": + value := x.ContractAddress + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.bridge.v1.MsgSetAuthorizedContract")) + } + panic(fmt.Errorf("message cosmos.bridge.v1.MsgSetAuthorizedContract 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_MsgSetAuthorizedContract) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "cosmos.bridge.v1.MsgSetAuthorizedContract.authority": + x.Authority = value.Interface().(string) + case "cosmos.bridge.v1.MsgSetAuthorizedContract.contract_address": + x.ContractAddress = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.bridge.v1.MsgSetAuthorizedContract")) + } + panic(fmt.Errorf("message cosmos.bridge.v1.MsgSetAuthorizedContract 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_MsgSetAuthorizedContract) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.bridge.v1.MsgSetAuthorizedContract.authority": + panic(fmt.Errorf("field authority of message cosmos.bridge.v1.MsgSetAuthorizedContract is not mutable")) + case "cosmos.bridge.v1.MsgSetAuthorizedContract.contract_address": + panic(fmt.Errorf("field contract_address of message cosmos.bridge.v1.MsgSetAuthorizedContract is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.bridge.v1.MsgSetAuthorizedContract")) + } + panic(fmt.Errorf("message cosmos.bridge.v1.MsgSetAuthorizedContract 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_MsgSetAuthorizedContract) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.bridge.v1.MsgSetAuthorizedContract.authority": + return protoreflect.ValueOfString("") + case "cosmos.bridge.v1.MsgSetAuthorizedContract.contract_address": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.bridge.v1.MsgSetAuthorizedContract")) + } + panic(fmt.Errorf("message cosmos.bridge.v1.MsgSetAuthorizedContract 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_MsgSetAuthorizedContract) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in cosmos.bridge.v1.MsgSetAuthorizedContract", 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_MsgSetAuthorizedContract) 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_MsgSetAuthorizedContract) 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_MsgSetAuthorizedContract) 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_MsgSetAuthorizedContract) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgSetAuthorizedContract) + 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)) + } + l = len(x.ContractAddress) + 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().(*MsgSetAuthorizedContract) + 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.ContractAddress) > 0 { + i -= len(x.ContractAddress) + copy(dAtA[i:], x.ContractAddress) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.ContractAddress))) + 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().(*MsgSetAuthorizedContract) + 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: MsgSetAuthorizedContract: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgSetAuthorizedContract: 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 ContractAddress", 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.ContractAddress = 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_MsgSetAuthorizedContractResponse protoreflect.MessageDescriptor +) + +func init() { + file_cosmos_bridge_v1_tx_proto_init() + md_MsgSetAuthorizedContractResponse = File_cosmos_bridge_v1_tx_proto.Messages().ByName("MsgSetAuthorizedContractResponse") +} + +var _ protoreflect.Message = (*fastReflection_MsgSetAuthorizedContractResponse)(nil) + +type fastReflection_MsgSetAuthorizedContractResponse MsgSetAuthorizedContractResponse + +func (x *MsgSetAuthorizedContractResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgSetAuthorizedContractResponse)(x) +} + +func (x *MsgSetAuthorizedContractResponse) slowProtoReflect() protoreflect.Message { + mi := &file_cosmos_bridge_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_MsgSetAuthorizedContractResponse_messageType fastReflection_MsgSetAuthorizedContractResponse_messageType +var _ protoreflect.MessageType = fastReflection_MsgSetAuthorizedContractResponse_messageType{} + +type fastReflection_MsgSetAuthorizedContractResponse_messageType struct{} + +func (x fastReflection_MsgSetAuthorizedContractResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgSetAuthorizedContractResponse)(nil) +} +func (x fastReflection_MsgSetAuthorizedContractResponse_messageType) New() protoreflect.Message { + return new(fastReflection_MsgSetAuthorizedContractResponse) +} +func (x fastReflection_MsgSetAuthorizedContractResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgSetAuthorizedContractResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgSetAuthorizedContractResponse) Descriptor() protoreflect.MessageDescriptor { + return md_MsgSetAuthorizedContractResponse +} + +// 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_MsgSetAuthorizedContractResponse) Type() protoreflect.MessageType { + return _fastReflection_MsgSetAuthorizedContractResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgSetAuthorizedContractResponse) New() protoreflect.Message { + return new(fastReflection_MsgSetAuthorizedContractResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgSetAuthorizedContractResponse) Interface() protoreflect.ProtoMessage { + return (*MsgSetAuthorizedContractResponse)(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_MsgSetAuthorizedContractResponse) 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_MsgSetAuthorizedContractResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.bridge.v1.MsgSetAuthorizedContractResponse")) + } + panic(fmt.Errorf("message cosmos.bridge.v1.MsgSetAuthorizedContractResponse 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_MsgSetAuthorizedContractResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.bridge.v1.MsgSetAuthorizedContractResponse")) + } + panic(fmt.Errorf("message cosmos.bridge.v1.MsgSetAuthorizedContractResponse 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_MsgSetAuthorizedContractResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.bridge.v1.MsgSetAuthorizedContractResponse")) + } + panic(fmt.Errorf("message cosmos.bridge.v1.MsgSetAuthorizedContractResponse 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_MsgSetAuthorizedContractResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.bridge.v1.MsgSetAuthorizedContractResponse")) + } + panic(fmt.Errorf("message cosmos.bridge.v1.MsgSetAuthorizedContractResponse 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_MsgSetAuthorizedContractResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.bridge.v1.MsgSetAuthorizedContractResponse")) + } + panic(fmt.Errorf("message cosmos.bridge.v1.MsgSetAuthorizedContractResponse 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_MsgSetAuthorizedContractResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.bridge.v1.MsgSetAuthorizedContractResponse")) + } + panic(fmt.Errorf("message cosmos.bridge.v1.MsgSetAuthorizedContractResponse 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_MsgSetAuthorizedContractResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in cosmos.bridge.v1.MsgSetAuthorizedContractResponse", 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_MsgSetAuthorizedContractResponse) 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_MsgSetAuthorizedContractResponse) 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_MsgSetAuthorizedContractResponse) 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_MsgSetAuthorizedContractResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgSetAuthorizedContractResponse) + 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().(*MsgSetAuthorizedContractResponse) + 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().(*MsgSetAuthorizedContractResponse) + 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: MsgSetAuthorizedContractResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgSetAuthorizedContractResponse: 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: cosmos/bridge/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 defines a Msg for updating the x/bridge module parameters. +type MsgUpdateParams struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // authority is the address of the governance account. + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // params defines the x/bridge parameters to update. + Params *Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params,omitempty"` +} + +func (x *MsgUpdateParams) Reset() { + *x = MsgUpdateParams{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_bridge_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_cosmos_bridge_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 for MsgUpdateParams. +type MsgUpdateParamsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *MsgUpdateParamsResponse) Reset() { + *x = MsgUpdateParamsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_bridge_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_cosmos_bridge_v1_tx_proto_rawDescGZIP(), []int{1} +} + +// MsgSetAuthorizedContract sets the authorized bridge contract address. Governance-only. +type MsgSetAuthorizedContract struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // authority is the address of the governance account. + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // contract_address is the hex EVM address of the authorized bridge contract. + ContractAddress string `protobuf:"bytes,2,opt,name=contract_address,json=contractAddress,proto3" json:"contract_address,omitempty"` +} + +func (x *MsgSetAuthorizedContract) Reset() { + *x = MsgSetAuthorizedContract{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_bridge_v1_tx_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgSetAuthorizedContract) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgSetAuthorizedContract) ProtoMessage() {} + +// Deprecated: Use MsgSetAuthorizedContract.ProtoReflect.Descriptor instead. +func (*MsgSetAuthorizedContract) Descriptor() ([]byte, []int) { + return file_cosmos_bridge_v1_tx_proto_rawDescGZIP(), []int{2} +} + +func (x *MsgSetAuthorizedContract) GetAuthority() string { + if x != nil { + return x.Authority + } + return "" +} + +func (x *MsgSetAuthorizedContract) GetContractAddress() string { + if x != nil { + return x.ContractAddress + } + return "" +} + +// MsgSetAuthorizedContractResponse defines the response for MsgSetAuthorizedContract. +type MsgSetAuthorizedContractResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *MsgSetAuthorizedContractResponse) Reset() { + *x = MsgSetAuthorizedContractResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_bridge_v1_tx_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgSetAuthorizedContractResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgSetAuthorizedContractResponse) ProtoMessage() {} + +// Deprecated: Use MsgSetAuthorizedContractResponse.ProtoReflect.Descriptor instead. +func (*MsgSetAuthorizedContractResponse) Descriptor() ([]byte, []int) { + return file_cosmos_bridge_v1_tx_proto_rawDescGZIP(), []int{3} +} + +var File_cosmos_bridge_v1_tx_proto protoreflect.FileDescriptor + +var file_cosmos_bridge_v1_tx_proto_rawDesc = []byte{ + 0x0a, 0x19, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, 0x72, 0x69, 0x64, 0x67, 0x65, 0x2f, + 0x76, 0x31, 0x2f, 0x74, 0x78, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x10, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x72, 0x69, 0x64, 0x67, 0x65, 0x2e, 0x76, 0x31, 0x1a, 0x11, 0x61, + 0x6d, 0x69, 0x6e, 0x6f, 0x2f, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x1a, 0x1d, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, 0x72, 0x69, 0x64, 0x67, 0x65, 0x2f, + 0x76, 0x31, 0x2f, 0x62, 0x72, 0x69, 0x64, 0x67, 0x65, 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, 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, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, + 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xba, 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, 0x3b, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, + 0x72, 0x69, 0x64, 0x67, 0x65, 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, 0x32, 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, + 0x74, 0x79, 0x8a, 0xe7, 0xb0, 0x2a, 0x1f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x78, 0x2f, + 0x62, 0x72, 0x69, 0x64, 0x67, 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, 0xba, 0x01, 0x0a, 0x18, 0x4d, 0x73, 0x67, 0x53, 0x65, 0x74, 0x41, 0x75, 0x74, 0x68, + 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 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, 0x29, 0x0a, 0x10, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, + 0x63, 0x74, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, + 0x73, 0x3a, 0x3b, 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, + 0x79, 0x8a, 0xe7, 0xb0, 0x2a, 0x28, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x78, 0x2f, 0x62, + 0x72, 0x69, 0x64, 0x67, 0x65, 0x2f, 0x4d, 0x73, 0x67, 0x53, 0x65, 0x74, 0x41, 0x75, 0x74, 0x68, + 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x22, 0x22, + 0x0a, 0x20, 0x4d, 0x73, 0x67, 0x53, 0x65, 0x74, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, + 0x65, 0x64, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x32, 0xe3, 0x01, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x5c, 0x0a, 0x0c, 0x55, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x21, 0x2e, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x72, 0x69, 0x64, 0x67, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, + 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x29, 0x2e, + 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x72, 0x69, 0x64, 0x67, 0x65, 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, 0x77, 0x0a, 0x15, 0x53, 0x65, 0x74, 0x41, + 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, + 0x74, 0x12, 0x2a, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x72, 0x69, 0x64, 0x67, + 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x65, 0x74, 0x41, 0x75, 0x74, 0x68, 0x6f, + 0x72, 0x69, 0x7a, 0x65, 0x64, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x1a, 0x32, 0x2e, + 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x72, 0x69, 0x64, 0x67, 0x65, 0x2e, 0x76, 0x31, + 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x65, 0x74, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, + 0x64, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0xad, 0x01, 0x0a, 0x14, 0x63, 0x6f, 0x6d, + 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x72, 0x69, 0x64, 0x67, 0x65, 0x2e, 0x76, + 0x31, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2a, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, 0x72, 0x69, 0x64, 0x67, 0x65, 0x2f, 0x76, 0x31, 0x3b, + 0x62, 0x72, 0x69, 0x64, 0x67, 0x65, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x42, 0x58, 0xaa, 0x02, + 0x10, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x42, 0x72, 0x69, 0x64, 0x67, 0x65, 0x2e, 0x56, + 0x31, 0xca, 0x02, 0x10, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x42, 0x72, 0x69, 0x64, 0x67, + 0x65, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x1c, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x42, 0x72, + 0x69, 0x64, 0x67, 0x65, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, + 0x61, 0x74, 0x61, 0xea, 0x02, 0x12, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x42, 0x72, + 0x69, 0x64, 0x67, 0x65, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_cosmos_bridge_v1_tx_proto_rawDescOnce sync.Once + file_cosmos_bridge_v1_tx_proto_rawDescData = file_cosmos_bridge_v1_tx_proto_rawDesc +) + +func file_cosmos_bridge_v1_tx_proto_rawDescGZIP() []byte { + file_cosmos_bridge_v1_tx_proto_rawDescOnce.Do(func() { + file_cosmos_bridge_v1_tx_proto_rawDescData = protoimpl.X.CompressGZIP(file_cosmos_bridge_v1_tx_proto_rawDescData) + }) + return file_cosmos_bridge_v1_tx_proto_rawDescData +} + +var file_cosmos_bridge_v1_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_cosmos_bridge_v1_tx_proto_goTypes = []interface{}{ + (*MsgUpdateParams)(nil), // 0: cosmos.bridge.v1.MsgUpdateParams + (*MsgUpdateParamsResponse)(nil), // 1: cosmos.bridge.v1.MsgUpdateParamsResponse + (*MsgSetAuthorizedContract)(nil), // 2: cosmos.bridge.v1.MsgSetAuthorizedContract + (*MsgSetAuthorizedContractResponse)(nil), // 3: cosmos.bridge.v1.MsgSetAuthorizedContractResponse + (*Params)(nil), // 4: cosmos.bridge.v1.Params +} +var file_cosmos_bridge_v1_tx_proto_depIdxs = []int32{ + 4, // 0: cosmos.bridge.v1.MsgUpdateParams.params:type_name -> cosmos.bridge.v1.Params + 0, // 1: cosmos.bridge.v1.Msg.UpdateParams:input_type -> cosmos.bridge.v1.MsgUpdateParams + 2, // 2: cosmos.bridge.v1.Msg.SetAuthorizedContract:input_type -> cosmos.bridge.v1.MsgSetAuthorizedContract + 1, // 3: cosmos.bridge.v1.Msg.UpdateParams:output_type -> cosmos.bridge.v1.MsgUpdateParamsResponse + 3, // 4: cosmos.bridge.v1.Msg.SetAuthorizedContract:output_type -> cosmos.bridge.v1.MsgSetAuthorizedContractResponse + 3, // [3:5] is the sub-list for method output_type + 1, // [1:3] 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_cosmos_bridge_v1_tx_proto_init() } +func file_cosmos_bridge_v1_tx_proto_init() { + if File_cosmos_bridge_v1_tx_proto != nil { + return + } + file_cosmos_bridge_v1_bridge_proto_init() + if !protoimpl.UnsafeEnabled { + file_cosmos_bridge_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_cosmos_bridge_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_cosmos_bridge_v1_tx_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgSetAuthorizedContract); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_cosmos_bridge_v1_tx_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgSetAuthorizedContractResponse); 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_cosmos_bridge_v1_tx_proto_rawDesc, + NumEnums: 0, + NumMessages: 4, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_cosmos_bridge_v1_tx_proto_goTypes, + DependencyIndexes: file_cosmos_bridge_v1_tx_proto_depIdxs, + MessageInfos: file_cosmos_bridge_v1_tx_proto_msgTypes, + }.Build() + File_cosmos_bridge_v1_tx_proto = out.File + file_cosmos_bridge_v1_tx_proto_rawDesc = nil + file_cosmos_bridge_v1_tx_proto_goTypes = nil + file_cosmos_bridge_v1_tx_proto_depIdxs = nil +} diff --git a/api/cosmos/bridge/v1/tx_grpc.pb.go b/api/cosmos/bridge/v1/tx_grpc.pb.go new file mode 100644 index 00000000..f7ae8f06 --- /dev/null +++ b/api/cosmos/bridge/v1/tx_grpc.pb.go @@ -0,0 +1,150 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc (unknown) +// source: cosmos/bridge/v1/tx.proto + +package bridgev1 + +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.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + Msg_UpdateParams_FullMethodName = "/cosmos.bridge.v1.Msg/UpdateParams" + Msg_SetAuthorizedContract_FullMethodName = "/cosmos.bridge.v1.Msg/SetAuthorizedContract" +) + +// 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. +type MsgClient interface { + // UpdateParams updates the x/bridge module parameters. Governance-only. + UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) + // SetAuthorizedContract sets the authorized bridge contract address. Governance-only. + SetAuthorizedContract(ctx context.Context, in *MsgSetAuthorizedContract, opts ...grpc.CallOption) (*MsgSetAuthorizedContractResponse, 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) { + out := new(MsgUpdateParamsResponse) + err := c.cc.Invoke(ctx, Msg_UpdateParams_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) SetAuthorizedContract(ctx context.Context, in *MsgSetAuthorizedContract, opts ...grpc.CallOption) (*MsgSetAuthorizedContractResponse, error) { + out := new(MsgSetAuthorizedContractResponse) + err := c.cc.Invoke(ctx, Msg_SetAuthorizedContract_FullMethodName, in, out, opts...) + 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 +type MsgServer interface { + // UpdateParams updates the x/bridge module parameters. Governance-only. + UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) + // SetAuthorizedContract sets the authorized bridge contract address. Governance-only. + SetAuthorizedContract(context.Context, *MsgSetAuthorizedContract) (*MsgSetAuthorizedContractResponse, error) + mustEmbedUnimplementedMsgServer() +} + +// UnimplementedMsgServer must be embedded to have forward compatible implementations. +type UnimplementedMsgServer struct { +} + +func (UnimplementedMsgServer) UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") +} +func (UnimplementedMsgServer) SetAuthorizedContract(context.Context, *MsgSetAuthorizedContract) (*MsgSetAuthorizedContractResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SetAuthorizedContract not implemented") +} +func (UnimplementedMsgServer) mustEmbedUnimplementedMsgServer() {} + +// 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) { + 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_SetAuthorizedContract_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgSetAuthorizedContract) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).SetAuthorizedContract(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Msg_SetAuthorizedContract_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).SetAuthorizedContract(ctx, req.(*MsgSetAuthorizedContract)) + } + 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: "cosmos.bridge.v1.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "UpdateParams", + Handler: _Msg_UpdateParams_Handler, + }, + { + MethodName: "SetAuthorizedContract", + Handler: _Msg_SetAuthorizedContract_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "cosmos/bridge/v1/tx.proto", +} diff --git a/api/cosmos/svip/v1/genesis.pulsar.go b/api/cosmos/svip/v1/genesis.pulsar.go new file mode 100644 index 00000000..fdccaac3 --- /dev/null +++ b/api/cosmos/svip/v1/genesis.pulsar.go @@ -0,0 +1,1132 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package svipv1 + +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" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" + io "io" + reflect "reflect" + sync "sync" +) + +var ( + md_GenesisState protoreflect.MessageDescriptor + fd_GenesisState_params protoreflect.FieldDescriptor + fd_GenesisState_total_distributed protoreflect.FieldDescriptor + fd_GenesisState_activation_time protoreflect.FieldDescriptor + fd_GenesisState_pool_balance_at_activation protoreflect.FieldDescriptor + fd_GenesisState_last_block_time protoreflect.FieldDescriptor + fd_GenesisState_total_paused_seconds protoreflect.FieldDescriptor + fd_GenesisState_activated protoreflect.FieldDescriptor + fd_GenesisState_paused protoreflect.FieldDescriptor +) + +func init() { + file_cosmos_svip_v1_genesis_proto_init() + md_GenesisState = File_cosmos_svip_v1_genesis_proto.Messages().ByName("GenesisState") + fd_GenesisState_params = md_GenesisState.Fields().ByName("params") + fd_GenesisState_total_distributed = md_GenesisState.Fields().ByName("total_distributed") + fd_GenesisState_activation_time = md_GenesisState.Fields().ByName("activation_time") + fd_GenesisState_pool_balance_at_activation = md_GenesisState.Fields().ByName("pool_balance_at_activation") + fd_GenesisState_last_block_time = md_GenesisState.Fields().ByName("last_block_time") + fd_GenesisState_total_paused_seconds = md_GenesisState.Fields().ByName("total_paused_seconds") + fd_GenesisState_activated = md_GenesisState.Fields().ByName("activated") + fd_GenesisState_paused = md_GenesisState.Fields().ByName("paused") +} + +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_cosmos_svip_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 x.TotalDistributed != "" { + value := protoreflect.ValueOfString(x.TotalDistributed) + if !f(fd_GenesisState_total_distributed, value) { + return + } + } + if x.ActivationTime != nil { + value := protoreflect.ValueOfMessage(x.ActivationTime.ProtoReflect()) + if !f(fd_GenesisState_activation_time, value) { + return + } + } + if x.PoolBalanceAtActivation != "" { + value := protoreflect.ValueOfString(x.PoolBalanceAtActivation) + if !f(fd_GenesisState_pool_balance_at_activation, value) { + return + } + } + if x.LastBlockTime != nil { + value := protoreflect.ValueOfMessage(x.LastBlockTime.ProtoReflect()) + if !f(fd_GenesisState_last_block_time, value) { + return + } + } + if x.TotalPausedSeconds != int64(0) { + value := protoreflect.ValueOfInt64(x.TotalPausedSeconds) + if !f(fd_GenesisState_total_paused_seconds, value) { + return + } + } + if x.Activated != false { + value := protoreflect.ValueOfBool(x.Activated) + if !f(fd_GenesisState_activated, value) { + return + } + } + if x.Paused != false { + value := protoreflect.ValueOfBool(x.Paused) + if !f(fd_GenesisState_paused, 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 "cosmos.svip.v1.GenesisState.params": + return x.Params != nil + case "cosmos.svip.v1.GenesisState.total_distributed": + return x.TotalDistributed != "" + case "cosmos.svip.v1.GenesisState.activation_time": + return x.ActivationTime != nil + case "cosmos.svip.v1.GenesisState.pool_balance_at_activation": + return x.PoolBalanceAtActivation != "" + case "cosmos.svip.v1.GenesisState.last_block_time": + return x.LastBlockTime != nil + case "cosmos.svip.v1.GenesisState.total_paused_seconds": + return x.TotalPausedSeconds != int64(0) + case "cosmos.svip.v1.GenesisState.activated": + return x.Activated != false + case "cosmos.svip.v1.GenesisState.paused": + return x.Paused != false + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.svip.v1.GenesisState")) + } + panic(fmt.Errorf("message cosmos.svip.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 "cosmos.svip.v1.GenesisState.params": + x.Params = nil + case "cosmos.svip.v1.GenesisState.total_distributed": + x.TotalDistributed = "" + case "cosmos.svip.v1.GenesisState.activation_time": + x.ActivationTime = nil + case "cosmos.svip.v1.GenesisState.pool_balance_at_activation": + x.PoolBalanceAtActivation = "" + case "cosmos.svip.v1.GenesisState.last_block_time": + x.LastBlockTime = nil + case "cosmos.svip.v1.GenesisState.total_paused_seconds": + x.TotalPausedSeconds = int64(0) + case "cosmos.svip.v1.GenesisState.activated": + x.Activated = false + case "cosmos.svip.v1.GenesisState.paused": + x.Paused = false + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.svip.v1.GenesisState")) + } + panic(fmt.Errorf("message cosmos.svip.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 "cosmos.svip.v1.GenesisState.params": + value := x.Params + return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "cosmos.svip.v1.GenesisState.total_distributed": + value := x.TotalDistributed + return protoreflect.ValueOfString(value) + case "cosmos.svip.v1.GenesisState.activation_time": + value := x.ActivationTime + return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "cosmos.svip.v1.GenesisState.pool_balance_at_activation": + value := x.PoolBalanceAtActivation + return protoreflect.ValueOfString(value) + case "cosmos.svip.v1.GenesisState.last_block_time": + value := x.LastBlockTime + return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "cosmos.svip.v1.GenesisState.total_paused_seconds": + value := x.TotalPausedSeconds + return protoreflect.ValueOfInt64(value) + case "cosmos.svip.v1.GenesisState.activated": + value := x.Activated + return protoreflect.ValueOfBool(value) + case "cosmos.svip.v1.GenesisState.paused": + value := x.Paused + return protoreflect.ValueOfBool(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.svip.v1.GenesisState")) + } + panic(fmt.Errorf("message cosmos.svip.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 "cosmos.svip.v1.GenesisState.params": + x.Params = value.Message().Interface().(*Params) + case "cosmos.svip.v1.GenesisState.total_distributed": + x.TotalDistributed = value.Interface().(string) + case "cosmos.svip.v1.GenesisState.activation_time": + x.ActivationTime = value.Message().Interface().(*timestamppb.Timestamp) + case "cosmos.svip.v1.GenesisState.pool_balance_at_activation": + x.PoolBalanceAtActivation = value.Interface().(string) + case "cosmos.svip.v1.GenesisState.last_block_time": + x.LastBlockTime = value.Message().Interface().(*timestamppb.Timestamp) + case "cosmos.svip.v1.GenesisState.total_paused_seconds": + x.TotalPausedSeconds = value.Int() + case "cosmos.svip.v1.GenesisState.activated": + x.Activated = value.Bool() + case "cosmos.svip.v1.GenesisState.paused": + x.Paused = value.Bool() + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.svip.v1.GenesisState")) + } + panic(fmt.Errorf("message cosmos.svip.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 "cosmos.svip.v1.GenesisState.params": + if x.Params == nil { + x.Params = new(Params) + } + return protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + case "cosmos.svip.v1.GenesisState.activation_time": + if x.ActivationTime == nil { + x.ActivationTime = new(timestamppb.Timestamp) + } + return protoreflect.ValueOfMessage(x.ActivationTime.ProtoReflect()) + case "cosmos.svip.v1.GenesisState.last_block_time": + if x.LastBlockTime == nil { + x.LastBlockTime = new(timestamppb.Timestamp) + } + return protoreflect.ValueOfMessage(x.LastBlockTime.ProtoReflect()) + case "cosmos.svip.v1.GenesisState.total_distributed": + panic(fmt.Errorf("field total_distributed of message cosmos.svip.v1.GenesisState is not mutable")) + case "cosmos.svip.v1.GenesisState.pool_balance_at_activation": + panic(fmt.Errorf("field pool_balance_at_activation of message cosmos.svip.v1.GenesisState is not mutable")) + case "cosmos.svip.v1.GenesisState.total_paused_seconds": + panic(fmt.Errorf("field total_paused_seconds of message cosmos.svip.v1.GenesisState is not mutable")) + case "cosmos.svip.v1.GenesisState.activated": + panic(fmt.Errorf("field activated of message cosmos.svip.v1.GenesisState is not mutable")) + case "cosmos.svip.v1.GenesisState.paused": + panic(fmt.Errorf("field paused of message cosmos.svip.v1.GenesisState is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.svip.v1.GenesisState")) + } + panic(fmt.Errorf("message cosmos.svip.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 "cosmos.svip.v1.GenesisState.params": + m := new(Params) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "cosmos.svip.v1.GenesisState.total_distributed": + return protoreflect.ValueOfString("") + case "cosmos.svip.v1.GenesisState.activation_time": + m := new(timestamppb.Timestamp) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "cosmos.svip.v1.GenesisState.pool_balance_at_activation": + return protoreflect.ValueOfString("") + case "cosmos.svip.v1.GenesisState.last_block_time": + m := new(timestamppb.Timestamp) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "cosmos.svip.v1.GenesisState.total_paused_seconds": + return protoreflect.ValueOfInt64(int64(0)) + case "cosmos.svip.v1.GenesisState.activated": + return protoreflect.ValueOfBool(false) + case "cosmos.svip.v1.GenesisState.paused": + return protoreflect.ValueOfBool(false) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.svip.v1.GenesisState")) + } + panic(fmt.Errorf("message cosmos.svip.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 cosmos.svip.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)) + } + l = len(x.TotalDistributed) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.ActivationTime != nil { + l = options.Size(x.ActivationTime) + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.PoolBalanceAtActivation) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.LastBlockTime != nil { + l = options.Size(x.LastBlockTime) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.TotalPausedSeconds != 0 { + n += 1 + runtime.Sov(uint64(x.TotalPausedSeconds)) + } + if x.Activated { + n += 2 + } + if x.Paused { + n += 2 + } + 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 x.Paused { + i-- + if x.Paused { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x40 + } + if x.Activated { + i-- + if x.Activated { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x38 + } + if x.TotalPausedSeconds != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.TotalPausedSeconds)) + i-- + dAtA[i] = 0x30 + } + if x.LastBlockTime != nil { + encoded, err := options.Marshal(x.LastBlockTime) + 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.PoolBalanceAtActivation) > 0 { + i -= len(x.PoolBalanceAtActivation) + copy(dAtA[i:], x.PoolBalanceAtActivation) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.PoolBalanceAtActivation))) + i-- + dAtA[i] = 0x22 + } + if x.ActivationTime != nil { + encoded, err := options.Marshal(x.ActivationTime) + 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.TotalDistributed) > 0 { + i -= len(x.TotalDistributed) + copy(dAtA[i:], x.TotalDistributed) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.TotalDistributed))) + 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 TotalDistributed", 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.TotalDistributed = 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 ActivationTime", 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.ActivationTime == nil { + x.ActivationTime = ×tamppb.Timestamp{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.ActivationTime); 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 PoolBalanceAtActivation", 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.PoolBalanceAtActivation = 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 LastBlockTime", 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.LastBlockTime == nil { + x.LastBlockTime = ×tamppb.Timestamp{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.LastBlockTime); 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 TotalPausedSeconds", wireType) + } + x.TotalPausedSeconds = 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.TotalPausedSeconds |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 7: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Activated", 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.Activated = bool(v != 0) + case 8: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Paused", 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.Paused = bool(v != 0) + 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: cosmos/svip/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 svip module's genesis state. +type GenesisState struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // params defines all the parameters of the svip module. + Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` + // total_distributed is the cumulative tokens sent to FeeCollector. + TotalDistributed string `protobuf:"bytes,2,opt,name=total_distributed,json=totalDistributed,proto3" json:"total_distributed,omitempty"` + // activation_time is when SVIP was activated. Zero if not yet activated. + ActivationTime *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=activation_time,json=activationTime,proto3" json:"activation_time,omitempty"` + // pool_balance_at_activation is the pool snapshot used to derive Râ‚€. + PoolBalanceAtActivation string `protobuf:"bytes,4,opt,name=pool_balance_at_activation,json=poolBalanceAtActivation,proto3" json:"pool_balance_at_activation,omitempty"` + // last_block_time is the timestamp of the last processed block. + LastBlockTime *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=last_block_time,json=lastBlockTime,proto3" json:"last_block_time,omitempty"` + // total_paused_seconds is the cumulative seconds spent in paused state. + TotalPausedSeconds int64 `protobuf:"varint,6,opt,name=total_paused_seconds,json=totalPausedSeconds,proto3" json:"total_paused_seconds,omitempty"` + // activated indicates whether SVIP reward distribution is active. + Activated bool `protobuf:"varint,7,opt,name=activated,proto3" json:"activated,omitempty"` + // paused is an emergency pause flag. + Paused bool `protobuf:"varint,8,opt,name=paused,proto3" json:"paused,omitempty"` +} + +func (x *GenesisState) Reset() { + *x = GenesisState{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_svip_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_cosmos_svip_v1_genesis_proto_rawDescGZIP(), []int{0} +} + +func (x *GenesisState) GetParams() *Params { + if x != nil { + return x.Params + } + return nil +} + +func (x *GenesisState) GetTotalDistributed() string { + if x != nil { + return x.TotalDistributed + } + return "" +} + +func (x *GenesisState) GetActivationTime() *timestamppb.Timestamp { + if x != nil { + return x.ActivationTime + } + return nil +} + +func (x *GenesisState) GetPoolBalanceAtActivation() string { + if x != nil { + return x.PoolBalanceAtActivation + } + return "" +} + +func (x *GenesisState) GetLastBlockTime() *timestamppb.Timestamp { + if x != nil { + return x.LastBlockTime + } + return nil +} + +func (x *GenesisState) GetTotalPausedSeconds() int64 { + if x != nil { + return x.TotalPausedSeconds + } + return 0 +} + +func (x *GenesisState) GetActivated() bool { + if x != nil { + return x.Activated + } + return false +} + +func (x *GenesisState) GetPaused() bool { + if x != nil { + return x.Paused + } + return false +} + +var File_cosmos_svip_v1_genesis_proto protoreflect.FileDescriptor + +var file_cosmos_svip_v1_genesis_proto_rawDesc = []byte{ + 0x0a, 0x1c, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x73, 0x76, 0x69, 0x70, 0x2f, 0x76, 0x31, + 0x2f, 0x67, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0e, + 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x76, 0x69, 0x70, 0x2e, 0x76, 0x31, 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, 0x2f, 0x73, 0x76, 0x69, 0x70, 0x2f, 0x76, + 0x31, 0x2f, 0x73, 0x76, 0x69, 0x70, 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, 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, 0x22, 0xf6, 0x03, 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, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x76, + 0x69, 0x70, 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, + 0x4a, 0x0a, 0x11, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, + 0x75, 0x74, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x1d, 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, 0x52, 0x10, 0x74, 0x6f, 0x74, 0x61, 0x6c, + 0x44, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x64, 0x12, 0x4d, 0x0a, 0x0f, 0x61, + 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x03, + 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, 0x08, 0xc8, 0xde, 0x1f, 0x00, 0x90, 0xdf, 0x1f, 0x01, 0x52, 0x0e, 0x61, 0x63, 0x74, 0x69, + 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x5a, 0x0a, 0x1a, 0x70, 0x6f, + 0x6f, 0x6c, 0x5f, 0x62, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x5f, 0x61, 0x74, 0x5f, 0x61, 0x63, + 0x74, 0x69, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x42, 0x1d, + 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, 0x52, 0x17, 0x70, + 0x6f, 0x6f, 0x6c, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x41, 0x74, 0x41, 0x63, 0x74, 0x69, + 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x4c, 0x0a, 0x0f, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x62, + 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x05, 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, 0x08, 0xc8, 0xde, 0x1f, + 0x00, 0x90, 0xdf, 0x1f, 0x01, 0x52, 0x0d, 0x6c, 0x61, 0x73, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, + 0x54, 0x69, 0x6d, 0x65, 0x12, 0x30, 0x0a, 0x14, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, 0x70, 0x61, + 0x75, 0x73, 0x65, 0x64, 0x5f, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x18, 0x06, 0x20, 0x01, + 0x28, 0x03, 0x52, 0x12, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x50, 0x61, 0x75, 0x73, 0x65, 0x64, 0x53, + 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x63, 0x74, 0x69, 0x76, 0x61, + 0x74, 0x65, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x61, 0x63, 0x74, 0x69, 0x76, + 0x61, 0x74, 0x65, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x61, 0x75, 0x73, 0x65, 0x64, 0x18, 0x08, + 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x70, 0x61, 0x75, 0x73, 0x65, 0x64, 0x42, 0xa4, 0x01, 0x0a, + 0x12, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x76, 0x69, 0x70, + 0x2e, 0x76, 0x31, 0x42, 0x0c, 0x47, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 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, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x73, 0x76, 0x69, + 0x70, 0x2f, 0x76, 0x31, 0x3b, 0x73, 0x76, 0x69, 0x70, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x53, + 0x58, 0xaa, 0x02, 0x0e, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x53, 0x76, 0x69, 0x70, 0x2e, + 0x56, 0x31, 0xca, 0x02, 0x0e, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x53, 0x76, 0x69, 0x70, + 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x1a, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x53, 0x76, 0x69, + 0x70, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, + 0xea, 0x02, 0x10, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x53, 0x76, 0x69, 0x70, 0x3a, + 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_cosmos_svip_v1_genesis_proto_rawDescOnce sync.Once + file_cosmos_svip_v1_genesis_proto_rawDescData = file_cosmos_svip_v1_genesis_proto_rawDesc +) + +func file_cosmos_svip_v1_genesis_proto_rawDescGZIP() []byte { + file_cosmos_svip_v1_genesis_proto_rawDescOnce.Do(func() { + file_cosmos_svip_v1_genesis_proto_rawDescData = protoimpl.X.CompressGZIP(file_cosmos_svip_v1_genesis_proto_rawDescData) + }) + return file_cosmos_svip_v1_genesis_proto_rawDescData +} + +var file_cosmos_svip_v1_genesis_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_cosmos_svip_v1_genesis_proto_goTypes = []interface{}{ + (*GenesisState)(nil), // 0: cosmos.svip.v1.GenesisState + (*Params)(nil), // 1: cosmos.svip.v1.Params + (*timestamppb.Timestamp)(nil), // 2: google.protobuf.Timestamp +} +var file_cosmos_svip_v1_genesis_proto_depIdxs = []int32{ + 1, // 0: cosmos.svip.v1.GenesisState.params:type_name -> cosmos.svip.v1.Params + 2, // 1: cosmos.svip.v1.GenesisState.activation_time:type_name -> google.protobuf.Timestamp + 2, // 2: cosmos.svip.v1.GenesisState.last_block_time:type_name -> google.protobuf.Timestamp + 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_cosmos_svip_v1_genesis_proto_init() } +func file_cosmos_svip_v1_genesis_proto_init() { + if File_cosmos_svip_v1_genesis_proto != nil { + return + } + file_cosmos_svip_v1_svip_proto_init() + if !protoimpl.UnsafeEnabled { + file_cosmos_svip_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_cosmos_svip_v1_genesis_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_cosmos_svip_v1_genesis_proto_goTypes, + DependencyIndexes: file_cosmos_svip_v1_genesis_proto_depIdxs, + MessageInfos: file_cosmos_svip_v1_genesis_proto_msgTypes, + }.Build() + File_cosmos_svip_v1_genesis_proto = out.File + file_cosmos_svip_v1_genesis_proto_rawDesc = nil + file_cosmos_svip_v1_genesis_proto_goTypes = nil + file_cosmos_svip_v1_genesis_proto_depIdxs = nil +} diff --git a/api/cosmos/svip/v1/query.pulsar.go b/api/cosmos/svip/v1/query.pulsar.go new file mode 100644 index 00000000..7796bf26 --- /dev/null +++ b/api/cosmos/svip/v1/query.pulsar.go @@ -0,0 +1,2292 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package svipv1 + +import ( + _ "cosmossdk.io/api/amino" + v1beta1 "cosmossdk.io/api/cosmos/base/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" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" + io "io" + reflect "reflect" + sync "sync" +) + +var ( + md_QueryParamsRequest protoreflect.MessageDescriptor +) + +func init() { + file_cosmos_svip_v1_query_proto_init() + md_QueryParamsRequest = File_cosmos_svip_v1_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_cosmos_svip_v1_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: cosmos.svip.v1.QueryParamsRequest")) + } + panic(fmt.Errorf("message cosmos.svip.v1.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: cosmos.svip.v1.QueryParamsRequest")) + } + panic(fmt.Errorf("message cosmos.svip.v1.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: cosmos.svip.v1.QueryParamsRequest")) + } + panic(fmt.Errorf("message cosmos.svip.v1.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: cosmos.svip.v1.QueryParamsRequest")) + } + panic(fmt.Errorf("message cosmos.svip.v1.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: cosmos.svip.v1.QueryParamsRequest")) + } + panic(fmt.Errorf("message cosmos.svip.v1.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: cosmos.svip.v1.QueryParamsRequest")) + } + panic(fmt.Errorf("message cosmos.svip.v1.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 cosmos.svip.v1.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_cosmos_svip_v1_query_proto_init() + md_QueryParamsResponse = File_cosmos_svip_v1_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_cosmos_svip_v1_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 "cosmos.svip.v1.QueryParamsResponse.params": + return x.Params != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.svip.v1.QueryParamsResponse")) + } + panic(fmt.Errorf("message cosmos.svip.v1.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 "cosmos.svip.v1.QueryParamsResponse.params": + x.Params = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.svip.v1.QueryParamsResponse")) + } + panic(fmt.Errorf("message cosmos.svip.v1.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 "cosmos.svip.v1.QueryParamsResponse.params": + value := x.Params + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.svip.v1.QueryParamsResponse")) + } + panic(fmt.Errorf("message cosmos.svip.v1.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 "cosmos.svip.v1.QueryParamsResponse.params": + x.Params = value.Message().Interface().(*Params) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.svip.v1.QueryParamsResponse")) + } + panic(fmt.Errorf("message cosmos.svip.v1.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 "cosmos.svip.v1.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: cosmos.svip.v1.QueryParamsResponse")) + } + panic(fmt.Errorf("message cosmos.svip.v1.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 "cosmos.svip.v1.QueryParamsResponse.params": + m := new(Params) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.svip.v1.QueryParamsResponse")) + } + panic(fmt.Errorf("message cosmos.svip.v1.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 cosmos.svip.v1.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, + } +} + +var ( + md_QueryPoolStateRequest protoreflect.MessageDescriptor +) + +func init() { + file_cosmos_svip_v1_query_proto_init() + md_QueryPoolStateRequest = File_cosmos_svip_v1_query_proto.Messages().ByName("QueryPoolStateRequest") +} + +var _ protoreflect.Message = (*fastReflection_QueryPoolStateRequest)(nil) + +type fastReflection_QueryPoolStateRequest QueryPoolStateRequest + +func (x *QueryPoolStateRequest) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryPoolStateRequest)(x) +} + +func (x *QueryPoolStateRequest) slowProtoReflect() protoreflect.Message { + mi := &file_cosmos_svip_v1_query_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_QueryPoolStateRequest_messageType fastReflection_QueryPoolStateRequest_messageType +var _ protoreflect.MessageType = fastReflection_QueryPoolStateRequest_messageType{} + +type fastReflection_QueryPoolStateRequest_messageType struct{} + +func (x fastReflection_QueryPoolStateRequest_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryPoolStateRequest)(nil) +} +func (x fastReflection_QueryPoolStateRequest_messageType) New() protoreflect.Message { + return new(fastReflection_QueryPoolStateRequest) +} +func (x fastReflection_QueryPoolStateRequest_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryPoolStateRequest +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_QueryPoolStateRequest) Descriptor() protoreflect.MessageDescriptor { + return md_QueryPoolStateRequest +} + +// 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_QueryPoolStateRequest) Type() protoreflect.MessageType { + return _fastReflection_QueryPoolStateRequest_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_QueryPoolStateRequest) New() protoreflect.Message { + return new(fastReflection_QueryPoolStateRequest) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_QueryPoolStateRequest) Interface() protoreflect.ProtoMessage { + return (*QueryPoolStateRequest)(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_QueryPoolStateRequest) 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_QueryPoolStateRequest) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.svip.v1.QueryPoolStateRequest")) + } + panic(fmt.Errorf("message cosmos.svip.v1.QueryPoolStateRequest 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_QueryPoolStateRequest) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.svip.v1.QueryPoolStateRequest")) + } + panic(fmt.Errorf("message cosmos.svip.v1.QueryPoolStateRequest 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_QueryPoolStateRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.svip.v1.QueryPoolStateRequest")) + } + panic(fmt.Errorf("message cosmos.svip.v1.QueryPoolStateRequest 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_QueryPoolStateRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.svip.v1.QueryPoolStateRequest")) + } + panic(fmt.Errorf("message cosmos.svip.v1.QueryPoolStateRequest 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_QueryPoolStateRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.svip.v1.QueryPoolStateRequest")) + } + panic(fmt.Errorf("message cosmos.svip.v1.QueryPoolStateRequest 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_QueryPoolStateRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.svip.v1.QueryPoolStateRequest")) + } + panic(fmt.Errorf("message cosmos.svip.v1.QueryPoolStateRequest 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_QueryPoolStateRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in cosmos.svip.v1.QueryPoolStateRequest", 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_QueryPoolStateRequest) 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_QueryPoolStateRequest) 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_QueryPoolStateRequest) 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_QueryPoolStateRequest) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*QueryPoolStateRequest) + 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().(*QueryPoolStateRequest) + 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().(*QueryPoolStateRequest) + 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: QueryPoolStateRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryPoolStateRequest: 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_QueryPoolStateResponse protoreflect.MessageDescriptor + fd_QueryPoolStateResponse_pool_balance protoreflect.FieldDescriptor + fd_QueryPoolStateResponse_total_distributed protoreflect.FieldDescriptor + fd_QueryPoolStateResponse_current_rate_per_second protoreflect.FieldDescriptor + fd_QueryPoolStateResponse_activated protoreflect.FieldDescriptor + fd_QueryPoolStateResponse_paused protoreflect.FieldDescriptor + fd_QueryPoolStateResponse_activation_time protoreflect.FieldDescriptor +) + +func init() { + file_cosmos_svip_v1_query_proto_init() + md_QueryPoolStateResponse = File_cosmos_svip_v1_query_proto.Messages().ByName("QueryPoolStateResponse") + fd_QueryPoolStateResponse_pool_balance = md_QueryPoolStateResponse.Fields().ByName("pool_balance") + fd_QueryPoolStateResponse_total_distributed = md_QueryPoolStateResponse.Fields().ByName("total_distributed") + fd_QueryPoolStateResponse_current_rate_per_second = md_QueryPoolStateResponse.Fields().ByName("current_rate_per_second") + fd_QueryPoolStateResponse_activated = md_QueryPoolStateResponse.Fields().ByName("activated") + fd_QueryPoolStateResponse_paused = md_QueryPoolStateResponse.Fields().ByName("paused") + fd_QueryPoolStateResponse_activation_time = md_QueryPoolStateResponse.Fields().ByName("activation_time") +} + +var _ protoreflect.Message = (*fastReflection_QueryPoolStateResponse)(nil) + +type fastReflection_QueryPoolStateResponse QueryPoolStateResponse + +func (x *QueryPoolStateResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryPoolStateResponse)(x) +} + +func (x *QueryPoolStateResponse) slowProtoReflect() protoreflect.Message { + mi := &file_cosmos_svip_v1_query_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_QueryPoolStateResponse_messageType fastReflection_QueryPoolStateResponse_messageType +var _ protoreflect.MessageType = fastReflection_QueryPoolStateResponse_messageType{} + +type fastReflection_QueryPoolStateResponse_messageType struct{} + +func (x fastReflection_QueryPoolStateResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryPoolStateResponse)(nil) +} +func (x fastReflection_QueryPoolStateResponse_messageType) New() protoreflect.Message { + return new(fastReflection_QueryPoolStateResponse) +} +func (x fastReflection_QueryPoolStateResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryPoolStateResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_QueryPoolStateResponse) Descriptor() protoreflect.MessageDescriptor { + return md_QueryPoolStateResponse +} + +// 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_QueryPoolStateResponse) Type() protoreflect.MessageType { + return _fastReflection_QueryPoolStateResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_QueryPoolStateResponse) New() protoreflect.Message { + return new(fastReflection_QueryPoolStateResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_QueryPoolStateResponse) Interface() protoreflect.ProtoMessage { + return (*QueryPoolStateResponse)(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_QueryPoolStateResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.PoolBalance != nil { + value := protoreflect.ValueOfMessage(x.PoolBalance.ProtoReflect()) + if !f(fd_QueryPoolStateResponse_pool_balance, value) { + return + } + } + if x.TotalDistributed != "" { + value := protoreflect.ValueOfString(x.TotalDistributed) + if !f(fd_QueryPoolStateResponse_total_distributed, value) { + return + } + } + if x.CurrentRatePerSecond != "" { + value := protoreflect.ValueOfString(x.CurrentRatePerSecond) + if !f(fd_QueryPoolStateResponse_current_rate_per_second, value) { + return + } + } + if x.Activated != false { + value := protoreflect.ValueOfBool(x.Activated) + if !f(fd_QueryPoolStateResponse_activated, value) { + return + } + } + if x.Paused != false { + value := protoreflect.ValueOfBool(x.Paused) + if !f(fd_QueryPoolStateResponse_paused, value) { + return + } + } + if x.ActivationTime != nil { + value := protoreflect.ValueOfMessage(x.ActivationTime.ProtoReflect()) + if !f(fd_QueryPoolStateResponse_activation_time, 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_QueryPoolStateResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "cosmos.svip.v1.QueryPoolStateResponse.pool_balance": + return x.PoolBalance != nil + case "cosmos.svip.v1.QueryPoolStateResponse.total_distributed": + return x.TotalDistributed != "" + case "cosmos.svip.v1.QueryPoolStateResponse.current_rate_per_second": + return x.CurrentRatePerSecond != "" + case "cosmos.svip.v1.QueryPoolStateResponse.activated": + return x.Activated != false + case "cosmos.svip.v1.QueryPoolStateResponse.paused": + return x.Paused != false + case "cosmos.svip.v1.QueryPoolStateResponse.activation_time": + return x.ActivationTime != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.svip.v1.QueryPoolStateResponse")) + } + panic(fmt.Errorf("message cosmos.svip.v1.QueryPoolStateResponse 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_QueryPoolStateResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "cosmos.svip.v1.QueryPoolStateResponse.pool_balance": + x.PoolBalance = nil + case "cosmos.svip.v1.QueryPoolStateResponse.total_distributed": + x.TotalDistributed = "" + case "cosmos.svip.v1.QueryPoolStateResponse.current_rate_per_second": + x.CurrentRatePerSecond = "" + case "cosmos.svip.v1.QueryPoolStateResponse.activated": + x.Activated = false + case "cosmos.svip.v1.QueryPoolStateResponse.paused": + x.Paused = false + case "cosmos.svip.v1.QueryPoolStateResponse.activation_time": + x.ActivationTime = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.svip.v1.QueryPoolStateResponse")) + } + panic(fmt.Errorf("message cosmos.svip.v1.QueryPoolStateResponse 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_QueryPoolStateResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "cosmos.svip.v1.QueryPoolStateResponse.pool_balance": + value := x.PoolBalance + return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "cosmos.svip.v1.QueryPoolStateResponse.total_distributed": + value := x.TotalDistributed + return protoreflect.ValueOfString(value) + case "cosmos.svip.v1.QueryPoolStateResponse.current_rate_per_second": + value := x.CurrentRatePerSecond + return protoreflect.ValueOfString(value) + case "cosmos.svip.v1.QueryPoolStateResponse.activated": + value := x.Activated + return protoreflect.ValueOfBool(value) + case "cosmos.svip.v1.QueryPoolStateResponse.paused": + value := x.Paused + return protoreflect.ValueOfBool(value) + case "cosmos.svip.v1.QueryPoolStateResponse.activation_time": + value := x.ActivationTime + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.svip.v1.QueryPoolStateResponse")) + } + panic(fmt.Errorf("message cosmos.svip.v1.QueryPoolStateResponse 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_QueryPoolStateResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "cosmos.svip.v1.QueryPoolStateResponse.pool_balance": + x.PoolBalance = value.Message().Interface().(*v1beta1.Coin) + case "cosmos.svip.v1.QueryPoolStateResponse.total_distributed": + x.TotalDistributed = value.Interface().(string) + case "cosmos.svip.v1.QueryPoolStateResponse.current_rate_per_second": + x.CurrentRatePerSecond = value.Interface().(string) + case "cosmos.svip.v1.QueryPoolStateResponse.activated": + x.Activated = value.Bool() + case "cosmos.svip.v1.QueryPoolStateResponse.paused": + x.Paused = value.Bool() + case "cosmos.svip.v1.QueryPoolStateResponse.activation_time": + x.ActivationTime = value.Message().Interface().(*timestamppb.Timestamp) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.svip.v1.QueryPoolStateResponse")) + } + panic(fmt.Errorf("message cosmos.svip.v1.QueryPoolStateResponse 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_QueryPoolStateResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.svip.v1.QueryPoolStateResponse.pool_balance": + if x.PoolBalance == nil { + x.PoolBalance = new(v1beta1.Coin) + } + return protoreflect.ValueOfMessage(x.PoolBalance.ProtoReflect()) + case "cosmos.svip.v1.QueryPoolStateResponse.activation_time": + if x.ActivationTime == nil { + x.ActivationTime = new(timestamppb.Timestamp) + } + return protoreflect.ValueOfMessage(x.ActivationTime.ProtoReflect()) + case "cosmos.svip.v1.QueryPoolStateResponse.total_distributed": + panic(fmt.Errorf("field total_distributed of message cosmos.svip.v1.QueryPoolStateResponse is not mutable")) + case "cosmos.svip.v1.QueryPoolStateResponse.current_rate_per_second": + panic(fmt.Errorf("field current_rate_per_second of message cosmos.svip.v1.QueryPoolStateResponse is not mutable")) + case "cosmos.svip.v1.QueryPoolStateResponse.activated": + panic(fmt.Errorf("field activated of message cosmos.svip.v1.QueryPoolStateResponse is not mutable")) + case "cosmos.svip.v1.QueryPoolStateResponse.paused": + panic(fmt.Errorf("field paused of message cosmos.svip.v1.QueryPoolStateResponse is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.svip.v1.QueryPoolStateResponse")) + } + panic(fmt.Errorf("message cosmos.svip.v1.QueryPoolStateResponse 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_QueryPoolStateResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.svip.v1.QueryPoolStateResponse.pool_balance": + m := new(v1beta1.Coin) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "cosmos.svip.v1.QueryPoolStateResponse.total_distributed": + return protoreflect.ValueOfString("") + case "cosmos.svip.v1.QueryPoolStateResponse.current_rate_per_second": + return protoreflect.ValueOfString("") + case "cosmos.svip.v1.QueryPoolStateResponse.activated": + return protoreflect.ValueOfBool(false) + case "cosmos.svip.v1.QueryPoolStateResponse.paused": + return protoreflect.ValueOfBool(false) + case "cosmos.svip.v1.QueryPoolStateResponse.activation_time": + m := new(timestamppb.Timestamp) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.svip.v1.QueryPoolStateResponse")) + } + panic(fmt.Errorf("message cosmos.svip.v1.QueryPoolStateResponse 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_QueryPoolStateResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in cosmos.svip.v1.QueryPoolStateResponse", 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_QueryPoolStateResponse) 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_QueryPoolStateResponse) 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_QueryPoolStateResponse) 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_QueryPoolStateResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*QueryPoolStateResponse) + 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.PoolBalance != nil { + l = options.Size(x.PoolBalance) + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.TotalDistributed) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.CurrentRatePerSecond) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.Activated { + n += 2 + } + if x.Paused { + n += 2 + } + if x.ActivationTime != nil { + l = options.Size(x.ActivationTime) + 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().(*QueryPoolStateResponse) + 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.ActivationTime != nil { + encoded, err := options.Marshal(x.ActivationTime) + 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] = 0x32 + } + if x.Paused { + i-- + if x.Paused { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x28 + } + if x.Activated { + i-- + if x.Activated { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x20 + } + if len(x.CurrentRatePerSecond) > 0 { + i -= len(x.CurrentRatePerSecond) + copy(dAtA[i:], x.CurrentRatePerSecond) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.CurrentRatePerSecond))) + i-- + dAtA[i] = 0x1a + } + if len(x.TotalDistributed) > 0 { + i -= len(x.TotalDistributed) + copy(dAtA[i:], x.TotalDistributed) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.TotalDistributed))) + i-- + dAtA[i] = 0x12 + } + if x.PoolBalance != nil { + encoded, err := options.Marshal(x.PoolBalance) + 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().(*QueryPoolStateResponse) + 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: QueryPoolStateResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryPoolStateResponse: 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 PoolBalance", 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.PoolBalance == nil { + x.PoolBalance = &v1beta1.Coin{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.PoolBalance); 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 TotalDistributed", 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.TotalDistributed = 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 CurrentRatePerSecond", 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.CurrentRatePerSecond = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Activated", 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.Activated = bool(v != 0) + case 5: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Paused", 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.Paused = bool(v != 0) + case 6: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ActivationTime", 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.ActivationTime == nil { + x.ActivationTime = ×tamppb.Timestamp{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.ActivationTime); 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: cosmos/svip/v1/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 defines the request type for querying x/svip parameters. +type QueryParamsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *QueryParamsRequest) Reset() { + *x = QueryParamsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_svip_v1_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_cosmos_svip_v1_query_proto_rawDescGZIP(), []int{0} +} + +// QueryParamsResponse defines the response type for querying x/svip parameters. +type QueryParamsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // params define the svip module parameters. + Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` +} + +func (x *QueryParamsResponse) Reset() { + *x = QueryParamsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_svip_v1_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_cosmos_svip_v1_query_proto_rawDescGZIP(), []int{1} +} + +func (x *QueryParamsResponse) GetParams() *Params { + if x != nil { + return x.Params + } + return nil +} + +// QueryPoolStateRequest defines the request type for querying pool state. +type QueryPoolStateRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *QueryPoolStateRequest) Reset() { + *x = QueryPoolStateRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_svip_v1_query_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryPoolStateRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryPoolStateRequest) ProtoMessage() {} + +// Deprecated: Use QueryPoolStateRequest.ProtoReflect.Descriptor instead. +func (*QueryPoolStateRequest) Descriptor() ([]byte, []int) { + return file_cosmos_svip_v1_query_proto_rawDescGZIP(), []int{2} +} + +// QueryPoolStateResponse returns the current SVIP pool state. +type QueryPoolStateResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // pool_balance is the current balance in the SVIP module account. + PoolBalance *v1beta1.Coin `protobuf:"bytes,1,opt,name=pool_balance,json=poolBalance,proto3" json:"pool_balance,omitempty"` + // total_distributed is cumulative tokens sent to FeeCollector. + TotalDistributed string `protobuf:"bytes,2,opt,name=total_distributed,json=totalDistributed,proto3" json:"total_distributed,omitempty"` + // current_rate_per_second is the current reward rate after decay. + CurrentRatePerSecond string `protobuf:"bytes,3,opt,name=current_rate_per_second,json=currentRatePerSecond,proto3" json:"current_rate_per_second,omitempty"` + // activated indicates whether SVIP is active. + Activated bool `protobuf:"varint,4,opt,name=activated,proto3" json:"activated,omitempty"` + // paused indicates whether SVIP is paused. + Paused bool `protobuf:"varint,5,opt,name=paused,proto3" json:"paused,omitempty"` + // activation_time is when SVIP was activated. + ActivationTime *timestamppb.Timestamp `protobuf:"bytes,6,opt,name=activation_time,json=activationTime,proto3" json:"activation_time,omitempty"` +} + +func (x *QueryPoolStateResponse) Reset() { + *x = QueryPoolStateResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_svip_v1_query_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryPoolStateResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryPoolStateResponse) ProtoMessage() {} + +// Deprecated: Use QueryPoolStateResponse.ProtoReflect.Descriptor instead. +func (*QueryPoolStateResponse) Descriptor() ([]byte, []int) { + return file_cosmos_svip_v1_query_proto_rawDescGZIP(), []int{3} +} + +func (x *QueryPoolStateResponse) GetPoolBalance() *v1beta1.Coin { + if x != nil { + return x.PoolBalance + } + return nil +} + +func (x *QueryPoolStateResponse) GetTotalDistributed() string { + if x != nil { + return x.TotalDistributed + } + return "" +} + +func (x *QueryPoolStateResponse) GetCurrentRatePerSecond() string { + if x != nil { + return x.CurrentRatePerSecond + } + return "" +} + +func (x *QueryPoolStateResponse) GetActivated() bool { + if x != nil { + return x.Activated + } + return false +} + +func (x *QueryPoolStateResponse) GetPaused() bool { + if x != nil { + return x.Paused + } + return false +} + +func (x *QueryPoolStateResponse) GetActivationTime() *timestamppb.Timestamp { + if x != nil { + return x.ActivationTime + } + return nil +} + +var File_cosmos_svip_v1_query_proto protoreflect.FileDescriptor + +var file_cosmos_svip_v1_query_proto_rawDesc = []byte{ + 0x0a, 0x1a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x73, 0x76, 0x69, 0x70, 0x2f, 0x76, 0x31, + 0x2f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0e, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x76, 0x69, 0x70, 0x2e, 0x76, 0x31, 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, 0x2f, 0x73, 0x76, 0x69, 0x70, 0x2f, 0x76, 0x31, 0x2f, + 0x73, 0x76, 0x69, 0x70, 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, 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, + 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, 0x63, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x76, 0x69, 0x70, 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, 0x22, 0x17, 0x0a, 0x15, 0x51, 0x75, 0x65, 0x72, 0x79, + 0x50, 0x6f, 0x6f, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x22, 0x89, 0x03, 0x0a, 0x16, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x6f, 0x6f, 0x6c, 0x53, 0x74, + 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x42, 0x0a, 0x0c, 0x70, + 0x6f, 0x6f, 0x6c, 0x5f, 0x62, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x18, 0x01, 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, 0x04, 0xc8, 0xde, + 0x1f, 0x00, 0x52, 0x0b, 0x70, 0x6f, 0x6f, 0x6c, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x12, + 0x4a, 0x0a, 0x11, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, + 0x75, 0x74, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x1d, 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, 0x52, 0x10, 0x74, 0x6f, 0x74, 0x61, 0x6c, + 0x44, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x64, 0x12, 0x5a, 0x0a, 0x17, 0x63, + 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x72, 0x61, 0x74, 0x65, 0x5f, 0x70, 0x65, 0x72, 0x5f, + 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x23, 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, 0x52, 0x14, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x52, 0x61, 0x74, 0x65, 0x50, 0x65, + 0x72, 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x63, 0x74, 0x69, 0x76, + 0x61, 0x74, 0x65, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x61, 0x63, 0x74, 0x69, + 0x76, 0x61, 0x74, 0x65, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x61, 0x75, 0x73, 0x65, 0x64, 0x18, + 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x70, 0x61, 0x75, 0x73, 0x65, 0x64, 0x12, 0x4d, 0x0a, + 0x0f, 0x61, 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x69, 0x6d, 0x65, + 0x18, 0x06, 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, 0x08, 0xc8, 0xde, 0x1f, 0x00, 0x90, 0xdf, 0x1f, 0x01, 0x52, 0x0e, 0x61, 0x63, + 0x74, 0x69, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x69, 0x6d, 0x65, 0x32, 0xfa, 0x01, 0x0a, + 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x71, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, + 0x12, 0x22, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x76, 0x69, 0x70, 0x2e, 0x76, + 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x76, + 0x69, 0x70, 0x2e, 0x76, 0x31, 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, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x73, 0x76, 0x69, 0x70, 0x2f, + 0x76, 0x31, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x7e, 0x0a, 0x09, 0x50, 0x6f, 0x6f, + 0x6c, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x25, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, + 0x73, 0x76, 0x69, 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x6f, 0x6f, + 0x6c, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x26, 0x2e, + 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x76, 0x69, 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x51, + 0x75, 0x65, 0x72, 0x79, 0x50, 0x6f, 0x6f, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x22, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1c, 0x12, 0x1a, 0x2f, + 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x73, 0x76, 0x69, 0x70, 0x2f, 0x76, 0x31, 0x2f, 0x70, + 0x6f, 0x6f, 0x6c, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x65, 0x42, 0xa2, 0x01, 0x0a, 0x12, 0x63, 0x6f, + 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x76, 0x69, 0x70, 0x2e, 0x76, 0x31, + 0x42, 0x0a, 0x51, 0x75, 0x65, 0x72, 0x79, 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, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x73, 0x76, 0x69, 0x70, 0x2f, 0x76, 0x31, 0x3b, + 0x73, 0x76, 0x69, 0x70, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x53, 0x58, 0xaa, 0x02, 0x0e, 0x43, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x53, 0x76, 0x69, 0x70, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x0e, + 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x53, 0x76, 0x69, 0x70, 0x5c, 0x56, 0x31, 0xe2, 0x02, + 0x1a, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x53, 0x76, 0x69, 0x70, 0x5c, 0x56, 0x31, 0x5c, + 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x10, 0x43, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x53, 0x76, 0x69, 0x70, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_cosmos_svip_v1_query_proto_rawDescOnce sync.Once + file_cosmos_svip_v1_query_proto_rawDescData = file_cosmos_svip_v1_query_proto_rawDesc +) + +func file_cosmos_svip_v1_query_proto_rawDescGZIP() []byte { + file_cosmos_svip_v1_query_proto_rawDescOnce.Do(func() { + file_cosmos_svip_v1_query_proto_rawDescData = protoimpl.X.CompressGZIP(file_cosmos_svip_v1_query_proto_rawDescData) + }) + return file_cosmos_svip_v1_query_proto_rawDescData +} + +var file_cosmos_svip_v1_query_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_cosmos_svip_v1_query_proto_goTypes = []interface{}{ + (*QueryParamsRequest)(nil), // 0: cosmos.svip.v1.QueryParamsRequest + (*QueryParamsResponse)(nil), // 1: cosmos.svip.v1.QueryParamsResponse + (*QueryPoolStateRequest)(nil), // 2: cosmos.svip.v1.QueryPoolStateRequest + (*QueryPoolStateResponse)(nil), // 3: cosmos.svip.v1.QueryPoolStateResponse + (*Params)(nil), // 4: cosmos.svip.v1.Params + (*v1beta1.Coin)(nil), // 5: cosmos.base.v1beta1.Coin + (*timestamppb.Timestamp)(nil), // 6: google.protobuf.Timestamp +} +var file_cosmos_svip_v1_query_proto_depIdxs = []int32{ + 4, // 0: cosmos.svip.v1.QueryParamsResponse.params:type_name -> cosmos.svip.v1.Params + 5, // 1: cosmos.svip.v1.QueryPoolStateResponse.pool_balance:type_name -> cosmos.base.v1beta1.Coin + 6, // 2: cosmos.svip.v1.QueryPoolStateResponse.activation_time:type_name -> google.protobuf.Timestamp + 0, // 3: cosmos.svip.v1.Query.Params:input_type -> cosmos.svip.v1.QueryParamsRequest + 2, // 4: cosmos.svip.v1.Query.PoolState:input_type -> cosmos.svip.v1.QueryPoolStateRequest + 1, // 5: cosmos.svip.v1.Query.Params:output_type -> cosmos.svip.v1.QueryParamsResponse + 3, // 6: cosmos.svip.v1.Query.PoolState:output_type -> cosmos.svip.v1.QueryPoolStateResponse + 5, // [5:7] is the sub-list for method output_type + 3, // [3:5] 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_cosmos_svip_v1_query_proto_init() } +func file_cosmos_svip_v1_query_proto_init() { + if File_cosmos_svip_v1_query_proto != nil { + return + } + file_cosmos_svip_v1_svip_proto_init() + if !protoimpl.UnsafeEnabled { + file_cosmos_svip_v1_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_cosmos_svip_v1_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 + } + } + file_cosmos_svip_v1_query_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QueryPoolStateRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_cosmos_svip_v1_query_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QueryPoolStateResponse); 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_cosmos_svip_v1_query_proto_rawDesc, + NumEnums: 0, + NumMessages: 4, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_cosmos_svip_v1_query_proto_goTypes, + DependencyIndexes: file_cosmos_svip_v1_query_proto_depIdxs, + MessageInfos: file_cosmos_svip_v1_query_proto_msgTypes, + }.Build() + File_cosmos_svip_v1_query_proto = out.File + file_cosmos_svip_v1_query_proto_rawDesc = nil + file_cosmos_svip_v1_query_proto_goTypes = nil + file_cosmos_svip_v1_query_proto_depIdxs = nil +} diff --git a/api/cosmos/svip/v1/query_grpc.pb.go b/api/cosmos/svip/v1/query_grpc.pb.go new file mode 100644 index 00000000..053061b4 --- /dev/null +++ b/api/cosmos/svip/v1/query_grpc.pb.go @@ -0,0 +1,152 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc (unknown) +// source: cosmos/svip/v1/query.proto + +package svipv1 + +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.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + Query_Params_FullMethodName = "/cosmos.svip.v1.Query/Params" + Query_PoolState_FullMethodName = "/cosmos.svip.v1.Query/PoolState" +) + +// 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. +type QueryClient interface { + // Params queries the parameters of x/svip module. + Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) + // PoolState queries the current SVIP pool balance, distribution stats, and + // reward rate. + PoolState(ctx context.Context, in *QueryPoolStateRequest, opts ...grpc.CallOption) (*QueryPoolStateResponse, 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) { + out := new(QueryParamsResponse) + err := c.cc.Invoke(ctx, Query_Params_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) PoolState(ctx context.Context, in *QueryPoolStateRequest, opts ...grpc.CallOption) (*QueryPoolStateResponse, error) { + out := new(QueryPoolStateResponse) + err := c.cc.Invoke(ctx, Query_PoolState_FullMethodName, in, out, opts...) + 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 +type QueryServer interface { + // Params queries the parameters of x/svip module. + Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) + // PoolState queries the current SVIP pool balance, distribution stats, and + // reward rate. + PoolState(context.Context, *QueryPoolStateRequest) (*QueryPoolStateResponse, error) + mustEmbedUnimplementedQueryServer() +} + +// UnimplementedQueryServer must be embedded to have forward compatible implementations. +type UnimplementedQueryServer struct { +} + +func (UnimplementedQueryServer) Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") +} +func (UnimplementedQueryServer) PoolState(context.Context, *QueryPoolStateRequest) (*QueryPoolStateResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method PoolState not implemented") +} +func (UnimplementedQueryServer) mustEmbedUnimplementedQueryServer() {} + +// 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) { + 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) +} + +func _Query_PoolState_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryPoolStateRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).PoolState(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Query_PoolState_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).PoolState(ctx, req.(*QueryPoolStateRequest)) + } + 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: "cosmos.svip.v1.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Params", + Handler: _Query_Params_Handler, + }, + { + MethodName: "PoolState", + Handler: _Query_PoolState_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "cosmos/svip/v1/query.proto", +} diff --git a/api/cosmos/svip/v1/svip.pulsar.go b/api/cosmos/svip/v1/svip.pulsar.go new file mode 100644 index 00000000..af27baf9 --- /dev/null +++ b/api/cosmos/svip/v1/svip.pulsar.go @@ -0,0 +1,560 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package svipv1 + +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 ( + md_Params protoreflect.MessageDescriptor + fd_Params_half_life_seconds protoreflect.FieldDescriptor +) + +func init() { + file_cosmos_svip_v1_svip_proto_init() + md_Params = File_cosmos_svip_v1_svip_proto.Messages().ByName("Params") + fd_Params_half_life_seconds = md_Params.Fields().ByName("half_life_seconds") +} + +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_cosmos_svip_v1_svip_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.HalfLifeSeconds != int64(0) { + value := protoreflect.ValueOfInt64(x.HalfLifeSeconds) + if !f(fd_Params_half_life_seconds, 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 "cosmos.svip.v1.Params.half_life_seconds": + return x.HalfLifeSeconds != int64(0) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.svip.v1.Params")) + } + panic(fmt.Errorf("message cosmos.svip.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 "cosmos.svip.v1.Params.half_life_seconds": + x.HalfLifeSeconds = int64(0) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.svip.v1.Params")) + } + panic(fmt.Errorf("message cosmos.svip.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 "cosmos.svip.v1.Params.half_life_seconds": + value := x.HalfLifeSeconds + return protoreflect.ValueOfInt64(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.svip.v1.Params")) + } + panic(fmt.Errorf("message cosmos.svip.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 "cosmos.svip.v1.Params.half_life_seconds": + x.HalfLifeSeconds = value.Int() + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.svip.v1.Params")) + } + panic(fmt.Errorf("message cosmos.svip.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 "cosmos.svip.v1.Params.half_life_seconds": + panic(fmt.Errorf("field half_life_seconds of message cosmos.svip.v1.Params is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.svip.v1.Params")) + } + panic(fmt.Errorf("message cosmos.svip.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 "cosmos.svip.v1.Params.half_life_seconds": + return protoreflect.ValueOfInt64(int64(0)) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.svip.v1.Params")) + } + panic(fmt.Errorf("message cosmos.svip.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 cosmos.svip.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.HalfLifeSeconds != 0 { + n += 1 + runtime.Sov(uint64(x.HalfLifeSeconds)) + } + 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.HalfLifeSeconds != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.HalfLifeSeconds)) + i-- + dAtA[i] = 0x18 + } + 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 3: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field HalfLifeSeconds", wireType) + } + x.HalfLifeSeconds = 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.HalfLifeSeconds |= int64(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: cosmos/svip/v1/svip.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 x/svip module parameters. +type Params struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // half_life_seconds is the half-life for exponential decay, in seconds. + HalfLifeSeconds int64 `protobuf:"varint,3,opt,name=half_life_seconds,json=halfLifeSeconds,proto3" json:"half_life_seconds,omitempty"` +} + +func (x *Params) Reset() { + *x = Params{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_svip_v1_svip_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_cosmos_svip_v1_svip_proto_rawDescGZIP(), []int{0} +} + +func (x *Params) GetHalfLifeSeconds() int64 { + if x != nil { + return x.HalfLifeSeconds + } + return 0 +} + +var File_cosmos_svip_v1_svip_proto protoreflect.FileDescriptor + +var file_cosmos_svip_v1_svip_proto_rawDesc = []byte{ + 0x0a, 0x19, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x73, 0x76, 0x69, 0x70, 0x2f, 0x76, 0x31, + 0x2f, 0x73, 0x76, 0x69, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0e, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x76, 0x69, 0x70, 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, 0x22, 0x6b, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x46, + 0x0a, 0x11, 0x68, 0x61, 0x6c, 0x66, 0x5f, 0x6c, 0x69, 0x66, 0x65, 0x5f, 0x73, 0x65, 0x63, 0x6f, + 0x6e, 0x64, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x42, 0x1a, 0xea, 0xde, 0x1f, 0x11, 0x68, + 0x61, 0x6c, 0x66, 0x5f, 0x6c, 0x69, 0x66, 0x65, 0x5f, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, + 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x0f, 0x68, 0x61, 0x6c, 0x66, 0x4c, 0x69, 0x66, 0x65, 0x53, + 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x3a, 0x19, 0x8a, 0xe7, 0xb0, 0x2a, 0x14, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x2f, 0x78, 0x2f, 0x73, 0x76, 0x69, 0x70, 0x2f, 0x50, 0x61, 0x72, 0x61, 0x6d, + 0x73, 0x42, 0xa1, 0x01, 0x0a, 0x12, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x2e, 0x73, 0x76, 0x69, 0x70, 0x2e, 0x76, 0x31, 0x42, 0x09, 0x53, 0x76, 0x69, 0x70, 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, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x73, + 0x76, 0x69, 0x70, 0x2f, 0x76, 0x31, 0x3b, 0x73, 0x76, 0x69, 0x70, 0x76, 0x31, 0xa2, 0x02, 0x03, + 0x43, 0x53, 0x58, 0xaa, 0x02, 0x0e, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x53, 0x76, 0x69, + 0x70, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x0e, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x53, 0x76, + 0x69, 0x70, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x1a, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x53, + 0x76, 0x69, 0x70, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, + 0x74, 0x61, 0xea, 0x02, 0x10, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x53, 0x76, 0x69, + 0x70, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_cosmos_svip_v1_svip_proto_rawDescOnce sync.Once + file_cosmos_svip_v1_svip_proto_rawDescData = file_cosmos_svip_v1_svip_proto_rawDesc +) + +func file_cosmos_svip_v1_svip_proto_rawDescGZIP() []byte { + file_cosmos_svip_v1_svip_proto_rawDescOnce.Do(func() { + file_cosmos_svip_v1_svip_proto_rawDescData = protoimpl.X.CompressGZIP(file_cosmos_svip_v1_svip_proto_rawDescData) + }) + return file_cosmos_svip_v1_svip_proto_rawDescData +} + +var file_cosmos_svip_v1_svip_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_cosmos_svip_v1_svip_proto_goTypes = []interface{}{ + (*Params)(nil), // 0: cosmos.svip.v1.Params +} +var file_cosmos_svip_v1_svip_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_cosmos_svip_v1_svip_proto_init() } +func file_cosmos_svip_v1_svip_proto_init() { + if File_cosmos_svip_v1_svip_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_cosmos_svip_v1_svip_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_cosmos_svip_v1_svip_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_cosmos_svip_v1_svip_proto_goTypes, + DependencyIndexes: file_cosmos_svip_v1_svip_proto_depIdxs, + MessageInfos: file_cosmos_svip_v1_svip_proto_msgTypes, + }.Build() + File_cosmos_svip_v1_svip_proto = out.File + file_cosmos_svip_v1_svip_proto_rawDesc = nil + file_cosmos_svip_v1_svip_proto_goTypes = nil + file_cosmos_svip_v1_svip_proto_depIdxs = nil +} diff --git a/api/cosmos/svip/v1/tx.pulsar.go b/api/cosmos/svip/v1/tx.pulsar.go new file mode 100644 index 00000000..7c66588e --- /dev/null +++ b/api/cosmos/svip/v1/tx.pulsar.go @@ -0,0 +1,4826 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package svipv1 + +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_cosmos_svip_v1_tx_proto_init() + md_MsgUpdateParams = File_cosmos_svip_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_cosmos_svip_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 "cosmos.svip.v1.MsgUpdateParams.authority": + return x.Authority != "" + case "cosmos.svip.v1.MsgUpdateParams.params": + return x.Params != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.svip.v1.MsgUpdateParams")) + } + panic(fmt.Errorf("message cosmos.svip.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 "cosmos.svip.v1.MsgUpdateParams.authority": + x.Authority = "" + case "cosmos.svip.v1.MsgUpdateParams.params": + x.Params = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.svip.v1.MsgUpdateParams")) + } + panic(fmt.Errorf("message cosmos.svip.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 "cosmos.svip.v1.MsgUpdateParams.authority": + value := x.Authority + return protoreflect.ValueOfString(value) + case "cosmos.svip.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: cosmos.svip.v1.MsgUpdateParams")) + } + panic(fmt.Errorf("message cosmos.svip.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 "cosmos.svip.v1.MsgUpdateParams.authority": + x.Authority = value.Interface().(string) + case "cosmos.svip.v1.MsgUpdateParams.params": + x.Params = value.Message().Interface().(*Params) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.svip.v1.MsgUpdateParams")) + } + panic(fmt.Errorf("message cosmos.svip.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 "cosmos.svip.v1.MsgUpdateParams.params": + if x.Params == nil { + x.Params = new(Params) + } + return protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + case "cosmos.svip.v1.MsgUpdateParams.authority": + panic(fmt.Errorf("field authority of message cosmos.svip.v1.MsgUpdateParams is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.svip.v1.MsgUpdateParams")) + } + panic(fmt.Errorf("message cosmos.svip.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 "cosmos.svip.v1.MsgUpdateParams.authority": + return protoreflect.ValueOfString("") + case "cosmos.svip.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: cosmos.svip.v1.MsgUpdateParams")) + } + panic(fmt.Errorf("message cosmos.svip.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 cosmos.svip.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_cosmos_svip_v1_tx_proto_init() + md_MsgUpdateParamsResponse = File_cosmos_svip_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_cosmos_svip_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: cosmos.svip.v1.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message cosmos.svip.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: cosmos.svip.v1.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message cosmos.svip.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: cosmos.svip.v1.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message cosmos.svip.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: cosmos.svip.v1.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message cosmos.svip.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: cosmos.svip.v1.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message cosmos.svip.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: cosmos.svip.v1.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message cosmos.svip.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 cosmos.svip.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_MsgActivate protoreflect.MessageDescriptor + fd_MsgActivate_authority protoreflect.FieldDescriptor +) + +func init() { + file_cosmos_svip_v1_tx_proto_init() + md_MsgActivate = File_cosmos_svip_v1_tx_proto.Messages().ByName("MsgActivate") + fd_MsgActivate_authority = md_MsgActivate.Fields().ByName("authority") +} + +var _ protoreflect.Message = (*fastReflection_MsgActivate)(nil) + +type fastReflection_MsgActivate MsgActivate + +func (x *MsgActivate) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgActivate)(x) +} + +func (x *MsgActivate) slowProtoReflect() protoreflect.Message { + mi := &file_cosmos_svip_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_MsgActivate_messageType fastReflection_MsgActivate_messageType +var _ protoreflect.MessageType = fastReflection_MsgActivate_messageType{} + +type fastReflection_MsgActivate_messageType struct{} + +func (x fastReflection_MsgActivate_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgActivate)(nil) +} +func (x fastReflection_MsgActivate_messageType) New() protoreflect.Message { + return new(fastReflection_MsgActivate) +} +func (x fastReflection_MsgActivate_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgActivate +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgActivate) Descriptor() protoreflect.MessageDescriptor { + return md_MsgActivate +} + +// 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_MsgActivate) Type() protoreflect.MessageType { + return _fastReflection_MsgActivate_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgActivate) New() protoreflect.Message { + return new(fastReflection_MsgActivate) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgActivate) Interface() protoreflect.ProtoMessage { + return (*MsgActivate)(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_MsgActivate) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Authority != "" { + value := protoreflect.ValueOfString(x.Authority) + if !f(fd_MsgActivate_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_MsgActivate) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "cosmos.svip.v1.MsgActivate.authority": + return x.Authority != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.svip.v1.MsgActivate")) + } + panic(fmt.Errorf("message cosmos.svip.v1.MsgActivate 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_MsgActivate) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "cosmos.svip.v1.MsgActivate.authority": + x.Authority = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.svip.v1.MsgActivate")) + } + panic(fmt.Errorf("message cosmos.svip.v1.MsgActivate 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_MsgActivate) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "cosmos.svip.v1.MsgActivate.authority": + value := x.Authority + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.svip.v1.MsgActivate")) + } + panic(fmt.Errorf("message cosmos.svip.v1.MsgActivate 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_MsgActivate) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "cosmos.svip.v1.MsgActivate.authority": + x.Authority = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.svip.v1.MsgActivate")) + } + panic(fmt.Errorf("message cosmos.svip.v1.MsgActivate 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_MsgActivate) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.svip.v1.MsgActivate.authority": + panic(fmt.Errorf("field authority of message cosmos.svip.v1.MsgActivate is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.svip.v1.MsgActivate")) + } + panic(fmt.Errorf("message cosmos.svip.v1.MsgActivate 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_MsgActivate) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.svip.v1.MsgActivate.authority": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.svip.v1.MsgActivate")) + } + panic(fmt.Errorf("message cosmos.svip.v1.MsgActivate 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_MsgActivate) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in cosmos.svip.v1.MsgActivate", 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_MsgActivate) 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_MsgActivate) 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_MsgActivate) 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_MsgActivate) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgActivate) + 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().(*MsgActivate) + 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().(*MsgActivate) + 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: MsgActivate: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgActivate: 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, + } +} + +var ( + md_MsgActivateResponse protoreflect.MessageDescriptor +) + +func init() { + file_cosmos_svip_v1_tx_proto_init() + md_MsgActivateResponse = File_cosmos_svip_v1_tx_proto.Messages().ByName("MsgActivateResponse") +} + +var _ protoreflect.Message = (*fastReflection_MsgActivateResponse)(nil) + +type fastReflection_MsgActivateResponse MsgActivateResponse + +func (x *MsgActivateResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgActivateResponse)(x) +} + +func (x *MsgActivateResponse) slowProtoReflect() protoreflect.Message { + mi := &file_cosmos_svip_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_MsgActivateResponse_messageType fastReflection_MsgActivateResponse_messageType +var _ protoreflect.MessageType = fastReflection_MsgActivateResponse_messageType{} + +type fastReflection_MsgActivateResponse_messageType struct{} + +func (x fastReflection_MsgActivateResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgActivateResponse)(nil) +} +func (x fastReflection_MsgActivateResponse_messageType) New() protoreflect.Message { + return new(fastReflection_MsgActivateResponse) +} +func (x fastReflection_MsgActivateResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgActivateResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgActivateResponse) Descriptor() protoreflect.MessageDescriptor { + return md_MsgActivateResponse +} + +// 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_MsgActivateResponse) Type() protoreflect.MessageType { + return _fastReflection_MsgActivateResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgActivateResponse) New() protoreflect.Message { + return new(fastReflection_MsgActivateResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgActivateResponse) Interface() protoreflect.ProtoMessage { + return (*MsgActivateResponse)(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_MsgActivateResponse) 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_MsgActivateResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.svip.v1.MsgActivateResponse")) + } + panic(fmt.Errorf("message cosmos.svip.v1.MsgActivateResponse 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_MsgActivateResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.svip.v1.MsgActivateResponse")) + } + panic(fmt.Errorf("message cosmos.svip.v1.MsgActivateResponse 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_MsgActivateResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.svip.v1.MsgActivateResponse")) + } + panic(fmt.Errorf("message cosmos.svip.v1.MsgActivateResponse 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_MsgActivateResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.svip.v1.MsgActivateResponse")) + } + panic(fmt.Errorf("message cosmos.svip.v1.MsgActivateResponse 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_MsgActivateResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.svip.v1.MsgActivateResponse")) + } + panic(fmt.Errorf("message cosmos.svip.v1.MsgActivateResponse 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_MsgActivateResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.svip.v1.MsgActivateResponse")) + } + panic(fmt.Errorf("message cosmos.svip.v1.MsgActivateResponse 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_MsgActivateResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in cosmos.svip.v1.MsgActivateResponse", 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_MsgActivateResponse) 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_MsgActivateResponse) 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_MsgActivateResponse) 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_MsgActivateResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgActivateResponse) + 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().(*MsgActivateResponse) + 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().(*MsgActivateResponse) + 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: MsgActivateResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgActivateResponse: 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_MsgReactivate protoreflect.MessageDescriptor + fd_MsgReactivate_authority protoreflect.FieldDescriptor +) + +func init() { + file_cosmos_svip_v1_tx_proto_init() + md_MsgReactivate = File_cosmos_svip_v1_tx_proto.Messages().ByName("MsgReactivate") + fd_MsgReactivate_authority = md_MsgReactivate.Fields().ByName("authority") +} + +var _ protoreflect.Message = (*fastReflection_MsgReactivate)(nil) + +type fastReflection_MsgReactivate MsgReactivate + +func (x *MsgReactivate) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgReactivate)(x) +} + +func (x *MsgReactivate) slowProtoReflect() protoreflect.Message { + mi := &file_cosmos_svip_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_MsgReactivate_messageType fastReflection_MsgReactivate_messageType +var _ protoreflect.MessageType = fastReflection_MsgReactivate_messageType{} + +type fastReflection_MsgReactivate_messageType struct{} + +func (x fastReflection_MsgReactivate_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgReactivate)(nil) +} +func (x fastReflection_MsgReactivate_messageType) New() protoreflect.Message { + return new(fastReflection_MsgReactivate) +} +func (x fastReflection_MsgReactivate_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgReactivate +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgReactivate) Descriptor() protoreflect.MessageDescriptor { + return md_MsgReactivate +} + +// 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_MsgReactivate) Type() protoreflect.MessageType { + return _fastReflection_MsgReactivate_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgReactivate) New() protoreflect.Message { + return new(fastReflection_MsgReactivate) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgReactivate) Interface() protoreflect.ProtoMessage { + return (*MsgReactivate)(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_MsgReactivate) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Authority != "" { + value := protoreflect.ValueOfString(x.Authority) + if !f(fd_MsgReactivate_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_MsgReactivate) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "cosmos.svip.v1.MsgReactivate.authority": + return x.Authority != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.svip.v1.MsgReactivate")) + } + panic(fmt.Errorf("message cosmos.svip.v1.MsgReactivate 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_MsgReactivate) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "cosmos.svip.v1.MsgReactivate.authority": + x.Authority = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.svip.v1.MsgReactivate")) + } + panic(fmt.Errorf("message cosmos.svip.v1.MsgReactivate 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_MsgReactivate) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "cosmos.svip.v1.MsgReactivate.authority": + value := x.Authority + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.svip.v1.MsgReactivate")) + } + panic(fmt.Errorf("message cosmos.svip.v1.MsgReactivate 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_MsgReactivate) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "cosmos.svip.v1.MsgReactivate.authority": + x.Authority = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.svip.v1.MsgReactivate")) + } + panic(fmt.Errorf("message cosmos.svip.v1.MsgReactivate 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_MsgReactivate) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.svip.v1.MsgReactivate.authority": + panic(fmt.Errorf("field authority of message cosmos.svip.v1.MsgReactivate is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.svip.v1.MsgReactivate")) + } + panic(fmt.Errorf("message cosmos.svip.v1.MsgReactivate 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_MsgReactivate) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.svip.v1.MsgReactivate.authority": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.svip.v1.MsgReactivate")) + } + panic(fmt.Errorf("message cosmos.svip.v1.MsgReactivate 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_MsgReactivate) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in cosmos.svip.v1.MsgReactivate", 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_MsgReactivate) 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_MsgReactivate) 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_MsgReactivate) 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_MsgReactivate) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgReactivate) + 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().(*MsgReactivate) + 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().(*MsgReactivate) + 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: MsgReactivate: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgReactivate: 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, + } +} + +var ( + md_MsgReactivateResponse protoreflect.MessageDescriptor +) + +func init() { + file_cosmos_svip_v1_tx_proto_init() + md_MsgReactivateResponse = File_cosmos_svip_v1_tx_proto.Messages().ByName("MsgReactivateResponse") +} + +var _ protoreflect.Message = (*fastReflection_MsgReactivateResponse)(nil) + +type fastReflection_MsgReactivateResponse MsgReactivateResponse + +func (x *MsgReactivateResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgReactivateResponse)(x) +} + +func (x *MsgReactivateResponse) slowProtoReflect() protoreflect.Message { + mi := &file_cosmos_svip_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_MsgReactivateResponse_messageType fastReflection_MsgReactivateResponse_messageType +var _ protoreflect.MessageType = fastReflection_MsgReactivateResponse_messageType{} + +type fastReflection_MsgReactivateResponse_messageType struct{} + +func (x fastReflection_MsgReactivateResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgReactivateResponse)(nil) +} +func (x fastReflection_MsgReactivateResponse_messageType) New() protoreflect.Message { + return new(fastReflection_MsgReactivateResponse) +} +func (x fastReflection_MsgReactivateResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgReactivateResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgReactivateResponse) Descriptor() protoreflect.MessageDescriptor { + return md_MsgReactivateResponse +} + +// 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_MsgReactivateResponse) Type() protoreflect.MessageType { + return _fastReflection_MsgReactivateResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgReactivateResponse) New() protoreflect.Message { + return new(fastReflection_MsgReactivateResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgReactivateResponse) Interface() protoreflect.ProtoMessage { + return (*MsgReactivateResponse)(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_MsgReactivateResponse) 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_MsgReactivateResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.svip.v1.MsgReactivateResponse")) + } + panic(fmt.Errorf("message cosmos.svip.v1.MsgReactivateResponse 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_MsgReactivateResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.svip.v1.MsgReactivateResponse")) + } + panic(fmt.Errorf("message cosmos.svip.v1.MsgReactivateResponse 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_MsgReactivateResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.svip.v1.MsgReactivateResponse")) + } + panic(fmt.Errorf("message cosmos.svip.v1.MsgReactivateResponse 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_MsgReactivateResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.svip.v1.MsgReactivateResponse")) + } + panic(fmt.Errorf("message cosmos.svip.v1.MsgReactivateResponse 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_MsgReactivateResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.svip.v1.MsgReactivateResponse")) + } + panic(fmt.Errorf("message cosmos.svip.v1.MsgReactivateResponse 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_MsgReactivateResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.svip.v1.MsgReactivateResponse")) + } + panic(fmt.Errorf("message cosmos.svip.v1.MsgReactivateResponse 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_MsgReactivateResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in cosmos.svip.v1.MsgReactivateResponse", 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_MsgReactivateResponse) 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_MsgReactivateResponse) 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_MsgReactivateResponse) 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_MsgReactivateResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgReactivateResponse) + 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().(*MsgReactivateResponse) + 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().(*MsgReactivateResponse) + 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: MsgReactivateResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgReactivateResponse: 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_MsgPause protoreflect.MessageDescriptor + fd_MsgPause_authority protoreflect.FieldDescriptor + fd_MsgPause_paused protoreflect.FieldDescriptor +) + +func init() { + file_cosmos_svip_v1_tx_proto_init() + md_MsgPause = File_cosmos_svip_v1_tx_proto.Messages().ByName("MsgPause") + fd_MsgPause_authority = md_MsgPause.Fields().ByName("authority") + fd_MsgPause_paused = md_MsgPause.Fields().ByName("paused") +} + +var _ protoreflect.Message = (*fastReflection_MsgPause)(nil) + +type fastReflection_MsgPause MsgPause + +func (x *MsgPause) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgPause)(x) +} + +func (x *MsgPause) slowProtoReflect() protoreflect.Message { + mi := &file_cosmos_svip_v1_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_MsgPause_messageType fastReflection_MsgPause_messageType +var _ protoreflect.MessageType = fastReflection_MsgPause_messageType{} + +type fastReflection_MsgPause_messageType struct{} + +func (x fastReflection_MsgPause_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgPause)(nil) +} +func (x fastReflection_MsgPause_messageType) New() protoreflect.Message { + return new(fastReflection_MsgPause) +} +func (x fastReflection_MsgPause_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgPause +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgPause) Descriptor() protoreflect.MessageDescriptor { + return md_MsgPause +} + +// 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_MsgPause) Type() protoreflect.MessageType { + return _fastReflection_MsgPause_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgPause) New() protoreflect.Message { + return new(fastReflection_MsgPause) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgPause) Interface() protoreflect.ProtoMessage { + return (*MsgPause)(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_MsgPause) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Authority != "" { + value := protoreflect.ValueOfString(x.Authority) + if !f(fd_MsgPause_authority, value) { + return + } + } + if x.Paused != false { + value := protoreflect.ValueOfBool(x.Paused) + if !f(fd_MsgPause_paused, 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_MsgPause) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "cosmos.svip.v1.MsgPause.authority": + return x.Authority != "" + case "cosmos.svip.v1.MsgPause.paused": + return x.Paused != false + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.svip.v1.MsgPause")) + } + panic(fmt.Errorf("message cosmos.svip.v1.MsgPause 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_MsgPause) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "cosmos.svip.v1.MsgPause.authority": + x.Authority = "" + case "cosmos.svip.v1.MsgPause.paused": + x.Paused = false + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.svip.v1.MsgPause")) + } + panic(fmt.Errorf("message cosmos.svip.v1.MsgPause 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_MsgPause) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "cosmos.svip.v1.MsgPause.authority": + value := x.Authority + return protoreflect.ValueOfString(value) + case "cosmos.svip.v1.MsgPause.paused": + value := x.Paused + return protoreflect.ValueOfBool(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.svip.v1.MsgPause")) + } + panic(fmt.Errorf("message cosmos.svip.v1.MsgPause 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_MsgPause) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "cosmos.svip.v1.MsgPause.authority": + x.Authority = value.Interface().(string) + case "cosmos.svip.v1.MsgPause.paused": + x.Paused = value.Bool() + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.svip.v1.MsgPause")) + } + panic(fmt.Errorf("message cosmos.svip.v1.MsgPause 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_MsgPause) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.svip.v1.MsgPause.authority": + panic(fmt.Errorf("field authority of message cosmos.svip.v1.MsgPause is not mutable")) + case "cosmos.svip.v1.MsgPause.paused": + panic(fmt.Errorf("field paused of message cosmos.svip.v1.MsgPause is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.svip.v1.MsgPause")) + } + panic(fmt.Errorf("message cosmos.svip.v1.MsgPause 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_MsgPause) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.svip.v1.MsgPause.authority": + return protoreflect.ValueOfString("") + case "cosmos.svip.v1.MsgPause.paused": + return protoreflect.ValueOfBool(false) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.svip.v1.MsgPause")) + } + panic(fmt.Errorf("message cosmos.svip.v1.MsgPause 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_MsgPause) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in cosmos.svip.v1.MsgPause", 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_MsgPause) 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_MsgPause) 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_MsgPause) 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_MsgPause) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgPause) + 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.Paused { + n += 2 + } + 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().(*MsgPause) + 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.Paused { + i-- + if x.Paused { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x10 + } + 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().(*MsgPause) + 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: MsgPause: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgPause: 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 != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Paused", 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.Paused = bool(v != 0) + 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_MsgPauseResponse protoreflect.MessageDescriptor +) + +func init() { + file_cosmos_svip_v1_tx_proto_init() + md_MsgPauseResponse = File_cosmos_svip_v1_tx_proto.Messages().ByName("MsgPauseResponse") +} + +var _ protoreflect.Message = (*fastReflection_MsgPauseResponse)(nil) + +type fastReflection_MsgPauseResponse MsgPauseResponse + +func (x *MsgPauseResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgPauseResponse)(x) +} + +func (x *MsgPauseResponse) slowProtoReflect() protoreflect.Message { + mi := &file_cosmos_svip_v1_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_MsgPauseResponse_messageType fastReflection_MsgPauseResponse_messageType +var _ protoreflect.MessageType = fastReflection_MsgPauseResponse_messageType{} + +type fastReflection_MsgPauseResponse_messageType struct{} + +func (x fastReflection_MsgPauseResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgPauseResponse)(nil) +} +func (x fastReflection_MsgPauseResponse_messageType) New() protoreflect.Message { + return new(fastReflection_MsgPauseResponse) +} +func (x fastReflection_MsgPauseResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgPauseResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgPauseResponse) Descriptor() protoreflect.MessageDescriptor { + return md_MsgPauseResponse +} + +// 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_MsgPauseResponse) Type() protoreflect.MessageType { + return _fastReflection_MsgPauseResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgPauseResponse) New() protoreflect.Message { + return new(fastReflection_MsgPauseResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgPauseResponse) Interface() protoreflect.ProtoMessage { + return (*MsgPauseResponse)(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_MsgPauseResponse) 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_MsgPauseResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.svip.v1.MsgPauseResponse")) + } + panic(fmt.Errorf("message cosmos.svip.v1.MsgPauseResponse 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_MsgPauseResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.svip.v1.MsgPauseResponse")) + } + panic(fmt.Errorf("message cosmos.svip.v1.MsgPauseResponse 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_MsgPauseResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.svip.v1.MsgPauseResponse")) + } + panic(fmt.Errorf("message cosmos.svip.v1.MsgPauseResponse 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_MsgPauseResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.svip.v1.MsgPauseResponse")) + } + panic(fmt.Errorf("message cosmos.svip.v1.MsgPauseResponse 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_MsgPauseResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.svip.v1.MsgPauseResponse")) + } + panic(fmt.Errorf("message cosmos.svip.v1.MsgPauseResponse 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_MsgPauseResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.svip.v1.MsgPauseResponse")) + } + panic(fmt.Errorf("message cosmos.svip.v1.MsgPauseResponse 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_MsgPauseResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in cosmos.svip.v1.MsgPauseResponse", 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_MsgPauseResponse) 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_MsgPauseResponse) 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_MsgPauseResponse) 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_MsgPauseResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgPauseResponse) + 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().(*MsgPauseResponse) + 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().(*MsgPauseResponse) + 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: MsgPauseResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgPauseResponse: 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 _ protoreflect.List = (*_MsgFundPool_2_list)(nil) + +type _MsgFundPool_2_list struct { + list *[]*v1beta1.Coin +} + +func (x *_MsgFundPool_2_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_MsgFundPool_2_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) +} + +func (x *_MsgFundPool_2_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*v1beta1.Coin) + (*x.list)[i] = concreteValue +} + +func (x *_MsgFundPool_2_list) Append(value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*v1beta1.Coin) + *x.list = append(*x.list, concreteValue) +} + +func (x *_MsgFundPool_2_list) AppendMutable() protoreflect.Value { + v := new(v1beta1.Coin) + *x.list = append(*x.list, v) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_MsgFundPool_2_list) Truncate(n int) { + for i := n; i < len(*x.list); i++ { + (*x.list)[i] = nil + } + *x.list = (*x.list)[:n] +} + +func (x *_MsgFundPool_2_list) NewElement() protoreflect.Value { + v := new(v1beta1.Coin) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_MsgFundPool_2_list) IsValid() bool { + return x.list != nil +} + +var ( + md_MsgFundPool protoreflect.MessageDescriptor + fd_MsgFundPool_depositor protoreflect.FieldDescriptor + fd_MsgFundPool_amount protoreflect.FieldDescriptor +) + +func init() { + file_cosmos_svip_v1_tx_proto_init() + md_MsgFundPool = File_cosmos_svip_v1_tx_proto.Messages().ByName("MsgFundPool") + fd_MsgFundPool_depositor = md_MsgFundPool.Fields().ByName("depositor") + fd_MsgFundPool_amount = md_MsgFundPool.Fields().ByName("amount") +} + +var _ protoreflect.Message = (*fastReflection_MsgFundPool)(nil) + +type fastReflection_MsgFundPool MsgFundPool + +func (x *MsgFundPool) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgFundPool)(x) +} + +func (x *MsgFundPool) slowProtoReflect() protoreflect.Message { + mi := &file_cosmos_svip_v1_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_MsgFundPool_messageType fastReflection_MsgFundPool_messageType +var _ protoreflect.MessageType = fastReflection_MsgFundPool_messageType{} + +type fastReflection_MsgFundPool_messageType struct{} + +func (x fastReflection_MsgFundPool_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgFundPool)(nil) +} +func (x fastReflection_MsgFundPool_messageType) New() protoreflect.Message { + return new(fastReflection_MsgFundPool) +} +func (x fastReflection_MsgFundPool_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgFundPool +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgFundPool) Descriptor() protoreflect.MessageDescriptor { + return md_MsgFundPool +} + +// 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_MsgFundPool) Type() protoreflect.MessageType { + return _fastReflection_MsgFundPool_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgFundPool) New() protoreflect.Message { + return new(fastReflection_MsgFundPool) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgFundPool) Interface() protoreflect.ProtoMessage { + return (*MsgFundPool)(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_MsgFundPool) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Depositor != "" { + value := protoreflect.ValueOfString(x.Depositor) + if !f(fd_MsgFundPool_depositor, value) { + return + } + } + if len(x.Amount) != 0 { + value := protoreflect.ValueOfList(&_MsgFundPool_2_list{list: &x.Amount}) + if !f(fd_MsgFundPool_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_MsgFundPool) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "cosmos.svip.v1.MsgFundPool.depositor": + return x.Depositor != "" + case "cosmos.svip.v1.MsgFundPool.amount": + return len(x.Amount) != 0 + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.svip.v1.MsgFundPool")) + } + panic(fmt.Errorf("message cosmos.svip.v1.MsgFundPool 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_MsgFundPool) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "cosmos.svip.v1.MsgFundPool.depositor": + x.Depositor = "" + case "cosmos.svip.v1.MsgFundPool.amount": + x.Amount = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.svip.v1.MsgFundPool")) + } + panic(fmt.Errorf("message cosmos.svip.v1.MsgFundPool 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_MsgFundPool) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "cosmos.svip.v1.MsgFundPool.depositor": + value := x.Depositor + return protoreflect.ValueOfString(value) + case "cosmos.svip.v1.MsgFundPool.amount": + if len(x.Amount) == 0 { + return protoreflect.ValueOfList(&_MsgFundPool_2_list{}) + } + listValue := &_MsgFundPool_2_list{list: &x.Amount} + return protoreflect.ValueOfList(listValue) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.svip.v1.MsgFundPool")) + } + panic(fmt.Errorf("message cosmos.svip.v1.MsgFundPool 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_MsgFundPool) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "cosmos.svip.v1.MsgFundPool.depositor": + x.Depositor = value.Interface().(string) + case "cosmos.svip.v1.MsgFundPool.amount": + lv := value.List() + clv := lv.(*_MsgFundPool_2_list) + x.Amount = *clv.list + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.svip.v1.MsgFundPool")) + } + panic(fmt.Errorf("message cosmos.svip.v1.MsgFundPool 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_MsgFundPool) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.svip.v1.MsgFundPool.amount": + if x.Amount == nil { + x.Amount = []*v1beta1.Coin{} + } + value := &_MsgFundPool_2_list{list: &x.Amount} + return protoreflect.ValueOfList(value) + case "cosmos.svip.v1.MsgFundPool.depositor": + panic(fmt.Errorf("field depositor of message cosmos.svip.v1.MsgFundPool is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.svip.v1.MsgFundPool")) + } + panic(fmt.Errorf("message cosmos.svip.v1.MsgFundPool 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_MsgFundPool) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.svip.v1.MsgFundPool.depositor": + return protoreflect.ValueOfString("") + case "cosmos.svip.v1.MsgFundPool.amount": + list := []*v1beta1.Coin{} + return protoreflect.ValueOfList(&_MsgFundPool_2_list{list: &list}) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.svip.v1.MsgFundPool")) + } + panic(fmt.Errorf("message cosmos.svip.v1.MsgFundPool 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_MsgFundPool) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in cosmos.svip.v1.MsgFundPool", 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_MsgFundPool) 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_MsgFundPool) 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_MsgFundPool) 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_MsgFundPool) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgFundPool) + 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.Depositor) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if len(x.Amount) > 0 { + for _, e := range x.Amount { + 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().(*MsgFundPool) + 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.Amount) > 0 { + for iNdEx := len(x.Amount) - 1; iNdEx >= 0; iNdEx-- { + encoded, err := options.Marshal(x.Amount[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 len(x.Depositor) > 0 { + i -= len(x.Depositor) + copy(dAtA[i:], x.Depositor) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Depositor))) + 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().(*MsgFundPool) + 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: MsgFundPool: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgFundPool: 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 Depositor", 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.Depositor = 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 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 + } + x.Amount = append(x.Amount, &v1beta1.Coin{}) + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Amount[len(x.Amount)-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 ( + md_MsgFundPoolResponse protoreflect.MessageDescriptor +) + +func init() { + file_cosmos_svip_v1_tx_proto_init() + md_MsgFundPoolResponse = File_cosmos_svip_v1_tx_proto.Messages().ByName("MsgFundPoolResponse") +} + +var _ protoreflect.Message = (*fastReflection_MsgFundPoolResponse)(nil) + +type fastReflection_MsgFundPoolResponse MsgFundPoolResponse + +func (x *MsgFundPoolResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgFundPoolResponse)(x) +} + +func (x *MsgFundPoolResponse) slowProtoReflect() protoreflect.Message { + mi := &file_cosmos_svip_v1_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_MsgFundPoolResponse_messageType fastReflection_MsgFundPoolResponse_messageType +var _ protoreflect.MessageType = fastReflection_MsgFundPoolResponse_messageType{} + +type fastReflection_MsgFundPoolResponse_messageType struct{} + +func (x fastReflection_MsgFundPoolResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgFundPoolResponse)(nil) +} +func (x fastReflection_MsgFundPoolResponse_messageType) New() protoreflect.Message { + return new(fastReflection_MsgFundPoolResponse) +} +func (x fastReflection_MsgFundPoolResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgFundPoolResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgFundPoolResponse) Descriptor() protoreflect.MessageDescriptor { + return md_MsgFundPoolResponse +} + +// 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_MsgFundPoolResponse) Type() protoreflect.MessageType { + return _fastReflection_MsgFundPoolResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgFundPoolResponse) New() protoreflect.Message { + return new(fastReflection_MsgFundPoolResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgFundPoolResponse) Interface() protoreflect.ProtoMessage { + return (*MsgFundPoolResponse)(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_MsgFundPoolResponse) 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_MsgFundPoolResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.svip.v1.MsgFundPoolResponse")) + } + panic(fmt.Errorf("message cosmos.svip.v1.MsgFundPoolResponse 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_MsgFundPoolResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.svip.v1.MsgFundPoolResponse")) + } + panic(fmt.Errorf("message cosmos.svip.v1.MsgFundPoolResponse 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_MsgFundPoolResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.svip.v1.MsgFundPoolResponse")) + } + panic(fmt.Errorf("message cosmos.svip.v1.MsgFundPoolResponse 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_MsgFundPoolResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.svip.v1.MsgFundPoolResponse")) + } + panic(fmt.Errorf("message cosmos.svip.v1.MsgFundPoolResponse 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_MsgFundPoolResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.svip.v1.MsgFundPoolResponse")) + } + panic(fmt.Errorf("message cosmos.svip.v1.MsgFundPoolResponse 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_MsgFundPoolResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.svip.v1.MsgFundPoolResponse")) + } + panic(fmt.Errorf("message cosmos.svip.v1.MsgFundPoolResponse 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_MsgFundPoolResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in cosmos.svip.v1.MsgFundPoolResponse", 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_MsgFundPoolResponse) 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_MsgFundPoolResponse) 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_MsgFundPoolResponse) 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_MsgFundPoolResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgFundPoolResponse) + 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().(*MsgFundPoolResponse) + 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().(*MsgFundPoolResponse) + 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: MsgFundPoolResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgFundPoolResponse: 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: cosmos/svip/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 defines a Msg for updating the x/svip module parameters. +type MsgUpdateParams struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // authority is the address of the governance account. + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // params defines the x/svip parameters to update. + // NOTE: Only half_life_seconds is configurable via this message. + Params *Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params,omitempty"` +} + +func (x *MsgUpdateParams) Reset() { + *x = MsgUpdateParams{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_svip_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_cosmos_svip_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 for MsgUpdateParams. +type MsgUpdateParamsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *MsgUpdateParamsResponse) Reset() { + *x = MsgUpdateParamsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_svip_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_cosmos_svip_v1_tx_proto_rawDescGZIP(), []int{1} +} + +// MsgActivate activates SVIP reward distribution. Governance-only. +type MsgActivate struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // authority is the address of the governance account. + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` +} + +func (x *MsgActivate) Reset() { + *x = MsgActivate{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_svip_v1_tx_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgActivate) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgActivate) ProtoMessage() {} + +// Deprecated: Use MsgActivate.ProtoReflect.Descriptor instead. +func (*MsgActivate) Descriptor() ([]byte, []int) { + return file_cosmos_svip_v1_tx_proto_rawDescGZIP(), []int{2} +} + +func (x *MsgActivate) GetAuthority() string { + if x != nil { + return x.Authority + } + return "" +} + +// MsgActivateResponse defines the response for MsgActivate. +type MsgActivateResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *MsgActivateResponse) Reset() { + *x = MsgActivateResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_svip_v1_tx_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgActivateResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgActivateResponse) ProtoMessage() {} + +// Deprecated: Use MsgActivateResponse.ProtoReflect.Descriptor instead. +func (*MsgActivateResponse) Descriptor() ([]byte, []int) { + return file_cosmos_svip_v1_tx_proto_rawDescGZIP(), []int{3} +} + +// MsgReactivate restarts the decay curve with a fresh pool snapshot. +// Governance-only. Used after pool exhaustion and refund. +type MsgReactivate struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // authority is the address of the governance account. + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` +} + +func (x *MsgReactivate) Reset() { + *x = MsgReactivate{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_svip_v1_tx_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgReactivate) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgReactivate) ProtoMessage() {} + +// Deprecated: Use MsgReactivate.ProtoReflect.Descriptor instead. +func (*MsgReactivate) Descriptor() ([]byte, []int) { + return file_cosmos_svip_v1_tx_proto_rawDescGZIP(), []int{4} +} + +func (x *MsgReactivate) GetAuthority() string { + if x != nil { + return x.Authority + } + return "" +} + +// MsgReactivateResponse defines the response for MsgReactivate. +type MsgReactivateResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *MsgReactivateResponse) Reset() { + *x = MsgReactivateResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_svip_v1_tx_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgReactivateResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgReactivateResponse) ProtoMessage() {} + +// Deprecated: Use MsgReactivateResponse.ProtoReflect.Descriptor instead. +func (*MsgReactivateResponse) Descriptor() ([]byte, []int) { + return file_cosmos_svip_v1_tx_proto_rawDescGZIP(), []int{5} +} + +// MsgPause toggles the SVIP emergency pause flag. Governance-only. +type MsgPause struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // authority is the address of the governance account. + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // paused is the desired pause state. + Paused bool `protobuf:"varint,2,opt,name=paused,proto3" json:"paused,omitempty"` +} + +func (x *MsgPause) Reset() { + *x = MsgPause{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_svip_v1_tx_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgPause) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgPause) ProtoMessage() {} + +// Deprecated: Use MsgPause.ProtoReflect.Descriptor instead. +func (*MsgPause) Descriptor() ([]byte, []int) { + return file_cosmos_svip_v1_tx_proto_rawDescGZIP(), []int{6} +} + +func (x *MsgPause) GetAuthority() string { + if x != nil { + return x.Authority + } + return "" +} + +func (x *MsgPause) GetPaused() bool { + if x != nil { + return x.Paused + } + return false +} + +// MsgPauseResponse defines the response for MsgPause. +type MsgPauseResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *MsgPauseResponse) Reset() { + *x = MsgPauseResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_svip_v1_tx_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgPauseResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgPauseResponse) ProtoMessage() {} + +// Deprecated: Use MsgPauseResponse.ProtoReflect.Descriptor instead. +func (*MsgPauseResponse) Descriptor() ([]byte, []int) { + return file_cosmos_svip_v1_tx_proto_rawDescGZIP(), []int{7} +} + +// MsgFundPool sends native tokens to the SVIP reward pool. Permissionless. +type MsgFundPool struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // depositor is the address funding the pool. + Depositor string `protobuf:"bytes,1,opt,name=depositor,proto3" json:"depositor,omitempty"` + // amount is the coins to transfer. Only the native denom is accepted. + Amount []*v1beta1.Coin `protobuf:"bytes,2,rep,name=amount,proto3" json:"amount,omitempty"` +} + +func (x *MsgFundPool) Reset() { + *x = MsgFundPool{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_svip_v1_tx_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgFundPool) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgFundPool) ProtoMessage() {} + +// Deprecated: Use MsgFundPool.ProtoReflect.Descriptor instead. +func (*MsgFundPool) Descriptor() ([]byte, []int) { + return file_cosmos_svip_v1_tx_proto_rawDescGZIP(), []int{8} +} + +func (x *MsgFundPool) GetDepositor() string { + if x != nil { + return x.Depositor + } + return "" +} + +func (x *MsgFundPool) GetAmount() []*v1beta1.Coin { + if x != nil { + return x.Amount + } + return nil +} + +// MsgFundPoolResponse defines the response for MsgFundPool. +type MsgFundPoolResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *MsgFundPoolResponse) Reset() { + *x = MsgFundPoolResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_svip_v1_tx_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgFundPoolResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgFundPoolResponse) ProtoMessage() {} + +// Deprecated: Use MsgFundPoolResponse.ProtoReflect.Descriptor instead. +func (*MsgFundPoolResponse) Descriptor() ([]byte, []int) { + return file_cosmos_svip_v1_tx_proto_rawDescGZIP(), []int{9} +} + +var File_cosmos_svip_v1_tx_proto protoreflect.FileDescriptor + +var file_cosmos_svip_v1_tx_proto_rawDesc = []byte{ + 0x0a, 0x17, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x73, 0x76, 0x69, 0x70, 0x2f, 0x76, 0x31, + 0x2f, 0x74, 0x78, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x2e, 0x73, 0x76, 0x69, 0x70, 0x2e, 0x76, 0x31, 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, 0x2f, 0x73, 0x76, 0x69, 0x70, 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x76, 0x69, + 0x70, 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, 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, 0x14, 0x67, 0x6f, 0x67, + 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 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, 0x22, 0xb6, 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, + 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x76, 0x69, 0x70, 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, 0x30, 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x61, + 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x8a, 0xe7, 0xb0, 0x2a, 0x1d, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x2f, 0x78, 0x2f, 0x73, 0x76, 0x69, 0x70, 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, 0x55, 0x0a, 0x0b, 0x4d, 0x73, 0x67, 0x41, 0x63, 0x74, 0x69, + 0x76, 0x61, 0x74, 0x65, 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, 0x3a, 0x0e, 0x82, 0xe7, + 0xb0, 0x2a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x22, 0x15, 0x0a, 0x13, + 0x4d, 0x73, 0x67, 0x41, 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x57, 0x0a, 0x0d, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x61, 0x63, 0x74, 0x69, + 0x76, 0x61, 0x74, 0x65, 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, 0x3a, 0x0e, 0x82, 0xe7, + 0xb0, 0x2a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x22, 0x17, 0x0a, 0x15, + 0x4d, 0x73, 0x67, 0x52, 0x65, 0x61, 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x6a, 0x0a, 0x08, 0x4d, 0x73, 0x67, 0x50, 0x61, 0x75, 0x73, + 0x65, 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, 0x16, 0x0a, 0x06, 0x70, 0x61, 0x75, + 0x73, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x70, 0x61, 0x75, 0x73, 0x65, + 0x64, 0x3a, 0x0e, 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, + 0x79, 0x22, 0x12, 0x0a, 0x10, 0x4d, 0x73, 0x67, 0x50, 0x61, 0x75, 0x73, 0x65, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x93, 0x01, 0x0a, 0x0b, 0x4d, 0x73, 0x67, 0x46, 0x75, 0x6e, + 0x64, 0x50, 0x6f, 0x6f, 0x6c, 0x12, 0x36, 0x0a, 0x09, 0x64, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, + 0x6f, 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, 0x09, 0x64, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x12, 0x3c, 0x0a, + 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x03, 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, 0x0e, 0x82, 0xe7, 0xb0, + 0x2a, 0x09, 0x64, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x22, 0x15, 0x0a, 0x13, 0x4d, + 0x73, 0x67, 0x46, 0x75, 0x6e, 0x64, 0x50, 0x6f, 0x6f, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x32, 0x9b, 0x03, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x58, 0x0a, 0x0c, 0x55, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x1f, 0x2e, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x76, 0x69, 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x55, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x27, 0x2e, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x76, 0x69, 0x70, 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, 0x4c, 0x0a, 0x08, 0x41, 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x65, + 0x12, 0x1b, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x76, 0x69, 0x70, 0x2e, 0x76, + 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x41, 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x65, 0x1a, 0x23, 0x2e, + 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x76, 0x69, 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x4d, + 0x73, 0x67, 0x41, 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x52, 0x0a, 0x0a, 0x52, 0x65, 0x61, 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x65, + 0x12, 0x1d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x76, 0x69, 0x70, 0x2e, 0x76, + 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x61, 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x65, 0x1a, + 0x25, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x76, 0x69, 0x70, 0x2e, 0x76, 0x31, + 0x2e, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x61, 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x65, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x43, 0x0a, 0x05, 0x50, 0x61, 0x75, 0x73, 0x65, 0x12, + 0x18, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x76, 0x69, 0x70, 0x2e, 0x76, 0x31, + 0x2e, 0x4d, 0x73, 0x67, 0x50, 0x61, 0x75, 0x73, 0x65, 0x1a, 0x20, 0x2e, 0x63, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x2e, 0x73, 0x76, 0x69, 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x50, 0x61, + 0x75, 0x73, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4c, 0x0a, 0x08, 0x46, + 0x75, 0x6e, 0x64, 0x50, 0x6f, 0x6f, 0x6c, 0x12, 0x1b, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x2e, 0x73, 0x76, 0x69, 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x46, 0x75, 0x6e, 0x64, + 0x50, 0x6f, 0x6f, 0x6c, 0x1a, 0x23, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x76, + 0x69, 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x46, 0x75, 0x6e, 0x64, 0x50, 0x6f, 0x6f, + 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, + 0x42, 0x9f, 0x01, 0x0a, 0x12, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, + 0x73, 0x76, 0x69, 0x70, 0x2e, 0x76, 0x31, 0x42, 0x07, 0x54, 0x78, 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, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x73, 0x76, 0x69, 0x70, + 0x2f, 0x76, 0x31, 0x3b, 0x73, 0x76, 0x69, 0x70, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x53, 0x58, + 0xaa, 0x02, 0x0e, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x53, 0x76, 0x69, 0x70, 0x2e, 0x56, + 0x31, 0xca, 0x02, 0x0e, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x53, 0x76, 0x69, 0x70, 0x5c, + 0x56, 0x31, 0xe2, 0x02, 0x1a, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x53, 0x76, 0x69, 0x70, + 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, + 0x02, 0x10, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x53, 0x76, 0x69, 0x70, 0x3a, 0x3a, + 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_cosmos_svip_v1_tx_proto_rawDescOnce sync.Once + file_cosmos_svip_v1_tx_proto_rawDescData = file_cosmos_svip_v1_tx_proto_rawDesc +) + +func file_cosmos_svip_v1_tx_proto_rawDescGZIP() []byte { + file_cosmos_svip_v1_tx_proto_rawDescOnce.Do(func() { + file_cosmos_svip_v1_tx_proto_rawDescData = protoimpl.X.CompressGZIP(file_cosmos_svip_v1_tx_proto_rawDescData) + }) + return file_cosmos_svip_v1_tx_proto_rawDescData +} + +var file_cosmos_svip_v1_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 10) +var file_cosmos_svip_v1_tx_proto_goTypes = []interface{}{ + (*MsgUpdateParams)(nil), // 0: cosmos.svip.v1.MsgUpdateParams + (*MsgUpdateParamsResponse)(nil), // 1: cosmos.svip.v1.MsgUpdateParamsResponse + (*MsgActivate)(nil), // 2: cosmos.svip.v1.MsgActivate + (*MsgActivateResponse)(nil), // 3: cosmos.svip.v1.MsgActivateResponse + (*MsgReactivate)(nil), // 4: cosmos.svip.v1.MsgReactivate + (*MsgReactivateResponse)(nil), // 5: cosmos.svip.v1.MsgReactivateResponse + (*MsgPause)(nil), // 6: cosmos.svip.v1.MsgPause + (*MsgPauseResponse)(nil), // 7: cosmos.svip.v1.MsgPauseResponse + (*MsgFundPool)(nil), // 8: cosmos.svip.v1.MsgFundPool + (*MsgFundPoolResponse)(nil), // 9: cosmos.svip.v1.MsgFundPoolResponse + (*Params)(nil), // 10: cosmos.svip.v1.Params + (*v1beta1.Coin)(nil), // 11: cosmos.base.v1beta1.Coin +} +var file_cosmos_svip_v1_tx_proto_depIdxs = []int32{ + 10, // 0: cosmos.svip.v1.MsgUpdateParams.params:type_name -> cosmos.svip.v1.Params + 11, // 1: cosmos.svip.v1.MsgFundPool.amount:type_name -> cosmos.base.v1beta1.Coin + 0, // 2: cosmos.svip.v1.Msg.UpdateParams:input_type -> cosmos.svip.v1.MsgUpdateParams + 2, // 3: cosmos.svip.v1.Msg.Activate:input_type -> cosmos.svip.v1.MsgActivate + 4, // 4: cosmos.svip.v1.Msg.Reactivate:input_type -> cosmos.svip.v1.MsgReactivate + 6, // 5: cosmos.svip.v1.Msg.Pause:input_type -> cosmos.svip.v1.MsgPause + 8, // 6: cosmos.svip.v1.Msg.FundPool:input_type -> cosmos.svip.v1.MsgFundPool + 1, // 7: cosmos.svip.v1.Msg.UpdateParams:output_type -> cosmos.svip.v1.MsgUpdateParamsResponse + 3, // 8: cosmos.svip.v1.Msg.Activate:output_type -> cosmos.svip.v1.MsgActivateResponse + 5, // 9: cosmos.svip.v1.Msg.Reactivate:output_type -> cosmos.svip.v1.MsgReactivateResponse + 7, // 10: cosmos.svip.v1.Msg.Pause:output_type -> cosmos.svip.v1.MsgPauseResponse + 9, // 11: cosmos.svip.v1.Msg.FundPool:output_type -> cosmos.svip.v1.MsgFundPoolResponse + 7, // [7:12] is the sub-list for method output_type + 2, // [2:7] 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_cosmos_svip_v1_tx_proto_init() } +func file_cosmos_svip_v1_tx_proto_init() { + if File_cosmos_svip_v1_tx_proto != nil { + return + } + file_cosmos_svip_v1_svip_proto_init() + if !protoimpl.UnsafeEnabled { + file_cosmos_svip_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_cosmos_svip_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_cosmos_svip_v1_tx_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgActivate); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_cosmos_svip_v1_tx_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgActivateResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_cosmos_svip_v1_tx_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgReactivate); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_cosmos_svip_v1_tx_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgReactivateResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_cosmos_svip_v1_tx_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgPause); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_cosmos_svip_v1_tx_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgPauseResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_cosmos_svip_v1_tx_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgFundPool); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_cosmos_svip_v1_tx_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgFundPoolResponse); 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_cosmos_svip_v1_tx_proto_rawDesc, + NumEnums: 0, + NumMessages: 10, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_cosmos_svip_v1_tx_proto_goTypes, + DependencyIndexes: file_cosmos_svip_v1_tx_proto_depIdxs, + MessageInfos: file_cosmos_svip_v1_tx_proto_msgTypes, + }.Build() + File_cosmos_svip_v1_tx_proto = out.File + file_cosmos_svip_v1_tx_proto_rawDesc = nil + file_cosmos_svip_v1_tx_proto_goTypes = nil + file_cosmos_svip_v1_tx_proto_depIdxs = nil +} diff --git a/api/cosmos/svip/v1/tx_grpc.pb.go b/api/cosmos/svip/v1/tx_grpc.pb.go new file mode 100644 index 00000000..908b18fd --- /dev/null +++ b/api/cosmos/svip/v1/tx_grpc.pb.go @@ -0,0 +1,267 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc (unknown) +// source: cosmos/svip/v1/tx.proto + +package svipv1 + +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.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + Msg_UpdateParams_FullMethodName = "/cosmos.svip.v1.Msg/UpdateParams" + Msg_Activate_FullMethodName = "/cosmos.svip.v1.Msg/Activate" + Msg_Reactivate_FullMethodName = "/cosmos.svip.v1.Msg/Reactivate" + Msg_Pause_FullMethodName = "/cosmos.svip.v1.Msg/Pause" + Msg_FundPool_FullMethodName = "/cosmos.svip.v1.Msg/FundPool" +) + +// 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. +type MsgClient interface { + // UpdateParams updates the x/svip module parameters. Governance-only. + UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) + // Activate turns on reward distribution. Snapshots pool balance. + Activate(ctx context.Context, in *MsgActivate, opts ...grpc.CallOption) (*MsgActivateResponse, error) + // Reactivate restarts the decay curve with a fresh pool snapshot. + Reactivate(ctx context.Context, in *MsgReactivate, opts ...grpc.CallOption) (*MsgReactivateResponse, error) + // Pause toggles the emergency pause flag. Governance-only. + Pause(ctx context.Context, in *MsgPause, opts ...grpc.CallOption) (*MsgPauseResponse, error) + // FundPool transfers native tokens into the SVIP pool. Permissionless. + FundPool(ctx context.Context, in *MsgFundPool, opts ...grpc.CallOption) (*MsgFundPoolResponse, 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) { + out := new(MsgUpdateParamsResponse) + err := c.cc.Invoke(ctx, Msg_UpdateParams_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) Activate(ctx context.Context, in *MsgActivate, opts ...grpc.CallOption) (*MsgActivateResponse, error) { + out := new(MsgActivateResponse) + err := c.cc.Invoke(ctx, Msg_Activate_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) Reactivate(ctx context.Context, in *MsgReactivate, opts ...grpc.CallOption) (*MsgReactivateResponse, error) { + out := new(MsgReactivateResponse) + err := c.cc.Invoke(ctx, Msg_Reactivate_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) Pause(ctx context.Context, in *MsgPause, opts ...grpc.CallOption) (*MsgPauseResponse, error) { + out := new(MsgPauseResponse) + err := c.cc.Invoke(ctx, Msg_Pause_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) FundPool(ctx context.Context, in *MsgFundPool, opts ...grpc.CallOption) (*MsgFundPoolResponse, error) { + out := new(MsgFundPoolResponse) + err := c.cc.Invoke(ctx, Msg_FundPool_FullMethodName, in, out, opts...) + 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 +type MsgServer interface { + // UpdateParams updates the x/svip module parameters. Governance-only. + UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) + // Activate turns on reward distribution. Snapshots pool balance. + Activate(context.Context, *MsgActivate) (*MsgActivateResponse, error) + // Reactivate restarts the decay curve with a fresh pool snapshot. + Reactivate(context.Context, *MsgReactivate) (*MsgReactivateResponse, error) + // Pause toggles the emergency pause flag. Governance-only. + Pause(context.Context, *MsgPause) (*MsgPauseResponse, error) + // FundPool transfers native tokens into the SVIP pool. Permissionless. + FundPool(context.Context, *MsgFundPool) (*MsgFundPoolResponse, error) + mustEmbedUnimplementedMsgServer() +} + +// UnimplementedMsgServer must be embedded to have forward compatible implementations. +type UnimplementedMsgServer struct { +} + +func (UnimplementedMsgServer) UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") +} +func (UnimplementedMsgServer) Activate(context.Context, *MsgActivate) (*MsgActivateResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Activate not implemented") +} +func (UnimplementedMsgServer) Reactivate(context.Context, *MsgReactivate) (*MsgReactivateResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Reactivate not implemented") +} +func (UnimplementedMsgServer) Pause(context.Context, *MsgPause) (*MsgPauseResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Pause not implemented") +} +func (UnimplementedMsgServer) FundPool(context.Context, *MsgFundPool) (*MsgFundPoolResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method FundPool not implemented") +} +func (UnimplementedMsgServer) mustEmbedUnimplementedMsgServer() {} + +// 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) { + 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_Activate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgActivate) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).Activate(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Msg_Activate_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).Activate(ctx, req.(*MsgActivate)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_Reactivate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgReactivate) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).Reactivate(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Msg_Reactivate_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).Reactivate(ctx, req.(*MsgReactivate)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_Pause_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgPause) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).Pause(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Msg_Pause_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).Pause(ctx, req.(*MsgPause)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_FundPool_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgFundPool) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).FundPool(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Msg_FundPool_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).FundPool(ctx, req.(*MsgFundPool)) + } + 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: "cosmos.svip.v1.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "UpdateParams", + Handler: _Msg_UpdateParams_Handler, + }, + { + MethodName: "Activate", + Handler: _Msg_Activate_Handler, + }, + { + MethodName: "Reactivate", + Handler: _Msg_Reactivate_Handler, + }, + { + MethodName: "Pause", + Handler: _Msg_Pause_Handler, + }, + { + MethodName: "FundPool", + Handler: _Msg_FundPool_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "cosmos/svip/v1/tx.proto", +} diff --git a/contracts/hardhat.config.js b/contracts/hardhat.config.js index 88d5e90a..3f31da43 100644 --- a/contracts/hardhat.config.js +++ b/contracts/hardhat.config.js @@ -1,7 +1,48 @@ -/** @type import('hardhat/config').HardhatUserConfig */ -export default { +import hardhatToolboxViemPlugin from "@nomicfoundation/hardhat-toolbox-viem"; +import { defineConfig } from "hardhat/config"; + +const hyperlaneCompiler = { + version: "0.8.22", + settings: { + optimizer: { + enabled: true, + runs: 25000, + }, + evmVersion: "paris", + viaIR: true, + }, +}; + +const hyperlaneSources = [ + "./solidity/bridge/OfficialHypERC20Collateral.sol", + "./solidity/hyperlane/PackageVersioned.sol", + "./solidity/hyperlane/client/GasRouter.sol", + "./solidity/hyperlane/client/MailboxClient.sol", + "./solidity/hyperlane/client/Router.sol", + "./solidity/hyperlane/hooks/libs/StandardHookMetadata.sol", + "./solidity/hyperlane/interfaces/IInterchainSecurityModule.sol", + "./solidity/hyperlane/interfaces/IMailbox.sol", + "./solidity/hyperlane/interfaces/IMessageRecipient.sol", + "./solidity/hyperlane/interfaces/ITokenBridge.sol", + "./solidity/hyperlane/interfaces/hooks/IPostDispatchHook.sol", + "./solidity/hyperlane/libs/EnumerableMapExtended.sol", + "./solidity/hyperlane/libs/Message.sol", + "./solidity/hyperlane/libs/TypeCasts.sol", + "./solidity/hyperlane/token/HypERC20Collateral.sol", + "./solidity/hyperlane/token/interfaces/IWETH.sol", + "./solidity/hyperlane/token/libs/LpCollateralRouter.sol", + "./solidity/hyperlane/token/libs/MovableCollateralRouter.sol", + "./solidity/hyperlane/token/libs/Quotes.sol", + "./solidity/hyperlane/token/libs/TokenCollateral.sol", + "./solidity/hyperlane/token/libs/TokenMessage.sol", + "./solidity/hyperlane/token/libs/TokenRouter.sol", +]; + +export default defineConfig({ + plugins: [hardhatToolboxViemPlugin], solidity: { compilers: [ + hyperlaneCompiler, { version: "0.8.20", settings: { @@ -17,9 +58,12 @@ export default { version: "0.4.22", }, ], + overrides: Object.fromEntries( + hyperlaneSources.map((source) => [source, hyperlaneCompiler]), + ), }, paths: { sources: "./solidity", exclude: ["**/lib/**"] }, -}; +}); diff --git a/contracts/hyp_og_native.go b/contracts/hyp_og_native.go new file mode 100644 index 00000000..01ffd1e7 --- /dev/null +++ b/contracts/hyp_og_native.go @@ -0,0 +1,27 @@ +package contracts + +import ( + _ "embed" + + contractutils "github.com/cosmos/evm/contracts/utils" + evmtypes "github.com/cosmos/evm/x/vm/types" +) + +var ( + // HypOGNativeJSON are the compiled bytes of the HypOGNative contract. + // + //go:embed solidity/bridge/HypOGNative.json + HypOGNativeJSON []byte + + // HypOGNativeContract is the compiled HypOGNative contract. + HypOGNativeContract evmtypes.CompiledContract +) + +func init() { + var err error + if HypOGNativeContract, err = contractutils.ConvertHardhatBytesToCompiledContract( + HypOGNativeJSON, + ); err != nil { + panic(err) + } +} diff --git a/contracts/hyp_opg_collateral.go b/contracts/hyp_opg_collateral.go new file mode 100644 index 00000000..fabeb2e3 --- /dev/null +++ b/contracts/hyp_opg_collateral.go @@ -0,0 +1,27 @@ +package contracts + +import ( + _ "embed" + + contractutils "github.com/cosmos/evm/contracts/utils" + evmtypes "github.com/cosmos/evm/x/vm/types" +) + +var ( + // HypOPGCollateralJSON are the compiled bytes of the HypOPGCollateral contract. + // + //go:embed solidity/bridge/HypOPGCollateral.json + HypOPGCollateralJSON []byte + + // HypOPGCollateralContract is the compiled HypOPGCollateral contract. + HypOPGCollateralContract evmtypes.CompiledContract +) + +func init() { + var err error + if HypOPGCollateralContract, err = contractutils.ConvertHardhatBytesToCompiledContract( + HypOPGCollateralJSON, + ); err != nil { + panic(err) + } +} diff --git a/contracts/mock_mailbox.go b/contracts/mock_mailbox.go new file mode 100644 index 00000000..ddf52e59 --- /dev/null +++ b/contracts/mock_mailbox.go @@ -0,0 +1,27 @@ +package contracts + +import ( + _ "embed" + + contractutils "github.com/cosmos/evm/contracts/utils" + evmtypes "github.com/cosmos/evm/x/vm/types" +) + +var ( + // MockMailboxJSON are the compiled bytes of the MockMailbox contract. + // + //go:embed solidity/bridge/MockMailbox.json + MockMailboxJSON []byte + + // MockMailboxContract is the compiled MockMailbox contract. + MockMailboxContract evmtypes.CompiledContract +) + +func init() { + var err error + if MockMailboxContract, err = contractutils.ConvertHardhatBytesToCompiledContract( + MockMailboxJSON, + ); err != nil { + panic(err) + } +} diff --git a/contracts/package-lock.json b/contracts/package-lock.json index 325711df..3f897545 100644 --- a/contracts/package-lock.json +++ b/contracts/package-lock.json @@ -12,8 +12,12 @@ "@account-abstraction/contracts": "^0.6.0" }, "devDependencies": { - "@openzeppelin/contracts": "^5.4.0", - "hardhat": "^3.0.15" + "@hyperlane-xyz/core": "^11.1.0", + "@nomicfoundation/hardhat-toolbox-viem": "^5.0.3", + "@openzeppelin/contracts": "4.9.6", + "@openzeppelin/contracts-upgradeable": "^4.9.6", + "hardhat": "^3.0.15", + "viem": "^2.47.6" } }, "node_modules/@account-abstraction/contracts": { @@ -22,6 +26,57 @@ "integrity": "sha512-8ooRJuR7XzohMDM4MV34I12Ci2bmxfE9+cixakRL7lA4BAwJKQ3ahvd8FbJa9kiwkUPCUNtj+/zxDQWYYalLMQ==", "license": "MIT" }, + "node_modules/@actions/core": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.11.1.tgz", + "integrity": "sha512-hXJCSrkwfA46Vd9Z3q4cpEpHB1rL5NG04+/rbqW9d3+CSvtB1tYe8UTpAlixa1vj0m/ULglfEK2UKxMGxCxv5A==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@actions/exec": "^1.1.1", + "@actions/http-client": "^2.0.1" + } + }, + "node_modules/@actions/exec": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@actions/exec/-/exec-1.1.1.tgz", + "integrity": "sha512-+sCcHHbVdk93a0XT19ECtO/gIXoxvdsgQLzb2fE2/5sIZmWQuluYyjPQtrtTHdU1YzTZ7bAPN4sITq2xi1679w==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@actions/io": "^1.0.1" + } + }, + "node_modules/@actions/http-client": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.2.3.tgz", + "integrity": "sha512-mx8hyJi/hjFvbPokCg4uRd4ZX78t+YyRPtnKWwIl+RzNaVuFpQHfmlGVfsKEJN8LwTCvL+DfVgAM04XaHkm6bA==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "tunnel": "^0.0.6", + "undici": "^5.25.4" + } + }, + "node_modules/@actions/io": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/@actions/io/-/io-1.1.3.tgz", + "integrity": "sha512-wi9JjgKLYS7U/z8PPbco+PvTb/nRWjeoFlJ1Qer83k/3C5PHQi28hiVdeE2kHXmIL99mQFawx8qt/JPjZilJ8Q==", + "dev": true, + "license": "MIT", + "peer": true + }, + "node_modules/@adraffy/ens-normalize": { + "version": "1.10.1", + "resolved": "https://registry.npmjs.org/@adraffy/ens-normalize/-/ens-normalize-1.10.1.tgz", + "integrity": "sha512-96Z2IP3mYmF1Xg2cDm8f1gWGf/HUVedQ3FMifV4kG/PQ4yEP51xDtRAEfhVNt5f/uzpNkZHwWQuUcu6D6K+Ekw==", + "dev": true, + "license": "MIT", + "peer": true + }, "node_modules/@esbuild/aix-ppc64": { "version": "0.25.12", "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.25.12.tgz", @@ -464,6 +519,618 @@ "node": ">=18" } }, + "node_modules/@ethersproject/abi": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@ethersproject/abi/-/abi-5.8.0.tgz", + "integrity": "sha512-b9YS/43ObplgyV6SlyQsG53/vkSal0MNA1fskSC4mbnCMi8R+NkcH8K9FPYNESf6jUefBUniE4SOKms0E/KK1Q==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", + "peer": true, + "dependencies": { + "@ethersproject/address": "^5.8.0", + "@ethersproject/bignumber": "^5.8.0", + "@ethersproject/bytes": "^5.8.0", + "@ethersproject/constants": "^5.8.0", + "@ethersproject/hash": "^5.8.0", + "@ethersproject/keccak256": "^5.8.0", + "@ethersproject/logger": "^5.8.0", + "@ethersproject/properties": "^5.8.0", + "@ethersproject/strings": "^5.8.0" + } + }, + "node_modules/@ethersproject/abstract-provider": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@ethersproject/abstract-provider/-/abstract-provider-5.8.0.tgz", + "integrity": "sha512-wC9SFcmh4UK0oKuLJQItoQdzS/qZ51EJegK6EmAWlh+OptpQ/npECOR3QqECd8iGHC0RJb4WKbVdSfif4ammrg==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", + "peer": true, + "dependencies": { + "@ethersproject/bignumber": "^5.8.0", + "@ethersproject/bytes": "^5.8.0", + "@ethersproject/logger": "^5.8.0", + "@ethersproject/networks": "^5.8.0", + "@ethersproject/properties": "^5.8.0", + "@ethersproject/transactions": "^5.8.0", + "@ethersproject/web": "^5.8.0" + } + }, + "node_modules/@ethersproject/abstract-signer": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@ethersproject/abstract-signer/-/abstract-signer-5.8.0.tgz", + "integrity": "sha512-N0XhZTswXcmIZQdYtUnd79VJzvEwXQw6PK0dTl9VoYrEBxxCPXqS0Eod7q5TNKRxe1/5WUMuR0u0nqTF/avdCA==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", + "peer": true, + "dependencies": { + "@ethersproject/abstract-provider": "^5.8.0", + "@ethersproject/bignumber": "^5.8.0", + "@ethersproject/bytes": "^5.8.0", + "@ethersproject/logger": "^5.8.0", + "@ethersproject/properties": "^5.8.0" + } + }, + "node_modules/@ethersproject/address": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@ethersproject/address/-/address-5.8.0.tgz", + "integrity": "sha512-GhH/abcC46LJwshoN+uBNoKVFPxUuZm6dA257z0vZkKmU1+t8xTn8oK7B9qrj8W2rFRMch4gbJl6PmVxjxBEBA==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", + "peer": true, + "dependencies": { + "@ethersproject/bignumber": "^5.8.0", + "@ethersproject/bytes": "^5.8.0", + "@ethersproject/keccak256": "^5.8.0", + "@ethersproject/logger": "^5.8.0", + "@ethersproject/rlp": "^5.8.0" + } + }, + "node_modules/@ethersproject/base64": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@ethersproject/base64/-/base64-5.8.0.tgz", + "integrity": "sha512-lN0oIwfkYj9LbPx4xEkie6rAMJtySbpOAFXSDVQaBnAzYfB4X2Qr+FXJGxMoc3Bxp2Sm8OwvzMrywxyw0gLjIQ==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", + "peer": true, + "dependencies": { + "@ethersproject/bytes": "^5.8.0" + } + }, + "node_modules/@ethersproject/basex": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@ethersproject/basex/-/basex-5.8.0.tgz", + "integrity": "sha512-PIgTszMlDRmNwW9nhS6iqtVfdTAKosA7llYXNmGPw4YAI1PUyMv28988wAb41/gHF/WqGdoLv0erHaRcHRKW2Q==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", + "peer": true, + "dependencies": { + "@ethersproject/bytes": "^5.8.0", + "@ethersproject/properties": "^5.8.0" + } + }, + "node_modules/@ethersproject/bignumber": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@ethersproject/bignumber/-/bignumber-5.8.0.tgz", + "integrity": "sha512-ZyaT24bHaSeJon2tGPKIiHszWjD/54Sz8t57Toch475lCLljC6MgPmxk7Gtzz+ddNN5LuHea9qhAe0x3D+uYPA==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", + "peer": true, + "dependencies": { + "@ethersproject/bytes": "^5.8.0", + "@ethersproject/logger": "^5.8.0", + "bn.js": "^5.2.1" + } + }, + "node_modules/@ethersproject/bytes": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@ethersproject/bytes/-/bytes-5.8.0.tgz", + "integrity": "sha512-vTkeohgJVCPVHu5c25XWaWQOZ4v+DkGoC42/TS2ond+PARCxTJvgTFUNDZovyQ/uAQ4EcpqqowKydcdmRKjg7A==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", + "peer": true, + "dependencies": { + "@ethersproject/logger": "^5.8.0" + } + }, + "node_modules/@ethersproject/constants": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@ethersproject/constants/-/constants-5.8.0.tgz", + "integrity": "sha512-wigX4lrf5Vu+axVTIvNsuL6YrV4O5AXl5ubcURKMEME5TnWBouUh0CDTWxZ2GpnRn1kcCgE7l8O5+VbV9QTTcg==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", + "peer": true, + "dependencies": { + "@ethersproject/bignumber": "^5.8.0" + } + }, + "node_modules/@ethersproject/hash": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@ethersproject/hash/-/hash-5.8.0.tgz", + "integrity": "sha512-ac/lBcTbEWW/VGJij0CNSw/wPcw9bSRgCB0AIBz8CvED/jfvDoV9hsIIiWfvWmFEi8RcXtlNwp2jv6ozWOsooA==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", + "peer": true, + "dependencies": { + "@ethersproject/abstract-signer": "^5.8.0", + "@ethersproject/address": "^5.8.0", + "@ethersproject/base64": "^5.8.0", + "@ethersproject/bignumber": "^5.8.0", + "@ethersproject/bytes": "^5.8.0", + "@ethersproject/keccak256": "^5.8.0", + "@ethersproject/logger": "^5.8.0", + "@ethersproject/properties": "^5.8.0", + "@ethersproject/strings": "^5.8.0" + } + }, + "node_modules/@ethersproject/keccak256": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@ethersproject/keccak256/-/keccak256-5.8.0.tgz", + "integrity": "sha512-A1pkKLZSz8pDaQ1ftutZoaN46I6+jvuqugx5KYNeQOPqq+JZ0Txm7dlWesCHB5cndJSu5vP2VKptKf7cksERng==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", + "peer": true, + "dependencies": { + "@ethersproject/bytes": "^5.8.0", + "js-sha3": "0.8.0" + } + }, + "node_modules/@ethersproject/logger": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@ethersproject/logger/-/logger-5.8.0.tgz", + "integrity": "sha512-Qe6knGmY+zPPWTC+wQrpitodgBfH7XoceCGL5bJVejmH+yCS3R8jJm8iiWuvWbG76RUmyEG53oqv6GMVWqunjA==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", + "peer": true + }, + "node_modules/@ethersproject/networks": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@ethersproject/networks/-/networks-5.8.0.tgz", + "integrity": "sha512-egPJh3aPVAzbHwq8DD7Po53J4OUSsA1MjQp8Vf/OZPav5rlmWUaFLiq8cvQiGK0Z5K6LYzm29+VA/p4RL1FzNg==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", + "peer": true, + "dependencies": { + "@ethersproject/logger": "^5.8.0" + } + }, + "node_modules/@ethersproject/properties": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@ethersproject/properties/-/properties-5.8.0.tgz", + "integrity": "sha512-PYuiEoQ+FMaZZNGrStmN7+lWjlsoufGIHdww7454FIaGdbe/p5rnaCXTr5MtBYl3NkeoVhHZuyzChPeGeKIpQw==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", + "peer": true, + "dependencies": { + "@ethersproject/logger": "^5.8.0" + } + }, + "node_modules/@ethersproject/providers": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@ethersproject/providers/-/providers-5.8.0.tgz", + "integrity": "sha512-3Il3oTzEx3o6kzcg9ZzbE+oCZYyY+3Zh83sKkn4s1DZfTUjIegHnN2Cm0kbn9YFy45FDVcuCLLONhU7ny0SsCw==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", + "peer": true, + "dependencies": { + "@ethersproject/abstract-provider": "^5.8.0", + "@ethersproject/abstract-signer": "^5.8.0", + "@ethersproject/address": "^5.8.0", + "@ethersproject/base64": "^5.8.0", + "@ethersproject/basex": "^5.8.0", + "@ethersproject/bignumber": "^5.8.0", + "@ethersproject/bytes": "^5.8.0", + "@ethersproject/constants": "^5.8.0", + "@ethersproject/hash": "^5.8.0", + "@ethersproject/logger": "^5.8.0", + "@ethersproject/networks": "^5.8.0", + "@ethersproject/properties": "^5.8.0", + "@ethersproject/random": "^5.8.0", + "@ethersproject/rlp": "^5.8.0", + "@ethersproject/sha2": "^5.8.0", + "@ethersproject/strings": "^5.8.0", + "@ethersproject/transactions": "^5.8.0", + "@ethersproject/web": "^5.8.0", + "bech32": "1.1.4", + "ws": "8.18.0" + } + }, + "node_modules/@ethersproject/providers/node_modules/ws": { + "version": "8.18.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.0.tgz", + "integrity": "sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/@ethersproject/random": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@ethersproject/random/-/random-5.8.0.tgz", + "integrity": "sha512-E4I5TDl7SVqyg4/kkA/qTfuLWAQGXmSOgYyO01So8hLfwgKvYK5snIlzxJMk72IFdG/7oh8yuSqY2KX7MMwg+A==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", + "peer": true, + "dependencies": { + "@ethersproject/bytes": "^5.8.0", + "@ethersproject/logger": "^5.8.0" + } + }, + "node_modules/@ethersproject/rlp": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@ethersproject/rlp/-/rlp-5.8.0.tgz", + "integrity": "sha512-LqZgAznqDbiEunaUvykH2JAoXTT9NV0Atqk8rQN9nx9SEgThA/WMx5DnW8a9FOufo//6FZOCHZ+XiClzgbqV9Q==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", + "peer": true, + "dependencies": { + "@ethersproject/bytes": "^5.8.0", + "@ethersproject/logger": "^5.8.0" + } + }, + "node_modules/@ethersproject/sha2": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@ethersproject/sha2/-/sha2-5.8.0.tgz", + "integrity": "sha512-dDOUrXr9wF/YFltgTBYS0tKslPEKr6AekjqDW2dbn1L1xmjGR+9GiKu4ajxovnrDbwxAKdHjW8jNcwfz8PAz4A==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", + "peer": true, + "dependencies": { + "@ethersproject/bytes": "^5.8.0", + "@ethersproject/logger": "^5.8.0", + "hash.js": "1.1.7" + } + }, + "node_modules/@ethersproject/signing-key": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@ethersproject/signing-key/-/signing-key-5.8.0.tgz", + "integrity": "sha512-LrPW2ZxoigFi6U6aVkFN/fa9Yx/+4AtIUe4/HACTvKJdhm0eeb107EVCIQcrLZkxaSIgc/eCrX8Q1GtbH+9n3w==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", + "peer": true, + "dependencies": { + "@ethersproject/bytes": "^5.8.0", + "@ethersproject/logger": "^5.8.0", + "@ethersproject/properties": "^5.8.0", + "bn.js": "^5.2.1", + "elliptic": "6.6.1", + "hash.js": "1.1.7" + } + }, + "node_modules/@ethersproject/strings": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@ethersproject/strings/-/strings-5.8.0.tgz", + "integrity": "sha512-qWEAk0MAvl0LszjdfnZ2uC8xbR2wdv4cDabyHiBh3Cldq/T8dPH3V4BbBsAYJUeonwD+8afVXld274Ls+Y1xXg==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", + "peer": true, + "dependencies": { + "@ethersproject/bytes": "^5.8.0", + "@ethersproject/constants": "^5.8.0", + "@ethersproject/logger": "^5.8.0" + } + }, + "node_modules/@ethersproject/transactions": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@ethersproject/transactions/-/transactions-5.8.0.tgz", + "integrity": "sha512-UglxSDjByHG0TuU17bDfCemZ3AnKO2vYrL5/2n2oXvKzvb7Cz+W9gOWXKARjp2URVwcWlQlPOEQyAviKwT4AHg==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", + "peer": true, + "dependencies": { + "@ethersproject/address": "^5.8.0", + "@ethersproject/bignumber": "^5.8.0", + "@ethersproject/bytes": "^5.8.0", + "@ethersproject/constants": "^5.8.0", + "@ethersproject/keccak256": "^5.8.0", + "@ethersproject/logger": "^5.8.0", + "@ethersproject/properties": "^5.8.0", + "@ethersproject/rlp": "^5.8.0", + "@ethersproject/signing-key": "^5.8.0" + } + }, + "node_modules/@ethersproject/web": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@ethersproject/web/-/web-5.8.0.tgz", + "integrity": "sha512-j7+Ksi/9KfGviws6Qtf9Q7KCqRhpwrYKQPs+JBA/rKVFF/yaWLHJEH3zfVP2plVu+eys0d2DlFmhoQJayFewcw==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", + "peer": true, + "dependencies": { + "@ethersproject/base64": "^5.8.0", + "@ethersproject/bytes": "^5.8.0", + "@ethersproject/logger": "^5.8.0", + "@ethersproject/properties": "^5.8.0", + "@ethersproject/strings": "^5.8.0" + } + }, + "node_modules/@fastify/busboy": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@fastify/busboy/-/busboy-2.1.1.tgz", + "integrity": "sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">=14" + } + }, + "node_modules/@hyperlane-xyz/core": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/@hyperlane-xyz/core/-/core-11.1.0.tgz", + "integrity": "sha512-hPu/Ggi32nlhefT4G237so0vKmlSUGIPYY+Gx3I9RdC5ei5dV1zdZNyO5mNozXvY4kecwRSRJ4Qr7QOlz6VEjQ==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=16" + }, + "peerDependencies": { + "@ethersproject/abi": "*", + "@ethersproject/providers": "*", + "@types/sinon-chai": "*" + } + }, + "node_modules/@jest/schemas": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-29.6.3.tgz", + "integrity": "sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@sinclair/typebox": "^0.27.8" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@noble/ciphers": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@noble/ciphers/-/ciphers-1.2.1.tgz", + "integrity": "sha512-rONPWMC7PeExE077uLE4oqWrZ1IvAfz3oH9LibVAcVCopJiA9R62uavnbEzdkVmJYI6M6Zgkbeb07+tWjlq2XA==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, "node_modules/@noble/curves": { "version": "1.4.2", "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.4.2.tgz", @@ -477,7 +1144,7 @@ "url": "https://paulmillr.com/funding/" } }, - "node_modules/@noble/hashes": { + "node_modules/@noble/curves/node_modules/@noble/hashes": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.4.0.tgz", "integrity": "sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg==", @@ -490,29 +1157,43 @@ "url": "https://paulmillr.com/funding/" } }, + "node_modules/@noble/hashes": { + "version": "1.7.1", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.7.1.tgz", + "integrity": "sha512-B8XBPsn4vT/KJAGqDzbwztd+6Yte3P4V7iafm24bxgDe/mlRuK6xmWPuCNrKt2vDafZ8MfJLlchDG/vYafQEjQ==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, "node_modules/@nomicfoundation/edr": { - "version": "0.12.0-next.14", - "resolved": "https://registry.npmjs.org/@nomicfoundation/edr/-/edr-0.12.0-next.14.tgz", - "integrity": "sha512-MGHY2x7JaNdkqlQxFBYoM7Miw2EqsQrI3ReVZMwLP5mULSRTAOnt3hCw6cnjXxGi991HnejNAedJofke6OdqqA==", + "version": "0.12.0-next.28", + "resolved": "https://registry.npmjs.org/@nomicfoundation/edr/-/edr-0.12.0-next.28.tgz", + "integrity": "sha512-DOW5VFGIZWpuB6Llx+5ewn9HingN7uV/6nI3ecB3pZ4qc5OnwxnfG/KatYS6Fq3J55SuWMSxgDMHHA0kAVTFHQ==", "dev": true, "license": "MIT", "dependencies": { - "@nomicfoundation/edr-darwin-arm64": "0.12.0-next.14", - "@nomicfoundation/edr-darwin-x64": "0.12.0-next.14", - "@nomicfoundation/edr-linux-arm64-gnu": "0.12.0-next.14", - "@nomicfoundation/edr-linux-arm64-musl": "0.12.0-next.14", - "@nomicfoundation/edr-linux-x64-gnu": "0.12.0-next.14", - "@nomicfoundation/edr-linux-x64-musl": "0.12.0-next.14", - "@nomicfoundation/edr-win32-x64-msvc": "0.12.0-next.14" + "@nomicfoundation/edr-darwin-arm64": "0.12.0-next.28", + "@nomicfoundation/edr-darwin-x64": "0.12.0-next.28", + "@nomicfoundation/edr-linux-arm64-gnu": "0.12.0-next.28", + "@nomicfoundation/edr-linux-arm64-musl": "0.12.0-next.28", + "@nomicfoundation/edr-linux-x64-gnu": "0.12.0-next.28", + "@nomicfoundation/edr-linux-x64-musl": "0.12.0-next.28", + "@nomicfoundation/edr-win32-x64-msvc": "0.12.0-next.28" }, "engines": { "node": ">= 20" } }, "node_modules/@nomicfoundation/edr-darwin-arm64": { - "version": "0.12.0-next.14", - "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-darwin-arm64/-/edr-darwin-arm64-0.12.0-next.14.tgz", - "integrity": "sha512-sl0DibKSUOS7JXhUtaQ6FJUY+nk+uq5gx+Fyd9iiqs8awZPNn6KSuvV1EbWCi+yd3mrxgZ/wO8E77C1Dxj4xQA==", + "version": "0.12.0-next.28", + "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-darwin-arm64/-/edr-darwin-arm64-0.12.0-next.28.tgz", + "integrity": "sha512-fJsQ8enlgp4Sky98jHcAFXXmb3EYNoYlwtGlmfoYjDsIeL74a2lozNzyo55CtduHD/sugffjtyF0nDyxZEdwMg==", "dev": true, "license": "MIT", "engines": { @@ -520,9 +1201,9 @@ } }, "node_modules/@nomicfoundation/edr-darwin-x64": { - "version": "0.12.0-next.14", - "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-darwin-x64/-/edr-darwin-x64-0.12.0-next.14.tgz", - "integrity": "sha512-lfmatc1MSOaw0rDFB+ynnAGz5TWm3hSeY/+zDpPZghMODZelXm4JCqF41CQ6paLsW3X/pXcHM1HUGCUBWeoI/A==", + "version": "0.12.0-next.28", + "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-darwin-x64/-/edr-darwin-x64-0.12.0-next.28.tgz", + "integrity": "sha512-QST3PPJPejfRJhxThR5CoCxQAfIty0n8k40JtI+wLwKGCDT86JRKkJ3AaXPM1a72nUqMYoQK+gzQyA11zZGd4Q==", "dev": true, "license": "MIT", "engines": { @@ -530,9 +1211,9 @@ } }, "node_modules/@nomicfoundation/edr-linux-arm64-gnu": { - "version": "0.12.0-next.14", - "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-linux-arm64-gnu/-/edr-linux-arm64-gnu-0.12.0-next.14.tgz", - "integrity": "sha512-sWun3PhVgat8d4lg1d5MAXSIsFlSMBzvrpMSDFNOU9hPJEclSHbHBMRcarQuGqwm/5ZBzTwCS25u78A+UATTrg==", + "version": "0.12.0-next.28", + "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-linux-arm64-gnu/-/edr-linux-arm64-gnu-0.12.0-next.28.tgz", + "integrity": "sha512-sj4p6jeQfkiePxn1goZFZzz7V0SVFfZDH6ngPileQcAoFBWHKqi17UOG4IZ4NFpjYmDCcdrUWDNRbxC7OhgEqQ==", "dev": true, "license": "MIT", "engines": { @@ -540,9 +1221,9 @@ } }, "node_modules/@nomicfoundation/edr-linux-arm64-musl": { - "version": "0.12.0-next.14", - "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-linux-arm64-musl/-/edr-linux-arm64-musl-0.12.0-next.14.tgz", - "integrity": "sha512-omWKioD8fFp7ayCeSDu2CqvG78+oYw8zdVECDwZVmE0jpszRCsTufNYflWRQnlGqH6GqjEUwq2c3yLxFgOTjFg==", + "version": "0.12.0-next.28", + "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-linux-arm64-musl/-/edr-linux-arm64-musl-0.12.0-next.28.tgz", + "integrity": "sha512-d0hV02jMTozPEqRF3PO65Xi6/RqN5EywU5KaiDMcO+8b0nk+pJZ6VdcugRgv3lMMJbM/sP3LDFQn2eoOhalp7w==", "dev": true, "license": "MIT", "engines": { @@ -550,9 +1231,9 @@ } }, "node_modules/@nomicfoundation/edr-linux-x64-gnu": { - "version": "0.12.0-next.14", - "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-linux-x64-gnu/-/edr-linux-x64-gnu-0.12.0-next.14.tgz", - "integrity": "sha512-vk0s4SaC7s1wa98W24a4zqunTK/yIcSEnsSLRM/Nl+JJs6iqS8tvmnh/BbFINORMBJ065OWc10qw2Lsbu/rxtg==", + "version": "0.12.0-next.28", + "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-linux-x64-gnu/-/edr-linux-x64-gnu-0.12.0-next.28.tgz", + "integrity": "sha512-x3z4xbmCtSyZZg9MOhHcw1DOscngj50KK+6ZG0HKkGEbZ7WvDB9BnmRFEWo1rvIM+gqIcZvUBJbpLIdkA/BQYw==", "dev": true, "license": "MIT", "engines": { @@ -560,9 +1241,9 @@ } }, "node_modules/@nomicfoundation/edr-linux-x64-musl": { - "version": "0.12.0-next.14", - "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-linux-x64-musl/-/edr-linux-x64-musl-0.12.0-next.14.tgz", - "integrity": "sha512-/xKQD6c2RXQBIb30iTeh/NrMdYvHs6Nd+2UXS6wxlfX7GzRPOkpVDiDGD7Sda82JI459KH67dADOD6CpX8cpHQ==", + "version": "0.12.0-next.28", + "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-linux-x64-musl/-/edr-linux-x64-musl-0.12.0-next.28.tgz", + "integrity": "sha512-CKGcvP7enTo7gTXVxQiR8txPDOTNqS+wPLPkKXFzQBuVJ0FDj8eKIMRlZaw3Wbcd8QObaAKmKH7KzHVO5zzXmQ==", "dev": true, "license": "MIT", "engines": { @@ -570,9 +1251,9 @@ } }, "node_modules/@nomicfoundation/edr-win32-x64-msvc": { - "version": "0.12.0-next.14", - "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-win32-x64-msvc/-/edr-win32-x64-msvc-0.12.0-next.14.tgz", - "integrity": "sha512-GZcyGdOoLWnUtfPU+6B1vUi4fwf3bouSRf3xuKFHz3p/WNhpDK+8Esq3UmOmYAZWRgFT0ZR6XUk9H2owGDTVvQ==", + "version": "0.12.0-next.28", + "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-win32-x64-msvc/-/edr-win32-x64-msvc-0.12.0-next.28.tgz", + "integrity": "sha512-QAzb9dZGwOU7Ee2N96dvdSLiUMmjlPVxgLqTKsQbkibcBZ9I+Zs8TGisGUZsDccrbUcR4wDv8S9tD1EM9fEs/g==", "dev": true, "license": "MIT", "engines": { @@ -580,57 +1261,310 @@ } }, "node_modules/@nomicfoundation/hardhat-errors": { - "version": "3.0.5", - "resolved": "https://registry.npmjs.org/@nomicfoundation/hardhat-errors/-/hardhat-errors-3.0.5.tgz", - "integrity": "sha512-8Ayqf6hFM1glmrSxrXgX6n2pn5uTlHNxEB8N5Me0DOeOGB67PRIrQdiO+RzUhrNW5YgWUNWBevOLQbW06uQ79g==", + "version": "3.0.9", + "resolved": "https://registry.npmjs.org/@nomicfoundation/hardhat-errors/-/hardhat-errors-3.0.9.tgz", + "integrity": "sha512-qwKMpPsTI0q2Q5w3SKh231WZZPyCHjUvlbUivAn8zNeQ7ko59nBqWoiwMNRuq4F0zVaO1XZ3863R8HwyNd/n0A==", "dev": true, "license": "MIT", "dependencies": { - "@nomicfoundation/hardhat-utils": "^3.0.1" + "@nomicfoundation/hardhat-utils": "^4.0.1" } }, - "node_modules/@nomicfoundation/hardhat-utils": { - "version": "3.0.5", - "resolved": "https://registry.npmjs.org/@nomicfoundation/hardhat-utils/-/hardhat-utils-3.0.5.tgz", - "integrity": "sha512-5zkQSuSxkwK7fQxKswJ1GGc/3AuWBSmxA7GhczTPLx28dAXQnubRU8nA48SkCkKesJq5x4TROP+XheSE2VkLUA==", + "node_modules/@nomicfoundation/hardhat-ignition": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@nomicfoundation/hardhat-ignition/-/hardhat-ignition-3.1.0.tgz", + "integrity": "sha512-ENZcVz/L5cpxhtJhglN3nY9gYeMex9aJddOsMpcD+6xQqSwFcEslgJjXXCVJsjhtzDJC2UGBJT2DbpYWV1jILA==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { - "@streamparser/json-node": "^0.0.22", + "@nomicfoundation/hardhat-errors": "^3.0.9", + "@nomicfoundation/hardhat-utils": "^4.0.0", + "@nomicfoundation/ignition-core": "^3.1.0", + "@nomicfoundation/ignition-ui": "^3.1.0", + "chalk": "^5.3.0", "debug": "^4.3.2", - "env-paths": "^2.2.0", - "ethereum-cryptography": "^2.2.1", - "fast-equals": "^5.0.1", - "json-stream-stringify": "^3.1.6", - "rfdc": "^1.3.1", - "undici": "^6.16.1" + "json5": "^2.2.3", + "prompts": "^2.4.2" + }, + "peerDependencies": { + "@nomicfoundation/hardhat-verify": "^3.0.0", + "hardhat": "^3.1.5" } }, - "node_modules/@nomicfoundation/hardhat-zod-utils": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/@nomicfoundation/hardhat-zod-utils/-/hardhat-zod-utils-3.0.1.tgz", - "integrity": "sha512-I6/pyYiS9p2lLkzQuedr1ScMocH+ew8l233xTi+LP92gjEiviJDxselpkzgU01MUM0t6BPpfP8yMO958LDEJVg==", + "node_modules/@nomicfoundation/hardhat-ignition-viem": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@nomicfoundation/hardhat-ignition-viem/-/hardhat-ignition-viem-3.1.0.tgz", + "integrity": "sha512-HIMQ1gY1oBiO6UNNtHUQ3HZcrchX96cwZk7YAtv694SjdWC3cQULAdhH/2pbu/8x3nKmAlx6JqEjrK7PACf2Jg==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { - "@nomicfoundation/hardhat-errors": "^3.0.0", - "@nomicfoundation/hardhat-utils": "^3.0.2" + "@nomicfoundation/hardhat-errors": "^3.0.9" }, "peerDependencies": { - "zod": "^3.23.8" + "@nomicfoundation/hardhat-ignition": "^3.0.7", + "@nomicfoundation/hardhat-verify": "^3.0.0", + "@nomicfoundation/hardhat-viem": "^3.0.4", + "@nomicfoundation/ignition-core": "^3.0.7", + "hardhat": "^3.1.5", + "viem": "^2.43.0" } }, - "node_modules/@nomicfoundation/solidity-analyzer": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/@nomicfoundation/solidity-analyzer/-/solidity-analyzer-0.1.1.tgz", - "integrity": "sha512-1LMtXj1puAxyFusBgUIy5pZk3073cNXYnXUpuNKFghHbIit/xZgbk0AokpUADbNm3gyD6bFWl3LRFh3dhVdREg==", + "node_modules/@nomicfoundation/hardhat-keystore": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/@nomicfoundation/hardhat-keystore/-/hardhat-keystore-3.0.5.tgz", + "integrity": "sha512-jxihFx7r9ekcGmxRVbeDxFJcE3P9cmOHObKxX4ORyBR4b/AKiaqKiktirvsF5MXKJSuQbbp/+wmaqfQDB3LyeA==", "dev": true, - "engines": { - "node": ">= 12" + "license": "MIT", + "peer": true, + "dependencies": { + "@noble/ciphers": "1.2.1", + "@noble/hashes": "1.7.1", + "@nomicfoundation/hardhat-errors": "^3.0.7", + "@nomicfoundation/hardhat-utils": "^4.0.0", + "@nomicfoundation/hardhat-zod-utils": "^3.0.2", + "chalk": "^5.3.0", + "debug": "^4.3.2", + "zod": "^3.23.8" }, - "optionalDependencies": { - "@nomicfoundation/solidity-analyzer-darwin-arm64": "0.1.1", - "@nomicfoundation/solidity-analyzer-darwin-x64": "0.1.1", + "peerDependencies": { + "hardhat": "^3.0.0" + } + }, + "node_modules/@nomicfoundation/hardhat-network-helpers": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@nomicfoundation/hardhat-network-helpers/-/hardhat-network-helpers-3.0.4.tgz", + "integrity": "sha512-WTNISH3/ZkcSDNp//dML18zgV4z3ooeibNcxvv4soCh0AmI8I+2kKaTlKN/Ou1mhKOdiLUbCZCbKNz9LGK3uQw==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@nomicfoundation/hardhat-errors": "^3.0.7", + "@nomicfoundation/hardhat-utils": "^4.0.0" + }, + "peerDependencies": { + "hardhat": "^3.0.0" + } + }, + "node_modules/@nomicfoundation/hardhat-node-test-reporter": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@nomicfoundation/hardhat-node-test-reporter/-/hardhat-node-test-reporter-3.0.2.tgz", + "integrity": "sha512-lbbOVOVxHY+x3olztf8m19nuxpkx/6zN8dmGlbb1CA0V3QvN8EyQWl8O6xtxmTQhLTPKUGwA2r02ikE5Qa02dw==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@actions/core": "^1.10.1", + "chalk": "^5.3.0", + "jest-diff": "^29.7.0" + } + }, + "node_modules/@nomicfoundation/hardhat-node-test-runner": { + "version": "3.0.12", + "resolved": "https://registry.npmjs.org/@nomicfoundation/hardhat-node-test-runner/-/hardhat-node-test-runner-3.0.12.tgz", + "integrity": "sha512-9l69pJmk0E3U6bwLDTZhZaQvuhrFCmusLEfNb6LEQ0f+Zfqs6kZXGQpzECqtQsx3Hr7k22o4swT6kMFaSSv16Q==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@nomicfoundation/hardhat-errors": "^3.0.9", + "@nomicfoundation/hardhat-node-test-reporter": "^3.0.2", + "@nomicfoundation/hardhat-utils": "^4.0.1", + "@nomicfoundation/hardhat-zod-utils": "^3.0.3", + "tsx": "^4.19.3", + "zod": "^3.23.8" + }, + "peerDependencies": { + "hardhat": "^3.2.0" + } + }, + "node_modules/@nomicfoundation/hardhat-toolbox-viem": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/@nomicfoundation/hardhat-toolbox-viem/-/hardhat-toolbox-viem-5.0.3.tgz", + "integrity": "sha512-YV32VGrzmVJLFddVoBQpRu4lOUVcUGt9Y6LukFFkOYVsmvjCzmse7k0z/Hw8vZhd/pnEKB5CQuXPXtfzjgnBKA==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "@nomicfoundation/hardhat-ignition": "^3.0.7", + "@nomicfoundation/hardhat-ignition-viem": "^3.0.7", + "@nomicfoundation/hardhat-keystore": "^3.0.0", + "@nomicfoundation/hardhat-network-helpers": "^3.0.0", + "@nomicfoundation/hardhat-node-test-runner": "^3.0.0", + "@nomicfoundation/hardhat-verify": "^3.0.0", + "@nomicfoundation/hardhat-viem": "^3.0.4", + "@nomicfoundation/hardhat-viem-assertions": "^3.0.5", + "@nomicfoundation/ignition-core": "^3.0.7", + "hardhat": "^3.0.0", + "viem": "^2.43.0" + } + }, + "node_modules/@nomicfoundation/hardhat-utils": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@nomicfoundation/hardhat-utils/-/hardhat-utils-4.0.1.tgz", + "integrity": "sha512-9xxD6WXLn+kopd+hmF+XYcJJ38Gm06QmZxKf/fIJzlzs9FuNI6C7Lvdd4qHv8/3ReegIbpBCrzozaL2GISmNrA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@streamparser/json-node": "^0.0.22", + "debug": "^4.3.2", + "env-paths": "^2.2.0", + "ethereum-cryptography": "^2.2.1", + "fast-equals": "^5.4.0", + "json-stream-stringify": "^3.1.6", + "rfdc": "^1.3.1", + "undici": "^6.16.1" + } + }, + "node_modules/@nomicfoundation/hardhat-utils/node_modules/undici": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/undici/-/undici-6.24.1.tgz", + "integrity": "sha512-sC+b0tB1whOCzbtlx20fx3WgCXwkW627p4EA9uM+/tNNPkSS+eSEld6pAs9nDv7WbY1UUljBMYPtu9BCOrCWKA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18.17" + } + }, + "node_modules/@nomicfoundation/hardhat-vendored": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@nomicfoundation/hardhat-vendored/-/hardhat-vendored-3.0.1.tgz", + "integrity": "sha512-jBOAqmEAMJ8zdfiQmTLV+c0IaSyySqkDSJ9spTy8Ts/m/mO8w364TClyfn+p4ZpxBjyX4LMa3NfC402hoDtwCg==", + "dev": true, + "license": "MIT" + }, + "node_modules/@nomicfoundation/hardhat-verify": { + "version": "3.0.12", + "resolved": "https://registry.npmjs.org/@nomicfoundation/hardhat-verify/-/hardhat-verify-3.0.12.tgz", + "integrity": "sha512-urgtoJdhOnL+SYVNYeoLUXhhs9ZEOa3Za4613eDaOlWn7YcrDC3bdcYkF/9oVF/9hmRN3FB4VTdtMPwPapBUhw==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@ethersproject/abi": "^5.8.0", + "@nomicfoundation/hardhat-errors": "^3.0.7", + "@nomicfoundation/hardhat-utils": "^4.0.0", + "@nomicfoundation/hardhat-zod-utils": "^3.0.3", + "cbor2": "^1.9.0", + "chalk": "^5.3.0", + "debug": "^4.3.2", + "semver": "^7.6.3", + "zod": "^3.23.8" + }, + "peerDependencies": { + "hardhat": "^3.1.11" + } + }, + "node_modules/@nomicfoundation/hardhat-viem": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@nomicfoundation/hardhat-viem/-/hardhat-viem-3.0.4.tgz", + "integrity": "sha512-zauCnEMOgy8+nijwVOAQr7piGYsWtUFb0i2snaBF4e7TJWbcXbyJL3wGBplo3h0D9UOYYmLDE7DWTxuqZjEsZA==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@nomicfoundation/hardhat-errors": "^3.0.7", + "@nomicfoundation/hardhat-utils": "^4.0.0" + }, + "peerDependencies": { + "hardhat": "^3.1.11", + "viem": "^2.43.0" + } + }, + "node_modules/@nomicfoundation/hardhat-viem-assertions": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/@nomicfoundation/hardhat-viem-assertions/-/hardhat-viem-assertions-3.0.7.tgz", + "integrity": "sha512-H5MVK5khUHNtey/T2jMIoqa1f/zoIQM+lsF7QWwdgCChuC75t81hD9qF684Y8gLNIIdB4jHXPXuvZ1AqKx9FLA==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@nomicfoundation/hardhat-errors": "^3.0.7", + "@nomicfoundation/hardhat-utils": "^4.0.0" + }, + "peerDependencies": { + "@nomicfoundation/hardhat-viem": "^3.0.4", + "hardhat": "^3.0.0", + "viem": "^2.43.0" + } + }, + "node_modules/@nomicfoundation/hardhat-zod-utils": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@nomicfoundation/hardhat-zod-utils/-/hardhat-zod-utils-3.0.3.tgz", + "integrity": "sha512-WER4/UKLpm7/nz1asvNR7EKZKKBW+48Hw7GOdcd3Rhdr3VTNuTaeIxCJpl6YxTTg+Eq/sPAWX0mr25+USs6KWw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@nomicfoundation/hardhat-errors": "^3.0.7", + "@nomicfoundation/hardhat-utils": "^4.0.0" + }, + "peerDependencies": { + "zod": "^3.23.8" + } + }, + "node_modules/@nomicfoundation/ignition-core": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@nomicfoundation/ignition-core/-/ignition-core-3.1.0.tgz", + "integrity": "sha512-RJMBTBZqiWRT6lP0sWr2QoIogS0czCioxF4wYW8Y6PowipQKg/usvfJEbzcIEkTIbqOPBZbA7WGINr8YKIoJAA==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@ethersproject/address": "5.6.1", + "@nomicfoundation/hardhat-errors": "^3.0.9", + "@nomicfoundation/hardhat-utils": "^4.0.0", + "@nomicfoundation/solidity-analyzer": "^0.1.1", + "cbor2": "^1.9.0", + "debug": "^4.3.2", + "ethers": "^6.14.0", + "immer": "10.0.2", + "lodash-es": "4.17.21", + "ndjson": "2.0.0" + } + }, + "node_modules/@nomicfoundation/ignition-core/node_modules/@ethersproject/address": { + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/address/-/address-5.6.1.tgz", + "integrity": "sha512-uOgF0kS5MJv9ZvCz7x6T2EXJSzotiybApn4XlOgoTX0xdtyVIJ7pF+6cGPxiEq/dpBiTfMiw7Yc81JcwhSYA0Q==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", + "peer": true, + "dependencies": { + "@ethersproject/bignumber": "^5.6.2", + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/keccak256": "^5.6.1", + "@ethersproject/logger": "^5.6.0", + "@ethersproject/rlp": "^5.6.1" + } + }, + "node_modules/@nomicfoundation/ignition-ui": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@nomicfoundation/ignition-ui/-/ignition-ui-3.1.0.tgz", + "integrity": "sha512-K34qH+C0IgerzzcY+OmLlXvAnpE1TGKRlDRDE0IfyhjB/ueDJj83+5+YhoPbCiwDFIl7uT7vaWopfFhkRPn9YQ==", + "dev": true, + "peer": true + }, + "node_modules/@nomicfoundation/solidity-analyzer": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/@nomicfoundation/solidity-analyzer/-/solidity-analyzer-0.1.1.tgz", + "integrity": "sha512-1LMtXj1puAxyFusBgUIy5pZk3073cNXYnXUpuNKFghHbIit/xZgbk0AokpUADbNm3gyD6bFWl3LRFh3dhVdREg==", + "dev": true, + "engines": { + "node": ">= 12" + }, + "optionalDependencies": { + "@nomicfoundation/solidity-analyzer-darwin-arm64": "0.1.1", + "@nomicfoundation/solidity-analyzer-darwin-x64": "0.1.1", "@nomicfoundation/solidity-analyzer-freebsd-x64": "0.1.1", "@nomicfoundation/solidity-analyzer-linux-arm64-gnu": "0.1.1", "@nomicfoundation/solidity-analyzer-linux-arm64-musl": "0.1.1", @@ -802,9 +1736,16 @@ } }, "node_modules/@openzeppelin/contracts": { - "version": "5.4.0", - "resolved": "https://registry.npmjs.org/@openzeppelin/contracts/-/contracts-5.4.0.tgz", - "integrity": "sha512-eCYgWnLg6WO+X52I16TZt8uEjbtdkgLC0SUX/xnAksjjrQI4Xfn4iBRoI5j55dmlOhDv1Y7BoR3cU7e3WWhC6A==", + "version": "4.9.6", + "resolved": "https://registry.npmjs.org/@openzeppelin/contracts/-/contracts-4.9.6.tgz", + "integrity": "sha512-xSmezSupL+y9VkHZJGDoCBpmnB2ogM13ccaYDWqJTfS3dbuHkgjuwDFUmaFauBCboQMGB/S5UqUl2y54X99BmA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@openzeppelin/contracts-upgradeable": { + "version": "4.9.6", + "resolved": "https://registry.npmjs.org/@openzeppelin/contracts-upgradeable/-/contracts-upgradeable-4.9.6.tgz", + "integrity": "sha512-m4iHazOsOCv1DgM7eD7GupTJ+NFVujRZt1wzddDPSVGpWdKq1SKkla5htKG7+IS4d2XOCtzkUNwRZ7Vq5aEUMA==", "dev": true, "license": "MIT" }, @@ -833,6 +1774,19 @@ "url": "https://paulmillr.com/funding/" } }, + "node_modules/@scure/bip32/node_modules/@noble/hashes": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.4.0.tgz", + "integrity": "sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, "node_modules/@scure/bip39": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.3.0.tgz", @@ -847,6 +1801,19 @@ "url": "https://paulmillr.com/funding/" } }, + "node_modules/@scure/bip39/node_modules/@noble/hashes": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.4.0.tgz", + "integrity": "sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, "node_modules/@sentry/core": { "version": "9.47.1", "resolved": "https://registry.npmjs.org/@sentry/core/-/core-9.47.1.tgz", @@ -857,6 +1824,14 @@ "node": ">=18" } }, + "node_modules/@sinclair/typebox": { + "version": "0.27.10", + "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.10.tgz", + "integrity": "sha512-MTBk/3jGLNB2tVxv6uLlFh1iu64iYOQ2PbdOSK3NW8JZsmlaOh2q6sdtKowBhfw8QFLmYNzTW4/oK4uATIi6ZA==", + "dev": true, + "license": "MIT", + "peer": true + }, "node_modules/@streamparser/json": { "version": "0.0.22", "resolved": "https://registry.npmjs.org/@streamparser/json/-/json-0.0.22.tgz", @@ -874,6 +1849,90 @@ "@streamparser/json": "^0.0.22" } }, + "node_modules/@types/chai": { + "version": "5.2.3", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-5.2.3.tgz", + "integrity": "sha512-Mw558oeA9fFbv65/y4mHtXDs9bPnFMZAL/jxdPFUpOHHIXX91mcgEHbS5Lahr+pwZFR8A7GQleRWeI6cGFC2UA==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@types/deep-eql": "*", + "assertion-error": "^2.0.1" + } + }, + "node_modules/@types/deep-eql": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@types/deep-eql/-/deep-eql-4.0.2.tgz", + "integrity": "sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw==", + "dev": true, + "license": "MIT", + "peer": true + }, + "node_modules/@types/node": { + "version": "22.7.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.7.5.tgz", + "integrity": "sha512-jML7s2NAzMWc//QSJ1a3prpk78cOPchGvXJsC3C6R6PSMoooztvRVQEz89gmBTBY1SPMaqo5teB4uNHPdetShQ==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "undici-types": "~6.19.2" + } + }, + "node_modules/@types/sinon": { + "version": "21.0.0", + "resolved": "https://registry.npmjs.org/@types/sinon/-/sinon-21.0.0.tgz", + "integrity": "sha512-+oHKZ0lTI+WVLxx1IbJDNmReQaIsQJjN2e7UUrJHEeByG7bFeKJYsv1E75JxTQ9QKJDp21bAa/0W2Xo4srsDnw==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@types/sinonjs__fake-timers": "*" + } + }, + "node_modules/@types/sinon-chai": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@types/sinon-chai/-/sinon-chai-4.0.0.tgz", + "integrity": "sha512-Uar+qk3TmeFsUWCwtqRNqNUE7vf34+MCJiQJR5M2rd4nCbhtE8RgTiHwN/mVwbfCjhmO6DiOel/MgzHkRMJJFg==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@types/chai": "*", + "@types/sinon": "*" + } + }, + "node_modules/@types/sinonjs__fake-timers": { + "version": "15.0.1", + "resolved": "https://registry.npmjs.org/@types/sinonjs__fake-timers/-/sinonjs__fake-timers-15.0.1.tgz", + "integrity": "sha512-Ko2tjWJq8oozHzHV+reuvS5KYIRAokHnGbDwGh/J64LntgpbuylF74ipEL24HCyRjf9FOlBiBHWBR1RlVKsI1w==", + "dev": true, + "license": "MIT", + "peer": true + }, + "node_modules/abitype": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/abitype/-/abitype-1.2.3.tgz", + "integrity": "sha512-Ofer5QUnuUdTFsBRwARMoWKOH1ND5ehwYhJ3OJ/BQO+StkwQjHw0XyVh4vDttzHB7QOFhPHa/o413PJ82gU/Tg==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/wevm" + }, + "peerDependencies": { + "typescript": ">=5.0.4", + "zod": "^3.22.0 || ^4.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + }, + "zod": { + "optional": true + } + } + }, "node_modules/adm-zip": { "version": "0.4.16", "resolved": "https://registry.npmjs.org/adm-zip/-/adm-zip-0.4.16.tgz", @@ -883,6 +1942,14 @@ "node": ">=0.3.0" } }, + "node_modules/aes-js": { + "version": "4.0.0-beta.5", + "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-4.0.0-beta.5.tgz", + "integrity": "sha512-G965FqalsNyrPqgEGON7nIx1e/OVENSgiEIzyC63haUMuvNnwIgIjMs52hlTCKhkBny7A2ORNlfY9Zu+jmGk1Q==", + "dev": true, + "license": "MIT", + "peer": true + }, "node_modules/ansi-colors": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.3.tgz", @@ -901,6 +1968,66 @@ "node": ">=8" } }, + "node_modules/ansi-styles": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", + "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/assertion-error": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-2.0.1.tgz", + "integrity": "sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">=12" + } + }, + "node_modules/bech32": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/bech32/-/bech32-1.1.4.tgz", + "integrity": "sha512-s0IrSOzLlbvX7yp4WBfPITzpAU8sqQcpsmwXDiKwrG4r491vwCO/XpejasRNl0piBMe/DvP4Tz0mIS/X1DPJBQ==", + "dev": true, + "license": "MIT", + "peer": true + }, + "node_modules/bn.js": { + "version": "5.2.3", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.3.tgz", + "integrity": "sha512-EAcmnPkxpntVL+DS7bO1zhcZNvCkxqtkd0ZY53h06GNQ3DEkkGZ/gKgmDv6DdZQGj9BgfSPKtJJ7Dp1GPP8f7w==", + "dev": true, + "license": "MIT", + "peer": true + }, + "node_modules/brorand": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", + "integrity": "sha512-cKV8tMCEpQs4hK/ik71d6LrPOnpkpGBR0wzxqr68g2m/LB2GxVYQroAjMJZRVM1Y4BCjCKc3vAamxSzOY2RP+w==", + "dev": true, + "license": "MIT", + "peer": true + }, + "node_modules/cbor2": { + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/cbor2/-/cbor2-1.12.0.tgz", + "integrity": "sha512-3Cco8XQhi27DogSp9Ri6LYNZLi/TBY/JVnDe+mj06NkBjW/ZYOtekaEU4wZ4xcRMNrFkDv8KNtOAqHyDfz3lYg==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">=18.7" + } + }, "node_modules/chalk": { "version": "5.6.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.6.2.tgz", @@ -930,6 +2057,28 @@ "url": "https://paulmillr.com/funding/" } }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true, + "license": "MIT", + "peer": true + }, "node_modules/debug": { "version": "4.4.3", "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", @@ -948,6 +2097,42 @@ } } }, + "node_modules/diff-sequences": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.6.3.tgz", + "integrity": "sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/elliptic": { + "version": "6.6.1", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.6.1.tgz", + "integrity": "sha512-RaddvvMatK2LJHqFJ+YA4WysVN5Ita9E35botqIYspQ4TkRAlCicdzKOjlyv/1Za5RyTNn7di//eEV0uTAfe3g==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "bn.js": "^4.11.9", + "brorand": "^1.1.0", + "hash.js": "^1.0.0", + "hmac-drbg": "^1.0.1", + "inherits": "^2.0.4", + "minimalistic-assert": "^1.0.1", + "minimalistic-crypto-utils": "^1.0.1" + } + }, + "node_modules/elliptic/node_modules/bn.js": { + "version": "4.12.3", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.3.tgz", + "integrity": "sha512-fGTi3gxV/23FTYdAoUtLYp6qySe2KE3teyZitipKNRuVYcBkoP/bB3guXN/XVKUe9mxCHXnc9C4ocyz8OmgN0g==", + "dev": true, + "license": "MIT", + "peer": true + }, "node_modules/enquirer": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.4.1.tgz", @@ -1026,24 +2211,125 @@ "@scure/bip39": "1.3.0" } }, - "node_modules/fast-equals": { - "version": "5.3.3", - "resolved": "https://registry.npmjs.org/fast-equals/-/fast-equals-5.3.3.tgz", - "integrity": "sha512-/boTcHZeIAQ2r/tL11voclBHDeP9WPxLt+tyAbVSyyXuUFyh0Tne7gJZTqGbxnvj79TjLdCXLOY7UIPhyG5MTw==", + "node_modules/ethereum-cryptography/node_modules/@noble/hashes": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.4.0.tgz", + "integrity": "sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg==", "dev": true, "license": "MIT", "engines": { - "node": ">=6.0.0" + "node": ">= 16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" } }, - "node_modules/fsevents": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", - "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "node_modules/ethers": { + "version": "6.16.0", + "resolved": "https://registry.npmjs.org/ethers/-/ethers-6.16.0.tgz", + "integrity": "sha512-U1wulmetNymijEhpSEQ7Ct/P/Jw9/e7R1j5XIbPRydgV2DjLVMsULDlNksq3RQnFgKoLlZf88ijYtWEXcPa07A==", "dev": true, - "hasInstallScript": true, + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/ethers-io/" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], "license": "MIT", - "optional": true, + "peer": true, + "dependencies": { + "@adraffy/ens-normalize": "1.10.1", + "@noble/curves": "1.2.0", + "@noble/hashes": "1.3.2", + "@types/node": "22.7.5", + "aes-js": "4.0.0-beta.5", + "tslib": "2.7.0", + "ws": "8.17.1" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/ethers/node_modules/@noble/curves": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.2.0.tgz", + "integrity": "sha512-oYclrNgRaM9SsBUBVbb8M6DTV7ZHRTKugureoYEncY5c65HOmRzvSiTE3y5CYaPYJA/GVkrhXEoF0M3Ya9PMnw==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@noble/hashes": "1.3.2" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/ethers/node_modules/@noble/hashes": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.2.tgz", + "integrity": "sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/ethers/node_modules/ws": { + "version": "8.17.1", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.17.1.tgz", + "integrity": "sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/eventemitter3": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.1.tgz", + "integrity": "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==", + "dev": true, + "license": "MIT" + }, + "node_modules/fast-equals": { + "version": "5.4.0", + "resolved": "https://registry.npmjs.org/fast-equals/-/fast-equals-5.4.0.tgz", + "integrity": "sha512-jt2DW/aNFNwke7AUd+Z+e6pz39KO5rzdbbFCg2sGafS4mk13MI7Z8O5z9cADNn5lhGODIgLwug6TZO2ctf7kcw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "optional": true, "os": [ "darwin" ], @@ -1065,16 +2351,17 @@ } }, "node_modules/hardhat": { - "version": "3.0.15", - "resolved": "https://registry.npmjs.org/hardhat/-/hardhat-3.0.15.tgz", - "integrity": "sha512-cXxaeSxFJ+u0MfbvWsS3Gdr7/uP7wjo4xviYcGdu9AKtwY6YsU+v0quK/j1NWmvO1Y4gk350SdZzQw++hJy4LA==", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/hardhat/-/hardhat-3.2.0.tgz", + "integrity": "sha512-1s5mE1OEx4ksnv+9bHRfzfWxlzI77mQ5cHbSNRxZp2DvpVOC41qSoIDfwqwvb3I2JqUVd0TBUgN/Ypco6sabkQ==", "dev": true, "license": "MIT", "dependencies": { - "@nomicfoundation/edr": "0.12.0-next.14", - "@nomicfoundation/hardhat-errors": "^3.0.4", - "@nomicfoundation/hardhat-utils": "^3.0.5", - "@nomicfoundation/hardhat-zod-utils": "^3.0.1", + "@nomicfoundation/edr": "0.12.0-next.28", + "@nomicfoundation/hardhat-errors": "^3.0.9", + "@nomicfoundation/hardhat-utils": "^4.0.1", + "@nomicfoundation/hardhat-vendored": "^3.0.1", + "@nomicfoundation/hardhat-zod-utils": "^3.0.3", "@nomicfoundation/solidity-analyzer": "^0.1.1", "@sentry/core": "^9.4.0", "adm-zip": "^0.4.16", @@ -1095,6 +2382,149 @@ "hardhat": "dist/src/cli.js" } }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/hash.js": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz", + "integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "inherits": "^2.0.3", + "minimalistic-assert": "^1.0.1" + } + }, + "node_modules/hmac-drbg": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", + "integrity": "sha512-Tti3gMqLdZfhOQY1Mzf/AanLiqh1WTiJgEj26ZuYQ9fbkLomzGchCws4FyrSd4VkpBfiNhaE1On+lOz894jvXg==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "hash.js": "^1.0.3", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.1" + } + }, + "node_modules/immer": { + "version": "10.0.2", + "resolved": "https://registry.npmjs.org/immer/-/immer-10.0.2.tgz", + "integrity": "sha512-Rx3CqeqQ19sxUtYV9CU911Vhy8/721wRFnJv3REVGWUmoAcIwzifTsdmJte/MV+0/XpM35LZdQMBGkRIoLPwQA==", + "dev": true, + "license": "MIT", + "peer": true, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/immer" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true, + "license": "ISC", + "peer": true + }, + "node_modules/isows": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/isows/-/isows-1.0.7.tgz", + "integrity": "sha512-I1fSfDCZL5P0v33sVqeTDSpcstAg/N+wF5HS033mogOVIp4B+oHC7oOCsA3axAbBSGTJ8QubbNmnIRN/h8U7hg==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/wevm" + } + ], + "license": "MIT", + "peerDependencies": { + "ws": "*" + } + }, + "node_modules/jest-diff": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-29.7.0.tgz", + "integrity": "sha512-LMIgiIrhigmPrs03JHpxUh2yISK3vLFPkAodPeo0+BuF7wA2FoQbkEg1u8gBYBThncu7e1oEDUfIXVuTqLRUjw==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "chalk": "^4.0.0", + "diff-sequences": "^29.6.3", + "jest-get-type": "^29.6.3", + "pretty-format": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-diff/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/jest-diff/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/jest-get-type": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-29.6.3.tgz", + "integrity": "sha512-zrteXnqYxfQh7l5FHyL38jL39di8H8rHoecLH3JNxH3BwOrBsNeabdap5e0I23lD4HHI8W5VFBZqG4Eaq5LNcw==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/js-sha3": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.8.0.tgz", + "integrity": "sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q==", + "dev": true, + "license": "MIT", + "peer": true + }, "node_modules/json-stream-stringify": { "version": "3.1.6", "resolved": "https://registry.npmjs.org/json-stream-stringify/-/json-stream-stringify-3.1.6.tgz", @@ -1105,6 +2535,47 @@ "node": ">=7.10.1" } }, + "node_modules/json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==", + "dev": true, + "license": "ISC", + "peer": true + }, + "node_modules/json5": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", + "dev": true, + "license": "MIT", + "peer": true, + "bin": { + "json5": "lib/cli.js" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/kleur": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz", + "integrity": "sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/lodash-es": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.17.21.tgz", + "integrity": "sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==", + "dev": true, + "license": "MIT", + "peer": true + }, "node_modules/micro-eth-signer": { "version": "0.14.0", "resolved": "https://registry.npmjs.org/micro-eth-signer/-/micro-eth-signer-0.14.0.tgz", @@ -1169,6 +2640,33 @@ "url": "https://paulmillr.com/funding/" } }, + "node_modules/minimalistic-assert": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", + "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==", + "dev": true, + "license": "ISC", + "peer": true + }, + "node_modules/minimalistic-crypto-utils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", + "integrity": "sha512-JIYlbt6g8i5jKfJ3xz7rF0LXmv2TkDxBLUkiBeZ7bAx4GnnNMr8xFpGnOxn6GhTEHx3SjRrZEoU+j04prX1ktg==", + "dev": true, + "license": "MIT", + "peer": true + }, + "node_modules/minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "dev": true, + "license": "MIT", + "peer": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/ms": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", @@ -1176,6 +2674,146 @@ "dev": true, "license": "MIT" }, + "node_modules/ndjson": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ndjson/-/ndjson-2.0.0.tgz", + "integrity": "sha512-nGl7LRGrzugTtaFcJMhLbpzJM6XdivmbkdlaGcrk/LXg2KL/YBC6z1g70xh0/al+oFuVFP8N8kiWRucmeEH/qQ==", + "dev": true, + "license": "BSD-3-Clause", + "peer": true, + "dependencies": { + "json-stringify-safe": "^5.0.1", + "minimist": "^1.2.5", + "readable-stream": "^3.6.0", + "split2": "^3.0.0", + "through2": "^4.0.0" + }, + "bin": { + "ndjson": "cli.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/ox": { + "version": "0.14.7", + "resolved": "https://registry.npmjs.org/ox/-/ox-0.14.7.tgz", + "integrity": "sha512-zSQ/cfBdolj7U4++NAvH7sI+VG0T3pEohITCgcQj8KlawvTDY4vGVhDT64Atsm0d6adWfIYHDpu88iUBMMp+AQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/wevm" + } + ], + "license": "MIT", + "dependencies": { + "@adraffy/ens-normalize": "^1.11.0", + "@noble/ciphers": "^1.3.0", + "@noble/curves": "1.9.1", + "@noble/hashes": "^1.8.0", + "@scure/bip32": "^1.7.0", + "@scure/bip39": "^1.6.0", + "abitype": "^1.2.3", + "eventemitter3": "5.0.1" + }, + "peerDependencies": { + "typescript": ">=5.4.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/ox/node_modules/@adraffy/ens-normalize": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@adraffy/ens-normalize/-/ens-normalize-1.11.1.tgz", + "integrity": "sha512-nhCBV3quEgesuf7c7KYfperqSS14T8bYuvJ8PcLJp6znkZpFc0AuW4qBtr8eKVyPPe/8RSr7sglCWPU5eaxwKQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/ox/node_modules/@noble/ciphers": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@noble/ciphers/-/ciphers-1.3.0.tgz", + "integrity": "sha512-2I0gnIVPtfnMw9ee9h1dJG7tp81+8Ob3OJb3Mv37rx5L40/b0i7djjCVvGOVqc9AEIQyvyu1i6ypKdFw8R8gQw==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/ox/node_modules/@noble/curves": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.9.1.tgz", + "integrity": "sha512-k11yZxZg+t+gWvBbIswW0yoJlu8cHOC7dhunwOzoWH/mXGBiYyR4YY6hAEK/3EUs4UpB8la1RfdRpeGsFHkWsA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@noble/hashes": "1.8.0" + }, + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/ox/node_modules/@noble/hashes": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.8.0.tgz", + "integrity": "sha512-jCs9ldd7NwzpgXDIf6P3+NrHh9/sD6CQdxHyjQI+h/6rDNo88ypBxxz45UDuZHz9r3tNz7N/VInSVoVdtXEI4A==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/ox/node_modules/@scure/base": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.2.6.tgz", + "integrity": "sha512-g/nm5FgUa//MCj1gV09zTJTaM6KBAHqLN907YVQqf7zC49+DcO4B1so4ZX07Ef10Twr6nuqYEH9GEggFXA4Fmg==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/ox/node_modules/@scure/bip32": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.7.0.tgz", + "integrity": "sha512-E4FFX/N3f4B80AKWp5dP6ow+flD1LQZo/w8UnLGYZO674jS6YnYeepycOOksv+vLPSpgN35wgKgy+ybfTb2SMw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@noble/curves": "~1.9.0", + "@noble/hashes": "~1.8.0", + "@scure/base": "~1.2.5" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/ox/node_modules/@scure/bip39": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.6.0.tgz", + "integrity": "sha512-+lF0BbLiJNwVlev4eKelw1WWLaiKXw7sSl8T6FvBlWkdX+94aGJ4o8XjUdlyhTCjd8c+B3KT3JfS8P0bLRNU6A==", + "dev": true, + "license": "MIT", + "dependencies": { + "@noble/hashes": "~1.8.0", + "@scure/base": "~1.2.5" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, "node_modules/p-map": { "version": "7.0.4", "resolved": "https://registry.npmjs.org/p-map/-/p-map-7.0.4.tgz", @@ -1189,6 +2827,61 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/pretty-format": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.7.0.tgz", + "integrity": "sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@jest/schemas": "^29.6.3", + "ansi-styles": "^5.0.0", + "react-is": "^18.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/prompts": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.4.2.tgz", + "integrity": "sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "kleur": "^3.0.3", + "sisteransi": "^1.0.5" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/react-is": { + "version": "18.3.1", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.3.1.tgz", + "integrity": "sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg==", + "dev": true, + "license": "MIT", + "peer": true + }, + "node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/readdirp": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-4.1.2.tgz", @@ -1230,6 +2923,28 @@ "dev": true, "license": "MIT" }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "peer": true + }, "node_modules/semver": { "version": "7.7.3", "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.3.tgz", @@ -1243,6 +2958,36 @@ "node": ">=10" } }, + "node_modules/sisteransi": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.5.tgz", + "integrity": "sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==", + "dev": true, + "license": "MIT", + "peer": true + }, + "node_modules/split2": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/split2/-/split2-3.2.2.tgz", + "integrity": "sha512-9NThjpgZnifTkJpzTZ7Eue85S49QwpNhZTq6GRJwObb6jnLFNGB7Qm73V5HewTROPyxD0C29xqmaI68bQtV+hg==", + "dev": true, + "license": "ISC", + "peer": true, + "dependencies": { + "readable-stream": "^3.0.0" + } + }, + "node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, "node_modules/strip-ansi": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", @@ -1255,6 +3000,39 @@ "node": ">=8" } }, + "node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/through2": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/through2/-/through2-4.0.2.tgz", + "integrity": "sha512-iOqSav00cVxEEICeD7TjLB1sueEL+81Wpzp2bY17uZjZN0pWZPuo4suZ/61VujxmqSGFfgOcNuTZ85QJwNZQpw==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "readable-stream": "3" + } + }, + "node_modules/tslib": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.7.0.tgz", + "integrity": "sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA==", + "dev": true, + "license": "0BSD", + "peer": true + }, "node_modules/tsx": { "version": "4.20.6", "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.20.6.tgz", @@ -1275,14 +3053,144 @@ "fsevents": "~2.3.3" } }, + "node_modules/tunnel": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz", + "integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">=0.6.11 <=0.7.0 || >=0.7.3" + } + }, "node_modules/undici": { - "version": "6.22.0", - "resolved": "https://registry.npmjs.org/undici/-/undici-6.22.0.tgz", - "integrity": "sha512-hU/10obOIu62MGYjdskASR3CUAiYaFTtC9Pa6vHyf//mAipSvSQg6od2CnJswq7fvzNS3zJhxoRkgNVaHurWKw==", + "version": "5.29.0", + "resolved": "https://registry.npmjs.org/undici/-/undici-5.29.0.tgz", + "integrity": "sha512-raqeBD6NQK4SkWhQzeYKd1KmIG6dllBOTt55Rmkt4HtI9mwdWtJljnrXjAFUBLTSN67HWrOIZ3EPF4kjUw80Bg==", "dev": true, "license": "MIT", + "peer": true, + "dependencies": { + "@fastify/busboy": "^2.0.0" + }, "engines": { - "node": ">=18.17" + "node": ">=14.0" + } + }, + "node_modules/undici-types": { + "version": "6.19.8", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz", + "integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==", + "dev": true, + "license": "MIT", + "peer": true + }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", + "dev": true, + "license": "MIT", + "peer": true + }, + "node_modules/viem": { + "version": "2.47.6", + "resolved": "https://registry.npmjs.org/viem/-/viem-2.47.6.tgz", + "integrity": "sha512-zExmbI99NGvMdYa7fmqSTLgkwh48dmhgEqFrUgkpL4kfG4XkVefZ8dZqIKVUhZo6Uhf0FrrEXOsHm9LUyIvI2Q==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/wevm" + } + ], + "license": "MIT", + "dependencies": { + "@noble/curves": "1.9.1", + "@noble/hashes": "1.8.0", + "@scure/bip32": "1.7.0", + "@scure/bip39": "1.6.0", + "abitype": "1.2.3", + "isows": "1.0.7", + "ox": "0.14.7", + "ws": "8.18.3" + }, + "peerDependencies": { + "typescript": ">=5.0.4" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/viem/node_modules/@noble/curves": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.9.1.tgz", + "integrity": "sha512-k11yZxZg+t+gWvBbIswW0yoJlu8cHOC7dhunwOzoWH/mXGBiYyR4YY6hAEK/3EUs4UpB8la1RfdRpeGsFHkWsA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@noble/hashes": "1.8.0" + }, + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/viem/node_modules/@noble/hashes": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.8.0.tgz", + "integrity": "sha512-jCs9ldd7NwzpgXDIf6P3+NrHh9/sD6CQdxHyjQI+h/6rDNo88ypBxxz45UDuZHz9r3tNz7N/VInSVoVdtXEI4A==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/viem/node_modules/@scure/base": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.2.6.tgz", + "integrity": "sha512-g/nm5FgUa//MCj1gV09zTJTaM6KBAHqLN907YVQqf7zC49+DcO4B1so4ZX07Ef10Twr6nuqYEH9GEggFXA4Fmg==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/viem/node_modules/@scure/bip32": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.7.0.tgz", + "integrity": "sha512-E4FFX/N3f4B80AKWp5dP6ow+flD1LQZo/w8UnLGYZO674jS6YnYeepycOOksv+vLPSpgN35wgKgy+ybfTb2SMw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@noble/curves": "~1.9.0", + "@noble/hashes": "~1.8.0", + "@scure/base": "~1.2.5" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/viem/node_modules/@scure/bip39": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.6.0.tgz", + "integrity": "sha512-+lF0BbLiJNwVlev4eKelw1WWLaiKXw7sSl8T6FvBlWkdX+94aGJ4o8XjUdlyhTCjd8c+B3KT3JfS8P0bLRNU6A==", + "dev": true, + "license": "MIT", + "dependencies": { + "@noble/hashes": "~1.8.0", + "@scure/base": "~1.2.5" + }, + "funding": { + "url": "https://paulmillr.com/funding/" } }, "node_modules/ws": { diff --git a/contracts/package.json b/contracts/package.json index d49eca81..d10b0fe0 100644 --- a/contracts/package.json +++ b/contracts/package.json @@ -3,11 +3,15 @@ "version": "2.0.0", "description": "A collection of smart contracts used in the development of the Cosmos EVM blockchain.", "devDependencies": { + "@hyperlane-xyz/core": "^11.1.0", + "@nomicfoundation/hardhat-toolbox-viem": "^5.0.3", "@openzeppelin/contracts": "4.9.6", - "hardhat": "^3.0.15" + "@openzeppelin/contracts-upgradeable": "^4.9.6", + "hardhat": "^3.0.15", + "viem": "^2.47.6" }, "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" + "test": "hardhat test" }, "repository": { "type": "git", diff --git a/contracts/solidity/IBridgeMint.sol b/contracts/solidity/IBridgeMint.sol new file mode 100644 index 00000000..8d6b8127 --- /dev/null +++ b/contracts/solidity/IBridgeMint.sol @@ -0,0 +1,35 @@ +// SPDX-License-Identifier: LGPL-3.0-only +pragma solidity >=0.8.18; + +/// @dev The IBridgeMint contract's address. +address constant IBRIDGE_MINT_PRECOMPILE_ADDRESS = 0x0000000000000000000000000000000000000A00; + +/// @dev The IBridgeMint contract's instance. +IBridgeMint constant IBRIDGE_MINT_CONTRACT = IBridgeMint(IBRIDGE_MINT_PRECOMPILE_ADDRESS); + +/// @title IBridgeMint +/// @dev Interface for the bridge precompile that mints and burns the chain-native token. +/// @custom:address 0x0000000000000000000000000000000000000A00 +interface IBridgeMint { + /// @dev Emitted when native tokens are minted to a recipient. + event MintNative(address indexed recipient, uint256 amount); + + /// @dev Emitted when native tokens are burned from a sender. + event BurnNative(address indexed sender, uint256 amount); + + /// @notice Mint native tokens to a recipient. + /// @dev Only callable by the authorized bridge contract. + /// @param recipient The recipient of the minted native tokens. + /// @param amount The amount of native tokens to mint. + /// @return success Whether the mint succeeded. + function mintNative(address recipient, uint256 amount) external returns (bool success); + + /// @notice Burn native tokens held by the authorized bridge contract. + /// @dev Only callable by the authorized bridge contract. + /// @param amount The amount of native tokens to burn. + /// @return success Whether the burn succeeded. + function burnNative(uint256 amount) external returns (bool success); + + /// @notice Returns whether bridge operations are enabled. + function isEnabled() external view returns (bool enabled); +} diff --git a/contracts/solidity/bridge/HypOGNative.json b/contracts/solidity/bridge/HypOGNative.json new file mode 100644 index 00000000..cfc0db6e --- /dev/null +++ b/contracts/solidity/bridge/HypOGNative.json @@ -0,0 +1,678 @@ +{ + "_format": "hh3-artifact-1", + "contractName": "HypOGNative", + "sourceName": "solidity/bridge/HypOGNative.sol", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_mailbox", + "type": "address" + }, + { + "internalType": "address", + "name": "_igp", + "type": "address" + }, + { + "internalType": "address", + "name": "_owner", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "BridgeDisabled", + "type": "error" + }, + { + "inputs": [], + "name": "BurnFailed", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "domain", + "type": "uint32" + } + ], + "name": "DestinationGasNotConfigured", + "type": "error" + }, + { + "inputs": [], + "name": "IGPNotConfigured", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "expected", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "actual", + "type": "uint256" + } + ], + "name": "IncorrectValue", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidAmount", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "expected", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "actual", + "type": "uint256" + } + ], + "name": "LengthMismatch", + "type": "error" + }, + { + "inputs": [], + "name": "MintFailed", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "caller", + "type": "address" + } + ], + "name": "NotMailbox", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "caller", + "type": "address" + } + ], + "name": "NotOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "domain", + "type": "uint32" + } + ], + "name": "UnknownRouter", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroMailbox", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroOwner", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroRecipient", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroRouter", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint32", + "name": "domain", + "type": "uint32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "gasLimit", + "type": "uint256" + } + ], + "name": "DestinationGasSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "messageId", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "uint32", + "name": "destination", + "type": "uint32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "gasLimit", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "payment", + "type": "uint256" + } + ], + "name": "HandleGasPaymentMade", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "ism", + "type": "address" + } + ], + "name": "ISMSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint32", + "name": "origin", + "type": "uint32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "recipient", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "ReceivedTransferRemote", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint32", + "name": "domain", + "type": "uint32" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "router", + "type": "bytes32" + } + ], + "name": "RouterEnrolled", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint32", + "name": "domain", + "type": "uint32" + } + ], + "name": "RouterUnenrolled", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint32", + "name": "destination", + "type": "uint32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "recipient", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "SentTransferRemote", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "name": "destinationGas", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "_domain", + "type": "uint32" + }, + { + "internalType": "bytes32", + "name": "_router", + "type": "bytes32" + } + ], + "name": "enrollRemoteRouter", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32[]", + "name": "_domains", + "type": "uint32[]" + }, + { + "internalType": "bytes32[]", + "name": "_routers", + "type": "bytes32[]" + } + ], + "name": "enrollRemoteRouters", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "_origin", + "type": "uint32" + }, + { + "internalType": "bytes32", + "name": "_sender", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "_body", + "type": "bytes" + } + ], + "name": "handle", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "igp", + "outputs": [ + { + "internalType": "contract IInterchainGasPaymaster", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "interchainSecurityModule", + "outputs": [ + { + "internalType": "contract IInterchainSecurityModule", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "ism", + "outputs": [ + { + "internalType": "contract IInterchainSecurityModule", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "mailbox", + "outputs": [ + { + "internalType": "contract IMailbox", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "_messageId", + "type": "bytes32" + }, + { + "internalType": "uint32", + "name": "_destination", + "type": "uint32" + }, + { + "internalType": "address", + "name": "_refundAddress", + "type": "address" + } + ], + "name": "payForHandleGas", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "_destination", + "type": "uint32" + }, + { + "internalType": "bytes32", + "name": "_recipient", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "quoteDispatchFee", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "_destination", + "type": "uint32" + } + ], + "name": "quoteHandleGasPayment", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "_destination", + "type": "uint32" + }, + { + "internalType": "bytes32", + "name": "_recipient", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "quoteTransferRemote", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "internalType": "struct Quote[]", + "name": "quotes", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "name": "routers", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "_domain", + "type": "uint32" + }, + { + "internalType": "uint256", + "name": "_gasLimit", + "type": "uint256" + } + ], + "name": "setDestinationGas", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_ism", + "type": "address" + } + ], + "name": "setInterchainSecurityModule", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "_destination", + "type": "uint32" + }, + { + "internalType": "bytes32", + "name": "_recipient", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "transferRemote", + "outputs": [ + { + "internalType": "bytes32", + "name": "messageId", + "type": "bytes32" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "_domain", + "type": "uint32" + } + ], + "name": "unenrollRemoteRouter", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "bytecode": "0x60c060405234801561000f575f5ffd5b506040516127c43803806127c483398181016040528101906100319190610262565b5f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603610096576040517f8147d4ac00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036100fb576040517f9905827b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8273ffffffffffffffffffffffffffffffffffffffff1660808173ffffffffffffffffffffffffffffffffffffffff16815250508173ffffffffffffffffffffffffffffffffffffffff1660a08173ffffffffffffffffffffffffffffffffffffffff1681525050805f5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff165f73ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050506102b2565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f61023182610208565b9050919050565b61024181610227565b811461024b575f5ffd5b50565b5f8151905061025c81610238565b92915050565b5f5f5f6060848603121561027957610278610204565b5b5f6102868682870161024e565b93505060206102978682870161024e565b92505060406102a88682870161024e565b9150509250925092565b60805160a0516124b961030b5f395f8181610947015281816109bc01528181610a7601528181610b49015261156a01525f81816106be01528181610d6701528181610f0b015281816111ba015261127b01526124b95ff3fe608060405260043610610117575f3560e01c80638bd90b821161009f578063e370ef3911610063578063e370ef391461039a578063e9198bf9146103d6578063efae508a146103fe578063f28b2daa14610426578063f2fde38b146104505761011e565b80638bd90b82146102b85780638da5cb5b146102f4578063b49c53a71461031e578063d5438eae14610346578063de523cf3146103705761011e565b806356d5d475116100e657806356d5d475146101d85780635b5dea05146101f4578063674ca29714610230578063775313a11461024c57806381b4e8b4146102885761011e565b80630e72cc06146101225780632ead72f61461014a57806349d462ef146101865780634deefab2146101ae5761011e565b3661011e57005b5f5ffd5b34801561012d575f5ffd5b5061014860048036038101906101439190611982565b610478565b005b348015610155575f5ffd5b50610170600480360381019061016b91906119e6565b61058e565b60405161017d9190611a29565b60405180910390f35b348015610191575f5ffd5b506101ac60048036038101906101a79190611a75565b6105a3565b005b3480156101b9575f5ffd5b506101c2610697565b6040516101cf9190611b0e565b60405180910390f35b6101f260048036038101906101ed9190611bb2565b6106bc565b005b3480156101ff575f5ffd5b5061021a600480360381019061021591906119e6565b61092d565b6040516102279190611c32565b60405180910390f35b61024a60048036038101906102459190611c4b565b610a5d565b005b348015610257575f5ffd5b50610272600480360381019061026d91906119e6565b610c1c565b60405161027f9190611c32565b60405180910390f35b6102a2600480360381019061029d9190611c9b565b610c31565b6040516102af9190611a29565b60405180910390f35b3480156102c3575f5ffd5b506102de60048036038101906102d99190611c9b565b610ff4565b6040516102eb9190611dde565b60405180910390f35b3480156102ff575f5ffd5b506103086110f6565b6040516103159190611e0d565b60405180910390f35b348015610329575f5ffd5b50610344600480360381019061033f9190611e26565b61111a565b005b348015610351575f5ffd5b5061035a6111b8565b6040516103679190611e84565b60405180910390f35b34801561037b575f5ffd5b506103846111dc565b6040516103919190611b0e565b60405180910390f35b3480156103a5575f5ffd5b506103c060048036038101906103bb9190611c9b565b611204565b6040516103cd9190611c32565b60405180910390f35b3480156103e1575f5ffd5b506103fc60048036038101906103f79190611f47565b61132f565b005b348015610409575f5ffd5b50610424600480360381019061041f91906119e6565b611482565b005b348015610431575f5ffd5b5061043a611568565b6040516104479190611fe5565b60405180910390f35b34801561045b575f5ffd5b5061047660048036038101906104719190611982565b61158c565b005b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461050857336040517f245aecd30000000000000000000000000000000000000000000000000000000081526004016104ff9190611e0d565b60405180910390fd5b8060015f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff167fc4940038c9f9003f33cacff00d7a660aae58dea4399e8cd84d4a30c5cb89ddce60405160405180910390a250565b6002602052805f5260405f205f915090505481565b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461063357336040517f245aecd300000000000000000000000000000000000000000000000000000000815260040161062a9190611e0d565b60405180910390fd5b8060035f8463ffffffff1663ffffffff1681526020019081526020015f20819055508163ffffffff167f90563f253ecb04527a6a7ae1a8cbe2bdc6caefb39d5f7b06a973cf5e7f8035a48260405161068b9190611c32565b60405180910390a25050565b60015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461074c57336040517f7d173b420000000000000000000000000000000000000000000000000000000081526004016107439190611e0d565b60405180910390fd5b5f6107568561173d565b905083811461079c57846040517ff3d5328b000000000000000000000000000000000000000000000000000000008152600401610793919061200d565b60405180910390fd5b5f6107a784846117a9565b90505f5f1b81036107e4576040517fd27b444300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f6107ef85856117e1565b90505f810361082a576040517f2c5211c600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610a0073ffffffffffffffffffffffffffffffffffffffff166362aaa1606108518461181c565b836040518363ffffffff1660e01b815260040161086f929190612026565b6020604051808303815f875af115801561088b573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906108af9190612082565b6108e5576040517f07637bd800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b818763ffffffff167fba20947a325f450d232530e5f5fce293e7963499d5309a07cee84a269f2f15a68360405161091c9190611c32565b60405180910390a350505050505050565b5f5f73ffffffffffffffffffffffffffffffffffffffff167f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1603610989575f9050610a58565b5f60035f8463ffffffff1663ffffffff1681526020019081526020015f205490505f81036109ba575f915050610a58565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663a692979384836040518363ffffffff1660e01b8152600401610a159291906120ad565b602060405180830381865afa158015610a30573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610a5491906120e8565b9150505b919050565b5f73ffffffffffffffffffffffffffffffffffffffff167f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1603610ae2576040517f3b06190a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f60035f8463ffffffff1663ffffffff1681526020019081526020015f205490505f8103610b4757826040517f965edead000000000000000000000000000000000000000000000000000000008152600401610b3e919061200d565b60405180910390fd5b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166311bf2c1834868685876040518663ffffffff1660e01b8152600401610ba79493929190612113565b5f604051808303818588803b158015610bbe575f5ffd5b505af1158015610bd0573d5f5f3e3d5ffd5b50505050508263ffffffff16847fc4216243aa36167cf88587397700d62a90d30e8cb904765f1f230561ac58c1aa8334604051610c0e929190612156565b60405180910390a350505050565b6003602052805f5260405f205f915090505481565b5f5f8203610c6b576040517f2c5211c600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f5f1b8303610ca6576040517fd27b444300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610a0073ffffffffffffffffffffffffffffffffffffffff16636aa633b66040518163ffffffff1660e01b8152600401602060405180830381865afa158015610cf1573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610d159190612082565b610d4b576040517f3cad327300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f610d558561173d565b90505f610d628585611827565b90505f7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16639c42bd188885856040518463ffffffff1660e01b8152600401610dc2939291906121ed565b602060405180830381865afa158015610ddd573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610e0191906120e8565b90505f8186610e109190612256565b9050803414610e585780346040517fb25102da000000000000000000000000000000000000000000000000000000008152600401610e4f929190612156565b60405180910390fd5b610a0073ffffffffffffffffffffffffffffffffffffffff1663abc10ca1876040518263ffffffff1660e01b8152600401610e939190611c32565b6020604051808303815f875af1158015610eaf573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610ed39190612082565b610f09576040517f6f16aafc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663fa31de01838a87876040518563ffffffff1660e01b8152600401610f67939291906121ed565b60206040518083038185885af1158015610f83573d5f5f3e3d5ffd5b50505050506040513d601f19601f82011682018060405250810190610fa8919061229d565b9450868863ffffffff167fd229aacb94204188fe8042965fa6b269c62dc5818b21238779ab64bdd17efeec88604051610fe19190611c32565b60405180910390a3505050509392505050565b60605f611002858585611204565b9050600267ffffffffffffffff81111561101f5761101e6122c8565b5b60405190808252806020026020018201604052801561105857816020015b6110456118f2565b81526020019060019003908161103d5790505b50915060405180604001604052805f73ffffffffffffffffffffffffffffffffffffffff16815260200182815250825f81518110611099576110986122f5565b5b602002602001018190525060405180604001604052805f73ffffffffffffffffffffffffffffffffffffffff16815260200184815250826001815181106110e3576110e26122f5565b5b6020026020010181905250509392505050565b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146111aa57336040517f245aecd30000000000000000000000000000000000000000000000000000000081526004016111a19190611e0d565b60405180910390fd5b6111b48282611853565b5050565b7f000000000000000000000000000000000000000000000000000000000000000081565b5f60015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b5f5f820361123e576040517f2c5211c600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f5f1b8303611279576040517fd27b444300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16639c42bd18856112bf8761173d565b6112c98787611827565b6040518463ffffffff1660e01b81526004016112e7939291906121ed565b602060405180830381865afa158015611302573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061132691906120e8565b90509392505050565b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146113bf57336040517f245aecd30000000000000000000000000000000000000000000000000000000081526004016113b69190611e0d565b60405180910390fd5b8181905084849050146114115783839050828290506040517fab8b67c6000000000000000000000000000000000000000000000000000000008152600401611408929190612156565b60405180910390fd5b5f8484905090505f5f90505b8181101561147a5761146f86868381811061143b5761143a6122f5565b5b905060200201602081019061145091906119e6565b858584818110611463576114626122f5565b5b90506020020135611853565b80600101905061141d565b505050505050565b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461151257336040517f245aecd30000000000000000000000000000000000000000000000000000000081526004016115099190611e0d565b60405180910390fd5b60025f8263ffffffff1663ffffffff1681526020019081526020015f205f90558063ffffffff167f4e0023cdff8cef336b33ca6d54f5f3a9c324767ac479b874c50eea5790a4418f60405160405180910390a250565b7f000000000000000000000000000000000000000000000000000000000000000081565b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461161c57336040517f245aecd30000000000000000000000000000000000000000000000000000000081526004016116139190611e0d565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603611681576040517f9905827b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff165f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3805f5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b5f60025f8363ffffffff1663ffffffff1681526020019081526020015f205490505f5f1b81036117a457816040517ff3d5328b00000000000000000000000000000000000000000000000000000000815260040161179b919061200d565b60405180910390fd5b919050565b5f82825f60ff169060205f6117be919061232e565b60ff16926117ce9392919061236a565b906117d991906123ba565b905092915050565b5f8282602060ff16906020806117f7919061232e565b60ff16926118079392919061236a565b9061181291906123ba565b5f1c905092915050565b5f815f1c9050919050565b6060828260405160200161183c929190612458565b604051602081830303815290604052905092915050565b5f5f1b810361188e576040517f920d929200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8060025f8463ffffffff1663ffffffff1681526020019081526020015f20819055508163ffffffff167f50f2ff5d2aecb68a5747b2c222d14e5f8d49a1e00bc6df7ef943af8e36439265826040516118e69190611a29565b60405180910390a25050565b60405180604001604052805f73ffffffffffffffffffffffffffffffffffffffff1681526020015f81525090565b5f5ffd5b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f61195182611928565b9050919050565b61196181611947565b811461196b575f5ffd5b50565b5f8135905061197c81611958565b92915050565b5f6020828403121561199757611996611920565b5b5f6119a48482850161196e565b91505092915050565b5f63ffffffff82169050919050565b6119c5816119ad565b81146119cf575f5ffd5b50565b5f813590506119e0816119bc565b92915050565b5f602082840312156119fb576119fa611920565b5b5f611a08848285016119d2565b91505092915050565b5f819050919050565b611a2381611a11565b82525050565b5f602082019050611a3c5f830184611a1a565b92915050565b5f819050919050565b611a5481611a42565b8114611a5e575f5ffd5b50565b5f81359050611a6f81611a4b565b92915050565b5f5f60408385031215611a8b57611a8a611920565b5b5f611a98858286016119d2565b9250506020611aa985828601611a61565b9150509250929050565b5f819050919050565b5f611ad6611ad1611acc84611928565b611ab3565b611928565b9050919050565b5f611ae782611abc565b9050919050565b5f611af882611add565b9050919050565b611b0881611aee565b82525050565b5f602082019050611b215f830184611aff565b92915050565b611b3081611a11565b8114611b3a575f5ffd5b50565b5f81359050611b4b81611b27565b92915050565b5f5ffd5b5f5ffd5b5f5ffd5b5f5f83601f840112611b7257611b71611b51565b5b8235905067ffffffffffffffff811115611b8f57611b8e611b55565b5b602083019150836001820283011115611bab57611baa611b59565b5b9250929050565b5f5f5f5f60608587031215611bca57611bc9611920565b5b5f611bd7878288016119d2565b9450506020611be887828801611b3d565b935050604085013567ffffffffffffffff811115611c0957611c08611924565b5b611c1587828801611b5d565b925092505092959194509250565b611c2c81611a42565b82525050565b5f602082019050611c455f830184611c23565b92915050565b5f5f5f60608486031215611c6257611c61611920565b5b5f611c6f86828701611b3d565b9350506020611c80868287016119d2565b9250506040611c918682870161196e565b9150509250925092565b5f5f5f60608486031215611cb257611cb1611920565b5b5f611cbf868287016119d2565b9350506020611cd086828701611b3d565b9250506040611ce186828701611a61565b9150509250925092565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b611d1d81611947565b82525050565b611d2c81611a42565b82525050565b604082015f820151611d465f850182611d14565b506020820151611d596020850182611d23565b50505050565b5f611d6a8383611d32565b60408301905092915050565b5f602082019050919050565b5f611d8c82611ceb565b611d968185611cf5565b9350611da183611d05565b805f5b83811015611dd1578151611db88882611d5f565b9750611dc383611d76565b925050600181019050611da4565b5085935050505092915050565b5f6020820190508181035f830152611df68184611d82565b905092915050565b611e0781611947565b82525050565b5f602082019050611e205f830184611dfe565b92915050565b5f5f60408385031215611e3c57611e3b611920565b5b5f611e49858286016119d2565b9250506020611e5a85828601611b3d565b9150509250929050565b5f611e6e82611add565b9050919050565b611e7e81611e64565b82525050565b5f602082019050611e975f830184611e75565b92915050565b5f5f83601f840112611eb257611eb1611b51565b5b8235905067ffffffffffffffff811115611ecf57611ece611b55565b5b602083019150836020820283011115611eeb57611eea611b59565b5b9250929050565b5f5f83601f840112611f0757611f06611b51565b5b8235905067ffffffffffffffff811115611f2457611f23611b55565b5b602083019150836020820283011115611f4057611f3f611b59565b5b9250929050565b5f5f5f5f60408587031215611f5f57611f5e611920565b5b5f85013567ffffffffffffffff811115611f7c57611f7b611924565b5b611f8887828801611e9d565b9450945050602085013567ffffffffffffffff811115611fab57611faa611924565b5b611fb787828801611ef2565b925092505092959194509250565b5f611fcf82611add565b9050919050565b611fdf81611fc5565b82525050565b5f602082019050611ff85f830184611fd6565b92915050565b612007816119ad565b82525050565b5f6020820190506120205f830184611ffe565b92915050565b5f6040820190506120395f830185611dfe565b6120466020830184611c23565b9392505050565b5f8115159050919050565b6120618161204d565b811461206b575f5ffd5b50565b5f8151905061207c81612058565b92915050565b5f6020828403121561209757612096611920565b5b5f6120a48482850161206e565b91505092915050565b5f6040820190506120c05f830185611ffe565b6120cd6020830184611c23565b9392505050565b5f815190506120e281611a4b565b92915050565b5f602082840312156120fd576120fc611920565b5b5f61210a848285016120d4565b91505092915050565b5f6080820190506121265f830187611a1a565b6121336020830186611ffe565b6121406040830185611c23565b61214d6060830184611dfe565b95945050505050565b5f6040820190506121695f830185611c23565b6121766020830184611c23565b9392505050565b5f81519050919050565b5f82825260208201905092915050565b8281835e5f83830152505050565b5f601f19601f8301169050919050565b5f6121bf8261217d565b6121c98185612187565b93506121d9818560208601612197565b6121e2816121a5565b840191505092915050565b5f6060820190506122005f830186611ffe565b61220d6020830185611a1a565b818103604083015261221f81846121b5565b9050949350505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f61226082611a42565b915061226b83611a42565b925082820190508082111561228357612282612229565b5b92915050565b5f8151905061229781611b27565b92915050565b5f602082840312156122b2576122b1611920565b5b5f6122bf84828501612289565b91505092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b5f60ff82169050919050565b5f61233882612322565b915061234383612322565b9250828201905060ff81111561235c5761235b612229565b5b92915050565b5f5ffd5b5f5ffd5b5f5f8585111561237d5761237c612362565b5b8386111561238e5761238d612366565b5b6001850283019150848603905094509492505050565b5f82905092915050565b5f82821b905092915050565b5f6123c583836123a4565b826123d08135611a11565b925060208210156124105761240b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff836020036008026123ae565b831692505b505092915050565b5f819050919050565b61243261242d82611a11565b612418565b82525050565b5f819050919050565b61245261244d82611a42565b612438565b82525050565b5f6124638285612421565b6020820191506124738284612441565b602082019150819050939250505056fea2646970667358221220196c223c74fdeaf657aacaa26cca622b0d4fa768bb2f4f5e8807ddc070ca0e0b64736f6c63430008220033" +} diff --git a/contracts/solidity/bridge/HypOGNative.sol b/contracts/solidity/bridge/HypOGNative.sol new file mode 100644 index 00000000..6186f935 --- /dev/null +++ b/contracts/solidity/bridge/HypOGNative.sol @@ -0,0 +1,302 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 +pragma solidity >=0.8.0; + +import "../IBridgeMint.sol"; +import "./IInterchainGasPaymaster.sol"; +import "./IInterchainSecurityModule.sol"; +import "./IMailbox.sol"; +import "./IMessageRecipient.sol"; +import "./ISpecifiesInterchainSecurityModule.sol"; +import "./ITokenBridge.sol"; +import "./TokenMessage.sol"; +import "./TypeCasts.sol"; + +contract HypOGNative is + ITokenBridge, + IMessageRecipient, + ISpecifiesInterchainSecurityModule +{ + using TypeCasts for bytes32; + + IMailbox public immutable mailbox; + IInterchainGasPaymaster public immutable igp; + + address public owner; + IInterchainSecurityModule public ism; + + mapping(uint32 => bytes32) public routers; + mapping(uint32 => uint256) public destinationGas; + + error BridgeDisabled(); + error DestinationGasNotConfigured(uint32 domain); + error IGPNotConfigured(); + error IncorrectValue(uint256 expected, uint256 actual); + error InvalidAmount(); + error LengthMismatch(uint256 expected, uint256 actual); + error MintFailed(); + error BurnFailed(); + error NotMailbox(address caller); + error NotOwner(address caller); + error UnknownRouter(uint32 domain); + error ZeroMailbox(); + error ZeroOwner(); + error ZeroRecipient(); + error ZeroRouter(); + + event SentTransferRemote( + uint32 indexed destination, + bytes32 indexed recipient, + uint256 amount + ); + event ReceivedTransferRemote( + uint32 indexed origin, + bytes32 indexed recipient, + uint256 amount + ); + event RouterEnrolled(uint32 indexed domain, bytes32 router); + event RouterUnenrolled(uint32 indexed domain); + event DestinationGasSet(uint32 indexed domain, uint256 gasLimit); + event HandleGasPaymentMade( + bytes32 indexed messageId, + uint32 indexed destination, + uint256 gasLimit, + uint256 payment + ); + event ISMSet(address indexed ism); + event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); + + modifier onlyOwner() { + if (msg.sender != owner) { + revert NotOwner(msg.sender); + } + _; + } + + modifier onlyMailbox() { + if (msg.sender != address(mailbox)) { + revert NotMailbox(msg.sender); + } + _; + } + + constructor(address _mailbox, address _igp, address _owner) { + if (_mailbox == address(0)) { + revert ZeroMailbox(); + } + if (_owner == address(0)) { + revert ZeroOwner(); + } + + mailbox = IMailbox(_mailbox); + igp = IInterchainGasPaymaster(_igp); + owner = _owner; + + emit OwnershipTransferred(address(0), _owner); + } + + function transferRemote( + uint32 _destination, + bytes32 _recipient, + uint256 _amount + ) external payable override returns (bytes32 messageId) { + if (_amount == 0) { + revert InvalidAmount(); + } + if (_recipient == bytes32(0)) { + revert ZeroRecipient(); + } + if (!IBRIDGE_MINT_CONTRACT.isEnabled()) { + revert BridgeDisabled(); + } + + bytes32 router = _mustHaveRemoteRouter(_destination); + bytes memory messageBody = TokenMessage.format(_recipient, _amount); + uint256 dispatchFee = mailbox.quoteDispatch( + _destination, + router, + messageBody + ); + uint256 expectedValue = _amount + dispatchFee; + if (msg.value != expectedValue) { + revert IncorrectValue(expectedValue, msg.value); + } + + if (!IBRIDGE_MINT_CONTRACT.burnNative(_amount)) { + revert BurnFailed(); + } + + messageId = mailbox.dispatch{value: dispatchFee}( + _destination, + router, + messageBody + ); + + emit SentTransferRemote(_destination, _recipient, _amount); + } + + function quoteDispatchFee( + uint32 _destination, + bytes32 _recipient, + uint256 _amount + ) public view returns (uint256) { + if (_amount == 0) { + revert InvalidAmount(); + } + if (_recipient == bytes32(0)) { + revert ZeroRecipient(); + } + + return mailbox.quoteDispatch( + _destination, + _mustHaveRemoteRouter(_destination), + TokenMessage.format(_recipient, _amount) + ); + } + + function quoteTransferRemote( + uint32 _destination, + bytes32 _recipient, + uint256 _amount + ) external view override returns (Quote[] memory quotes) { + uint256 dispatchFee = quoteDispatchFee(_destination, _recipient, _amount); + + quotes = new Quote[](2); + quotes[0] = Quote({token: address(0), amount: dispatchFee}); + quotes[1] = Quote({token: address(0), amount: _amount}); + } + + function quoteHandleGasPayment( + uint32 _destination + ) external view returns (uint256) { + if (address(igp) == address(0)) { + return 0; + } + + uint256 gasLimit = destinationGas[_destination]; + if (gasLimit == 0) { + return 0; + } + + return igp.quoteGasPayment(_destination, gasLimit); + } + + function payForHandleGas( + bytes32 _messageId, + uint32 _destination, + address _refundAddress + ) external payable { + if (address(igp) == address(0)) { + revert IGPNotConfigured(); + } + + uint256 gasLimit = destinationGas[_destination]; + if (gasLimit == 0) { + revert DestinationGasNotConfigured(_destination); + } + + igp.payForGas{value: msg.value}( + _messageId, + _destination, + gasLimit, + _refundAddress + ); + + emit HandleGasPaymentMade(_messageId, _destination, gasLimit, msg.value); + } + + function handle( + uint32 _origin, + bytes32 _sender, + bytes calldata _body + ) external payable override onlyMailbox { + bytes32 router = _mustHaveRemoteRouter(_origin); + if (router != _sender) { + revert UnknownRouter(_origin); + } + + bytes32 recipientB32 = TokenMessage.recipient(_body); + if (recipientB32 == bytes32(0)) { + revert ZeroRecipient(); + } + + uint256 amount = TokenMessage.amount(_body); + if (amount == 0) { + revert InvalidAmount(); + } + + if (!IBRIDGE_MINT_CONTRACT.mintNative(recipientB32.bytes32ToAddress(), amount)) { + revert MintFailed(); + } + + emit ReceivedTransferRemote(_origin, recipientB32, amount); + } + + function enrollRemoteRouter(uint32 _domain, bytes32 _router) external onlyOwner { + _enrollRemoteRouter(_domain, _router); + } + + function enrollRemoteRouters( + uint32[] calldata _domains, + bytes32[] calldata _routers + ) external onlyOwner { + if (_domains.length != _routers.length) { + revert LengthMismatch(_domains.length, _routers.length); + } + + uint256 length = _domains.length; + for (uint256 i = 0; i < length; ++i) { + _enrollRemoteRouter(_domains[i], _routers[i]); + } + } + + function unenrollRemoteRouter(uint32 _domain) external onlyOwner { + delete routers[_domain]; + emit RouterUnenrolled(_domain); + } + + function setDestinationGas(uint32 _domain, uint256 _gasLimit) external onlyOwner { + destinationGas[_domain] = _gasLimit; + emit DestinationGasSet(_domain, _gasLimit); + } + + function setInterchainSecurityModule(address _ism) external onlyOwner { + ism = IInterchainSecurityModule(_ism); + emit ISMSet(_ism); + } + + function transferOwnership(address _newOwner) external onlyOwner { + if (_newOwner == address(0)) { + revert ZeroOwner(); + } + + emit OwnershipTransferred(owner, _newOwner); + owner = _newOwner; + } + + function interchainSecurityModule() + external + view + override + returns (IInterchainSecurityModule) + { + return ism; + } + + function _enrollRemoteRouter(uint32 _domain, bytes32 _router) internal { + if (_router == bytes32(0)) { + revert ZeroRouter(); + } + + routers[_domain] = _router; + emit RouterEnrolled(_domain, _router); + } + + function _mustHaveRemoteRouter(uint32 _domain) internal view returns (bytes32 router) { + router = routers[_domain]; + if (router == bytes32(0)) { + revert UnknownRouter(_domain); + } + } + + receive() external payable {} +} diff --git a/contracts/solidity/bridge/HypOPGCollateral.json b/contracts/solidity/bridge/HypOPGCollateral.json new file mode 100644 index 00000000..0d923596 --- /dev/null +++ b/contracts/solidity/bridge/HypOPGCollateral.json @@ -0,0 +1,545 @@ +{ + "_format": "hh3-artifact-1", + "contractName": "HypOPGCollateral", + "sourceName": "solidity/bridge/HypOPGCollateral.sol", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_token", + "type": "address" + }, + { + "internalType": "address", + "name": "_mailbox", + "type": "address" + }, + { + "internalType": "address", + "name": "_igp", + "type": "address" + }, + { + "internalType": "address", + "name": "_owner", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "expected", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "actual", + "type": "uint256" + } + ], + "name": "IncorrectMailboxFee", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidAmount", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "expected", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "actual", + "type": "uint256" + } + ], + "name": "LengthMismatch", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "caller", + "type": "address" + } + ], + "name": "NotMailbox", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "caller", + "type": "address" + } + ], + "name": "NotOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "domain", + "type": "uint32" + } + ], + "name": "UnknownRouter", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroMailbox", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroOwner", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroRecipient", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroRouter", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroToken", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint32", + "name": "origin", + "type": "uint32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "sender", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "ReceivedTransferRemote", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint32", + "name": "domain", + "type": "uint32" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "router", + "type": "bytes32" + } + ], + "name": "RouterEnrolled", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint32", + "name": "domain", + "type": "uint32" + } + ], + "name": "RouterUnenrolled", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "messageId", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint32", + "name": "destination", + "type": "uint32" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "recipient", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "dispatchFee", + "type": "uint256" + } + ], + "name": "SentTransferRemote", + "type": "event" + }, + { + "inputs": [], + "name": "DESTINATION_GAS", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "collateralToken", + "outputs": [ + { + "internalType": "contract IERC20", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "_domain", + "type": "uint32" + }, + { + "internalType": "bytes32", + "name": "_router", + "type": "bytes32" + } + ], + "name": "enrollRemoteRouter", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32[]", + "name": "_domains", + "type": "uint32[]" + }, + { + "internalType": "bytes32[]", + "name": "_routers", + "type": "bytes32[]" + } + ], + "name": "enrollRemoteRouters", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "_origin", + "type": "uint32" + }, + { + "internalType": "bytes32", + "name": "_sender", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "_body", + "type": "bytes" + } + ], + "name": "handle", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "igp", + "outputs": [ + { + "internalType": "contract IInterchainGasPaymaster", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "mailbox", + "outputs": [ + { + "internalType": "contract IMailbox", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "_destination", + "type": "uint32" + }, + { + "internalType": "bytes32", + "name": "_recipient", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "quoteDispatchFee", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "_destination", + "type": "uint32" + } + ], + "name": "quoteHandleGasPayment", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "_destination", + "type": "uint32" + }, + { + "internalType": "bytes32", + "name": "_recipient", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "quoteTransferRemote", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "internalType": "struct Quote[]", + "name": "quotes", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "name": "routers", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "_destination", + "type": "uint32" + }, + { + "internalType": "bytes32", + "name": "_recipient", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "transferRemote", + "outputs": [ + { + "internalType": "bytes32", + "name": "messageId", + "type": "bytes32" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "_domain", + "type": "uint32" + } + ], + "name": "unenrollRemoteRouter", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "bytecode": "0x60e060405234801561000f575f5ffd5b5060405161281d38038061281d833981810160405281019061003191906102a2565b5f73ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1603610096576040517fad1991f500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036100fb576040517f8147d4ac00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610160576040517f9905827b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8373ffffffffffffffffffffffffffffffffffffffff1660808173ffffffffffffffffffffffffffffffffffffffff16815250508273ffffffffffffffffffffffffffffffffffffffff1660a08173ffffffffffffffffffffffffffffffffffffffff16815250508173ffffffffffffffffffffffffffffffffffffffff1660c08173ffffffffffffffffffffffffffffffffffffffff1681525050805f5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050505050610306565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f61027182610248565b9050919050565b61028181610267565b811461028b575f5ffd5b50565b5f8151905061029c81610278565b92915050565b5f5f5f5f608085870312156102ba576102b9610244565b5b5f6102c78782880161028e565b94505060206102d88782880161028e565b93505060406102e98782880161028e565b92505060606102fa8782880161028e565b91505092959194509250565b60805160a05160c0516124ae61036f5f395f81816105f80152818161063c01526110b801525f81816103bb01528181610770015281816108a101528181610c460152610cdf01525f818161053a0152818161085a01528181610a680152610af301526124ae5ff3fe6080604052600436106100eb575f3560e01c8063b2016bd411610089578063e9198bf911610058578063e9198bf914610302578063efae508a1461032a578063f28b2daa14610352578063f2fde38b1461037c576100f2565b8063b2016bd41461024a578063b49c53a714610274578063d5438eae1461029c578063e370ef39146102c6576100f2565b806381b4e8b4116100c557806381b4e8b41461018a57806387929e09146101ba5780638bd90b82146101e45780638da5cb5b14610220576100f2565b80632ead72f6146100f657806356d5d475146101325780635b5dea051461014e576100f2565b366100f257005b5f5ffd5b348015610101575f5ffd5b5061011c600480360381019061011791906117aa565b6103a4565b60405161012991906117ed565b60405180910390f35b61014c60048036038101906101479190611891565b6103b9565b005b348015610159575f5ffd5b50610174600480360381019061016f91906117aa565b6105de565b604051610181919061191a565b60405180910390f35b6101a4600480360381019061019f919061195d565b6106df565b6040516101b191906117ed565b60405180910390f35b3480156101c5575f5ffd5b506101ce6109a4565b6040516101db919061191a565b60405180910390f35b3480156101ef575f5ffd5b5061020a6004803603810190610205919061195d565b6109ab565b6040516102179190611ad0565b60405180910390f35b34801561022b575f5ffd5b50610234610acd565b6040516102419190611aff565b60405180910390f35b348015610255575f5ffd5b5061025e610af1565b60405161026b9190611b73565b60405180910390f35b34801561027f575f5ffd5b5061029a60048036038101906102959190611b8c565b610b15565b005b3480156102a7575f5ffd5b506102b0610c44565b6040516102bd9190611bea565b60405180910390f35b3480156102d1575f5ffd5b506102ec60048036038101906102e7919061195d565b610c68565b6040516102f9919061191a565b60405180910390f35b34801561030d575f5ffd5b5061032860048036038101906103239190611cad565b610d93565b005b348015610335575f5ffd5b50610350600480360381019061034b91906117aa565b610fd0565b005b34801561035d575f5ffd5b506103666110b6565b6040516103739190611d4b565b60405180910390f35b348015610387575f5ffd5b506103a2600480360381019061039d9190611d8e565b6110da565b005b6001602052805f5260405f205f915090505481565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461044957336040517f7d173b420000000000000000000000000000000000000000000000000000000081526004016104409190611aff565b60405180910390fd5b5f6104538561128b565b905083811461049957846040517ff3d5328b0000000000000000000000000000000000000000000000000000000081526004016104909190611dc8565b60405180910390fd5b5f6104a484846112f7565b90505f5f1b81036104e1576040517fd27b444300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f6104ec858561132f565b90505f8103610527576040517f2c5211c600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f6105318361136a565b905061057e81837f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166113759092919063ffffffff16565b8073ffffffffffffffffffffffffffffffffffffffff16878963ffffffff167f78560e0b721874d041186d4f01c78e73fb02b51cb542ca12496a3bc09cf9a0e1856040516105cc919061191a565b60405180910390a45050505050505050565b5f5f73ffffffffffffffffffffffffffffffffffffffff167f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff160361063a575f90506106da565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663a692979383620493e06040518363ffffffff1660e01b8152600401610698929190611de1565b602060405180830381865afa1580156106b3573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906106d79190611e1c565b90505b919050565b5f5f8203610719576040517f2c5211c600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f5f1b8303610754576040517fd27b444300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f61075e8561128b565b90505f61076b85856113fb565b90505f7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16639c42bd188885856040518463ffffffff1660e01b81526004016107cb93929190611eb7565b602060405180830381865afa1580156107e6573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061080a9190611e1c565b90508034146108525780346040517f512ba202000000000000000000000000000000000000000000000000000000008152600401610849929190611ef3565b60405180910390fd5b61089f3330877f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16611427909392919063ffffffff16565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663fa31de01828986866040518563ffffffff1660e01b81526004016108fd93929190611eb7565b60206040518083038185885af1158015610919573d5f5f3e3d5ffd5b50505050506040513d601f19601f8201168201806040525081019061093e9190611f2e565b93508663ffffffff163373ffffffffffffffffffffffffffffffffffffffff16857f4287699a39021436ef4c9f44c2d33db797d7925707a3e381e0ee955efe234cf689898660405161099293929190611f59565b60405180910390a45050509392505050565b620493e081565b60605f6109b9858585610c68565b9050600267ffffffffffffffff8111156109d6576109d5611f8e565b5b604051908082528060200260200182016040528015610a0f57816020015b6109fc61173b565b8152602001906001900390816109f45790505b50915060405180604001604052805f73ffffffffffffffffffffffffffffffffffffffff16815260200182815250825f81518110610a5057610a4f611fbb565b5b602002602001018190525060405180604001604052807f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1681526020018481525082600181518110610aba57610ab9611fbb565b5b6020026020010181905250509392505050565b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b7f000000000000000000000000000000000000000000000000000000000000000081565b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610ba557336040517f245aecd3000000000000000000000000000000000000000000000000000000008152600401610b9c9190611aff565b60405180910390fd5b5f5f1b8103610be0576040517f920d929200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8060015f8463ffffffff1663ffffffff1681526020019081526020015f20819055508163ffffffff167f50f2ff5d2aecb68a5747b2c222d14e5f8d49a1e00bc6df7ef943af8e3643926582604051610c3891906117ed565b60405180910390a25050565b7f000000000000000000000000000000000000000000000000000000000000000081565b5f5f8203610ca2576040517f2c5211c600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f5f1b8303610cdd576040517fd27b444300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16639c42bd1885610d238761128b565b610d2d87876113fb565b6040518463ffffffff1660e01b8152600401610d4b93929190611eb7565b602060405180830381865afa158015610d66573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610d8a9190611e1c565b90509392505050565b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610e2357336040517f245aecd3000000000000000000000000000000000000000000000000000000008152600401610e1a9190611aff565b60405180910390fd5b818190508484905014610e755783839050828290506040517fab8b67c6000000000000000000000000000000000000000000000000000000008152600401610e6c929190611ef3565b60405180910390fd5b5f8484905090505f5f90505b81811015610fc8575f5f1b848483818110610e9f57610e9e611fbb565b5b9050602002013503610edd576040517f920d929200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b838382818110610ef057610eef611fbb565b5b9050602002013560015f888885818110610f0d57610f0c611fbb565b5b9050602002016020810190610f2291906117aa565b63ffffffff1663ffffffff1681526020019081526020015f2081905550858582818110610f5257610f51611fbb565b5b9050602002016020810190610f6791906117aa565b63ffffffff167f50f2ff5d2aecb68a5747b2c222d14e5f8d49a1e00bc6df7ef943af8e36439265858584818110610fa157610fa0611fbb565b5b90506020020135604051610fb591906117ed565b60405180910390a2806001019050610e81565b505050505050565b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461106057336040517f245aecd30000000000000000000000000000000000000000000000000000000081526004016110579190611aff565b60405180910390fd5b60015f8263ffffffff1663ffffffff1681526020019081526020015f205f90558063ffffffff167f4e0023cdff8cef336b33ca6d54f5f3a9c324767ac479b874c50eea5790a4418f60405160405180910390a250565b7f000000000000000000000000000000000000000000000000000000000000000081565b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461116a57336040517f245aecd30000000000000000000000000000000000000000000000000000000081526004016111619190611aff565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036111cf576040517f9905827b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff165f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3805f5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b5f60015f8363ffffffff1663ffffffff1681526020019081526020015f205490505f5f1b81036112f257816040517ff3d5328b0000000000000000000000000000000000000000000000000000000081526004016112e99190611dc8565b60405180910390fd5b919050565b5f82825f60ff169060205f61130c9190612021565b60ff169261131c9392919061205d565b9061132791906120ad565b905092915050565b5f8282602060ff16906020806113459190612021565b60ff16926113559392919061205d565b9061136091906120ad565b5f1c905092915050565b5f815f1c9050919050565b6113f68363a9059cbb60e01b848460405160240161139492919061210b565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506114b0565b505050565b60608282604051602001611410929190612172565b604051602081830303815290604052905092915050565b6114aa846323b872dd60e01b8585856040516024016114489392919061219d565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506114b0565b50505050565b5f611511826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166115769092919063ffffffff16565b90505f815114806115325750808060200190518101906115319190612207565b5b611571576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611568906122b2565b60405180910390fd5b505050565b606061158484845f8561158d565b90509392505050565b6060824710156115d2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115c990612340565b60405180910390fd5b5f5f8673ffffffffffffffffffffffffffffffffffffffff1685876040516115fa9190612398565b5f6040518083038185875af1925050503d805f8114611634576040519150601f19603f3d011682016040523d82523d5f602084013e611639565b606091505b509150915061164a87838387611656565b92505050949350505050565b606083156116b7575f8351036116af5761166f856116ca565b6116ae576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116a5906123f8565b60405180910390fd5b5b8290506116c2565b6116c183836116ec565b5b949350505050565b5f5f8273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b5f825111156116fe5781518083602001fd5b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117329190612458565b60405180910390fd5b60405180604001604052805f73ffffffffffffffffffffffffffffffffffffffff1681526020015f81525090565b5f5ffd5b5f5ffd5b5f63ffffffff82169050919050565b61178981611771565b8114611793575f5ffd5b50565b5f813590506117a481611780565b92915050565b5f602082840312156117bf576117be611769565b5b5f6117cc84828501611796565b91505092915050565b5f819050919050565b6117e7816117d5565b82525050565b5f6020820190506118005f8301846117de565b92915050565b61180f816117d5565b8114611819575f5ffd5b50565b5f8135905061182a81611806565b92915050565b5f5ffd5b5f5ffd5b5f5ffd5b5f5f83601f84011261185157611850611830565b5b8235905067ffffffffffffffff81111561186e5761186d611834565b5b60208301915083600182028301111561188a57611889611838565b5b9250929050565b5f5f5f5f606085870312156118a9576118a8611769565b5b5f6118b687828801611796565b94505060206118c78782880161181c565b935050604085013567ffffffffffffffff8111156118e8576118e761176d565b5b6118f48782880161183c565b925092505092959194509250565b5f819050919050565b61191481611902565b82525050565b5f60208201905061192d5f83018461190b565b92915050565b61193c81611902565b8114611946575f5ffd5b50565b5f8135905061195781611933565b92915050565b5f5f5f6060848603121561197457611973611769565b5b5f61198186828701611796565b93505060206119928682870161181c565b92505060406119a386828701611949565b9150509250925092565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6119ff826119d6565b9050919050565b611a0f816119f5565b82525050565b611a1e81611902565b82525050565b604082015f820151611a385f850182611a06565b506020820151611a4b6020850182611a15565b50505050565b5f611a5c8383611a24565b60408301905092915050565b5f602082019050919050565b5f611a7e826119ad565b611a8881856119b7565b9350611a93836119c7565b805f5b83811015611ac3578151611aaa8882611a51565b9750611ab583611a68565b925050600181019050611a96565b5085935050505092915050565b5f6020820190508181035f830152611ae88184611a74565b905092915050565b611af9816119f5565b82525050565b5f602082019050611b125f830184611af0565b92915050565b5f819050919050565b5f611b3b611b36611b31846119d6565b611b18565b6119d6565b9050919050565b5f611b4c82611b21565b9050919050565b5f611b5d82611b42565b9050919050565b611b6d81611b53565b82525050565b5f602082019050611b865f830184611b64565b92915050565b5f5f60408385031215611ba257611ba1611769565b5b5f611baf85828601611796565b9250506020611bc08582860161181c565b9150509250929050565b5f611bd482611b42565b9050919050565b611be481611bca565b82525050565b5f602082019050611bfd5f830184611bdb565b92915050565b5f5f83601f840112611c1857611c17611830565b5b8235905067ffffffffffffffff811115611c3557611c34611834565b5b602083019150836020820283011115611c5157611c50611838565b5b9250929050565b5f5f83601f840112611c6d57611c6c611830565b5b8235905067ffffffffffffffff811115611c8a57611c89611834565b5b602083019150836020820283011115611ca657611ca5611838565b5b9250929050565b5f5f5f5f60408587031215611cc557611cc4611769565b5b5f85013567ffffffffffffffff811115611ce257611ce161176d565b5b611cee87828801611c03565b9450945050602085013567ffffffffffffffff811115611d1157611d1061176d565b5b611d1d87828801611c58565b925092505092959194509250565b5f611d3582611b42565b9050919050565b611d4581611d2b565b82525050565b5f602082019050611d5e5f830184611d3c565b92915050565b611d6d816119f5565b8114611d77575f5ffd5b50565b5f81359050611d8881611d64565b92915050565b5f60208284031215611da357611da2611769565b5b5f611db084828501611d7a565b91505092915050565b611dc281611771565b82525050565b5f602082019050611ddb5f830184611db9565b92915050565b5f604082019050611df45f830185611db9565b611e01602083018461190b565b9392505050565b5f81519050611e1681611933565b92915050565b5f60208284031215611e3157611e30611769565b5b5f611e3e84828501611e08565b91505092915050565b5f81519050919050565b5f82825260208201905092915050565b8281835e5f83830152505050565b5f601f19601f8301169050919050565b5f611e8982611e47565b611e938185611e51565b9350611ea3818560208601611e61565b611eac81611e6f565b840191505092915050565b5f606082019050611eca5f830186611db9565b611ed760208301856117de565b8181036040830152611ee98184611e7f565b9050949350505050565b5f604082019050611f065f83018561190b565b611f13602083018461190b565b9392505050565b5f81519050611f2881611806565b92915050565b5f60208284031215611f4357611f42611769565b5b5f611f5084828501611f1a565b91505092915050565b5f606082019050611f6c5f8301866117de565b611f79602083018561190b565b611f86604083018461190b565b949350505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b5f60ff82169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f61202b82611fe8565b915061203683611fe8565b9250828201905060ff81111561204f5761204e611ff4565b5b92915050565b5f5ffd5b5f5ffd5b5f5f858511156120705761206f612055565b5b8386111561208157612080612059565b5b6001850283019150848603905094509492505050565b5f82905092915050565b5f82821b905092915050565b5f6120b88383612097565b826120c381356117d5565b92506020821015612103576120fe7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff836020036008026120a1565b831692505b505092915050565b5f60408201905061211e5f830185611af0565b61212b602083018461190b565b9392505050565b5f819050919050565b61214c612147826117d5565b612132565b82525050565b5f819050919050565b61216c61216782611902565b612152565b82525050565b5f61217d828561213b565b60208201915061218d828461215b565b6020820191508190509392505050565b5f6060820190506121b05f830186611af0565b6121bd6020830185611af0565b6121ca604083018461190b565b949350505050565b5f8115159050919050565b6121e6816121d2565b81146121f0575f5ffd5b50565b5f81519050612201816121dd565b92915050565b5f6020828403121561221c5761221b611769565b5b5f612229848285016121f3565b91505092915050565b5f82825260208201905092915050565b7f5361666545524332303a204552433230206f7065726174696f6e20646964206e5f8201527f6f74207375636365656400000000000000000000000000000000000000000000602082015250565b5f61229c602a83612232565b91506122a782612242565b604082019050919050565b5f6020820190508181035f8301526122c981612290565b9050919050565b7f416464726573733a20696e73756666696369656e742062616c616e636520666f5f8201527f722063616c6c0000000000000000000000000000000000000000000000000000602082015250565b5f61232a602683612232565b9150612335826122d0565b604082019050919050565b5f6020820190508181035f8301526123578161231e565b9050919050565b5f81905092915050565b5f61237282611e47565b61237c818561235e565b935061238c818560208601611e61565b80840191505092915050565b5f6123a38284612368565b915081905092915050565b7f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000005f82015250565b5f6123e2601d83612232565b91506123ed826123ae565b602082019050919050565b5f6020820190508181035f83015261240f816123d6565b9050919050565b5f81519050919050565b5f61242a82612416565b6124348185612232565b9350612444818560208601611e61565b61244d81611e6f565b840191505092915050565b5f6020820190508181035f8301526124708184612420565b90509291505056fea26469706673582212205e5de09ba4807611fb941362dbc353900bcd506202da200dc3f51d188f52358664736f6c63430008220033" +} diff --git a/contracts/solidity/bridge/HypOPGCollateral.sol b/contracts/solidity/bridge/HypOPGCollateral.sol new file mode 100644 index 00000000..0325a98d --- /dev/null +++ b/contracts/solidity/bridge/HypOPGCollateral.sol @@ -0,0 +1,249 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.20; + +import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; +import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; + +import "./IInterchainGasPaymaster.sol"; +import "./IMailbox.sol"; +import "./IMessageRecipient.sol"; +import "./ITokenBridge.sol"; +import "./TokenMessage.sol"; +import "./TypeCasts.sol"; + +/// @title HypOPGCollateral +/// @notice Reference Base-side collateral router for OPG. +/// @dev Production deployments should use Hyperlane's audited +/// HypERC20Collateral. This contract keeps the bridge architecture testable +/// from within this repo and documents the expected collateral flow. +contract HypOPGCollateral is IMessageRecipient, ITokenBridge { + using SafeERC20 for IERC20; + using TypeCasts for bytes32; + + uint256 public constant DESTINATION_GAS = 300_000; + + IERC20 public immutable collateralToken; + IMailbox public immutable mailbox; + IInterchainGasPaymaster public immutable igp; + + address public owner; + mapping(uint32 => bytes32) public routers; + + error IncorrectMailboxFee(uint256 expected, uint256 actual); + error InvalidAmount(); + error LengthMismatch(uint256 expected, uint256 actual); + error NotMailbox(address caller); + error NotOwner(address caller); + error UnknownRouter(uint32 domain); + error ZeroMailbox(); + error ZeroOwner(); + error ZeroRecipient(); + error ZeroRouter(); + error ZeroToken(); + + event SentTransferRemote( + bytes32 indexed messageId, + address indexed sender, + uint32 indexed destination, + bytes32 recipient, + uint256 amount, + uint256 dispatchFee + ); + event ReceivedTransferRemote( + uint32 indexed origin, + bytes32 indexed sender, + address indexed recipient, + uint256 amount + ); + event RouterEnrolled(uint32 indexed domain, bytes32 router); + event RouterUnenrolled(uint32 indexed domain); + event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); + + modifier onlyOwner() { + if (msg.sender != owner) { + revert NotOwner(msg.sender); + } + _; + } + + modifier onlyMailbox() { + if (msg.sender != address(mailbox)) { + revert NotMailbox(msg.sender); + } + _; + } + + constructor( + address _token, + address _mailbox, + address _igp, + address _owner + ) { + if (_token == address(0)) { + revert ZeroToken(); + } + if (_mailbox == address(0)) { + revert ZeroMailbox(); + } + if (_owner == address(0)) { + revert ZeroOwner(); + } + + collateralToken = IERC20(_token); + mailbox = IMailbox(_mailbox); + igp = IInterchainGasPaymaster(_igp); + owner = _owner; + } + + function transferRemote( + uint32 _destination, + bytes32 _recipient, + uint256 _amount + ) external payable returns (bytes32 messageId) { + if (_amount == 0) { + revert InvalidAmount(); + } + if (_recipient == bytes32(0)) { + revert ZeroRecipient(); + } + + bytes32 router = _mustHaveRemoteRouter(_destination); + bytes memory messageBody = TokenMessage.format(_recipient, _amount); + uint256 dispatchFee = mailbox.quoteDispatch(_destination, router, messageBody); + if (msg.value != dispatchFee) { + revert IncorrectMailboxFee(dispatchFee, msg.value); + } + + collateralToken.safeTransferFrom(msg.sender, address(this), _amount); + + messageId = mailbox.dispatch{value: dispatchFee}( + _destination, + router, + messageBody + ); + + emit SentTransferRemote( + messageId, + msg.sender, + _destination, + _recipient, + _amount, + dispatchFee + ); + } + + function handle( + uint32 _origin, + bytes32 _sender, + bytes calldata _body + ) external payable onlyMailbox { + bytes32 router = _mustHaveRemoteRouter(_origin); + if (router != _sender) { + revert UnknownRouter(_origin); + } + + bytes32 recipientB32 = TokenMessage.recipient(_body); + if (recipientB32 == bytes32(0)) { + revert ZeroRecipient(); + } + + uint256 amount = TokenMessage.amount(_body); + if (amount == 0) { + revert InvalidAmount(); + } + + address recipient = recipientB32.bytes32ToAddress(); + collateralToken.safeTransfer(recipient, amount); + + emit ReceivedTransferRemote(_origin, _sender, recipient, amount); + } + + function quoteDispatchFee( + uint32 _destination, + bytes32 _recipient, + uint256 _amount + ) public view returns (uint256) { + if (_amount == 0) { + revert InvalidAmount(); + } + if (_recipient == bytes32(0)) { + revert ZeroRecipient(); + } + + return mailbox.quoteDispatch( + _destination, + _mustHaveRemoteRouter(_destination), + TokenMessage.format(_recipient, _amount) + ); + } + + function quoteHandleGasPayment(uint32 _destination) external view returns (uint256) { + if (address(igp) == address(0)) { + return 0; + } + + return igp.quoteGasPayment(_destination, DESTINATION_GAS); + } + + function quoteTransferRemote( + uint32 _destination, + bytes32 _recipient, + uint256 _amount + ) external view returns (Quote[] memory quotes) { + uint256 dispatchFee = quoteDispatchFee(_destination, _recipient, _amount); + quotes = new Quote[](2); + quotes[0] = Quote({token: address(0), amount: dispatchFee}); + quotes[1] = Quote({token: address(collateralToken), amount: _amount}); + } + + function enrollRemoteRouter(uint32 _domain, bytes32 _router) external onlyOwner { + if (_router == bytes32(0)) { + revert ZeroRouter(); + } + + routers[_domain] = _router; + emit RouterEnrolled(_domain, _router); + } + + function enrollRemoteRouters( + uint32[] calldata _domains, + bytes32[] calldata _routers + ) external onlyOwner { + if (_domains.length != _routers.length) { + revert LengthMismatch(_domains.length, _routers.length); + } + + uint256 length = _domains.length; + for (uint256 i = 0; i < length; ++i) { + if (_routers[i] == bytes32(0)) { + revert ZeroRouter(); + } + + routers[_domains[i]] = _routers[i]; + emit RouterEnrolled(_domains[i], _routers[i]); + } + } + + function unenrollRemoteRouter(uint32 _domain) external onlyOwner { + delete routers[_domain]; + emit RouterUnenrolled(_domain); + } + + function transferOwnership(address _newOwner) external onlyOwner { + if (_newOwner == address(0)) { + revert ZeroOwner(); + } + + emit OwnershipTransferred(owner, _newOwner); + owner = _newOwner; + } + + function _mustHaveRemoteRouter(uint32 _domain) internal view returns (bytes32 router) { + router = routers[_domain]; + if (router == bytes32(0)) { + revert UnknownRouter(_domain); + } + } + + receive() external payable {} +} diff --git a/contracts/solidity/bridge/IInterchainGasPaymaster.sol b/contracts/solidity/bridge/IInterchainGasPaymaster.sol new file mode 100644 index 00000000..53bb1292 --- /dev/null +++ b/contracts/solidity/bridge/IInterchainGasPaymaster.sol @@ -0,0 +1,16 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.20; + +interface IInterchainGasPaymaster { + function payForGas( + bytes32 _messageId, + uint32 _destinationDomain, + uint256 _gasAmount, + address _refundAddress + ) external payable; + + function quoteGasPayment( + uint32 _destinationDomain, + uint256 _gasAmount + ) external view returns (uint256); +} diff --git a/contracts/solidity/bridge/IInterchainSecurityModule.sol b/contracts/solidity/bridge/IInterchainSecurityModule.sol new file mode 100644 index 00000000..2dfc2ded --- /dev/null +++ b/contracts/solidity/bridge/IInterchainSecurityModule.sol @@ -0,0 +1,4 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.20; + +interface IInterchainSecurityModule {} diff --git a/contracts/solidity/bridge/IMailbox.sol b/contracts/solidity/bridge/IMailbox.sol new file mode 100644 index 00000000..166842b0 --- /dev/null +++ b/contracts/solidity/bridge/IMailbox.sol @@ -0,0 +1,33 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.20; + +interface IMailbox { + function dispatch( + uint32 destinationDomain, + bytes32 recipientAddress, + bytes calldata messageBody + ) external payable returns (bytes32 messageId); + + function quoteDispatch( + uint32 destinationDomain, + bytes32 recipientAddress, + bytes calldata messageBody + ) external view returns (uint256 fee); + + function process( + bytes calldata metadata, + bytes calldata message + ) external payable; + + function localDomain() external view returns (uint32); + + function delivered(bytes32 messageId) external view returns (bool); + + function latestDispatchedId() external view returns (bytes32); + + function defaultIsm() external view returns (address); + + function defaultHook() external view returns (address); + + function requiredHook() external view returns (address); +} diff --git a/contracts/solidity/bridge/IMessageRecipient.sol b/contracts/solidity/bridge/IMessageRecipient.sol new file mode 100644 index 00000000..7c28b635 --- /dev/null +++ b/contracts/solidity/bridge/IMessageRecipient.sol @@ -0,0 +1,10 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.20; + +interface IMessageRecipient { + function handle( + uint32 _origin, + bytes32 _sender, + bytes calldata _body + ) external payable; +} diff --git a/contracts/solidity/bridge/ISpecifiesInterchainSecurityModule.sol b/contracts/solidity/bridge/ISpecifiesInterchainSecurityModule.sol new file mode 100644 index 00000000..bb9a3516 --- /dev/null +++ b/contracts/solidity/bridge/ISpecifiesInterchainSecurityModule.sol @@ -0,0 +1,11 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.20; + +import "./IInterchainSecurityModule.sol"; + +interface ISpecifiesInterchainSecurityModule { + function interchainSecurityModule() + external + view + returns (IInterchainSecurityModule); +} diff --git a/contracts/solidity/bridge/ITokenBridge.sol b/contracts/solidity/bridge/ITokenBridge.sol new file mode 100644 index 00000000..cee7b0c9 --- /dev/null +++ b/contracts/solidity/bridge/ITokenBridge.sol @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 +pragma solidity >=0.8.0; + +struct Quote { + address token; + uint256 amount; +} + +interface ITokenFee { + function quoteTransferRemote( + uint32 _destination, + bytes32 _recipient, + uint256 _amount + ) external view returns (Quote[] memory quotes); +} + +interface ITokenBridge is ITokenFee { + function transferRemote( + uint32 _destination, + bytes32 _recipient, + uint256 _amount + ) external payable returns (bytes32 messageId); +} diff --git a/contracts/solidity/bridge/MockBridgeMint.sol b/contracts/solidity/bridge/MockBridgeMint.sol new file mode 100644 index 00000000..1bfc16d4 --- /dev/null +++ b/contracts/solidity/bridge/MockBridgeMint.sol @@ -0,0 +1,66 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.20; + +import "../IBridgeMint.sol"; + +/// @title MockBridgeMint +/// @notice Test-only mock for the bridge precompile surface. +contract MockBridgeMint is IBridgeMint { + bool public enabled; + bool public mintResult; + bool public burnResult; + bool public initialized; + + address public lastMintRecipient; + uint256 public lastMintAmount; + address public lastMintCaller; + uint256 public mintCalls; + + uint256 public lastBurnAmount; + address public lastBurnCaller; + uint256 public burnCalls; + + function initialize() external { + enabled = true; + mintResult = true; + burnResult = true; + initialized = true; + } + + function setEnabled(bool _enabled) external { + enabled = _enabled; + } + + function setMintResult(bool _mintResult) external { + mintResult = _mintResult; + } + + function setBurnResult(bool _burnResult) external { + burnResult = _burnResult; + } + + function mintNative(address recipient, uint256 amount) external returns (bool success) { + lastMintRecipient = recipient; + lastMintAmount = amount; + lastMintCaller = msg.sender; + mintCalls += 1; + + emit MintNative(recipient, amount); + + return mintResult; + } + + function burnNative(uint256 amount) external returns (bool success) { + lastBurnAmount = amount; + lastBurnCaller = msg.sender; + burnCalls += 1; + + emit BurnNative(msg.sender, amount); + + return burnResult; + } + + function isEnabled() external view returns (bool) { + return enabled; + } +} diff --git a/contracts/solidity/bridge/MockMailbox.json b/contracts/solidity/bridge/MockMailbox.json new file mode 100644 index 00000000..1a3bca37 --- /dev/null +++ b/contracts/solidity/bridge/MockMailbox.json @@ -0,0 +1,505 @@ +{ + "_format": "hh3-artifact-1", + "contractName": "MockMailbox", + "sourceName": "solidity/bridge/MockMailbox.sol", + "abi": [ + { + "inputs": [ + { + "internalType": "uint32", + "name": "_localDomain", + "type": "uint32" + }, + { + "internalType": "uint256", + "name": "_quoteFee", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "Unsupported", + "type": "error" + }, + { + "inputs": [], + "name": "defaultHook", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "defaultIsm", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint32", + "name": "origin", + "type": "uint32" + }, + { + "internalType": "bytes32", + "name": "sender", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "body", + "type": "bytes" + } + ], + "name": "deliver", + "outputs": [ + { + "internalType": "bytes32", + "name": "messageId", + "type": "bytes32" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "delivered", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "destinationDomain", + "type": "uint32" + }, + { + "internalType": "bytes32", + "name": "recipientAddress", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "messageBody", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "dispatch", + "outputs": [ + { + "internalType": "bytes32", + "name": "messageId", + "type": "bytes32" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "destinationDomain", + "type": "uint32" + }, + { + "internalType": "bytes32", + "name": "recipientAddress", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "messageBody", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "name": "dispatch", + "outputs": [ + { + "internalType": "bytes32", + "name": "messageId", + "type": "bytes32" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "destinationDomain", + "type": "uint32" + }, + { + "internalType": "bytes32", + "name": "recipientAddress", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "messageBody", + "type": "bytes" + } + ], + "name": "dispatch", + "outputs": [ + { + "internalType": "bytes32", + "name": "messageId", + "type": "bytes32" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "lastBody", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "lastDestination", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "lastRecipient", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "lastSender", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "lastValue", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "latestDispatchedId", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "localDomain", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "nonce", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "name": "process", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "destinationDomain", + "type": "uint32" + }, + { + "internalType": "bytes32", + "name": "recipientAddress", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "messageBody", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "quoteDispatch", + "outputs": [ + { + "internalType": "uint256", + "name": "fee", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + }, + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "name": "quoteDispatch", + "outputs": [ + { + "internalType": "uint256", + "name": "fee", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "destinationDomain", + "type": "uint32" + }, + { + "internalType": "bytes32", + "name": "recipientAddress", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "messageBody", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "name": "quoteDispatch", + "outputs": [ + { + "internalType": "uint256", + "name": "fee", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "quoteFee", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "recipientIsm", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "requiredHook", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_quoteFee", + "type": "uint256" + } + ], + "name": "setQuoteFee", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "bytecode": "0x60a03461007057601f610f3238819003918201601f19168301916001600160401b038311848410176100755780849260409485528339810103126100705780519063ffffffff82168203610070576020015190608052600055604051610ea6908161008c82396080518161039a0152f35b600080fd5b634e487b7160e01b600052604160045260246000fdfe60406080815260048036101561001457600080fd5b6000803560e01c91826305c009211461079f57826310b83dc01461077f578263134fbb4f14610760578263256fec881461072b5782633ae9a2601461070e5782633d1250b7146106da57826343183834146106bb57826348aee8d41461069c578263514ebb3b146104ac5782636e5f516e146104775782637c39d1301461040857826381d2ea95146103e657826386639836146103be5782638d3638f41461037d5782639c42bd181461035e578263a14496361461024f578263affed0e014610230578263d23ee66b14610211578263d6d08a09146101dc578263e495f1d4146101ab57508163e70f48ac1461016d578163f7ccd32114610149575063fa31de011461011f57600080fd5b60209061014261013c610131366108ed565b939192933691610a4e565b91610ba4565b9051908152f35b82346101695760209061014261015e3661088d565b505092919091610b17565b5080fd5b82346101695760206003193601126101695760209061018a6107e9565b5073ffffffffffffffffffffffffffffffffffffffff600354169051908152f35b8390346101d85760206003193601126101d8578160209360ff92358152600a855220541690519015158152f35b8280fd5b50823461016957816003193601126101695760209073ffffffffffffffffffffffffffffffffffffffff600554169051908152f35b5082346101695781600319360112610169576020906007549051908152f35b5082346101695781600319360112610169576020906001549051908152f35b83823461035b578060031936011261035b5781519182826008546102728161092d565b90818452602095600191876001821691826000146103165750506001146102ba575b5050506102b692916102a7910385610980565b519282849384528301906109f0565b0390f35b9190869350600883527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee35b8284106102fe57505050820101816102a76102b6610294565b8054848a0186015288955087949093019281016102e5565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00168782015293151560051b860190930193508492506102a791506102b69050610294565b80fd5b50823461016957602091610371366108ed565b50505050549051908152f35b5082346101695781600319360112610169576020905163ffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b50823461016957816003193601126101695760209063ffffffff60065460a01c169051908152f35b508234610169576020906101426103fc3661080c565b50505092919091610b17565b83828160031936011261035b5767ffffffffffffffff9083358281116101695761043590369086016107b6565b505060243591821161035b575061044f90369084016107b6565b5050517f90a2caf2000000000000000000000000000000000000000000000000000000008152fd5b50823461016957816003193601126101695760209073ffffffffffffffffffffffffffffffffffffffff600354169051908152f35b90836080600319360112610169576104c26107e9565b916024359063ffffffff821693848303610169576044356064359167ffffffffffffffff92838111610698576104fb9036908a016107b6565b6001969196549873ffffffffffffffffffffffffffffffffffffffff89519460208601928352868b870152169384606082015260a060808201526105798161054760c08201868d610ab3565b8d60a0830152037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08101835282610980565b519020986001810180911161066c57600155888652600a60205287862060017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00825416179055823b15610668579089610602879594938a51998a96879586957f56d5d4750000000000000000000000000000000000000000000000000000000087528601610af2565b039134905af1801561065e5761061d575b6020858551908152f35b82116106325750602093508152838080610613565b806041867f4e487b71000000000000000000000000000000000000000000000000000000006024945252fd5b84513d84823e3d90fd5b8580fd5b60248760118d7f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b8480fd5b60208461014261013c6106ae3661088d565b5050939192933691610a4e565b5082346101695781600319360112610169576020906009549051908152f35b83823461035b578060031936011261035b575073ffffffffffffffffffffffffffffffffffffffff60209254169051908152f35b508234610169578160031936011261016957602091549051908152f35b50823461016957816003193601126101695760209073ffffffffffffffffffffffffffffffffffffffff600654169051908152f35b5082346101695781600319360112610169576020906002549051908152f35b60208461014261013c6107913661080c565b505050939192933691610a4e565b346101695760206003193601126101695735815580f35b9181601f840112156107e45782359167ffffffffffffffff83116107e457602083818601950101116107e457565b600080fd5b6004359073ffffffffffffffffffffffffffffffffffffffff821682036107e457565b60a06003198201126107e45760043563ffffffff811681036107e457916024359167ffffffffffffffff916044358381116107e4578261084e916004016107b6565b939093926064359182116107e457610868916004016107b6565b909160843573ffffffffffffffffffffffffffffffffffffffff811681036107e45790565b60806003198201126107e45760043563ffffffff811681036107e457916024359167ffffffffffffffff916044358381116107e457826108cf916004016107b6565b939093926064359182116107e4576108e9916004016107b6565b9091565b60606003198201126107e45760043563ffffffff811681036107e45791602435916044359067ffffffffffffffff82116107e4576108e9916004016107b6565b90600182811c92168015610976575b602083101461094757565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b91607f169161093c565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff8211176109c157604052565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b919082519283825260005b848110610a3a5750507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8460006020809697860101520116010190565b6020818301810151848301820152016109fb565b92919267ffffffffffffffff82116109c15760405191610a9660207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8401160184610980565b8294818452818301116107e4578281602093846000960137010152565b601f82602094937fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0938186528686013760008582860101520116010190565b610b14949263ffffffff60609316825260208201528160408201520191610ab3565b90565b610b526020939460405195869485947f9c42bd1800000000000000000000000000000000000000000000000000000000865260048601610af2565b0381305afa908115610b9857600091610b69575090565b90506020813d602011610b90575b81610b8460209383610980565b810103126107e4575190565b3d9150610b77565b6040513d6000823e3d90fd5b90929160065477ffffffff00000000000000000000000000000000000000008360a01b16907fffffffffffffffff0000000000000000000000000000000000000000000000007fffffffffffffffff00000000ffffffffffffffffffffffffffffffffffffffff33169116171760065583600755805167ffffffffffffffff81116109c157610c3460085461092d565b601f8111610e09575b5080602080601f8311600114610d495750600091610d3e575b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8260011b9260031b1c1916176008555b34600955610cf760015494610cc560405193849263ffffffff6020850197338952166040850152606084015260a0608084015260c08301906109f0565b8660a0830152037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08101835282610980565b5190209160018101809111610d0f5760015581600255565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b905082015138610c56565b917fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660086000527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee3926000905b828210610df15750509083600194939210610dba575b5050811b01600855610c88565b8401517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60f88460031b161c191690553880610dad565b80600185968294968a01518155019501930190610d97565b600060086000527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee3601f840160051c81019260208510610e66575b601f0160051c01915b828110610e5b575050610c3d565b818155600101610e4d565b9092508290610e4456fea2646970667358221220bae4acbaa873b2462aa00fada840caa9017c231cf1667255b42b9bc628aa947164736f6c63430008160033", + "deployedBytecode": "0x60406080815260048036101561001457600080fd5b6000803560e01c91826305c009211461079f57826310b83dc01461077f578263134fbb4f14610760578263256fec881461072b5782633ae9a2601461070e5782633d1250b7146106da57826343183834146106bb57826348aee8d41461069c578263514ebb3b146104ac5782636e5f516e146104775782637c39d1301461040857826381d2ea95146103e657826386639836146103be5782638d3638f41461037d5782639c42bd181461035e578263a14496361461024f578263affed0e014610230578263d23ee66b14610211578263d6d08a09146101dc578263e495f1d4146101ab57508163e70f48ac1461016d578163f7ccd32114610149575063fa31de011461011f57600080fd5b60209061014261013c610131366108ed565b939192933691610a4e565b91610ba4565b9051908152f35b82346101695760209061014261015e3661088d565b505092919091610b17565b5080fd5b82346101695760206003193601126101695760209061018a6107e9565b5073ffffffffffffffffffffffffffffffffffffffff600354169051908152f35b8390346101d85760206003193601126101d8578160209360ff92358152600a855220541690519015158152f35b8280fd5b50823461016957816003193601126101695760209073ffffffffffffffffffffffffffffffffffffffff600554169051908152f35b5082346101695781600319360112610169576020906007549051908152f35b5082346101695781600319360112610169576020906001549051908152f35b83823461035b578060031936011261035b5781519182826008546102728161092d565b90818452602095600191876001821691826000146103165750506001146102ba575b5050506102b692916102a7910385610980565b519282849384528301906109f0565b0390f35b9190869350600883527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee35b8284106102fe57505050820101816102a76102b6610294565b8054848a0186015288955087949093019281016102e5565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00168782015293151560051b860190930193508492506102a791506102b69050610294565b80fd5b50823461016957602091610371366108ed565b50505050549051908152f35b5082346101695781600319360112610169576020905163ffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b50823461016957816003193601126101695760209063ffffffff60065460a01c169051908152f35b508234610169576020906101426103fc3661080c565b50505092919091610b17565b83828160031936011261035b5767ffffffffffffffff9083358281116101695761043590369086016107b6565b505060243591821161035b575061044f90369084016107b6565b5050517f90a2caf2000000000000000000000000000000000000000000000000000000008152fd5b50823461016957816003193601126101695760209073ffffffffffffffffffffffffffffffffffffffff600354169051908152f35b90836080600319360112610169576104c26107e9565b916024359063ffffffff821693848303610169576044356064359167ffffffffffffffff92838111610698576104fb9036908a016107b6565b6001969196549873ffffffffffffffffffffffffffffffffffffffff89519460208601928352868b870152169384606082015260a060808201526105798161054760c08201868d610ab3565b8d60a0830152037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08101835282610980565b519020986001810180911161066c57600155888652600a60205287862060017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00825416179055823b15610668579089610602879594938a51998a96879586957f56d5d4750000000000000000000000000000000000000000000000000000000087528601610af2565b039134905af1801561065e5761061d575b6020858551908152f35b82116106325750602093508152838080610613565b806041867f4e487b71000000000000000000000000000000000000000000000000000000006024945252fd5b84513d84823e3d90fd5b8580fd5b60248760118d7f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b8480fd5b60208461014261013c6106ae3661088d565b5050939192933691610a4e565b5082346101695781600319360112610169576020906009549051908152f35b83823461035b578060031936011261035b575073ffffffffffffffffffffffffffffffffffffffff60209254169051908152f35b508234610169578160031936011261016957602091549051908152f35b50823461016957816003193601126101695760209073ffffffffffffffffffffffffffffffffffffffff600654169051908152f35b5082346101695781600319360112610169576020906002549051908152f35b60208461014261013c6107913661080c565b505050939192933691610a4e565b346101695760206003193601126101695735815580f35b9181601f840112156107e45782359167ffffffffffffffff83116107e457602083818601950101116107e457565b600080fd5b6004359073ffffffffffffffffffffffffffffffffffffffff821682036107e457565b60a06003198201126107e45760043563ffffffff811681036107e457916024359167ffffffffffffffff916044358381116107e4578261084e916004016107b6565b939093926064359182116107e457610868916004016107b6565b909160843573ffffffffffffffffffffffffffffffffffffffff811681036107e45790565b60806003198201126107e45760043563ffffffff811681036107e457916024359167ffffffffffffffff916044358381116107e457826108cf916004016107b6565b939093926064359182116107e4576108e9916004016107b6565b9091565b60606003198201126107e45760043563ffffffff811681036107e45791602435916044359067ffffffffffffffff82116107e4576108e9916004016107b6565b90600182811c92168015610976575b602083101461094757565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b91607f169161093c565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff8211176109c157604052565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b919082519283825260005b848110610a3a5750507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8460006020809697860101520116010190565b6020818301810151848301820152016109fb565b92919267ffffffffffffffff82116109c15760405191610a9660207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8401160184610980565b8294818452818301116107e4578281602093846000960137010152565b601f82602094937fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0938186528686013760008582860101520116010190565b610b14949263ffffffff60609316825260208201528160408201520191610ab3565b90565b610b526020939460405195869485947f9c42bd1800000000000000000000000000000000000000000000000000000000865260048601610af2565b0381305afa908115610b9857600091610b69575090565b90506020813d602011610b90575b81610b8460209383610980565b810103126107e4575190565b3d9150610b77565b6040513d6000823e3d90fd5b90929160065477ffffffff00000000000000000000000000000000000000008360a01b16907fffffffffffffffff0000000000000000000000000000000000000000000000007fffffffffffffffff00000000ffffffffffffffffffffffffffffffffffffffff33169116171760065583600755805167ffffffffffffffff81116109c157610c3460085461092d565b601f8111610e09575b5080602080601f8311600114610d495750600091610d3e575b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8260011b9260031b1c1916176008555b34600955610cf760015494610cc560405193849263ffffffff6020850197338952166040850152606084015260a0608084015260c08301906109f0565b8660a0830152037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08101835282610980565b5190209160018101809111610d0f5760015581600255565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b905082015138610c56565b917fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660086000527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee3926000905b828210610df15750509083600194939210610dba575b5050811b01600855610c88565b8401517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60f88460031b161c191690553880610dad565b80600185968294968a01518155019501930190610d97565b600060086000527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee3601f840160051c81019260208510610e66575b601f0160051c01915b828110610e5b575050610c3d565b818155600101610e4d565b9092508290610e4456fea2646970667358221220bae4acbaa873b2462aa00fada840caa9017c231cf1667255b42b9bc628aa947164736f6c63430008160033", + "linkReferences": {}, + "deployedLinkReferences": {}, + "immutableReferences": { + "84": [ + { + "length": 32, + "start": 922 + } + ] + }, + "inputSourceName": "project/solidity/bridge/MockMailbox.sol", + "buildInfoId": "solc-0_8_22-12f92f1430a563cd766ceca61a5c06ba5b5bc64c" +} \ No newline at end of file diff --git a/contracts/solidity/bridge/MockMailbox.sol b/contracts/solidity/bridge/MockMailbox.sol new file mode 100644 index 00000000..57d433d6 --- /dev/null +++ b/contracts/solidity/bridge/MockMailbox.sol @@ -0,0 +1,131 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.20; + +import "./IMailbox.sol"; +import "./IMessageRecipient.sol"; + +/// @title MockMailbox +/// @notice Local test helper for bridge integration tests. +contract MockMailbox is IMailbox { + uint32 public immutable localDomain; + + uint256 public quoteFee; + uint256 public nonce; + + bytes32 public latestDispatchedId; + + address public defaultIsm; + address public defaultHook; + address public requiredHook; + + address public lastSender; + uint32 public lastDestination; + bytes32 public lastRecipient; + bytes public lastBody; + uint256 public lastValue; + + mapping(bytes32 => bool) public delivered; + + error Unsupported(); + + constructor(uint32 _localDomain, uint256 _quoteFee) { + localDomain = _localDomain; + quoteFee = _quoteFee; + } + + function setQuoteFee(uint256 _quoteFee) external { + quoteFee = _quoteFee; + } + + function dispatch( + uint32 destinationDomain, + bytes32 recipientAddress, + bytes calldata messageBody + ) external payable override returns (bytes32 messageId) { + return _dispatch(destinationDomain, recipientAddress, messageBody); + } + + function _dispatch( + uint32 destinationDomain, + bytes32 recipientAddress, + bytes memory messageBody + ) internal returns (bytes32 messageId) { + lastSender = msg.sender; + lastDestination = destinationDomain; + lastRecipient = recipientAddress; + lastBody = messageBody; + lastValue = msg.value; + + messageId = keccak256( + abi.encode(msg.sender, destinationDomain, recipientAddress, messageBody, nonce) + ); + nonce += 1; + latestDispatchedId = messageId; + } + + function quoteDispatch( + uint32, + bytes32, + bytes calldata + ) external view override returns (uint256 fee) { + return quoteFee; + } + + function dispatch( + uint32 destinationDomain, + bytes32 recipientAddress, + bytes calldata messageBody, + bytes calldata + ) external payable returns (bytes32 messageId) { + return _dispatch(destinationDomain, recipientAddress, messageBody); + } + + function quoteDispatch( + uint32 destinationDomain, + bytes32 recipientAddress, + bytes calldata messageBody, + bytes calldata + ) external view returns (uint256 fee) { + return this.quoteDispatch(destinationDomain, recipientAddress, messageBody); + } + + function dispatch( + uint32 destinationDomain, + bytes32 recipientAddress, + bytes calldata messageBody, + bytes calldata, + address + ) external payable returns (bytes32 messageId) { + return _dispatch(destinationDomain, recipientAddress, messageBody); + } + + function quoteDispatch( + uint32 destinationDomain, + bytes32 recipientAddress, + bytes calldata messageBody, + bytes calldata, + address + ) external view returns (uint256 fee) { + return this.quoteDispatch(destinationDomain, recipientAddress, messageBody); + } + + function process(bytes calldata, bytes calldata) external payable override { + revert Unsupported(); + } + + function recipientIsm(address) external view returns (address) { + return defaultIsm; + } + + function deliver( + address recipient, + uint32 origin, + bytes32 sender, + bytes calldata body + ) external payable returns (bytes32 messageId) { + messageId = keccak256(abi.encode(origin, sender, recipient, body, nonce)); + nonce += 1; + delivered[messageId] = true; + IMessageRecipient(recipient).handle{value: msg.value}(origin, sender, body); + } +} diff --git a/contracts/solidity/bridge/OfficialHypERC20Collateral.json b/contracts/solidity/bridge/OfficialHypERC20Collateral.json new file mode 100644 index 00000000..3df07273 --- /dev/null +++ b/contracts/solidity/bridge/OfficialHypERC20Collateral.json @@ -0,0 +1,1740 @@ +{ + "_format": "hh3-artifact-1", + "contractName": "OfficialHypERC20Collateral", + "sourceName": "solidity/bridge/OfficialHypERC20Collateral.sol", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "erc20", + "type": "address" + }, + { + "internalType": "uint256", + "name": "scaleNumerator", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "scaleDenominator", + "type": "uint256" + }, + { + "internalType": "address", + "name": "mailbox", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint32", + "name": "domain", + "type": "uint32" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "recipient", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "rebalancer", + "type": "address" + } + ], + "name": "CollateralMoved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "assets", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "shares", + "type": "uint256" + } + ], + "name": "Deposit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Donation", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "feeHook", + "type": "address" + } + ], + "name": "FeeHookSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "feeRecipient", + "type": "address" + } + ], + "name": "FeeRecipientSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint32", + "name": "domain", + "type": "uint32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "gas", + "type": "uint256" + } + ], + "name": "GasSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_hook", + "type": "address" + } + ], + "name": "HookSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_ism", + "type": "address" + } + ], + "name": "IsmSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint32", + "name": "origin", + "type": "uint32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "recipient", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amountOrId", + "type": "uint256" + } + ], + "name": "ReceivedTransferRemote", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint32", + "name": "destination", + "type": "uint32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "recipient", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amountOrId", + "type": "uint256" + } + ], + "name": "SentTransferRemote", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "assets", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "shares", + "type": "uint256" + } + ], + "name": "Withdraw", + "type": "event" + }, + { + "inputs": [], + "name": "PACKAGE_VERSION", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "domain", + "type": "uint32" + }, + { + "internalType": "contract ITokenBridge", + "name": "bridge", + "type": "address" + } + ], + "name": "addBridge", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "rebalancer", + "type": "address" + } + ], + "name": "addRebalancer", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "domain", + "type": "uint32" + } + ], + "name": "allowedBridges", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "allowedRebalancers", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "domain", + "type": "uint32" + } + ], + "name": "allowedRecipient", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IERC20", + "name": "token", + "type": "address" + }, + { + "internalType": "contract ITokenBridge", + "name": "bridge", + "type": "address" + } + ], + "name": "approveTokenForBridge", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "asset", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + } + ], + "name": "convertToAssets", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "assets", + "type": "uint256" + } + ], + "name": "convertToShares", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "subtractedValue", + "type": "uint256" + } + ], + "name": "decreaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "assets", + "type": "uint256" + }, + { + "internalType": "address", + "name": "receiver", + "type": "address" + } + ], + "name": "deposit", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "destinationDomain", + "type": "uint32" + } + ], + "name": "destinationGas", + "outputs": [ + { + "internalType": "uint256", + "name": "gasLimit", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "domains", + "outputs": [ + { + "internalType": "uint32[]", + "name": "", + "type": "uint32[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "donate", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "_domain", + "type": "uint32" + }, + { + "internalType": "bytes32", + "name": "_router", + "type": "bytes32" + } + ], + "name": "enrollRemoteRouter", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32[]", + "name": "_domains", + "type": "uint32[]" + }, + { + "internalType": "bytes32[]", + "name": "_addresses", + "type": "bytes32[]" + } + ], + "name": "enrollRemoteRouters", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "feeHook", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "feeRecipient", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "feeToken", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "_origin", + "type": "uint32" + }, + { + "internalType": "bytes32", + "name": "_sender", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "_message", + "type": "bytes" + } + ], + "name": "handle", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "hook", + "outputs": [ + { + "internalType": "contract IPostDispatchHook", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "addedValue", + "type": "uint256" + } + ], + "name": "increaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_hook", + "type": "address" + }, + { + "internalType": "address", + "name": "_interchainSecurityModule", + "type": "address" + }, + { + "internalType": "address", + "name": "_owner", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "interchainSecurityModule", + "outputs": [ + { + "internalType": "contract IInterchainSecurityModule", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "localDomain", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "mailbox", + "outputs": [ + { + "internalType": "contract IMailbox", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "maxDeposit", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "maxMint", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "maxRedeem", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "maxWithdraw", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + }, + { + "internalType": "address", + "name": "receiver", + "type": "address" + } + ], + "name": "mint", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "assets", + "type": "uint256" + } + ], + "name": "previewDeposit", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + } + ], + "name": "previewMint", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + } + ], + "name": "previewRedeem", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "assets", + "type": "uint256" + } + ], + "name": "previewWithdraw", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "_destinationDomain", + "type": "uint32" + } + ], + "name": "quoteGasPayment", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "_destination", + "type": "uint32" + }, + { + "internalType": "bytes32", + "name": "_recipient", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "quoteTransferRemote", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "internalType": "struct Quote[]", + "name": "quotes", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "domain", + "type": "uint32" + }, + { + "internalType": "uint256", + "name": "collateralAmount", + "type": "uint256" + }, + { + "internalType": "contract ITokenBridge", + "name": "bridge", + "type": "address" + } + ], + "name": "rebalance", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + }, + { + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "redeem", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "domain", + "type": "uint32" + }, + { + "internalType": "contract ITokenBridge", + "name": "bridge", + "type": "address" + } + ], + "name": "removeBridge", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "rebalancer", + "type": "address" + } + ], + "name": "removeRebalancer", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "domain", + "type": "uint32" + } + ], + "name": "removeRecipient", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "_domain", + "type": "uint32" + } + ], + "name": "routers", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "scaleDenominator", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "scaleNumerator", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "domain", + "type": "uint32" + }, + { + "internalType": "uint256", + "name": "gas", + "type": "uint256" + } + ], + "name": "setDestinationGas", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint32", + "name": "domain", + "type": "uint32" + }, + { + "internalType": "uint256", + "name": "gas", + "type": "uint256" + } + ], + "internalType": "struct GasRouter.GasRouterConfig[]", + "name": "gasConfigs", + "type": "tuple[]" + } + ], + "name": "setDestinationGas", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_feeHook", + "type": "address" + } + ], + "name": "setFeeHook", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + } + ], + "name": "setFeeRecipient", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_hook", + "type": "address" + } + ], + "name": "setHook", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_module", + "type": "address" + } + ], + "name": "setInterchainSecurityModule", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "domain", + "type": "uint32" + }, + { + "internalType": "bytes32", + "name": "recipient", + "type": "bytes32" + } + ], + "name": "setRecipient", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "token", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalAssets", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "_destination", + "type": "uint32" + }, + { + "internalType": "bytes32", + "name": "_recipient", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "transferRemote", + "outputs": [ + { + "internalType": "bytes32", + "name": "messageId", + "type": "bytes32" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "_domain", + "type": "uint32" + } + ], + "name": "unenrollRemoteRouter", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32[]", + "name": "_domains", + "type": "uint32[]" + } + ], + "name": "unenrollRemoteRouters", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "assets", + "type": "uint256" + }, + { + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "withdraw", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "wrappedToken", + "outputs": [ + { + "internalType": "contract IERC20", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "bytecode": "0x610120604081815234620002f057608082620051ce8038038091620000258285620002f5565b833981010312620002f0576200003b826200032f565b91602080820151916200005560608583015192016200032f565b92833b15620002ac576001600160a01b039384166080819052855163234d8e3d60e21b8152908490829060049082905afa908115620002a15760009162000259575b5060a05260338054336001600160a01b0319821681179092558651919086167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a3811515806200024f575b156200020d575060c05260e052833b15620001c057506101009216825251614e899182620003458339608051828181610c7f01528181611b49015281816123600152614112015260a051826117f4015260c051828181611a90015281816123f30152612904015260e05182818161149d01528181611a6e015261241401525181818161036a015281816103fc0152818161089a01528181610f53015281816114ed015281816118ca01528181611a1801528181611fd2015281816130420152818161393201528181613a4101528181613d9d01526148160152f35b60849083519062461bcd60e51b82526004820152602160248201527f4879704552433230436f6c6c61746572616c3a20696e76616c696420746f6b656044820152603760f91b6064820152fd5b62461bcd60e51b815260048101849052601e60248201527f546f6b656e526f757465723a207363616c652063616e6e6f74206265203000006044820152606490fd5b50821515620000e5565b8481813d831162000299575b620002718183620002f5565b810103126200029557519063ffffffff821682036200029257503862000097565b80fd5b5080fd5b503d62000265565b86513d6000823e3d90fd5b845162461bcd60e51b815260048101849052601e60248201527f4d61696c626f78436c69656e743a20696e76616c6964206d61696c626f7800006044820152606490fd5b600080fd5b601f909101601f19168101906001600160401b038211908210176200031957604052565b634e487b7160e01b600052604160045260246000fd5b51906001600160a01b0382168203620002f05756fe608060408181526004918236101561001657600080fd5b600092833560e01c91826301e1d11414612bc25750816306fdde0314612af357816307a2d13a146125a9578163095ea7b314612ac95781630a28a47714612aa95781630c97991914612a695781630e72cc06146129bb57816318160ddd1461299c5781631ba83149146129275781631c2eaac0146128ec57816323b872dd146128af5781632c2d80891461286c5781632ead72f614612838578163313ce567146127dd57816338d52e0f146114c057816339509351146127815781633dfd3873146126d3578163402d267d14610d7057816343bc4b9a1461268f578163440df4f41461262f57816346904840146125db57816349d462ef146125ae5781634cdad506146125a95781634e38a81d1461257757816356d5d475146122f7578163647846a5146122bd5781636a99c33314611ed95781636e553f6514611ea457816370a0823114610c0a578163715018a614611e2457816371a15b3814611d93578163775313a114611d5f57816377e2dc7a14611d2b5781637f5a7c7b14611cf657816381b4e8b4146119ad5781638bd90b82146118185781638d3638f4146117d75781638da5cb5b146117a257816392c18454146116f357816393c448471461169657816394bf804d1461166157816395d89b4114611511578163996c6cc3146114c05781639f0b765914611485578163a457c2d7146113ba578163a9059cbb14611389578163b1bd6436146112c1578163b3d7f6b9146112a1578163b460af94146111f4578163b49c53a7146111c7578163ba0876521461111f578163c0c53b8b14610dae57838263c382711514610d7557508163c63d75b614610d70578163c69c8ce214610ce8578163c6e6f5921461096b578163ce96cb7714610ca3578163d5438eae14610c52578163d905777e14610c0a578163dd62ed3e14610bb4578163de523cf314610b7f578163e74b981b14610a84578163e9198bf914610970578163ef8b30f71461096b578163efae508a1461093e578163f11f4461146108ea578163f14faf6f1461085c578163f2ed8c5314610781578163f2fde38b146106ca578163fa57f1571461052557508063fbaca44c146103925763fc0c546a1461033f57600080fd5b3461038e578160031936011261038e576020905173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b5080fd5b503461038e578060031936011261038e576103ab612cd9565b63ffffffff6103b8612c93565b916103c16133d1565b6103ca816136bc565b5016835260cc602052818320916103f973ffffffffffffffffffffffffffffffffffffffff809316809461435f565b507f0000000000000000000000000000000000000000000000000000000000000000908051926020840186807f095ea7b300000000000000000000000000000000000000000000000000000000938484528860248901527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60448901526044885261048388612e25565b86169287519082855af190610496614ca8565b826104f3575b50816104e8575b50156104ad578580f35b6104df946104da92519160208301526024820152856044820152604481526104d481612e25565b8261490c565b61490c565b38808080808580f35b90503b1515386104a3565b8051919250811591821561050b575b5050903861049c565b61051e925060208091830101910161483a565b3880610502565b8391503461038e578260031936011261038e57803573ffffffffffffffffffffffffffffffffffffffff91828216928383036106c657610563612c93565b61056b6133d1565b1690855180947fdd62ed3e000000000000000000000000000000000000000000000000000000008252308383015283602483015281604460209788935afa9081156106bc57869161068b575b5061062357507f095ea7b3000000000000000000000000000000000000000000000000000000006106209495519384015260248301527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6044830152604482526104da82612e25565b80f35b6084908487519162461bcd60e51b8352820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527f20746f206e6f6e2d7a65726f20616c6c6f77616e6365000000000000000000006064820152fd5b90508481813d83116106b5575b6106a28183612e79565b810103126106b15751876105b7565b8580fd5b503d610698565b87513d88823e3d90fd5b8480fd5b90503461077d57602060031936011261077d576106e5612c70565b916106ee6133d1565b73ffffffffffffffffffffffffffffffffffffffff831615610714578361062084613b5a565b906020608492519162461bcd60e51b8352820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152fd5b8280fd5b50503461038e57602060031936011261038e576108556020926107a2612cd9565b9063ffffffff8216815260ca8552838120549061082860768651936107c685612e41565b83855287519485917e010000000000000000000000000000000000000000000000000000000000008b84015285602284015260428301523360601b6062830152610818815180928c8686019101612bdf565b8101036056810185520183612e79565b73ffffffffffffffffffffffffffffffffffffffff606554169285519161084e83612e41565b82526140ab565b9051908152f35b9050602060031936011261077d577f5d8bc849764969eb1bcc6d0a2f55999d0167c1ccec240a4f39cf664ca9c4148e916108e49135906108be8230337f0000000000000000000000000000000000000000000000000000000000000000614cd8565b6101336108cc838254612fc5565b90555133815260208101919091529081906040820190565b0390a180f35b50503461038e578160031936011261038e5760209073ffffffffffffffffffffffffffffffffffffffff7fe797cab0ddd50f45c2a522220a721ebb6d0f53785d8595512b6122e7164a201f54169051908152f35b83346109685760206003193601126109685761062061095b612cd9565b6109636133d1565b613bc7565b80fd5b612f36565b90503461077d578160031936011261077d5767ffffffffffffffff9080358281116106c6576109a29036908301612d82565b602494919493602435908111610a80576109bf9036908501612d82565b9190926109ca6133d1565b828203610a3e5750865b8181106109df578780f35b610a076109f56109f083858b613150565b61318f565b610a00838688613150565b3590613fc0565b60018101809111156109d45785886011877f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b5162461bcd60e51b8152602081860152600760248201527f216c656e677468000000000000000000000000000000000000000000000000006044820152606490fd5b8680fd5b9190503461077d57602060031936011261077d5773ffffffffffffffffffffffffffffffffffffffff610ab5612c70565b610abd6133d1565b1691308314610b3d57507fbf9a9534339a9d6b81696e05dcfb614b7dc518a31d48be3cfb757988381fb323916020917f721d42344eebce0a76684e8fddd9c81a84afda39f3019e5a078a53853f098d11827fffffffffffffffffffffffff000000000000000000000000000000000000000082541617905551908152a180f35b6020606492519162461bcd60e51b8352820152601c60248201527f46656520726563697069656e742063616e6e6f742062652073656c66000000006044820152fd5b50503461038e578160031936011261038e5760209073ffffffffffffffffffffffffffffffffffffffff606654169051908152f35b50503461038e578060031936011261038e5780602092610bd2612c70565b610bda612c93565b73ffffffffffffffffffffffffffffffffffffffff918216835260d0865283832091168252845220549051908152f35b50503461038e57602060031936011261038e57602090610855610c2b612c70565b73ffffffffffffffffffffffffffffffffffffffff1660005260cf60205260406000205490565b50503461038e578160031936011261038e576020905173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b50503461038e57602060031936011261038e576108558160209373ffffffffffffffffffffffffffffffffffffffff610cda612c70565b16815260cf8552205461321b565b828434610968578060031936011261096857815191829160cd5480855260208095019460cd83527f83978b4c69c48dd978ab43fe30f077615294f938fb7f936d9eb340e51ea7db2e92905b828210610d5957610d558686610d4b828b0383612e79565b5191829182612cec565b0390f35b835487529586019560019384019390910190610d33565b612d3e565b808434610dab576020600319360112610dab5763ffffffff610d95612cd9565b610d9d6133d1565b16825260cb60205281205580f35b50fd5b90503461077d57606060031936011261077d57610dc9612c70565b90610dd2612c93565b610dda612cb6565b90855460ff8160081c161593848095611112575b80156110fb575b1561109257506020610f3a9392828660017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff007fc47cbcc588c67679e52261c45cc315e56562f8d0ccaba16facb9093ff94987999616178b55611064575b50610e7560ff8a5460081c16610e6781613fe3565b610e7081613fe3565b613fe3565b610e7e33613b5a565b863b15801590611046575b610e9290612f54565b610e9a6133d1565b73ffffffffffffffffffffffffffffffffffffffff80809816917f4eab7b127c764308788622363ad3e9532de3dfba7845bd4f84c125a22544255a847fffffffffffffffffffffffff000000000000000000000000000000000000000094808660655416176065558c51908152a1803b1580159061103c575b610f1c90612f54565b610f246133d1565b16809160665416176066558751908152a1613b5a565b835491610f7d60ff8460081c1691610f5183613fe3565b7f00000000000000000000000000000000000000000000000000000000000000001691610e7081613fe3565b610f8681614d3d565b901561103357905b610101917fffffffffffffffffffffff00000000000000000000000000000000000000000074ff000000000000000000000000000000000000000084549260a01b16911617179055610fde578280f35b7f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498917fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff6020921684555160018152a138808280f35b50601290610f8e565b5080821615610f13565b5073ffffffffffffffffffffffffffffffffffffffff871615610e89565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00001661010117895538610e52565b608490602088519162461bcd60e51b8352820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152fd5b50303b158015610df55750600160ff831614610df5565b50600160ff831610610dee565b90508234610968575061113136612ef4565b9261115d8473ffffffffffffffffffffffffffffffffffffffff1660005260cf60205260406000205490565b831161118457508161117e916111756020969461321b565b94859133613dfe565b51908152f35b606490602086519162461bcd60e51b8352820152601d60248201527f455243343632363a2072656465656d206d6f7265207468616e206d61780000006044820152fd5b50503461038e57600319360112610968576106206111e3612cd9565b6111eb6133d1565b60243590613fc0565b90508234610968575061120636612ef4565b9261123d6112388594939473ffffffffffffffffffffffffffffffffffffffff1660005260cf60205260406000205490565b61321b565b821161125e5750602093918161125561117e93613383565b94859233613dfe565b606490602086519162461bcd60e51b8352820152601f60248201527f455243343632363a207769746864726177206d6f7265207468616e206d6178006044820152fd5b8284346109685760206003193601126109685750610855602092356131f1565b83346109685760208060031936011261038e57823567ffffffffffffffff9384821161138557366023830112156113855781810135948511611385576024916024810190602436918860061b0101116106c65761131c6133d1565b845b868110611329578580f35b61134e61133a6109f0838a866131e1565b86611346848b876131e1565b01359061381f565b600181018091111561131e5783866011857f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b8380fd5b50503461038e578060031936011261038e576020906113b36113a9612c70565b60243590336134f9565b5160018152f35b905082346109685782600319360112610968576113d5612c70565b91836024359233815260d060205281812073ffffffffffffffffffffffffffffffffffffffff8616825260205220549082821061141c576020856113b38585038733613242565b608490602086519162461bcd60e51b8352820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f0000000000000000000000000000000000000000000000000000006064820152fd5b50503461038e578160031936011261038e57602090517f00000000000000000000000000000000000000000000000000000000000000008152f35b50503461038e578160031936011261038e576020905173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b8284346109685780600319360112610968578151918160d3549260018460011c9160018616958615611657575b602096878510811461162b578899509688969785829a5291826000146115e657505060011461158a575b505050610d55929161157b910385612e79565b51928284938452830190612c02565b919086935060d383527f915c3eb987b20e1af620c1403197bf687fb7f18513b3a73fde6e78c7072c41a65b8284106115ce575050508201018161157b610d55611568565b8054848a0186015288955087949093019281016115b5565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00168782015293151560051b8601909301935084925061157b9150610d559050611568565b60248360228c7f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b92607f169261153e565b90503461077d578160031936011261077d5760209250359061117e611684612c93565b9261168e816131f1565b809433613a37565b50503461038e578160031936011261038e578051610d55916116b782612dda565b600682527f31312e312e300000000000000000000000000000000000000000000000000000602083015251918291602083526020830190612c02565b50503461038e57602060031936011261038e5760207fd6e2f80c31feccfd7c896d69ad9963871021131ff84f2a9828b40bad60dd8cb49173ffffffffffffffffffffffffffffffffffffffff611747612c70565b61174f6133d1565b16907fe797cab0ddd50f45c2a522220a721ebb6d0f53785d8595512b6122e7164a201f827fffffffffffffffffffffffff000000000000000000000000000000000000000082541617905551908152a180f35b50503461038e578160031936011261038e5760209073ffffffffffffffffffffffffffffffffffffffff603354169051908152f35b50503461038e578160031936011261038e576020905163ffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b828434610968579061182936612db3565b93909192611835613001565b9481519361184285612e25565b60038552602095845b60608110611985575082826118c592611867836118f096614852565b9a6118986118758284614882565b9c73ffffffffffffffffffffffffffffffffffffffff9d8e6065541691856140ab565b8c8951926118a584612dda565b1682528b8201526118b58a6131a0565b526118bf896131a0565b50613c55565b9050877f00000000000000000000000000000000000000000000000000000000000000001692612fc5565b8251906118fc82612dda565b8282528682015261190c856131ad565b52611916846131ad565b5081519061192382612dda565b81528285820152611933846131bd565b5261193d836131bd565b5080519380850191818652845180935281818701950193905b8382106119635786860387f35b8451805189168752830151868401529485019493820193600190910190611956565b9684959781955161199581612dda565b898152898382015282828a010152019694939661184b565b83836119b836612db3565b909473ffffffffffffffffffffffffffffffffffffffff807fe797cab0ddd50f45c2a522220a721ebb6d0f53785d8595512b6122e7164a201f5416936119fc613001565b9488611a09868285613c55565b611a138189612fc5565b938a8c7f0000000000000000000000000000000000000000000000000000000000000000928a8c8b86169883611be1575b50505050505084611a589130903390614cd8565b80611bd1575b505015611bbe5750611ab534945b7f0000000000000000000000000000000000000000000000000000000000000000907f000000000000000000000000000000000000000000000000000000000000000090614a12565b93611aff611ac3868b614852565b96885196875260209a8b977fd229aacb94204188fe8042965fa6b269c62dc5818b21238779ab64bdd17efeec8963ffffffff881692a383614882565b93611b458460655416611b11856136bc565b968a51998a98899788967f10b83dc00000000000000000000000000000000000000000000000000000000088528701614054565b03927f0000000000000000000000000000000000000000000000000000000000000000165af1928315611bb3578093611b81575b505051908152f35b909192508382813d8311611bac575b611b9a8183612e79565b81010312610968575051908380611b79565b503d611b90565b8251903d90823e3d90fd5b611bcb611ab59134613143565b94611a6c565b611bda916147b2565b8a80611a5e565b611c0791611bf1919b969b614852565b611bfb8a8d614882565b8d60655416918d6140ab565b93308914611cd9579160209391611c2286611c799795612fc5565b9a5b51958694859384937f095ea7b300000000000000000000000000000000000000000000000000000000855284016020909392919373ffffffffffffffffffffffffffffffffffffffff60408201951681520152565b0391895af18015611ccf57918691611a5893611ca0575b8f8f9294508e93508c8c91611a44565b611cc19060203d602011611cc8575b611cb98183612e79565b81019061483a565b508f611c90565b503d611caf565b8c513d8f823e3d90fd5b9891602093918593611cf1611c7997308d3390614cd8565b611c24565b50503461038e578160031936011261038e5760209073ffffffffffffffffffffffffffffffffffffffff606554169051908152f35b50503461038e57602060031936011261038e578060209263ffffffff611d4f612cd9565b16815260cb845220549051908152f35b50503461038e57602060031936011261038e578060209263ffffffff611d83612cd9565b16815260ca845220549051908152f35b833461096857602060031936011261096857813567ffffffffffffffff811161038e57611dc39036908401612d82565b611dce9391936133d1565b825b818110611ddb578380f35b611dec6109636109f0838589613150565b6001810180911115611dd0576024846011857f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b8334610968578060031936011261096857611e3d6133d1565b8073ffffffffffffffffffffffffffffffffffffffff6033547fffffffffffffffffffffffff00000000000000000000000000000000000000008116603355167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b90503461077d578160031936011261077d5760209250359061117e611ec7612c93565b611ed0846133aa565b93849133613a37565b8284606060031936011261096857611eef612cd9565b9260243591611efc612cb6565b33825260209260ce8452858320541561227b5763ffffffff87169687845260cc855286842093611f5473ffffffffffffffffffffffffffffffffffffffff809516809660019160005201602052604060002054151590565b156122395788815260cb865287812054801561222a575b8851987f8bd90b82000000000000000000000000000000000000000000000000000000008a52828a80611fb98c86898b850160409194939263ffffffff606083019616825260208201520152565b03818a5afa998a1561222057839a6121fc575b5099899a7f000000000000000000000000000000000000000000000000000000000000000099878b1698859b8d87905b51811015612048578e8c8c61201184846131cd565b51511614612024575b506001018e611ffc565b819e8e61203660019461203f946131cd565b51015190612fc5565b9d90508e61201a565b508d9b989a5082908d9a989a8281116121dd575b5050508598865b8c518110156120a5578c8961207883836131cd565b5151161561208a575b50600101612063565b819b8b61203660019461209c946131cd565b9a90508c612081565b5090889392918a8c4782116121765785517f81b4e8b400000000000000000000000000000000000000000000000000000000815263ffffffff90931690830190815260208101899052604081018590529192869284928391829060600103925af1801561216c57612142575b507fb1e1b117ddf429b1b8a359fe0e978f0ae191c0f70e0babfea7acaad1b0ee8a2d9282519586528501523393a380f35b8390813d8311612165575b6121578183612e79565b810103126106b15786612111565b503d61214d565b83513d89823e3d90fd5b6084908787519162461bcd60e51b83528201526024808201527f526562616c616e6365206e61746976652066656520657863656564732062616c60448201527f616e6365000000000000000000000000000000000000000000000000000000006064820152fd5b6121f4926121ea91613143565b9030903390614cd8565b818c8061205c565b612219919a503d8085833e6122118183612e79565b810190613083565b988b611fcc565b81513d85823e3d90fd5b50612234826136bc565b611f6b565b606483878a519162461bcd60e51b8352820152601760248201527f4d43523a204e6f7420616c6c6f776564206272696467650000000000000000006044820152fd5b6064908487519162461bcd60e51b8352820152601460248201527f4d43523a204f6e6c7920526562616c616e6365720000000000000000000000006044820152fd5b50503461038e578160031936011261038e5760209073ffffffffffffffffffffffffffffffffffffffff6122ef613001565b915191168152f35b839150606060031936011261038e5761230e612cd9565b67ffffffffffffffff91604435919060248484116106b157366023850112156106b157838201359485116106b157368186860101116106b15773ffffffffffffffffffffffffffffffffffffffff93847f000000000000000000000000000000000000000000000000000000000000000016330361250f578135612391856136bc565b036124a75785602011610a805781810135958811610a8057604486910135937fba20947a325f450d232530e5f5fce293e7963499d5309a07cee84a269f2f15a6602063ffffffff8b51938885521692a3838511612440578561062086866124397f00000000000000000000000000000000000000000000000000000000000000007f000000000000000000000000000000000000000000000000000000000000000089614a12565b91166147b2565b60849250602087519262461bcd60e51b8452830152808201527f5479706543617374733a2062797465733332546f41646472657373206f76657260448201527f666c6f77000000000000000000000000000000000000000000000000000000006064820152fd5b60848360258460208c519362461bcd60e51b85528401528201527f456e726f6c6c656420726f7574657220646f6573206e6f74206d61746368207360448201527f656e6465720000000000000000000000000000000000000000000000000000006064820152fd5b60848360218460208c519362461bcd60e51b85528401528201527f4d61696c626f78436c69656e743a2073656e646572206e6f74206d61696c626f60448201527f78000000000000000000000000000000000000000000000000000000000000006064820152fd5b50503461038e5760031936011261096857610620612593612cd9565b61259b612c93565b906125a46133d1565b61388c565b612c45565b50503461038e57600319360112610968576106206125ca612cd9565b6125d26133d1565b6024359061381f565b50503461038e578160031936011261038e5760209073ffffffffffffffffffffffffffffffffffffffff7f721d42344eebce0a76684e8fddd9c81a84afda39f3019e5a078a53853f098d1154169051908152f35b50503461038e578160031936011261038e5761264961370d565b815192839260208080860192818752855180945286019401925b82811061267257505050500390f35b835163ffffffff1685528695509381019392810192600101612663565b8334610968576020600319360112610968576126cf73ffffffffffffffffffffffffffffffffffffffff6126c1612c70565b6126c96133d1565b1661443f565b5080f35b50503461038e57602060031936011261038e5760207f4eab7b127c764308788622363ad3e9532de3dfba7845bd4f84c125a22544255a9173ffffffffffffffffffffffffffffffffffffffff612727612c70565b803b15801590612777575b61273b90612f54565b6127436133d1565b1690817fffffffffffffffffffffffff0000000000000000000000000000000000000000606554161760655551908152a180f35b5080821615612732565b50503461038e578060031936011261038e576113b36020926127d66127a4612c70565b9133815260d0865284812073ffffffffffffffffffffffffffffffffffffffff84168252865284602435912054612fc5565b9033613242565b83833461038e578160031936011261038e5760ff6101015460a01c169160ff831161280c576020838351908152f35b806011857f4e487b71000000000000000000000000000000000000000000000000000000006024945252fd5b50503461038e57602060031936011261038e5760209061286463ffffffff61285e612cd9565b1661440f565b915191825250f35b50503461038e578060031936011261038e5763ffffffff61288b612cd9565b6128936133d1565b61289c816136bc565b5016825260cb6020526024359082205580f35b50503461038e57606060031936011261038e576020906113b36128d0612c70565b6128d8612c93565b604435916128e7833383613436565b6134f9565b50503461038e578160031936011261038e57602090517f00000000000000000000000000000000000000000000000000000000000000008152f35b50503461038e57602090602060031936011261077d5763ffffffff61294a612cd9565b16835260cc60205280832092815180936020865492838152019583526020832092905b82821061298557610d558686610d4b828b0383612e79565b83548752958601956001938401939091019061296d565b50503461038e578160031936011261038e5760209060d1549051908152f35b50503461038e57602060031936011261038e5760207fc47cbcc588c67679e52261c45cc315e56562f8d0ccaba16facb9093ff94987999173ffffffffffffffffffffffffffffffffffffffff612a0f612c70565b803b15801590612a5f575b612a2390612f54565b612a2b6133d1565b1690817fffffffffffffffffffffffff0000000000000000000000000000000000000000606654161760665551908152a180f35b5080821615612a1a565b8334610968576020600319360112610968576126cf73ffffffffffffffffffffffffffffffffffffffff612a9b612c70565b612aa36133d1565b16614254565b828434610968576020600319360112610968575061085560209235613383565b50503461038e578060031936011261038e576020906113b3612ae9612c70565b6024359033613242565b8284346109685780600319360112610968578151918160d2549260018460011c9160018616958615612bb8575b602096878510811461162b578899509688969785829a5291826000146115e6575050600114612b5c57505050610d55929161157b910385612e79565b919086935060d283527ff2192e1030363415d7b4fb0406540a0060e8e2fc8982f3f32289379e11fa65465b828410612ba0575050508201018161157b610d55611568565b8054848a018601528895508794909301928101612b87565b92607f1692612b20565b84903461038e578160031936011261038e57602090610133548152f35b60005b838110612bf25750506000910152565b8181015183820152602001612be2565b907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f602093612c3e81518092818752878088019101612bdf565b0116010190565b34612c6b576020600319360112612c6b576020612c6360043561321b565b604051908152f35b600080fd5b6004359073ffffffffffffffffffffffffffffffffffffffff82168203612c6b57565b6024359073ffffffffffffffffffffffffffffffffffffffff82168203612c6b57565b6044359073ffffffffffffffffffffffffffffffffffffffff82168203612c6b57565b6004359063ffffffff82168203612c6b57565b602090602060408183019282815285518094520193019160005b828110612d14575050505090565b835173ffffffffffffffffffffffffffffffffffffffff1685529381019392810192600101612d06565b34612c6b576020600319360112612c6b57612d57612c70565b5060206040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8152f35b9181601f84011215612c6b5782359167ffffffffffffffff8311612c6b576020808501948460051b010111612c6b57565b6003196060910112612c6b5760043563ffffffff81168103612c6b57906024359060443590565b6040810190811067ffffffffffffffff821117612df657604052565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6080810190811067ffffffffffffffff821117612df657604052565b6020810190811067ffffffffffffffff821117612df657604052565b60a0810190811067ffffffffffffffff821117612df657604052565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff821117612df657604052565b67ffffffffffffffff8111612df657601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b6003196060910112612c6b576004359073ffffffffffffffffffffffffffffffffffffffff906024358281168103612c6b57916044359081168103612c6b5790565b34612c6b576020600319360112612c6b576020612c636004356133aa565b15612f5b57565b608460405162461bcd60e51b815260206004820152602760248201527f4d61696c626f78436c69656e743a20696e76616c696420636f6e74726163742060448201527f73657474696e67000000000000000000000000000000000000000000000000006064820152fd5b91908201809211612fd257565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7fe797cab0ddd50f45c2a522220a721ebb6d0f53785d8595512b6122e7164a201f5473ffffffffffffffffffffffffffffffffffffffff90811615613065577f00000000000000000000000000000000000000000000000000000000000000001690565b50600090565b67ffffffffffffffff8111612df65760051b60200190565b906020918281830312612c6b5780519067ffffffffffffffff8211612c6b570181601f82011215612c6b578051926130ba8461306b565b936040936130cb6040519687612e79565b818652828087019260061b85010193818511612c6b578301915b8483106130f55750505050505090565b8583830312612c6b5785519061310a82612dda565b83519073ffffffffffffffffffffffffffffffffffffffff82168203612c6b5782869289945282860151838201528152019201916130e5565b91908203918211612fd257565b91908110156131605760051b0190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b3563ffffffff81168103612c6b5790565b8051156131605760200190565b8051600110156131605760400190565b8051600210156131605760600190565b80518210156131605760209160051b010190565b91908110156131605760061b0190565b6101335460018101809111612fd25760d1549060018201809211612fd25761321892614175565b90565b6101335460018101809111612fd25760d1549060018201809211612fd25761321892614a12565b73ffffffffffffffffffffffffffffffffffffffff80911691821561331a57169182156132b05760207f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925918360005260d08252604060002085600052825280604060002055604051908152a3565b608460405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f73730000000000000000000000000000000000000000000000000000000000006064820152fd5b608460405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152fd5b60d15460018101809111612fd257610133549060018201809211612fd25761321892614175565b60d15460018101809111612fd257610133549060018201809211612fd25761321892614a12565b73ffffffffffffffffffffffffffffffffffffffff6033541633036133f257565b606460405162461bcd60e51b815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b9073ffffffffffffffffffffffffffffffffffffffff80831660005260d06020526040600020908216600052602052604060002054927fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff840361349a575b50505050565b8084106134b5576134ac930391613242565b38808080613494565b606460405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152fd5b73ffffffffffffffffffffffffffffffffffffffff80911691821561365257169182156135e857600082815260cf60205260408120549180831061357e57604082827fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef95876020965260cf8652038282205586815220818154019055604051908152a3565b608460405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e636500000000000000000000000000000000000000000000000000006064820152fd5b608460405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152fd5b608460405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152fd5b63ffffffff16906136cc8261440f565b90613709576137056136e56136e085614af8565b6143bb565b60405191829162461bcd60e51b8352602060048401526024830190612c02565b0390fd5b9150565b6097549061371a8261306b565b916137286040519384612e79565b8083526137348161306b565b907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe080920136602086013760005b8181106137cf57505082519061379061377a8361306b565b926137886040519485612e79565b80845261306b565b013660208301378060005b84518110156137c9578063ffffffff6137b6600193886131cd565b51166137c282866131cd565b520161379b565b50925050565b806137db6001926141ce565b90549060031b1c6137ec82886131cd565b5201613762565b156137fb5750565b6137059060405191829162461bcd60e51b8352602060048401526024830190612c02565b7fc3de732a98b24a2b5c6f67e8a7fb057ffc14046b83968a2c73e4148d2fba978b9163ffffffff60409216908160005260986020526138708360002054151561386a6136e085614af8565b906137f3565b8160005260ca60205280836000205582519182526020820152a1565b9063ffffffff918260009116815260cc60209160cc835260409160408220936138cd73ffffffffffffffffffffffffffffffffffffffff8097168096614659565b506138d661370d565b96835b885181101561392757816138ed828b6131cd565b511685528383526139108787872060019160005201602052604060002054151590565b61391c576001016138d9565b505050505050505050565b5050939550509290507f0000000000000000000000000000000000000000000000000000000000000000916040519381850181807f095ea7b300000000000000000000000000000000000000000000000000000000958684528960248a01528160448a01526044895261399989612e25565b87169288519082855af1906139ac614ca8565b82613a04575b50816139f9575b50156139c8575b505050505050565b6139ee956104da936040519384015260248301526044820152604481526104d481612e25565b3880808080806139c0565b90503b1515386139b9565b809192505190848215928315613a1f575b50505090386139b2565b613a2f935082018101910161483a565b388481613a15565b9092613a658330337f0000000000000000000000000000000000000000000000000000000000000000614cd8565b610133613a73848254612fc5565b905573ffffffffffffffffffffffffffffffffffffffff809416938415613b16577fdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d79282613ac560409460d154612fc5565b60d1558660005260cf602052836000208181540190558660007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60208751858152a3835195865260208601521692a3565b606460405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152fd5b6033549073ffffffffffffffffffffffffffffffffffffffff80911691827fffffffffffffffffffffffff0000000000000000000000000000000000000000821617603355167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a3565b63ffffffff166000818152602060cb60205260409082604081205560cc60205260408320918254908460019360018601915b848110613c32575050505050509080613c309392558181526099602052604081205561386a6136e0613c2a83614592565b92614af8565b565b80613c3e87928961423c565b90549060031b1c8952838352888581205501613bf9565b92919073ffffffffffffffffffffffffffffffffffffffff90817f721d42344eebce0a76684e8fddd9c81a84afda39f3019e5a078a53853f098d115416948515613df5576040517f8bd90b8200000000000000000000000000000000000000000000000000000000815263ffffffff919091166004820152602481019190915260448101929092526000826064818785165afa918215613de957600092613dcc575b5081518015613dc4576001149081613d8b575b5015613d2157613d1b6020916131a0565b51015190565b608460405162461bcd60e51b815260206004820152602960248201527f46756e6769626c65546f6b656e526f757465723a20666565206d757374206d6160448201527f74636820746f6b656e00000000000000000000000000000000000000000000006064820152fd5b809150613d97836131a0565b515116907f0000000000000000000000000000000000000000000000000000000000000000161438613d0a565b505050600090565b613de29192503d806000833e6122118183612e79565b9038613cf7565b6040513d6000823e3d90fd5b50505050600090565b91939073ffffffffffffffffffffffffffffffffffffffff90818616958383861695888703613faf575b5050508515613f45578560005260cf6020526040928360002054818110613edc5790807ffbde797d201c681b91056529119e0b02407c7bb96a4a2c75c01fc9667232c8db959493928960005260cf6020520384600020558060d1540360d1556000887fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60208751858152a3610133613ec1888254613143565b9055613ecd87836147b2565b835196875260208701521693a4565b6084855162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f63650000000000000000000000000000000000000000000000000000000000006064820152fd5b608460405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f73000000000000000000000000000000000000000000000000000000000000006064820152fd5b613fb892613436565b388381613e28565b9063ffffffff613fe092169081600052609960205260406000205561430d565b50565b15613fea57565b608460405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e670000000000000000000000000000000000000000006064820152fd5b9361409660809473ffffffffffffffffffffffffffffffffffffffff9463ffffffff6140a4959a999a168852602088015260a0604088015260a0870190612c02565b908582036060870152612c02565b9416910152565b6020929391936140ba826136bc565b9261410e73ffffffffffffffffffffffffffffffffffffffff938493604051988997889687967f81d2ea95000000000000000000000000000000000000000000000000000000008852169360048701614054565b03917f0000000000000000000000000000000000000000000000000000000000000000165afa908115613de957600091614146575090565b90506020813d60201161416d575b8161416160209383612e79565b81010312612c6b575190565b3d9150614154565b9190614182828285614a12565b92821561419f57096141915790565b60018101809111612fd25790565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6097548110156131605760976000527f354a83ed9988f79f6038d4c7a7dadbad8af32f4ad6df893e0e5807a1b1944ff90190600090565b60cd548110156131605760cd6000527f83978b4c69c48dd978ab43fe30f077615294f938fb7f936d9eb340e51ea7db2e0190600090565b80548210156131605760005260206000200190600090565b600081815260ce60205260408120546143085760cd54680100000000000000008110156142db5790826142c76142928460016040960160cd55614205565b81939154907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9060031b92831b921b19161790565b905560cd5492815260ce6020522055600190565b6024827f4e487b710000000000000000000000000000000000000000000000000000000081526041600452fd5b905090565b60008181526098602052604081205461430857609754680100000000000000008110156142db57908261434b614292846001604096016097556141ce565b905560975492815260986020522055600190565b60008281526001820160205260409020546143b45780549068010000000000000000821015612df6578261439d61429284600180960185558461423c565b905580549260005201602052604060002055600190565b5050600090565b90613c30603f60405180947f4e6f20726f7574657220656e726f6c6c656420666f7220646f6d61696e3a200060208301526143ff8151809260208686019101612bdf565b810103601f810185520183612e79565b6000526099602052604060002054801560001461443a57506098602052604060002054151590600090565b600191565b600081815260ce6020526040812054909190801561458d577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff908181018181116145605760cd5490838201918211614533578082036144ff575b50505060cd5480156144d2578101906144b182614205565b909182549160031b1b1916905560cd55815260ce6020526040812055600190565b6024847f4e487b710000000000000000000000000000000000000000000000000000000081526031600452fd5b61451d61450e61429293614205565b90549060031b1c928392614205565b9055845260ce6020526040842055388080614499565b6024867f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b6024857f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b505090565b600081815260986020526040812054909190801561458d577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90818101818111614560576097549083820191821161453357808203614625575b50505060975480156144d257810190614604826141ce565b909182549160031b1b19169055609755815260986020526040812055600190565b614643614634614292936141ce565b90549060031b1c9283926141ce565b90558452609860205260408420553880806145ec565b906001820190600092818452826020526040842054908115156000146147ab577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9182810181811161477e578254908482019182116147515780820361471c575b505050805480156146ef578201916146d2838361423c565b909182549160031b1b191690555582526020526040812055600190565b6024867f4e487b710000000000000000000000000000000000000000000000000000000081526031600452fd5b61473c61472c614292938661423c565b90549060031b1c9283928661423c565b905586528460205260408620553880806146ba565b6024887f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b6024877f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b5050505090565b6040517fa9059cbb00000000000000000000000000000000000000000000000000000000602082015273ffffffffffffffffffffffffffffffffffffffff919091166024820152604480820192909252908152613c3090614814606482612e79565b7f000000000000000000000000000000000000000000000000000000000000000061490c565b90816020910312612c6b57518015158103612c6b5790565b906040519160208301526040820152604081526060810181811067ffffffffffffffff821117612df65760405290565b63ffffffff1660005260ca6020527fffffffffffffffffffffffffffffffffffffffff00000000000000000000000060406000205491604051927e0100000000000000000000000000000000000000000000000000000000000060208501526000602285015260428401523360601b606284015260601b166076820152606a815261321881612e5d565b6040516149779173ffffffffffffffffffffffffffffffffffffffff1661493282612dda565b6000806020958685527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656487860152868151910182855af1614971614ca8565b91614ddf565b8051908282159283156149fa575b505050156149905750565b6084906040519062461bcd60e51b82526004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152fd5b614a0a935082018101910161483a565b388281614985565b917fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8284099282810292838086109503948086039514614aea5784831115614aa6578291096001821901821680920460028082600302188083028203028083028203028083028203028083028203028083028203028092029003029360018380600003040190848311900302920304170290565b606460405162461bcd60e51b815260206004820152601560248201527f4d6174683a206d756c446976206f766572666c6f7700000000000000000000006044820152fd5b50508092501561419f570490565b806000917a184f03e93ff9f4daa797ed6e38ed64bf6a1f01000000000000000080821015614c9a575b506d04ee2d6d415b85acef810000000080831015614c8b575b50662386f26fc1000080831015614c7c575b506305f5e10080831015614c6d575b5061271080831015614c5e575b506064821015614c4e575b600a80921015614c44575b60019081602160018601957fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0614bcc614bb689612eba565b98614bc46040519a8b612e79565b808a52612eba565b01366020890137860101905b614be3575050505090565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff849101917f30313233343536373839616263646566000000000000000000000000000000008282061a835304918215614c3f57919082614bd8565b6147ab565b9160010191614b7e565b9190606460029104910191614b73565b60049193920491019138614b68565b60089193920491019138614b5b565b60109193920491019138614b4c565b60209193920491019138614b3a565b604093508104915038614b21565b3d15614cd3573d90614cb982612eba565b91614cc76040519384612e79565b82523d6000602084013e565b606090565b9092613c3093604051937f23b872dd00000000000000000000000000000000000000000000000000000000602086015273ffffffffffffffffffffffffffffffffffffffff80921660248601521660448401526064830152606482526104da82612e5d565b9073ffffffffffffffffffffffffffffffffffffffff60405160208101937f313ce56700000000000000000000000000000000000000000000000000000000855260048252614d8b82612dda565b600094859384935192165afa614d9f614ca8565b9080614dd3575b614db0575b508190565b60208180518101031261077d576020015160ff8111614dab576001925060ff1690565b50602081511015614da6565b91929015614e405750815115614df3575090565b3b15614dfc5790565b606460405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152fd5b8251909150156137fb5750805190602001fdfea2646970667358221220fff7c6ea8a7092050b25017d99af2003242bc5debebef21a98b3e9edb881af6664736f6c63430008160033", + "deployedBytecode": "0x608060408181526004918236101561001657600080fd5b600092833560e01c91826301e1d11414612bc25750816306fdde0314612af357816307a2d13a146125a9578163095ea7b314612ac95781630a28a47714612aa95781630c97991914612a695781630e72cc06146129bb57816318160ddd1461299c5781631ba83149146129275781631c2eaac0146128ec57816323b872dd146128af5781632c2d80891461286c5781632ead72f614612838578163313ce567146127dd57816338d52e0f146114c057816339509351146127815781633dfd3873146126d3578163402d267d14610d7057816343bc4b9a1461268f578163440df4f41461262f57816346904840146125db57816349d462ef146125ae5781634cdad506146125a95781634e38a81d1461257757816356d5d475146122f7578163647846a5146122bd5781636a99c33314611ed95781636e553f6514611ea457816370a0823114610c0a578163715018a614611e2457816371a15b3814611d93578163775313a114611d5f57816377e2dc7a14611d2b5781637f5a7c7b14611cf657816381b4e8b4146119ad5781638bd90b82146118185781638d3638f4146117d75781638da5cb5b146117a257816392c18454146116f357816393c448471461169657816394bf804d1461166157816395d89b4114611511578163996c6cc3146114c05781639f0b765914611485578163a457c2d7146113ba578163a9059cbb14611389578163b1bd6436146112c1578163b3d7f6b9146112a1578163b460af94146111f4578163b49c53a7146111c7578163ba0876521461111f578163c0c53b8b14610dae57838263c382711514610d7557508163c63d75b614610d70578163c69c8ce214610ce8578163c6e6f5921461096b578163ce96cb7714610ca3578163d5438eae14610c52578163d905777e14610c0a578163dd62ed3e14610bb4578163de523cf314610b7f578163e74b981b14610a84578163e9198bf914610970578163ef8b30f71461096b578163efae508a1461093e578163f11f4461146108ea578163f14faf6f1461085c578163f2ed8c5314610781578163f2fde38b146106ca578163fa57f1571461052557508063fbaca44c146103925763fc0c546a1461033f57600080fd5b3461038e578160031936011261038e576020905173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b5080fd5b503461038e578060031936011261038e576103ab612cd9565b63ffffffff6103b8612c93565b916103c16133d1565b6103ca816136bc565b5016835260cc602052818320916103f973ffffffffffffffffffffffffffffffffffffffff809316809461435f565b507f0000000000000000000000000000000000000000000000000000000000000000908051926020840186807f095ea7b300000000000000000000000000000000000000000000000000000000938484528860248901527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60448901526044885261048388612e25565b86169287519082855af190610496614ca8565b826104f3575b50816104e8575b50156104ad578580f35b6104df946104da92519160208301526024820152856044820152604481526104d481612e25565b8261490c565b61490c565b38808080808580f35b90503b1515386104a3565b8051919250811591821561050b575b5050903861049c565b61051e925060208091830101910161483a565b3880610502565b8391503461038e578260031936011261038e57803573ffffffffffffffffffffffffffffffffffffffff91828216928383036106c657610563612c93565b61056b6133d1565b1690855180947fdd62ed3e000000000000000000000000000000000000000000000000000000008252308383015283602483015281604460209788935afa9081156106bc57869161068b575b5061062357507f095ea7b3000000000000000000000000000000000000000000000000000000006106209495519384015260248301527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6044830152604482526104da82612e25565b80f35b6084908487519162461bcd60e51b8352820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527f20746f206e6f6e2d7a65726f20616c6c6f77616e6365000000000000000000006064820152fd5b90508481813d83116106b5575b6106a28183612e79565b810103126106b15751876105b7565b8580fd5b503d610698565b87513d88823e3d90fd5b8480fd5b90503461077d57602060031936011261077d576106e5612c70565b916106ee6133d1565b73ffffffffffffffffffffffffffffffffffffffff831615610714578361062084613b5a565b906020608492519162461bcd60e51b8352820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152fd5b8280fd5b50503461038e57602060031936011261038e576108556020926107a2612cd9565b9063ffffffff8216815260ca8552838120549061082860768651936107c685612e41565b83855287519485917e010000000000000000000000000000000000000000000000000000000000008b84015285602284015260428301523360601b6062830152610818815180928c8686019101612bdf565b8101036056810185520183612e79565b73ffffffffffffffffffffffffffffffffffffffff606554169285519161084e83612e41565b82526140ab565b9051908152f35b9050602060031936011261077d577f5d8bc849764969eb1bcc6d0a2f55999d0167c1ccec240a4f39cf664ca9c4148e916108e49135906108be8230337f0000000000000000000000000000000000000000000000000000000000000000614cd8565b6101336108cc838254612fc5565b90555133815260208101919091529081906040820190565b0390a180f35b50503461038e578160031936011261038e5760209073ffffffffffffffffffffffffffffffffffffffff7fe797cab0ddd50f45c2a522220a721ebb6d0f53785d8595512b6122e7164a201f54169051908152f35b83346109685760206003193601126109685761062061095b612cd9565b6109636133d1565b613bc7565b80fd5b612f36565b90503461077d578160031936011261077d5767ffffffffffffffff9080358281116106c6576109a29036908301612d82565b602494919493602435908111610a80576109bf9036908501612d82565b9190926109ca6133d1565b828203610a3e5750865b8181106109df578780f35b610a076109f56109f083858b613150565b61318f565b610a00838688613150565b3590613fc0565b60018101809111156109d45785886011877f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b5162461bcd60e51b8152602081860152600760248201527f216c656e677468000000000000000000000000000000000000000000000000006044820152606490fd5b8680fd5b9190503461077d57602060031936011261077d5773ffffffffffffffffffffffffffffffffffffffff610ab5612c70565b610abd6133d1565b1691308314610b3d57507fbf9a9534339a9d6b81696e05dcfb614b7dc518a31d48be3cfb757988381fb323916020917f721d42344eebce0a76684e8fddd9c81a84afda39f3019e5a078a53853f098d11827fffffffffffffffffffffffff000000000000000000000000000000000000000082541617905551908152a180f35b6020606492519162461bcd60e51b8352820152601c60248201527f46656520726563697069656e742063616e6e6f742062652073656c66000000006044820152fd5b50503461038e578160031936011261038e5760209073ffffffffffffffffffffffffffffffffffffffff606654169051908152f35b50503461038e578060031936011261038e5780602092610bd2612c70565b610bda612c93565b73ffffffffffffffffffffffffffffffffffffffff918216835260d0865283832091168252845220549051908152f35b50503461038e57602060031936011261038e57602090610855610c2b612c70565b73ffffffffffffffffffffffffffffffffffffffff1660005260cf60205260406000205490565b50503461038e578160031936011261038e576020905173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b50503461038e57602060031936011261038e576108558160209373ffffffffffffffffffffffffffffffffffffffff610cda612c70565b16815260cf8552205461321b565b828434610968578060031936011261096857815191829160cd5480855260208095019460cd83527f83978b4c69c48dd978ab43fe30f077615294f938fb7f936d9eb340e51ea7db2e92905b828210610d5957610d558686610d4b828b0383612e79565b5191829182612cec565b0390f35b835487529586019560019384019390910190610d33565b612d3e565b808434610dab576020600319360112610dab5763ffffffff610d95612cd9565b610d9d6133d1565b16825260cb60205281205580f35b50fd5b90503461077d57606060031936011261077d57610dc9612c70565b90610dd2612c93565b610dda612cb6565b90855460ff8160081c161593848095611112575b80156110fb575b1561109257506020610f3a9392828660017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff007fc47cbcc588c67679e52261c45cc315e56562f8d0ccaba16facb9093ff94987999616178b55611064575b50610e7560ff8a5460081c16610e6781613fe3565b610e7081613fe3565b613fe3565b610e7e33613b5a565b863b15801590611046575b610e9290612f54565b610e9a6133d1565b73ffffffffffffffffffffffffffffffffffffffff80809816917f4eab7b127c764308788622363ad3e9532de3dfba7845bd4f84c125a22544255a847fffffffffffffffffffffffff000000000000000000000000000000000000000094808660655416176065558c51908152a1803b1580159061103c575b610f1c90612f54565b610f246133d1565b16809160665416176066558751908152a1613b5a565b835491610f7d60ff8460081c1691610f5183613fe3565b7f00000000000000000000000000000000000000000000000000000000000000001691610e7081613fe3565b610f8681614d3d565b901561103357905b610101917fffffffffffffffffffffff00000000000000000000000000000000000000000074ff000000000000000000000000000000000000000084549260a01b16911617179055610fde578280f35b7f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498917fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff6020921684555160018152a138808280f35b50601290610f8e565b5080821615610f13565b5073ffffffffffffffffffffffffffffffffffffffff871615610e89565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00001661010117895538610e52565b608490602088519162461bcd60e51b8352820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152fd5b50303b158015610df55750600160ff831614610df5565b50600160ff831610610dee565b90508234610968575061113136612ef4565b9261115d8473ffffffffffffffffffffffffffffffffffffffff1660005260cf60205260406000205490565b831161118457508161117e916111756020969461321b565b94859133613dfe565b51908152f35b606490602086519162461bcd60e51b8352820152601d60248201527f455243343632363a2072656465656d206d6f7265207468616e206d61780000006044820152fd5b50503461038e57600319360112610968576106206111e3612cd9565b6111eb6133d1565b60243590613fc0565b90508234610968575061120636612ef4565b9261123d6112388594939473ffffffffffffffffffffffffffffffffffffffff1660005260cf60205260406000205490565b61321b565b821161125e5750602093918161125561117e93613383565b94859233613dfe565b606490602086519162461bcd60e51b8352820152601f60248201527f455243343632363a207769746864726177206d6f7265207468616e206d6178006044820152fd5b8284346109685760206003193601126109685750610855602092356131f1565b83346109685760208060031936011261038e57823567ffffffffffffffff9384821161138557366023830112156113855781810135948511611385576024916024810190602436918860061b0101116106c65761131c6133d1565b845b868110611329578580f35b61134e61133a6109f0838a866131e1565b86611346848b876131e1565b01359061381f565b600181018091111561131e5783866011857f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b8380fd5b50503461038e578060031936011261038e576020906113b36113a9612c70565b60243590336134f9565b5160018152f35b905082346109685782600319360112610968576113d5612c70565b91836024359233815260d060205281812073ffffffffffffffffffffffffffffffffffffffff8616825260205220549082821061141c576020856113b38585038733613242565b608490602086519162461bcd60e51b8352820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f0000000000000000000000000000000000000000000000000000006064820152fd5b50503461038e578160031936011261038e57602090517f00000000000000000000000000000000000000000000000000000000000000008152f35b50503461038e578160031936011261038e576020905173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b8284346109685780600319360112610968578151918160d3549260018460011c9160018616958615611657575b602096878510811461162b578899509688969785829a5291826000146115e657505060011461158a575b505050610d55929161157b910385612e79565b51928284938452830190612c02565b919086935060d383527f915c3eb987b20e1af620c1403197bf687fb7f18513b3a73fde6e78c7072c41a65b8284106115ce575050508201018161157b610d55611568565b8054848a0186015288955087949093019281016115b5565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00168782015293151560051b8601909301935084925061157b9150610d559050611568565b60248360228c7f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b92607f169261153e565b90503461077d578160031936011261077d5760209250359061117e611684612c93565b9261168e816131f1565b809433613a37565b50503461038e578160031936011261038e578051610d55916116b782612dda565b600682527f31312e312e300000000000000000000000000000000000000000000000000000602083015251918291602083526020830190612c02565b50503461038e57602060031936011261038e5760207fd6e2f80c31feccfd7c896d69ad9963871021131ff84f2a9828b40bad60dd8cb49173ffffffffffffffffffffffffffffffffffffffff611747612c70565b61174f6133d1565b16907fe797cab0ddd50f45c2a522220a721ebb6d0f53785d8595512b6122e7164a201f827fffffffffffffffffffffffff000000000000000000000000000000000000000082541617905551908152a180f35b50503461038e578160031936011261038e5760209073ffffffffffffffffffffffffffffffffffffffff603354169051908152f35b50503461038e578160031936011261038e576020905163ffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b828434610968579061182936612db3565b93909192611835613001565b9481519361184285612e25565b60038552602095845b60608110611985575082826118c592611867836118f096614852565b9a6118986118758284614882565b9c73ffffffffffffffffffffffffffffffffffffffff9d8e6065541691856140ab565b8c8951926118a584612dda565b1682528b8201526118b58a6131a0565b526118bf896131a0565b50613c55565b9050877f00000000000000000000000000000000000000000000000000000000000000001692612fc5565b8251906118fc82612dda565b8282528682015261190c856131ad565b52611916846131ad565b5081519061192382612dda565b81528285820152611933846131bd565b5261193d836131bd565b5080519380850191818652845180935281818701950193905b8382106119635786860387f35b8451805189168752830151868401529485019493820193600190910190611956565b9684959781955161199581612dda565b898152898382015282828a010152019694939661184b565b83836119b836612db3565b909473ffffffffffffffffffffffffffffffffffffffff807fe797cab0ddd50f45c2a522220a721ebb6d0f53785d8595512b6122e7164a201f5416936119fc613001565b9488611a09868285613c55565b611a138189612fc5565b938a8c7f0000000000000000000000000000000000000000000000000000000000000000928a8c8b86169883611be1575b50505050505084611a589130903390614cd8565b80611bd1575b505015611bbe5750611ab534945b7f0000000000000000000000000000000000000000000000000000000000000000907f000000000000000000000000000000000000000000000000000000000000000090614a12565b93611aff611ac3868b614852565b96885196875260209a8b977fd229aacb94204188fe8042965fa6b269c62dc5818b21238779ab64bdd17efeec8963ffffffff881692a383614882565b93611b458460655416611b11856136bc565b968a51998a98899788967f10b83dc00000000000000000000000000000000000000000000000000000000088528701614054565b03927f0000000000000000000000000000000000000000000000000000000000000000165af1928315611bb3578093611b81575b505051908152f35b909192508382813d8311611bac575b611b9a8183612e79565b81010312610968575051908380611b79565b503d611b90565b8251903d90823e3d90fd5b611bcb611ab59134613143565b94611a6c565b611bda916147b2565b8a80611a5e565b611c0791611bf1919b969b614852565b611bfb8a8d614882565b8d60655416918d6140ab565b93308914611cd9579160209391611c2286611c799795612fc5565b9a5b51958694859384937f095ea7b300000000000000000000000000000000000000000000000000000000855284016020909392919373ffffffffffffffffffffffffffffffffffffffff60408201951681520152565b0391895af18015611ccf57918691611a5893611ca0575b8f8f9294508e93508c8c91611a44565b611cc19060203d602011611cc8575b611cb98183612e79565b81019061483a565b508f611c90565b503d611caf565b8c513d8f823e3d90fd5b9891602093918593611cf1611c7997308d3390614cd8565b611c24565b50503461038e578160031936011261038e5760209073ffffffffffffffffffffffffffffffffffffffff606554169051908152f35b50503461038e57602060031936011261038e578060209263ffffffff611d4f612cd9565b16815260cb845220549051908152f35b50503461038e57602060031936011261038e578060209263ffffffff611d83612cd9565b16815260ca845220549051908152f35b833461096857602060031936011261096857813567ffffffffffffffff811161038e57611dc39036908401612d82565b611dce9391936133d1565b825b818110611ddb578380f35b611dec6109636109f0838589613150565b6001810180911115611dd0576024846011857f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b8334610968578060031936011261096857611e3d6133d1565b8073ffffffffffffffffffffffffffffffffffffffff6033547fffffffffffffffffffffffff00000000000000000000000000000000000000008116603355167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b90503461077d578160031936011261077d5760209250359061117e611ec7612c93565b611ed0846133aa565b93849133613a37565b8284606060031936011261096857611eef612cd9565b9260243591611efc612cb6565b33825260209260ce8452858320541561227b5763ffffffff87169687845260cc855286842093611f5473ffffffffffffffffffffffffffffffffffffffff809516809660019160005201602052604060002054151590565b156122395788815260cb865287812054801561222a575b8851987f8bd90b82000000000000000000000000000000000000000000000000000000008a52828a80611fb98c86898b850160409194939263ffffffff606083019616825260208201520152565b03818a5afa998a1561222057839a6121fc575b5099899a7f000000000000000000000000000000000000000000000000000000000000000099878b1698859b8d87905b51811015612048578e8c8c61201184846131cd565b51511614612024575b506001018e611ffc565b819e8e61203660019461203f946131cd565b51015190612fc5565b9d90508e61201a565b508d9b989a5082908d9a989a8281116121dd575b5050508598865b8c518110156120a5578c8961207883836131cd565b5151161561208a575b50600101612063565b819b8b61203660019461209c946131cd565b9a90508c612081565b5090889392918a8c4782116121765785517f81b4e8b400000000000000000000000000000000000000000000000000000000815263ffffffff90931690830190815260208101899052604081018590529192869284928391829060600103925af1801561216c57612142575b507fb1e1b117ddf429b1b8a359fe0e978f0ae191c0f70e0babfea7acaad1b0ee8a2d9282519586528501523393a380f35b8390813d8311612165575b6121578183612e79565b810103126106b15786612111565b503d61214d565b83513d89823e3d90fd5b6084908787519162461bcd60e51b83528201526024808201527f526562616c616e6365206e61746976652066656520657863656564732062616c60448201527f616e6365000000000000000000000000000000000000000000000000000000006064820152fd5b6121f4926121ea91613143565b9030903390614cd8565b818c8061205c565b612219919a503d8085833e6122118183612e79565b810190613083565b988b611fcc565b81513d85823e3d90fd5b50612234826136bc565b611f6b565b606483878a519162461bcd60e51b8352820152601760248201527f4d43523a204e6f7420616c6c6f776564206272696467650000000000000000006044820152fd5b6064908487519162461bcd60e51b8352820152601460248201527f4d43523a204f6e6c7920526562616c616e6365720000000000000000000000006044820152fd5b50503461038e578160031936011261038e5760209073ffffffffffffffffffffffffffffffffffffffff6122ef613001565b915191168152f35b839150606060031936011261038e5761230e612cd9565b67ffffffffffffffff91604435919060248484116106b157366023850112156106b157838201359485116106b157368186860101116106b15773ffffffffffffffffffffffffffffffffffffffff93847f000000000000000000000000000000000000000000000000000000000000000016330361250f578135612391856136bc565b036124a75785602011610a805781810135958811610a8057604486910135937fba20947a325f450d232530e5f5fce293e7963499d5309a07cee84a269f2f15a6602063ffffffff8b51938885521692a3838511612440578561062086866124397f00000000000000000000000000000000000000000000000000000000000000007f000000000000000000000000000000000000000000000000000000000000000089614a12565b91166147b2565b60849250602087519262461bcd60e51b8452830152808201527f5479706543617374733a2062797465733332546f41646472657373206f76657260448201527f666c6f77000000000000000000000000000000000000000000000000000000006064820152fd5b60848360258460208c519362461bcd60e51b85528401528201527f456e726f6c6c656420726f7574657220646f6573206e6f74206d61746368207360448201527f656e6465720000000000000000000000000000000000000000000000000000006064820152fd5b60848360218460208c519362461bcd60e51b85528401528201527f4d61696c626f78436c69656e743a2073656e646572206e6f74206d61696c626f60448201527f78000000000000000000000000000000000000000000000000000000000000006064820152fd5b50503461038e5760031936011261096857610620612593612cd9565b61259b612c93565b906125a46133d1565b61388c565b612c45565b50503461038e57600319360112610968576106206125ca612cd9565b6125d26133d1565b6024359061381f565b50503461038e578160031936011261038e5760209073ffffffffffffffffffffffffffffffffffffffff7f721d42344eebce0a76684e8fddd9c81a84afda39f3019e5a078a53853f098d1154169051908152f35b50503461038e578160031936011261038e5761264961370d565b815192839260208080860192818752855180945286019401925b82811061267257505050500390f35b835163ffffffff1685528695509381019392810192600101612663565b8334610968576020600319360112610968576126cf73ffffffffffffffffffffffffffffffffffffffff6126c1612c70565b6126c96133d1565b1661443f565b5080f35b50503461038e57602060031936011261038e5760207f4eab7b127c764308788622363ad3e9532de3dfba7845bd4f84c125a22544255a9173ffffffffffffffffffffffffffffffffffffffff612727612c70565b803b15801590612777575b61273b90612f54565b6127436133d1565b1690817fffffffffffffffffffffffff0000000000000000000000000000000000000000606554161760655551908152a180f35b5080821615612732565b50503461038e578060031936011261038e576113b36020926127d66127a4612c70565b9133815260d0865284812073ffffffffffffffffffffffffffffffffffffffff84168252865284602435912054612fc5565b9033613242565b83833461038e578160031936011261038e5760ff6101015460a01c169160ff831161280c576020838351908152f35b806011857f4e487b71000000000000000000000000000000000000000000000000000000006024945252fd5b50503461038e57602060031936011261038e5760209061286463ffffffff61285e612cd9565b1661440f565b915191825250f35b50503461038e578060031936011261038e5763ffffffff61288b612cd9565b6128936133d1565b61289c816136bc565b5016825260cb6020526024359082205580f35b50503461038e57606060031936011261038e576020906113b36128d0612c70565b6128d8612c93565b604435916128e7833383613436565b6134f9565b50503461038e578160031936011261038e57602090517f00000000000000000000000000000000000000000000000000000000000000008152f35b50503461038e57602090602060031936011261077d5763ffffffff61294a612cd9565b16835260cc60205280832092815180936020865492838152019583526020832092905b82821061298557610d558686610d4b828b0383612e79565b83548752958601956001938401939091019061296d565b50503461038e578160031936011261038e5760209060d1549051908152f35b50503461038e57602060031936011261038e5760207fc47cbcc588c67679e52261c45cc315e56562f8d0ccaba16facb9093ff94987999173ffffffffffffffffffffffffffffffffffffffff612a0f612c70565b803b15801590612a5f575b612a2390612f54565b612a2b6133d1565b1690817fffffffffffffffffffffffff0000000000000000000000000000000000000000606654161760665551908152a180f35b5080821615612a1a565b8334610968576020600319360112610968576126cf73ffffffffffffffffffffffffffffffffffffffff612a9b612c70565b612aa36133d1565b16614254565b828434610968576020600319360112610968575061085560209235613383565b50503461038e578060031936011261038e576020906113b3612ae9612c70565b6024359033613242565b8284346109685780600319360112610968578151918160d2549260018460011c9160018616958615612bb8575b602096878510811461162b578899509688969785829a5291826000146115e6575050600114612b5c57505050610d55929161157b910385612e79565b919086935060d283527ff2192e1030363415d7b4fb0406540a0060e8e2fc8982f3f32289379e11fa65465b828410612ba0575050508201018161157b610d55611568565b8054848a018601528895508794909301928101612b87565b92607f1692612b20565b84903461038e578160031936011261038e57602090610133548152f35b60005b838110612bf25750506000910152565b8181015183820152602001612be2565b907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f602093612c3e81518092818752878088019101612bdf565b0116010190565b34612c6b576020600319360112612c6b576020612c6360043561321b565b604051908152f35b600080fd5b6004359073ffffffffffffffffffffffffffffffffffffffff82168203612c6b57565b6024359073ffffffffffffffffffffffffffffffffffffffff82168203612c6b57565b6044359073ffffffffffffffffffffffffffffffffffffffff82168203612c6b57565b6004359063ffffffff82168203612c6b57565b602090602060408183019282815285518094520193019160005b828110612d14575050505090565b835173ffffffffffffffffffffffffffffffffffffffff1685529381019392810192600101612d06565b34612c6b576020600319360112612c6b57612d57612c70565b5060206040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8152f35b9181601f84011215612c6b5782359167ffffffffffffffff8311612c6b576020808501948460051b010111612c6b57565b6003196060910112612c6b5760043563ffffffff81168103612c6b57906024359060443590565b6040810190811067ffffffffffffffff821117612df657604052565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6080810190811067ffffffffffffffff821117612df657604052565b6020810190811067ffffffffffffffff821117612df657604052565b60a0810190811067ffffffffffffffff821117612df657604052565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff821117612df657604052565b67ffffffffffffffff8111612df657601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b6003196060910112612c6b576004359073ffffffffffffffffffffffffffffffffffffffff906024358281168103612c6b57916044359081168103612c6b5790565b34612c6b576020600319360112612c6b576020612c636004356133aa565b15612f5b57565b608460405162461bcd60e51b815260206004820152602760248201527f4d61696c626f78436c69656e743a20696e76616c696420636f6e74726163742060448201527f73657474696e67000000000000000000000000000000000000000000000000006064820152fd5b91908201809211612fd257565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7fe797cab0ddd50f45c2a522220a721ebb6d0f53785d8595512b6122e7164a201f5473ffffffffffffffffffffffffffffffffffffffff90811615613065577f00000000000000000000000000000000000000000000000000000000000000001690565b50600090565b67ffffffffffffffff8111612df65760051b60200190565b906020918281830312612c6b5780519067ffffffffffffffff8211612c6b570181601f82011215612c6b578051926130ba8461306b565b936040936130cb6040519687612e79565b818652828087019260061b85010193818511612c6b578301915b8483106130f55750505050505090565b8583830312612c6b5785519061310a82612dda565b83519073ffffffffffffffffffffffffffffffffffffffff82168203612c6b5782869289945282860151838201528152019201916130e5565b91908203918211612fd257565b91908110156131605760051b0190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b3563ffffffff81168103612c6b5790565b8051156131605760200190565b8051600110156131605760400190565b8051600210156131605760600190565b80518210156131605760209160051b010190565b91908110156131605760061b0190565b6101335460018101809111612fd25760d1549060018201809211612fd25761321892614175565b90565b6101335460018101809111612fd25760d1549060018201809211612fd25761321892614a12565b73ffffffffffffffffffffffffffffffffffffffff80911691821561331a57169182156132b05760207f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925918360005260d08252604060002085600052825280604060002055604051908152a3565b608460405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f73730000000000000000000000000000000000000000000000000000000000006064820152fd5b608460405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152fd5b60d15460018101809111612fd257610133549060018201809211612fd25761321892614175565b60d15460018101809111612fd257610133549060018201809211612fd25761321892614a12565b73ffffffffffffffffffffffffffffffffffffffff6033541633036133f257565b606460405162461bcd60e51b815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b9073ffffffffffffffffffffffffffffffffffffffff80831660005260d06020526040600020908216600052602052604060002054927fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff840361349a575b50505050565b8084106134b5576134ac930391613242565b38808080613494565b606460405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152fd5b73ffffffffffffffffffffffffffffffffffffffff80911691821561365257169182156135e857600082815260cf60205260408120549180831061357e57604082827fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef95876020965260cf8652038282205586815220818154019055604051908152a3565b608460405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e636500000000000000000000000000000000000000000000000000006064820152fd5b608460405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152fd5b608460405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152fd5b63ffffffff16906136cc8261440f565b90613709576137056136e56136e085614af8565b6143bb565b60405191829162461bcd60e51b8352602060048401526024830190612c02565b0390fd5b9150565b6097549061371a8261306b565b916137286040519384612e79565b8083526137348161306b565b907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe080920136602086013760005b8181106137cf57505082519061379061377a8361306b565b926137886040519485612e79565b80845261306b565b013660208301378060005b84518110156137c9578063ffffffff6137b6600193886131cd565b51166137c282866131cd565b520161379b565b50925050565b806137db6001926141ce565b90549060031b1c6137ec82886131cd565b5201613762565b156137fb5750565b6137059060405191829162461bcd60e51b8352602060048401526024830190612c02565b7fc3de732a98b24a2b5c6f67e8a7fb057ffc14046b83968a2c73e4148d2fba978b9163ffffffff60409216908160005260986020526138708360002054151561386a6136e085614af8565b906137f3565b8160005260ca60205280836000205582519182526020820152a1565b9063ffffffff918260009116815260cc60209160cc835260409160408220936138cd73ffffffffffffffffffffffffffffffffffffffff8097168096614659565b506138d661370d565b96835b885181101561392757816138ed828b6131cd565b511685528383526139108787872060019160005201602052604060002054151590565b61391c576001016138d9565b505050505050505050565b5050939550509290507f0000000000000000000000000000000000000000000000000000000000000000916040519381850181807f095ea7b300000000000000000000000000000000000000000000000000000000958684528960248a01528160448a01526044895261399989612e25565b87169288519082855af1906139ac614ca8565b82613a04575b50816139f9575b50156139c8575b505050505050565b6139ee956104da936040519384015260248301526044820152604481526104d481612e25565b3880808080806139c0565b90503b1515386139b9565b809192505190848215928315613a1f575b50505090386139b2565b613a2f935082018101910161483a565b388481613a15565b9092613a658330337f0000000000000000000000000000000000000000000000000000000000000000614cd8565b610133613a73848254612fc5565b905573ffffffffffffffffffffffffffffffffffffffff809416938415613b16577fdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d79282613ac560409460d154612fc5565b60d1558660005260cf602052836000208181540190558660007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60208751858152a3835195865260208601521692a3565b606460405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152fd5b6033549073ffffffffffffffffffffffffffffffffffffffff80911691827fffffffffffffffffffffffff0000000000000000000000000000000000000000821617603355167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a3565b63ffffffff166000818152602060cb60205260409082604081205560cc60205260408320918254908460019360018601915b848110613c32575050505050509080613c309392558181526099602052604081205561386a6136e0613c2a83614592565b92614af8565b565b80613c3e87928961423c565b90549060031b1c8952838352888581205501613bf9565b92919073ffffffffffffffffffffffffffffffffffffffff90817f721d42344eebce0a76684e8fddd9c81a84afda39f3019e5a078a53853f098d115416948515613df5576040517f8bd90b8200000000000000000000000000000000000000000000000000000000815263ffffffff919091166004820152602481019190915260448101929092526000826064818785165afa918215613de957600092613dcc575b5081518015613dc4576001149081613d8b575b5015613d2157613d1b6020916131a0565b51015190565b608460405162461bcd60e51b815260206004820152602960248201527f46756e6769626c65546f6b656e526f757465723a20666565206d757374206d6160448201527f74636820746f6b656e00000000000000000000000000000000000000000000006064820152fd5b809150613d97836131a0565b515116907f0000000000000000000000000000000000000000000000000000000000000000161438613d0a565b505050600090565b613de29192503d806000833e6122118183612e79565b9038613cf7565b6040513d6000823e3d90fd5b50505050600090565b91939073ffffffffffffffffffffffffffffffffffffffff90818616958383861695888703613faf575b5050508515613f45578560005260cf6020526040928360002054818110613edc5790807ffbde797d201c681b91056529119e0b02407c7bb96a4a2c75c01fc9667232c8db959493928960005260cf6020520384600020558060d1540360d1556000887fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60208751858152a3610133613ec1888254613143565b9055613ecd87836147b2565b835196875260208701521693a4565b6084855162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f63650000000000000000000000000000000000000000000000000000000000006064820152fd5b608460405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f73000000000000000000000000000000000000000000000000000000000000006064820152fd5b613fb892613436565b388381613e28565b9063ffffffff613fe092169081600052609960205260406000205561430d565b50565b15613fea57565b608460405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e670000000000000000000000000000000000000000006064820152fd5b9361409660809473ffffffffffffffffffffffffffffffffffffffff9463ffffffff6140a4959a999a168852602088015260a0604088015260a0870190612c02565b908582036060870152612c02565b9416910152565b6020929391936140ba826136bc565b9261410e73ffffffffffffffffffffffffffffffffffffffff938493604051988997889687967f81d2ea95000000000000000000000000000000000000000000000000000000008852169360048701614054565b03917f0000000000000000000000000000000000000000000000000000000000000000165afa908115613de957600091614146575090565b90506020813d60201161416d575b8161416160209383612e79565b81010312612c6b575190565b3d9150614154565b9190614182828285614a12565b92821561419f57096141915790565b60018101809111612fd25790565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6097548110156131605760976000527f354a83ed9988f79f6038d4c7a7dadbad8af32f4ad6df893e0e5807a1b1944ff90190600090565b60cd548110156131605760cd6000527f83978b4c69c48dd978ab43fe30f077615294f938fb7f936d9eb340e51ea7db2e0190600090565b80548210156131605760005260206000200190600090565b600081815260ce60205260408120546143085760cd54680100000000000000008110156142db5790826142c76142928460016040960160cd55614205565b81939154907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9060031b92831b921b19161790565b905560cd5492815260ce6020522055600190565b6024827f4e487b710000000000000000000000000000000000000000000000000000000081526041600452fd5b905090565b60008181526098602052604081205461430857609754680100000000000000008110156142db57908261434b614292846001604096016097556141ce565b905560975492815260986020522055600190565b60008281526001820160205260409020546143b45780549068010000000000000000821015612df6578261439d61429284600180960185558461423c565b905580549260005201602052604060002055600190565b5050600090565b90613c30603f60405180947f4e6f20726f7574657220656e726f6c6c656420666f7220646f6d61696e3a200060208301526143ff8151809260208686019101612bdf565b810103601f810185520183612e79565b6000526099602052604060002054801560001461443a57506098602052604060002054151590600090565b600191565b600081815260ce6020526040812054909190801561458d577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff908181018181116145605760cd5490838201918211614533578082036144ff575b50505060cd5480156144d2578101906144b182614205565b909182549160031b1b1916905560cd55815260ce6020526040812055600190565b6024847f4e487b710000000000000000000000000000000000000000000000000000000081526031600452fd5b61451d61450e61429293614205565b90549060031b1c928392614205565b9055845260ce6020526040842055388080614499565b6024867f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b6024857f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b505090565b600081815260986020526040812054909190801561458d577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90818101818111614560576097549083820191821161453357808203614625575b50505060975480156144d257810190614604826141ce565b909182549160031b1b19169055609755815260986020526040812055600190565b614643614634614292936141ce565b90549060031b1c9283926141ce565b90558452609860205260408420553880806145ec565b906001820190600092818452826020526040842054908115156000146147ab577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9182810181811161477e578254908482019182116147515780820361471c575b505050805480156146ef578201916146d2838361423c565b909182549160031b1b191690555582526020526040812055600190565b6024867f4e487b710000000000000000000000000000000000000000000000000000000081526031600452fd5b61473c61472c614292938661423c565b90549060031b1c9283928661423c565b905586528460205260408620553880806146ba565b6024887f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b6024877f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b5050505090565b6040517fa9059cbb00000000000000000000000000000000000000000000000000000000602082015273ffffffffffffffffffffffffffffffffffffffff919091166024820152604480820192909252908152613c3090614814606482612e79565b7f000000000000000000000000000000000000000000000000000000000000000061490c565b90816020910312612c6b57518015158103612c6b5790565b906040519160208301526040820152604081526060810181811067ffffffffffffffff821117612df65760405290565b63ffffffff1660005260ca6020527fffffffffffffffffffffffffffffffffffffffff00000000000000000000000060406000205491604051927e0100000000000000000000000000000000000000000000000000000000000060208501526000602285015260428401523360601b606284015260601b166076820152606a815261321881612e5d565b6040516149779173ffffffffffffffffffffffffffffffffffffffff1661493282612dda565b6000806020958685527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656487860152868151910182855af1614971614ca8565b91614ddf565b8051908282159283156149fa575b505050156149905750565b6084906040519062461bcd60e51b82526004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152fd5b614a0a935082018101910161483a565b388281614985565b917fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8284099282810292838086109503948086039514614aea5784831115614aa6578291096001821901821680920460028082600302188083028203028083028203028083028203028083028203028083028203028092029003029360018380600003040190848311900302920304170290565b606460405162461bcd60e51b815260206004820152601560248201527f4d6174683a206d756c446976206f766572666c6f7700000000000000000000006044820152fd5b50508092501561419f570490565b806000917a184f03e93ff9f4daa797ed6e38ed64bf6a1f01000000000000000080821015614c9a575b506d04ee2d6d415b85acef810000000080831015614c8b575b50662386f26fc1000080831015614c7c575b506305f5e10080831015614c6d575b5061271080831015614c5e575b506064821015614c4e575b600a80921015614c44575b60019081602160018601957fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0614bcc614bb689612eba565b98614bc46040519a8b612e79565b808a52612eba565b01366020890137860101905b614be3575050505090565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff849101917f30313233343536373839616263646566000000000000000000000000000000008282061a835304918215614c3f57919082614bd8565b6147ab565b9160010191614b7e565b9190606460029104910191614b73565b60049193920491019138614b68565b60089193920491019138614b5b565b60109193920491019138614b4c565b60209193920491019138614b3a565b604093508104915038614b21565b3d15614cd3573d90614cb982612eba565b91614cc76040519384612e79565b82523d6000602084013e565b606090565b9092613c3093604051937f23b872dd00000000000000000000000000000000000000000000000000000000602086015273ffffffffffffffffffffffffffffffffffffffff80921660248601521660448401526064830152606482526104da82612e5d565b9073ffffffffffffffffffffffffffffffffffffffff60405160208101937f313ce56700000000000000000000000000000000000000000000000000000000855260048252614d8b82612dda565b600094859384935192165afa614d9f614ca8565b9080614dd3575b614db0575b508190565b60208180518101031261077d576020015160ff8111614dab576001925060ff1690565b50602081511015614da6565b91929015614e405750815115614df3575090565b3b15614dfc5790565b606460405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152fd5b8251909150156137fb5750805190602001fdfea2646970667358221220fff7c6ea8a7092050b25017d99af2003242bc5debebef21a98b3e9edb881af6664736f6c63430008160033", + "linkReferences": {}, + "deployedLinkReferences": {}, + "immutableReferences": { + "18848": [ + { + "length": 32, + "start": 3199 + }, + { + "length": 32, + "start": 6985 + }, + { + "length": 32, + "start": 9056 + }, + { + "length": 32, + "start": 16658 + } + ], + "18850": [ + { + "length": 32, + "start": 6132 + } + ], + "20787": [ + { + "length": 32, + "start": 874 + }, + { + "length": 32, + "start": 1020 + }, + { + "length": 32, + "start": 2202 + }, + { + "length": 32, + "start": 3923 + }, + { + "length": 32, + "start": 5357 + }, + { + "length": 32, + "start": 6346 + }, + { + "length": 32, + "start": 6680 + }, + { + "length": 32, + "start": 8146 + }, + { + "length": 32, + "start": 12354 + }, + { + "length": 32, + "start": 14642 + }, + { + "length": 32, + "start": 14913 + }, + { + "length": 32, + "start": 15773 + }, + { + "length": 32, + "start": 18454 + } + ], + "22134": [ + { + "length": 32, + "start": 6800 + }, + { + "length": 32, + "start": 9203 + }, + { + "length": 32, + "start": 10500 + } + ], + "22136": [ + { + "length": 32, + "start": 5277 + }, + { + "length": 32, + "start": 6766 + }, + { + "length": 32, + "start": 9236 + } + ] + }, + "inputSourceName": "project/solidity/bridge/OfficialHypERC20Collateral.sol", + "buildInfoId": "solc-0_8_22-f87b3d7047c75ce4db8bb87da21456f3af8ae79b" +} \ No newline at end of file diff --git a/contracts/solidity/bridge/OfficialHypERC20Collateral.sol b/contracts/solidity/bridge/OfficialHypERC20Collateral.sol new file mode 100644 index 00000000..d843d75d --- /dev/null +++ b/contracts/solidity/bridge/OfficialHypERC20Collateral.sol @@ -0,0 +1,15 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 +pragma solidity >=0.8.0; + +import "../hyperlane/token/HypERC20Collateral.sol"; + +/// @notice Thin wrapper that compiles Hyperlane's official HypERC20Collateral +/// source inside this repo's Hardhat workspace. +contract OfficialHypERC20Collateral is HypERC20Collateral { + constructor( + address erc20, + uint256 scaleNumerator, + uint256 scaleDenominator, + address mailbox + ) HypERC20Collateral(erc20, scaleNumerator, scaleDenominator, mailbox) {} +} diff --git a/contracts/solidity/bridge/TokenMessage.sol b/contracts/solidity/bridge/TokenMessage.sol new file mode 100644 index 00000000..685cb421 --- /dev/null +++ b/contracts/solidity/bridge/TokenMessage.sol @@ -0,0 +1,22 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 +pragma solidity >=0.8.0; + +library TokenMessage { + uint8 internal constant RECIPIENT_OFFSET = 0; + uint8 internal constant AMOUNT_OFFSET = 32; + + function format( + bytes32 _recipient, + uint256 _amount + ) internal pure returns (bytes memory) { + return abi.encodePacked(_recipient, _amount); + } + + function recipient(bytes calldata _message) internal pure returns (bytes32) { + return bytes32(_message[RECIPIENT_OFFSET:RECIPIENT_OFFSET + 32]); + } + + function amount(bytes calldata _message) internal pure returns (uint256) { + return uint256(bytes32(_message[AMOUNT_OFFSET:AMOUNT_OFFSET + 32])); + } +} diff --git a/contracts/solidity/bridge/TypeCasts.sol b/contracts/solidity/bridge/TypeCasts.sol new file mode 100644 index 00000000..580da40d --- /dev/null +++ b/contracts/solidity/bridge/TypeCasts.sol @@ -0,0 +1,12 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.20; + +library TypeCasts { + function addressToBytes32(address _addr) internal pure returns (bytes32) { + return bytes32(uint256(uint160(_addr))); + } + + function bytes32ToAddress(bytes32 _buf) internal pure returns (address) { + return address(uint160(uint256(_buf))); + } +} diff --git a/contracts/solidity/hyperlane/PackageVersioned.sol b/contracts/solidity/hyperlane/PackageVersioned.sol new file mode 100755 index 00000000..8be4a10d --- /dev/null +++ b/contracts/solidity/hyperlane/PackageVersioned.sol @@ -0,0 +1,11 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 +pragma solidity >=0.6.11; + +/** + * @title PackageVersioned + * @notice Package version getter for contracts + **/ +abstract contract PackageVersioned { + // GENERATED CODE - DO NOT EDIT + string public constant PACKAGE_VERSION = "11.1.0"; +} diff --git a/contracts/solidity/hyperlane/client/GasRouter.sol b/contracts/solidity/hyperlane/client/GasRouter.sol new file mode 100755 index 00000000..5fe8dd96 --- /dev/null +++ b/contracts/solidity/hyperlane/client/GasRouter.sol @@ -0,0 +1,89 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 +pragma solidity >=0.6.11; + +/*@@@@@@@ @@@@@@@@@ + @@@@@@@@@ @@@@@@@@@ + @@@@@@@@@ @@@@@@@@@ + @@@@@@@@@ @@@@@@@@@ + @@@@@@@@@@@@@@@@@@@@@@@@@ + @@@@@ HYPERLANE @@@@@@@ + @@@@@@@@@@@@@@@@@@@@@@@@@ + @@@@@@@@@ @@@@@@@@@ + @@@@@@@@@ @@@@@@@@@ + @@@@@@@@@ @@@@@@@@@ +@@@@@@@@@ @@@@@@@@*/ + +// ============ Internal Imports ============ +import {Router} from "./Router.sol"; +import {EnumerableMapExtended} from "../libs/EnumerableMapExtended.sol"; +import {StandardHookMetadata} from "../hooks/libs/StandardHookMetadata.sol"; + +abstract contract GasRouter is Router { + using EnumerableMapExtended for EnumerableMapExtended.UintToBytes32Map; + + event GasSet(uint32 domain, uint256 gas); + + // ============ Mutable Storage ============ + mapping(uint32 destinationDomain => uint256 gasLimit) public destinationGas; + + struct GasRouterConfig { + uint32 domain; + uint256 gas; + } + + constructor(address _mailbox) Router(_mailbox) {} + + /** + * @notice Sets the gas amount dispatched for each configured domain. + * @param gasConfigs The array of GasRouterConfig structs + */ + function setDestinationGas( + GasRouterConfig[] calldata gasConfigs + ) external onlyOwner { + for (uint256 i = 0; i < gasConfigs.length; i += 1) { + _setDestinationGas(gasConfigs[i].domain, gasConfigs[i].gas); + } + } + + /** + * @notice Sets the gas amount dispatched for each configured domain. + * @param domain The destination domain ID + * @param gas The gas limit + */ + function setDestinationGas(uint32 domain, uint256 gas) external onlyOwner { + _setDestinationGas(domain, gas); + } + + /** + * @notice Returns the gas payment required to dispatch a message to the given domain's router. + * @param _destinationDomain The domain of the router. + * @return _gasPayment Payment computed by the registered InterchainGasPaymaster. + */ + function quoteGasPayment( + uint32 _destinationDomain + ) public view virtual returns (uint256) { + return + _Router_quoteDispatch( + _destinationDomain, + "", + _GasRouter_hookMetadata(_destinationDomain), + address(hook) + ); + } + + function _GasRouter_hookMetadata( + uint32 _destination + ) internal view returns (bytes memory) { + return + StandardHookMetadata.overrideGasLimit(destinationGas[_destination]); + } + + function _setDestinationGas(uint32 domain, uint256 gas) internal virtual { + require( + _routers.contains(uint256(domain)), + _domainNotFoundError(domain) + ); + destinationGas[domain] = gas; + emit GasSet(domain, gas); + } +} diff --git a/contracts/solidity/hyperlane/client/MailboxClient.sol b/contracts/solidity/hyperlane/client/MailboxClient.sol new file mode 100755 index 00000000..0b0d3642 --- /dev/null +++ b/contracts/solidity/hyperlane/client/MailboxClient.sol @@ -0,0 +1,127 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 +pragma solidity >=0.6.11; + +/*@@@@@@@ @@@@@@@@@ + @@@@@@@@@ @@@@@@@@@ + @@@@@@@@@ @@@@@@@@@ + @@@@@@@@@ @@@@@@@@@ + @@@@@@@@@@@@@@@@@@@@@@@@@ + @@@@@ HYPERLANE @@@@@@@ + @@@@@@@@@@@@@@@@@@@@@@@@@ + @@@@@@@@@ @@@@@@@@@ + @@@@@@@@@ @@@@@@@@@ + @@@@@@@@@ @@@@@@@@@ +@@@@@@@@@ @@@@@@@@*/ + +// ============ Internal Imports ============ +import {IMailbox} from "../interfaces/IMailbox.sol"; +import {IPostDispatchHook} from "../interfaces/hooks/IPostDispatchHook.sol"; +import {IInterchainSecurityModule} from "../interfaces/IInterchainSecurityModule.sol"; +import {Message} from "../libs/Message.sol"; +import {PackageVersioned} from "../PackageVersioned.sol"; + +// ============ External Imports ============ +import {Address} from "@openzeppelin/contracts/utils/Address.sol"; +import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; + +abstract contract MailboxClient is OwnableUpgradeable, PackageVersioned { + using Message for bytes; + + event HookSet(address _hook); + event IsmSet(address _ism); + + IMailbox public immutable mailbox; + + uint32 public immutable localDomain; + + IPostDispatchHook public hook; + + IInterchainSecurityModule internal _interchainSecurityModule; + + uint256[48] private __GAP; // gap for upgrade safety + + // ============ Modifiers ============ + modifier onlyContract(address _contract) { + require( + Address.isContract(_contract), + "MailboxClient: invalid mailbox" + ); + _; + } + + modifier onlyContractOrNull(address _contract) { + require( + Address.isContract(_contract) || _contract == address(0), + "MailboxClient: invalid contract setting" + ); + _; + } + + /** + * @notice Only accept messages from a Hyperlane Mailbox contract + */ + modifier onlyMailbox() { + require( + msg.sender == address(mailbox), + "MailboxClient: sender not mailbox" + ); + _; + } + + constructor(address _mailbox) onlyContract(_mailbox) { + mailbox = IMailbox(_mailbox); + localDomain = mailbox.localDomain(); + _transferOwnership(msg.sender); + } + + function interchainSecurityModule() + external + view + virtual + returns (IInterchainSecurityModule) + { + return _interchainSecurityModule; + } + + /** + * @notice Sets the address of the application's custom hook. + * @param _hook The address of the hook contract. + */ + function setHook( + address _hook + ) public virtual onlyContractOrNull(_hook) onlyOwner { + hook = IPostDispatchHook(_hook); + emit HookSet(_hook); + } + + /** + * @notice Sets the address of the application's custom interchain security module. + * @param _module The address of the interchain security module contract. + */ + function setInterchainSecurityModule( + address _module + ) public onlyContractOrNull(_module) onlyOwner { + _interchainSecurityModule = IInterchainSecurityModule(_module); + emit IsmSet(_module); + } + + // ======== Initializer ========= + function _MailboxClient_initialize( + address _hook, + address __interchainSecurityModule, + address _owner + ) internal onlyInitializing { + __Ownable_init(); + setHook(_hook); + setInterchainSecurityModule(__interchainSecurityModule); + _transferOwnership(_owner); + } + + function _isLatestDispatched(bytes32 id) internal view returns (bool) { + return mailbox.latestDispatchedId() == id; + } + + function _isDelivered(bytes32 id) internal view returns (bool) { + return mailbox.delivered(id); + } +} diff --git a/contracts/solidity/hyperlane/client/Router.sol b/contracts/solidity/hyperlane/client/Router.sol new file mode 100755 index 00000000..7d17af75 --- /dev/null +++ b/contracts/solidity/hyperlane/client/Router.sol @@ -0,0 +1,235 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 +pragma solidity >=0.6.11; + +// ============ Internal Imports ============ +import {IMessageRecipient} from "../interfaces/IMessageRecipient.sol"; +import {IPostDispatchHook} from "../interfaces/hooks/IPostDispatchHook.sol"; +import {MailboxClient} from "./MailboxClient.sol"; +import {EnumerableMapExtended} from "../libs/EnumerableMapExtended.sol"; + +// ============ External Imports ============ +import {Strings} from "@openzeppelin/contracts/utils/Strings.sol"; + +abstract contract Router is MailboxClient, IMessageRecipient { + using EnumerableMapExtended for EnumerableMapExtended.UintToBytes32Map; + using Strings for uint32; + + // ============ Mutable Storage ============ + /// @dev Mapping of domain => router. For a given domain we have one router we send/receive messages from. + EnumerableMapExtended.UintToBytes32Map internal _routers; + + uint256[48] private __GAP; // gap for upgrade safety + + constructor(address _mailbox) MailboxClient(_mailbox) {} + + // ============ External functions ============ + function domains() external view returns (uint32[] memory) { + return _routers.uint32Keys(); + } + + /** + * @notice Returns the address of the Router contract for the given domain + * @param _domain The remote domain ID. + * @dev Returns 0 address if no router is enrolled for the given domain + * @return router The address of the Router contract for the given domain + */ + function routers(uint32 _domain) public view virtual returns (bytes32) { + (, bytes32 _router) = _routers.tryGet(_domain); + return _router; + } + + /** + * @notice Unregister the domain + * @param _domain The domain of the remote Application Router + */ + function unenrollRemoteRouter(uint32 _domain) external virtual onlyOwner { + _unenrollRemoteRouter(_domain); + } + + /** + * @notice Register the address of a Router contract for the same Application on a remote chain + * @param _domain The domain of the remote Application Router + * @param _router The address of the remote Application Router + */ + function enrollRemoteRouter( + uint32 _domain, + bytes32 _router + ) external virtual onlyOwner { + _enrollRemoteRouter(_domain, _router); + } + + /** + * @notice Batch version of `enrollRemoteRouter` + * @param _domains The domains of the remote Application Routers + * @param _addresses The addresses of the remote Application Routers + */ + function enrollRemoteRouters( + uint32[] calldata _domains, + bytes32[] calldata _addresses + ) external virtual onlyOwner { + require(_domains.length == _addresses.length, "!length"); + uint256 length = _domains.length; + for (uint256 i = 0; i < length; i += 1) { + _enrollRemoteRouter(_domains[i], _addresses[i]); + } + } + + /** + * @notice Batch version of `unenrollRemoteRouter` + * @param _domains The domains of the remote Application Routers + */ + function unenrollRemoteRouters( + uint32[] calldata _domains + ) external virtual onlyOwner { + uint256 length = _domains.length; + for (uint256 i = 0; i < length; i += 1) { + _unenrollRemoteRouter(_domains[i]); + } + } + + /** + * @notice Handles an incoming message + * @param _origin The origin domain + * @param _sender The sender address + * @param _message The message + */ + // solhint-disable-next-line hyperlane/no-virtual-override + function handle( + uint32 _origin, + bytes32 _sender, + bytes calldata _message + ) external payable virtual override onlyMailbox { + bytes32 _router = _mustHaveRemoteRouter(_origin); + require(_router == _sender, "Enrolled router does not match sender"); + _handle(_origin, _sender, _message); + } + + // ============ Virtual functions ============ + function _handle( + uint32 _origin, + bytes32 _sender, + bytes calldata _message + ) internal virtual; + + // ============ Internal functions ============ + + /** + * @notice Set the router for a given domain + * @param _domain The domain + * @param _address The new router + */ + function _enrollRemoteRouter( + uint32 _domain, + bytes32 _address + ) internal virtual { + _routers.set(_domain, _address); + } + + /** + * @notice Remove the router for a given domain + * @param _domain The domain + */ + function _unenrollRemoteRouter(uint32 _domain) internal virtual { + require(_routers.remove(_domain), _domainNotFoundError(_domain)); + } + + /** + * @notice Return true if the given domain / router is the address of a remote Application Router + * @param _domain The domain of the potential remote Application Router + * @param _address The address of the potential remote Application Router + */ + function _isRemoteRouter( + uint32 _domain, + bytes32 _address + ) internal view returns (bool) { + return routers(_domain) == _address; + } + + /** + * @notice Assert that the given domain has an Application Router registered and return its address + * @param _domain The domain of the chain for which to get the Application Router + * @return _router The address of the remote Application Router on _domain + */ + function _mustHaveRemoteRouter( + uint32 _domain + ) internal view returns (bytes32) { + (bool contained, bytes32 _router) = _routers.tryGet(_domain); + if (contained) { + return _router; + } + revert(_domainNotFoundError(_domain)); + } + + function _domainNotFoundError( + uint32 _domain + ) internal pure returns (string memory) { + return + string.concat( + "No router enrolled for domain: ", + _domain.toString() + ); + } + + function _Router_dispatch( + uint32 _destinationDomain, + uint256 _value, + bytes memory _messageBody + ) internal returns (bytes32) { + return + _Router_dispatch( + _destinationDomain, + _value, + _messageBody, + "", + address(hook) + ); + } + + function _Router_dispatch( + uint32 _destinationDomain, + uint256 _value, + bytes memory _messageBody, + bytes memory _hookMetadata, + address _hook + ) internal returns (bytes32) { + bytes32 _router = _mustHaveRemoteRouter(_destinationDomain); + return + mailbox.dispatch{value: _value}( + _destinationDomain, + _router, + _messageBody, + _hookMetadata, + IPostDispatchHook(_hook) + ); + } + + function _Router_quoteDispatch( + uint32 _destinationDomain, + bytes memory _messageBody + ) internal view returns (uint256) { + return + _Router_quoteDispatch( + _destinationDomain, + _messageBody, + "", + address(hook) + ); + } + + function _Router_quoteDispatch( + uint32 _destinationDomain, + bytes memory _messageBody, + bytes memory _hookMetadata, + address _hook + ) internal view returns (uint256) { + bytes32 _router = _mustHaveRemoteRouter(_destinationDomain); + return + mailbox.quoteDispatch( + _destinationDomain, + _router, + _messageBody, + _hookMetadata, + IPostDispatchHook(_hook) + ); + } +} diff --git a/contracts/solidity/hyperlane/hooks/libs/StandardHookMetadata.sol b/contracts/solidity/hyperlane/hooks/libs/StandardHookMetadata.sol new file mode 100755 index 00000000..2ca1226b --- /dev/null +++ b/contracts/solidity/hyperlane/hooks/libs/StandardHookMetadata.sol @@ -0,0 +1,267 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 +pragma solidity >=0.8.0; + +/*@@@@@@@ @@@@@@@@@ + @@@@@@@@@ @@@@@@@@@ + @@@@@@@@@ @@@@@@@@@ + @@@@@@@@@ @@@@@@@@@ + @@@@@@@@@@@@@@@@@@@@@@@@@ + @@@@@ HYPERLANE @@@@@@@ + @@@@@@@@@@@@@@@@@@@@@@@@@ + @@@@@@@@@ @@@@@@@@@ + @@@@@@@@@ @@@@@@@@@ + @@@@@@@@@ @@@@@@@@@ +@@@@@@@@@ @@@@@@@@*/ + +/** + * Format of metadata: + * + * [0:2] variant (uint16) = 1 + * [2:34] msg.value (uint256) + * [34:66] Gas limit for message (uint256) + * [66:86] Refund address (address) + * [86:106] Fee token address (address) - OPTIONAL, read if length >= 106 + * + * Fee Token Semantics: + * - When feeToken is address(0) or unspecified (metadata length < 106), fees are + * paid in native ETH via msg.value. + * - When feeToken is set to a non-zero address, fees are paid in that ERC-20 token. + * The caller must approve the hook to spend the fee token before calling dispatch. + * + * IMPORTANT: Mixing fee denominations within a single dispatch is NOT supported. + * All hooks in the call chain (requiredHook + hook, including any child hooks in + * aggregation) must use the same fee denomination. Hooks that only support native + * fees will reject metadata with a non-zero feeToken via supportsMetadata. + * + * The Mailbox.quoteDispatch function sums quotes from requiredHook and hook, + * assuming both return values in the same denomination. This works because: + * - Native-only hooks return 0 when feeToken is set (via supportsMetadata rejection) + * - The requiredHook (typically ProtocolFee) returns 0 when protocolFee is 0, allowing + * ERC-20 fee tokens to be used with the default hook even when requiredHook exists + */ + +library StandardHookMetadata { + struct Metadata { + uint16 variant; + uint256 msgValue; + uint256 gasLimit; + address refundAddress; + } + + uint8 private constant VARIANT_OFFSET = 0; + uint8 private constant MSG_VALUE_OFFSET = 2; + uint8 private constant GAS_LIMIT_OFFSET = 34; + uint8 private constant REFUND_ADDRESS_OFFSET = 66; + uint8 private constant FEE_TOKEN_OFFSET = 86; + + uint16 public constant VARIANT = 1; + + /** + * @notice Returns the variant of the metadata. + * @param _metadata ABI encoded standard hook metadata. + * @return variant of the metadata as uint16. + */ + function variant(bytes calldata _metadata) internal pure returns (uint16) { + if (_metadata.length < VARIANT_OFFSET + 2) return 0; + return uint16(bytes2(_metadata[VARIANT_OFFSET:VARIANT_OFFSET + 2])); + } + + /** + * @notice Returns the specified value for the message. + * @param _metadata ABI encoded standard hook metadata. + * @param _default Default fallback value. + * @return Value for the message as uint256. + */ + function msgValue( + bytes calldata _metadata, + uint256 _default + ) internal pure returns (uint256) { + if (_metadata.length < MSG_VALUE_OFFSET + 32) return _default; + return + uint256(bytes32(_metadata[MSG_VALUE_OFFSET:MSG_VALUE_OFFSET + 32])); + } + + /** + * @notice Returns the specified gas limit for the message. + * @param _metadata ABI encoded standard hook metadata. + * @param _default Default fallback gas limit. + * @return Gas limit for the message as uint256. + */ + function gasLimit( + bytes calldata _metadata, + uint256 _default + ) internal pure returns (uint256) { + if (_metadata.length < GAS_LIMIT_OFFSET + 32) return _default; + return + uint256(bytes32(_metadata[GAS_LIMIT_OFFSET:GAS_LIMIT_OFFSET + 32])); + } + + function gasLimit( + bytes memory _metadata + ) internal pure returns (uint256 _gasLimit) { + if (_metadata.length < GAS_LIMIT_OFFSET + 32) return 50_000; + assembly { + _gasLimit := mload(add(_metadata, add(0x20, GAS_LIMIT_OFFSET))) + } + } + + /** + * @notice Returns the specified refund address for the message. + * @param _metadata ABI encoded standard hook metadata. + * @param _default Default fallback refund address. + * @return Refund address for the message as address. + */ + function refundAddress( + bytes calldata _metadata, + address _default + ) internal pure returns (address) { + if (_metadata.length < REFUND_ADDRESS_OFFSET + 20) return _default; + return + address( + bytes20( + _metadata[REFUND_ADDRESS_OFFSET:REFUND_ADDRESS_OFFSET + 20] + ) + ); + } + + /** + * @notice Returns the fee token address for token-based gas payments. + * @param _metadata ABI encoded standard hook metadata. + * @param _default Default fallback fee token (typically address(0) for native). + * @return Fee token address at [86:106], or _default if metadata too short. + */ + function feeToken( + bytes calldata _metadata, + address _default + ) internal pure returns (address) { + if (_metadata.length < FEE_TOKEN_OFFSET + 20) return _default; + return + address(bytes20(_metadata[FEE_TOKEN_OFFSET:FEE_TOKEN_OFFSET + 20])); + } + + /** + * @notice Returns the fee token address for token-based gas payments (memory version). + * @param _metadata ABI encoded standard hook metadata. + * @return _feeToken Fee token address at [86:106], or address(0) if metadata too short. + */ + function feeToken( + bytes memory _metadata + ) internal pure returns (address _feeToken) { + if (_metadata.length < FEE_TOKEN_OFFSET + 20) return address(0); + assembly { + let data_start_ptr := add(_metadata, 32) // Skip length prefix + let mload_ptr := add(data_start_ptr, sub(FEE_TOKEN_OFFSET, 12)) + _feeToken := mload(mload_ptr) // Loads 32 bytes; address takes lower 20 bytes + } + } + + /** + * @notice Formats the specified gas limit and refund address into standard hook metadata. + * @param _msgValue msg.value for the message. + * @param _gasLimit Gas limit for the message. + * @param _refundAddress Refund address for the message. + * @return ABI encoded standard hook metadata. + */ + function format( + uint256 _msgValue, + uint256 _gasLimit, + address _refundAddress + ) internal pure returns (bytes memory) { + return abi.encodePacked(VARIANT, _msgValue, _gasLimit, _refundAddress); + } + + /** + * @notice Formats the specified gas limit and refund address into standard hook metadata. + * @param _msgValue msg.value for the message. + * @param _gasLimit Gas limit for the message. + * @param _refundAddress Refund address for the message. + * @param _customMetadata Additional metadata to include in the standard hook metadata. + * @return ABI encoded standard hook metadata. + */ + function formatMetadata( + uint256 _msgValue, + uint256 _gasLimit, + address _refundAddress, + bytes memory _customMetadata + ) internal pure returns (bytes memory) { + return + abi.encodePacked( + VARIANT, + _msgValue, + _gasLimit, + _refundAddress, + _customMetadata + ); + } + + /** + * @notice Formats the specified gas limit and refund address into standard hook metadata. + * @param _msgValue msg.value for the message. + * @return ABI encoded standard hook metadata. + */ + function overrideMsgValue( + uint256 _msgValue + ) internal view returns (bytes memory) { + return formatMetadata(_msgValue, uint256(0), msg.sender, ""); + } + + /** + * @notice Formats the specified gas limit and refund address into standard hook metadata. + * @param _gasLimit Gas limit for the message. + * @return ABI encoded standard hook metadata. + */ + function overrideGasLimit( + uint256 _gasLimit + ) internal view returns (bytes memory) { + return formatMetadata(uint256(0), _gasLimit, msg.sender, ""); + } + + /** + * @notice Formats the specified refund address into standard hook metadata. + * @param _refundAddress Refund address for the message. + * @return ABI encoded standard hook metadata. + */ + function overrideRefundAddress( + address _refundAddress + ) internal pure returns (bytes memory) { + return formatMetadata(uint256(0), uint256(0), _refundAddress, ""); + } + + /** + * @notice Formats metadata with fee token for token-based gas payments. + * @param _msgValue msg.value for the message. + * @param _gasLimit Gas limit for the message. + * @param _refundAddress Refund address for the message. + * @param _feeToken Fee token address for gas payment. + * @return ABI encoded hook metadata with fee token at [86:106]. + */ + function formatWithFeeToken( + uint256 _msgValue, + uint256 _gasLimit, + address _refundAddress, + address _feeToken + ) internal pure returns (bytes memory) { + return + abi.encodePacked( + VARIANT, + _msgValue, + _gasLimit, + _refundAddress, + _feeToken + ); + } + + function getRefundAddress( + bytes memory _metadata, + address _default + ) internal pure returns (address) { + if (_metadata.length < REFUND_ADDRESS_OFFSET + 20) return _default; + address result; + assembly { + let data_start_ptr := add(_metadata, 32) // Skip length prefix of _metadata + let mload_ptr := add(data_start_ptr, sub(REFUND_ADDRESS_OFFSET, 12)) + result := mload(mload_ptr) // Loads 32 bytes; address takes lower 20 bytes. + } + return result; + } +} diff --git a/contracts/solidity/hyperlane/interfaces/IInterchainSecurityModule.sol b/contracts/solidity/hyperlane/interfaces/IInterchainSecurityModule.sol new file mode 100755 index 00000000..796be5e2 --- /dev/null +++ b/contracts/solidity/hyperlane/interfaces/IInterchainSecurityModule.sol @@ -0,0 +1,47 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 +pragma solidity >=0.6.11; + +interface IInterchainSecurityModule { + enum Types { + UNUSED, + ROUTING, + AGGREGATION, + LEGACY_MULTISIG, + MERKLE_ROOT_MULTISIG, + MESSAGE_ID_MULTISIG, + NULL, // used with relayer carrying no metadata + CCIP_READ, + ARB_L2_TO_L1, + WEIGHTED_MERKLE_ROOT_MULTISIG, + WEIGHTED_MESSAGE_ID_MULTISIG, + OP_L2_TO_L1, + POLYMER + } + + /** + * @notice Returns an enum that represents the type of security model + * encoded by this ISM. + * @dev Relayers infer how to fetch and format metadata. + */ + function moduleType() external view returns (uint8); + + /** + * @notice Defines a security model responsible for verifying interchain + * messages based on the provided metadata. + * @param _metadata Off-chain metadata provided by a relayer, specific to + * the security model encoded by the module (e.g. validator signatures) + * @param _message Hyperlane encoded interchain message + * @return True if the message was verified + */ + function verify( + bytes calldata _metadata, + bytes calldata _message + ) external returns (bool); +} + +interface ISpecifiesInterchainSecurityModule { + function interchainSecurityModule() + external + view + returns (IInterchainSecurityModule); +} diff --git a/contracts/solidity/hyperlane/interfaces/IMailbox.sol b/contracts/solidity/hyperlane/interfaces/IMailbox.sol new file mode 100755 index 00000000..08a70102 --- /dev/null +++ b/contracts/solidity/hyperlane/interfaces/IMailbox.sol @@ -0,0 +1,111 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 +pragma solidity >=0.8.0; + +import {IInterchainSecurityModule} from "./IInterchainSecurityModule.sol"; +import {IPostDispatchHook} from "./hooks/IPostDispatchHook.sol"; + +interface IMailbox { + // ============ Events ============ + /** + * @notice Emitted when a new message is dispatched via Hyperlane + * @param sender The address that dispatched the message + * @param destination The destination domain of the message + * @param recipient The message recipient address on `destination` + * @param message Raw bytes of message + */ + event Dispatch( + address indexed sender, + uint32 indexed destination, + bytes32 indexed recipient, + bytes message + ); + + /** + * @notice Emitted when a new message is dispatched via Hyperlane + * @param messageId The unique message identifier + */ + event DispatchId(bytes32 indexed messageId); + + /** + * @notice Emitted when a Hyperlane message is processed + * @param messageId The unique message identifier + */ + event ProcessId(bytes32 indexed messageId); + + /** + * @notice Emitted when a Hyperlane message is delivered + * @param origin The origin domain of the message + * @param sender The message sender address on `origin` + * @param recipient The address that handled the message + */ + event Process( + uint32 indexed origin, + bytes32 indexed sender, + address indexed recipient + ); + + function localDomain() external view returns (uint32); + + function delivered(bytes32 messageId) external view returns (bool); + + function defaultIsm() external view returns (IInterchainSecurityModule); + + function defaultHook() external view returns (IPostDispatchHook); + + function requiredHook() external view returns (IPostDispatchHook); + + function latestDispatchedId() external view returns (bytes32); + + function nonce() external view returns (uint32); + + function dispatch( + uint32 destinationDomain, + bytes32 recipientAddress, + bytes calldata messageBody + ) external payable returns (bytes32 messageId); + + function quoteDispatch( + uint32 destinationDomain, + bytes32 recipientAddress, + bytes calldata messageBody + ) external view returns (uint256 fee); + + function dispatch( + uint32 destinationDomain, + bytes32 recipientAddress, + bytes calldata body, + bytes calldata defaultHookMetadata + ) external payable returns (bytes32 messageId); + + function quoteDispatch( + uint32 destinationDomain, + bytes32 recipientAddress, + bytes calldata messageBody, + bytes calldata defaultHookMetadata + ) external view returns (uint256 fee); + + function dispatch( + uint32 destinationDomain, + bytes32 recipientAddress, + bytes calldata body, + bytes calldata customHookMetadata, + IPostDispatchHook customHook + ) external payable returns (bytes32 messageId); + + function quoteDispatch( + uint32 destinationDomain, + bytes32 recipientAddress, + bytes calldata messageBody, + bytes calldata customHookMetadata, + IPostDispatchHook customHook + ) external view returns (uint256 fee); + + function process( + bytes calldata metadata, + bytes calldata message + ) external payable; + + function recipientIsm( + address recipient + ) external view returns (IInterchainSecurityModule module); +} diff --git a/contracts/solidity/hyperlane/interfaces/IMessageRecipient.sol b/contracts/solidity/hyperlane/interfaces/IMessageRecipient.sol new file mode 100755 index 00000000..187194b6 --- /dev/null +++ b/contracts/solidity/hyperlane/interfaces/IMessageRecipient.sol @@ -0,0 +1,10 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 +pragma solidity >=0.6.11; + +interface IMessageRecipient { + function handle( + uint32 _origin, + bytes32 _sender, + bytes calldata _message + ) external payable; +} diff --git a/contracts/solidity/hyperlane/interfaces/ITokenBridge.sol b/contracts/solidity/hyperlane/interfaces/ITokenBridge.sol new file mode 100755 index 00000000..9fddf6f4 --- /dev/null +++ b/contracts/solidity/hyperlane/interfaces/ITokenBridge.sol @@ -0,0 +1,40 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 +pragma solidity >=0.8.0; + +struct Quote { + address token; // address(0) for the native token, or ERC20 for token payments + uint256 amount; +} + +interface ITokenFee { + /** + * @notice Provide the value transfer quote + * @param _destination The destination domain of the message + * @param _recipient The message recipient address on `destination` + * @param _amount The amount to send to the recipient + * @return quotes Indicate how much of each token to approve and/or send. + * @dev Good practice is to use the first entry of the quotes for the IGP fee (native or ERC20). + * @dev Good practice is to use the last entry of the quotes for the token to be transferred. + * @dev There should not be duplicate `token` addresses in the returned quotes. + */ + function quoteTransferRemote( + uint32 _destination, + bytes32 _recipient, + uint256 _amount + ) external view returns (Quote[] memory quotes); +} + +interface ITokenBridge is ITokenFee { + /** + * @notice Transfer value to another domain + * @param _destination The destination domain of the message + * @param _recipient The message recipient address on `destination` + * @param _amount The amount to send to the recipient + * @return messageId The identifier of the dispatched message. + */ + function transferRemote( + uint32 _destination, + bytes32 _recipient, + uint256 _amount + ) external payable returns (bytes32); +} diff --git a/contracts/solidity/hyperlane/interfaces/hooks/IPostDispatchHook.sol b/contracts/solidity/hyperlane/interfaces/hooks/IPostDispatchHook.sol new file mode 100755 index 00000000..cc6d99c1 --- /dev/null +++ b/contracts/solidity/hyperlane/interfaces/hooks/IPostDispatchHook.sol @@ -0,0 +1,80 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 +pragma solidity >=0.8.0; + +/*@@@@@@@ @@@@@@@@@ + @@@@@@@@@ @@@@@@@@@ + @@@@@@@@@ @@@@@@@@@ + @@@@@@@@@ @@@@@@@@@ + @@@@@@@@@@@@@@@@@@@@@@@@@ + @@@@@ HYPERLANE @@@@@@@ + @@@@@@@@@@@@@@@@@@@@@@@@@ + @@@@@@@@@ @@@@@@@@@ + @@@@@@@@@ @@@@@@@@@ + @@@@@@@@@ @@@@@@@@@ +@@@@@@@@@ @@@@@@@@*/ + +interface IPostDispatchHook { + enum HookTypes { + UNUSED, + ROUTING, + AGGREGATION, + MERKLE_TREE, + INTERCHAIN_GAS_PAYMASTER, + FALLBACK_ROUTING, + ID_AUTH_ISM, + PAUSABLE, + PROTOCOL_FEE, + DEPRECATED, + RATE_LIMITED, + ARB_L2_TO_L1, + OP_L2_TO_L1, + MAILBOX_DEFAULT_HOOK, + AMOUNT_ROUTING, + CCTP, + TIMELOCK_ROUTING + } + + /** + * @notice Returns an enum that represents the type of hook + */ + function hookType() external view returns (uint8); + + /** + * @notice Returns whether the hook supports metadata + * @param metadata metadata + * @return Whether the hook supports metadata + */ + function supportsMetadata( + bytes calldata metadata + ) external view returns (bool); + + /** + * @notice Post action after a message is dispatched via the Mailbox + * @param metadata The metadata required for the hook + * @param message The message passed from the Mailbox.dispatch() call + */ + function postDispatch( + bytes calldata metadata, + bytes calldata message + ) external payable; + + /** + * @notice Compute the payment required by the postDispatch call + * @dev The returned quote is denominated in a single currency - either native ETH + * (when metadata.feeToken is address(0) or unspecified) or an ERC-20 token + * (when metadata.feeToken is set). Mixing fee denominations within a single + * dispatch is not supported. + * + * When feeToken is set, hooks that only support native fees should return 0 or + * revert via supportsMetadata. The Mailbox.quoteDispatch sums quotes from + * requiredHook and hook, which assumes both use the same denomination. + * + * @param metadata The metadata required for the hook + * @param message The message passed from the Mailbox.dispatch() call + * @return Quoted payment for the postDispatch call + */ + function quoteDispatch( + bytes calldata metadata, + bytes calldata message + ) external view returns (uint256); +} diff --git a/contracts/solidity/hyperlane/libs/EnumerableMapExtended.sol b/contracts/solidity/hyperlane/libs/EnumerableMapExtended.sol new file mode 100755 index 00000000..ff941f7b --- /dev/null +++ b/contracts/solidity/hyperlane/libs/EnumerableMapExtended.sol @@ -0,0 +1,88 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 +pragma solidity >=0.6.11; + +// ============ External Imports ============ +import "@openzeppelin/contracts/utils/structs/EnumerableMap.sol"; +import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol"; + +// extends EnumerableMap with uint256 => bytes32 type +// modelled after https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.8.0/contracts/utils/structs/EnumerableMap.sol +library EnumerableMapExtended { + using EnumerableMap for EnumerableMap.Bytes32ToBytes32Map; + using EnumerableSet for EnumerableSet.Bytes32Set; + + struct UintToBytes32Map { + EnumerableMap.Bytes32ToBytes32Map _inner; + } + + // ============ Library Functions ============ + function keys( + UintToBytes32Map storage map + ) internal view returns (uint256[] memory _keys) { + uint256 _length = map._inner.length(); + _keys = new uint256[](_length); + for (uint256 i = 0; i < _length; i++) { + _keys[i] = uint256(map._inner._keys.at(i)); + } + } + + function uint32Keys( + UintToBytes32Map storage map + ) internal view returns (uint32[] memory _keys) { + uint256[] memory uint256keys = keys(map); + _keys = new uint32[](uint256keys.length); + for (uint256 i = 0; i < uint256keys.length; i++) { + _keys[i] = uint32(uint256keys[i]); + } + } + + function set( + UintToBytes32Map storage map, + uint256 key, + bytes32 value + ) internal { + map._inner.set(bytes32(key), value); + } + + function get( + UintToBytes32Map storage map, + uint256 key + ) internal view returns (bytes32) { + return map._inner.get(bytes32(key)); + } + + function tryGet( + UintToBytes32Map storage map, + uint256 key + ) internal view returns (bool, bytes32) { + return map._inner.tryGet(bytes32(key)); + } + + function remove( + UintToBytes32Map storage map, + uint256 key + ) internal returns (bool) { + return map._inner.remove(bytes32(key)); + } + + function contains( + UintToBytes32Map storage map, + uint256 key + ) internal view returns (bool) { + return map._inner.contains(bytes32(key)); + } + + function length( + UintToBytes32Map storage map + ) internal view returns (uint256) { + return map._inner.length(); + } + + function at( + UintToBytes32Map storage map, + uint256 index + ) internal view returns (uint256, bytes32) { + (bytes32 key, bytes32 value) = map._inner.at(index); + return (uint256(key), value); + } +} diff --git a/contracts/solidity/hyperlane/libs/Message.sol b/contracts/solidity/hyperlane/libs/Message.sol new file mode 100755 index 00000000..3eb69120 --- /dev/null +++ b/contracts/solidity/hyperlane/libs/Message.sol @@ -0,0 +1,153 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 +pragma solidity >=0.8.0; + +import {TypeCasts} from "./TypeCasts.sol"; + +/** + * @title Hyperlane Message Library + * @notice Library for formatted messages used by Mailbox + **/ +library Message { + using TypeCasts for bytes32; + + uint256 private constant VERSION_OFFSET = 0; + uint256 private constant NONCE_OFFSET = 1; + uint256 private constant ORIGIN_OFFSET = 5; + uint256 private constant SENDER_OFFSET = 9; + uint256 private constant DESTINATION_OFFSET = 41; + uint256 private constant RECIPIENT_OFFSET = 45; + uint256 private constant BODY_OFFSET = 77; + + /** + * @notice Returns formatted (packed) Hyperlane message with provided fields + * @dev This function should only be used in memory message construction. + * @param _version The version of the origin and destination Mailboxes + * @param _nonce A nonce to uniquely identify the message on its origin chain + * @param _originDomain Domain of origin chain + * @param _sender Address of sender as bytes32 + * @param _destinationDomain Domain of destination chain + * @param _recipient Address of recipient on destination chain as bytes32 + * @param _messageBody Raw bytes of message body + * @return Formatted message + */ + function formatMessage( + uint8 _version, + uint32 _nonce, + uint32 _originDomain, + bytes32 _sender, + uint32 _destinationDomain, + bytes32 _recipient, + bytes calldata _messageBody + ) internal pure returns (bytes memory) { + return + abi.encodePacked( + _version, + _nonce, + _originDomain, + _sender, + _destinationDomain, + _recipient, + _messageBody + ); + } + + /** + * @notice Returns the message ID. + * @param _message ABI encoded Hyperlane message. + * @return ID of `_message` + */ + function id(bytes memory _message) internal pure returns (bytes32) { + return keccak256(_message); + } + + /** + * @notice Returns the message version. + * @param _message ABI encoded Hyperlane message. + * @return Version of `_message` + */ + function version(bytes calldata _message) internal pure returns (uint8) { + return uint8(bytes1(_message[VERSION_OFFSET:NONCE_OFFSET])); + } + + /** + * @notice Returns the message nonce. + * @param _message ABI encoded Hyperlane message. + * @return Nonce of `_message` + */ + function nonce(bytes calldata _message) internal pure returns (uint32) { + return uint32(bytes4(_message[NONCE_OFFSET:ORIGIN_OFFSET])); + } + + /** + * @notice Returns the message origin domain. + * @param _message ABI encoded Hyperlane message. + * @return Origin domain of `_message` + */ + function origin(bytes calldata _message) internal pure returns (uint32) { + return uint32(bytes4(_message[ORIGIN_OFFSET:SENDER_OFFSET])); + } + + /** + * @notice Returns the message sender as bytes32. + * @param _message ABI encoded Hyperlane message. + * @return Sender of `_message` as bytes32 + */ + function sender(bytes calldata _message) internal pure returns (bytes32) { + return bytes32(_message[SENDER_OFFSET:DESTINATION_OFFSET]); + } + + /** + * @notice Returns the message sender as address. + * @param _message ABI encoded Hyperlane message. + * @return Sender of `_message` as address + */ + function senderAddress( + bytes calldata _message + ) internal pure returns (address) { + return sender(_message).bytes32ToAddress(); + } + + /** + * @notice Returns the message destination domain. + * @param _message ABI encoded Hyperlane message. + * @return Destination domain of `_message` + */ + function destination( + bytes calldata _message + ) internal pure returns (uint32) { + return uint32(bytes4(_message[DESTINATION_OFFSET:RECIPIENT_OFFSET])); + } + + /** + * @notice Returns the message recipient as bytes32. + * @param _message ABI encoded Hyperlane message. + * @return Recipient of `_message` as bytes32 + */ + function recipient( + bytes calldata _message + ) internal pure returns (bytes32) { + return bytes32(_message[RECIPIENT_OFFSET:BODY_OFFSET]); + } + + /** + * @notice Returns the message recipient as address. + * @param _message ABI encoded Hyperlane message. + * @return Recipient of `_message` as address + */ + function recipientAddress( + bytes calldata _message + ) internal pure returns (address) { + return recipient(_message).bytes32ToAddress(); + } + + /** + * @notice Returns the message body. + * @param _message ABI encoded Hyperlane message. + * @return Body of `_message` + */ + function body( + bytes calldata _message + ) internal pure returns (bytes calldata) { + return bytes(_message[BODY_OFFSET:]); + } +} diff --git a/contracts/solidity/hyperlane/libs/TypeCasts.sol b/contracts/solidity/hyperlane/libs/TypeCasts.sol new file mode 100755 index 00000000..d156e985 --- /dev/null +++ b/contracts/solidity/hyperlane/libs/TypeCasts.sol @@ -0,0 +1,18 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 +pragma solidity >=0.6.11; + +library TypeCasts { + // alignment preserving cast + function addressToBytes32(address _addr) internal pure returns (bytes32) { + return bytes32(uint256(uint160(_addr))); + } + + // alignment preserving cast + function bytes32ToAddress(bytes32 _buf) internal pure returns (address) { + require( + uint256(_buf) <= uint256(type(uint160).max), + "TypeCasts: bytes32ToAddress overflow" + ); + return address(uint160(uint256(_buf))); + } +} diff --git a/contracts/solidity/hyperlane/token/HypERC20Collateral.sol b/contracts/solidity/hyperlane/token/HypERC20Collateral.sol new file mode 100755 index 00000000..727658fe --- /dev/null +++ b/contracts/solidity/hyperlane/token/HypERC20Collateral.sol @@ -0,0 +1,115 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 +pragma solidity >=0.8.0; + +/*@@@@@@@ @@@@@@@@@ + @@@@@@@@@ @@@@@@@@@ + @@@@@@@@@ @@@@@@@@@ + @@@@@@@@@ @@@@@@@@@ + @@@@@@@@@@@@@@@@@@@@@@@@@ + @@@@@ HYPERLANE @@@@@@@ + @@@@@@@@@@@@@@@@@@@@@@@@@ + @@@@@@@@@ @@@@@@@@@ + @@@@@@@@@ @@@@@@@@@ + @@@@@@@@@ @@@@@@@@@ +@@@@@@@@@ @@@@@@@@*/ + +// ============ Internal Imports ============ +import {TokenMessage} from "./libs/TokenMessage.sol"; +import {TokenRouter} from "./libs/TokenRouter.sol"; +import {MovableCollateralRouter} from "./libs/MovableCollateralRouter.sol"; +import {LpCollateralRouter} from "./libs/LpCollateralRouter.sol"; +import {ITokenBridge, Quote} from "../interfaces/ITokenBridge.sol"; +import {ERC20Collateral} from "./libs/TokenCollateral.sol"; +import {EnumerableMapExtended} from "../libs/EnumerableMapExtended.sol"; + +// ============ External Imports ============ +import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; +import {Address} from "@openzeppelin/contracts/utils/Address.sol"; +import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; +import {EnumerableSet} from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol"; + +/** + * @title Hyperlane ERC20 Token Collateral that wraps an existing ERC20 with remote transfer functionality. + * @author Abacus Works + */ +contract HypERC20Collateral is LpCollateralRouter { + using SafeERC20 for IERC20; + using ERC20Collateral for IERC20; + using EnumerableSet for EnumerableSet.AddressSet; + using EnumerableMapExtended for EnumerableMapExtended.UintToBytes32Map; + + IERC20 public immutable wrappedToken; + + /** + * @notice Constructor + * @param erc20 Address of the token to keep as collateral + */ + constructor( + address erc20, + uint256 _scaleNumerator, + uint256 _scaleDenominator, + address _mailbox + ) TokenRouter(_scaleNumerator, _scaleDenominator, _mailbox) { + require(Address.isContract(erc20), "HypERC20Collateral: invalid token"); + wrappedToken = IERC20(erc20); + } + + function initialize( + address _hook, + address _interchainSecurityModule, + address _owner + ) public initializer { + _MailboxClient_initialize(_hook, _interchainSecurityModule, _owner); + _LpCollateralRouter_initialize(); + } + + function token() public view override returns (address) { + return address(wrappedToken); + } + + function _addBridge(uint32 domain, ITokenBridge bridge) internal override { + MovableCollateralRouter._addBridge(domain, bridge); + wrappedToken.forceApprove(address(bridge), type(uint256).max); + } + + function _removeBridge( + uint32 domain, + ITokenBridge bridge + ) internal override { + MovableCollateralRouter._removeBridge(domain, bridge); + + uint32[] memory knownDomains = _routers.uint32Keys(); + + // Iteration is fine as number of enrolled domains is bounded + for (uint256 i = 0; i < knownDomains.length; i++) { + EnumerableSet.AddressSet storage bridges = allowed.bridges[ + knownDomains[i] + ]; + + if (bridges.contains(address(bridge))) { + return; + } + } + + wrappedToken.forceApprove(address(bridge), 0); + } + + /** + * @dev Transfers `_amount` of `wrappedToken` from `msg.sender` to this contract. + * @inheritdoc TokenRouter + */ + function _transferFromSender(uint256 _amount) internal override { + wrappedToken._transferFromSender(_amount); + } + + /** + * @dev Transfers `_amount` of `wrappedToken` from this contract to `_recipient`. + * @inheritdoc TokenRouter + */ + function _transferTo( + address _recipient, + uint256 _amount + ) internal override { + wrappedToken._transferTo(_recipient, _amount); + } +} diff --git a/contracts/solidity/hyperlane/token/interfaces/IWETH.sol b/contracts/solidity/hyperlane/token/interfaces/IWETH.sol new file mode 100755 index 00000000..5ba2a4fa --- /dev/null +++ b/contracts/solidity/hyperlane/token/interfaces/IWETH.sol @@ -0,0 +1,9 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 +pragma solidity ^0.8.22; + +import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; + +interface IWETH is IERC20 { + function deposit() external payable; + function withdraw(uint256 amount) external; +} diff --git a/contracts/solidity/hyperlane/token/libs/LpCollateralRouter.sol b/contracts/solidity/hyperlane/token/libs/LpCollateralRouter.sol new file mode 100755 index 00000000..4c002430 --- /dev/null +++ b/contracts/solidity/hyperlane/token/libs/LpCollateralRouter.sol @@ -0,0 +1,103 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.8.0; + +// ============ Internal Imports ============ +import {MovableCollateralRouter, MovableCollateralRouterStorage} from "./MovableCollateralRouter.sol"; + +// ============ External Imports ============ +import {ERC4626Upgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC4626Upgradeable.sol"; +import {IERC20Upgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; + +struct LpCollateralRouterStorage { + // MovableCollateralRouter layout + MovableCollateralRouterStorage __MOVABLE_COLLATERAL_GAP; + // ERC4626 layout + // - (ERC20 layout) + mapping(address => uint256) _balances; + mapping(address => mapping(address => uint256)) _allowances; + uint256 _totalSupply; + string _name; + string _symbol; + // @openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol:376 + uint256[45] __ERC20_GAP; + // - (ERC4626 layout) + address _asset; + uint8 _underlyingDecimals; + // @openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC4626Upgradeable.sol:267 + uint256[49] __ERC4626_GAP; + // user defined fields + uint256 lpAssets; +} + +abstract contract LpCollateralRouter is + MovableCollateralRouter, + ERC4626Upgradeable +{ + uint256 private lpAssets; + + event Donation(address sender, uint256 amount); + + function _LpCollateralRouter_initialize() internal onlyInitializing { + __ERC4626_init(IERC20Upgradeable(token())); + } + + function totalAssets() public view override returns (uint256) { + return lpAssets; + } + + function asset() public view override returns (address) { + return token(); + } + + // modeled after ERC4626Upgradeable._deposit + function _deposit( + address caller, + address receiver, + uint256 assets, + uint256 shares + ) internal override { + // checks + _transferFromSender(assets); + + // effects + lpAssets += assets; + + // interactions + _mint(receiver, shares); + + emit Deposit(caller, receiver, assets, shares); + } + + // modeled after ERC4626Upgradeable._withdraw + function _withdraw( + address caller, + address receiver, + address owner, + uint256 assets, + uint256 shares + ) internal override { + // checks + if (caller != owner) { + _spendAllowance(owner, caller, shares); + } + _burn(owner, shares); + + // effects + lpAssets -= assets; + + // interactions + _transferTo(receiver, assets); + + emit Withdraw(caller, receiver, owner, assets, shares); + } + + // can be used to distribute rewards to LPs pro rata + function donate(uint256 amount) public payable { + // checks + _transferFromSender(amount); + + // effects + lpAssets += amount; + emit Donation(msg.sender, amount); + } +} diff --git a/contracts/solidity/hyperlane/token/libs/MovableCollateralRouter.sol b/contracts/solidity/hyperlane/token/libs/MovableCollateralRouter.sol new file mode 100755 index 00000000..db25b460 --- /dev/null +++ b/contracts/solidity/hyperlane/token/libs/MovableCollateralRouter.sol @@ -0,0 +1,196 @@ +// SPDX-License-Identifier: Apache-2.0 +pragma solidity >=0.8.0; + +import {ITokenBridge, Quote} from "../../interfaces/ITokenBridge.sol"; +import {EnumerableSet} from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol"; +import {TokenRouter} from "./TokenRouter.sol"; +import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; +import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; +import {Router} from "../../client/Router.sol"; +import {Quotes} from "./Quotes.sol"; + +struct MovableCollateralRouterStorage { + mapping(uint32 routerDomain => bytes32 recipient) recipient; + mapping(uint32 routerDomain => EnumerableSet.AddressSet bridges) bridges; + EnumerableSet.AddressSet rebalancers; +} + +abstract contract MovableCollateralRouter is TokenRouter { + using SafeERC20 for IERC20; + using EnumerableSet for EnumerableSet.AddressSet; + using Quotes for Quote[]; + + MovableCollateralRouterStorage internal allowed; + + event CollateralMoved( + uint32 indexed domain, + bytes32 recipient, + uint256 amount, + address indexed rebalancer + ); + + modifier onlyRebalancer() { + require( + allowed.rebalancers.contains(_msgSender()), + "MCR: Only Rebalancer" + ); + _; + } + + modifier onlyAllowedBridge(uint32 domain, ITokenBridge bridge) { + EnumerableSet.AddressSet storage bridges = allowed.bridges[domain]; + require(bridges.contains(address(bridge)), "MCR: Not allowed bridge"); + _; + } + + /// @notice Set of addresses that are allowed to rebalance. + function allowedRebalancers() external view returns (address[] memory) { + return allowed.rebalancers.values(); + } + + /// @notice Mapping of domain to allowed rebalance recipient. + /// @dev Keys constrained to a subset of Router.domains() + function allowedRecipient(uint32 domain) external view returns (bytes32) { + return allowed.recipient[domain]; + } + + /// @notice Mapping of domain to allowed rebalance bridges. + /// @dev Keys constrained to a subset of Router.domains() + function allowedBridges( + uint32 domain + ) external view returns (address[] memory) { + return allowed.bridges[domain].values(); + } + + function setRecipient(uint32 domain, bytes32 recipient) external onlyOwner { + // constrain to a subset of Router.domains() + _mustHaveRemoteRouter(domain); + allowed.recipient[domain] = recipient; + } + + function removeRecipient(uint32 domain) external onlyOwner { + delete allowed.recipient[domain]; + } + + function addBridge(uint32 domain, ITokenBridge bridge) external onlyOwner { + // constrain to a subset of Router.domains() + _mustHaveRemoteRouter(domain); + _addBridge(domain, bridge); + } + + function _addBridge(uint32 domain, ITokenBridge bridge) internal virtual { + allowed.bridges[domain].add(address(bridge)); + } + + function removeBridge( + uint32 domain, + ITokenBridge bridge + ) external onlyOwner { + _removeBridge(domain, bridge); + } + + function _removeBridge( + uint32 domain, + ITokenBridge bridge + ) internal virtual { + allowed.bridges[domain].remove(address(bridge)); + } + + /** + * @notice Approves the token for the bridge. + * @param token The token to approve. + * @param bridge The bridge to approve the token for. + * @dev We need this to support bridges that charge fees in ERC20 tokens. + */ + function approveTokenForBridge( + IERC20 token, + ITokenBridge bridge + ) external onlyOwner { + token.safeApprove(address(bridge), type(uint256).max); + } + + function addRebalancer(address rebalancer) external onlyOwner { + allowed.rebalancers.add(rebalancer); + } + + function removeRebalancer(address rebalancer) external onlyOwner { + allowed.rebalancers.remove(rebalancer); + } + + /** + * @notice Rebalances the collateral between router domains. + * @param domain The domain to rebalance to. + * @param collateralAmount The amount of collateral to rebalance. + * @param bridge The bridge to use for the rebalance. + * @dev The caller must be an allowed rebalancer and the bridge must be an allowed bridge for the domain. + * @dev The recipient is the enrolled router if no recipient is set for the domain. + */ + function rebalance( + uint32 domain, + uint256 collateralAmount, + ITokenBridge bridge + ) external payable onlyRebalancer onlyAllowedBridge(domain, bridge) { + bytes32 recipient = _recipient(domain); + + Quote[] memory quotes = bridge.quoteTransferRemote( + domain, + recipient, + collateralAmount + ); + + // charge the rebalancer any bridging fees denominated in the collateral + // token to avoid undercollateralization + uint256 collateralFees = quotes.extract(token()); + if (collateralFees > collateralAmount) { + _transferFromSender(collateralFees - collateralAmount); + } + + // need to handle native quote separately from collateral quote because + // token() may be address(0), in which case we need to use address(this).balance + // to move native collateral tokens across chains + uint256 nativeFees = quotes.extract(address(0)); + if (nativeFees > address(this).balance) { + revert("Rebalance native fee exceeds balance"); + } + + bridge.transferRemote{value: nativeFees}( + domain, + recipient, + collateralAmount + ); + emit CollateralMoved(domain, recipient, collateralAmount, msg.sender); + } + + function _recipient( + uint32 domain + ) internal view returns (bytes32 recipient) { + recipient = allowed.recipient[domain]; + if (recipient == bytes32(0)) { + recipient = _mustHaveRemoteRouter(domain); + } + } + + /// @dev This function in `EnumerableSet` was introduced in OpenZeppelin v5. We are using 4.9 + /// See https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.3.0-rc.0/contracts/utils/structs/EnumerableSet.sol#L126 + function _clear(EnumerableSet.Set storage set) private { + uint256 len = set._values.length; + for (uint256 i = 0; i < len; ++i) { + delete set._indexes[set._values[i]]; + } + _unsafeSetLength(set._values, 0); + } + + /// @dev A helper for `_clear`. See https://github.com/OpenZeppelin/openzeppelin-contracts/blob/39f5a0284e7eb539354e44b76fcbb69033b22b56/contracts/utils/Arrays.sol#L466 + function _unsafeSetLength(bytes32[] storage array, uint256 len) internal { + assembly ("memory-safe") { + sstore(array.slot, len) + } + } + + /// @dev Constrains keys of rebalance mappings to Router.domains() + function _unenrollRemoteRouter(uint32 domain) internal override { + delete allowed.recipient[domain]; + _clear(allowed.bridges[domain]._inner); + Router._unenrollRemoteRouter(domain); + } +} diff --git a/contracts/solidity/hyperlane/token/libs/Quotes.sol b/contracts/solidity/hyperlane/token/libs/Quotes.sol new file mode 100755 index 00000000..6f4d6152 --- /dev/null +++ b/contracts/solidity/hyperlane/token/libs/Quotes.sol @@ -0,0 +1,18 @@ +// SPDX-License-Identifier: Apache-2.0 +pragma solidity >=0.8.0; + +import {Quote} from "../../interfaces/ITokenBridge.sol"; + +library Quotes { + function extract( + Quote[] memory quotes, + address token + ) internal pure returns (uint256 sum) { + sum = 0; + for (uint256 i = 0; i < quotes.length; i++) { + if (quotes[i].token == token) { + sum += quotes[i].amount; + } + } + } +} diff --git a/contracts/solidity/hyperlane/token/libs/TokenCollateral.sol b/contracts/solidity/hyperlane/token/libs/TokenCollateral.sol new file mode 100755 index 00000000..e9cf4f7b --- /dev/null +++ b/contracts/solidity/hyperlane/token/libs/TokenCollateral.sol @@ -0,0 +1,80 @@ +// SPDX-License-Identifier: Apache-2.0 +pragma solidity >=0.8.0; + +import {IWETH} from "../interfaces/IWETH.sol"; + +// ============ External Imports ============ +import {Address} from "@openzeppelin/contracts/utils/Address.sol"; +import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; +import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; +import {IERC721} from "@openzeppelin/contracts/token/ERC721/IERC721.sol"; + +/** + * @title Handles deposits and withdrawals of native token collateral. + */ +library NativeCollateral { + function _transferFromSender(uint256 _amount) internal { + require(msg.value >= _amount, "Native: amount exceeds msg.value"); + } + + function _transferTo(address _recipient, uint256 _amount) internal { + Address.sendValue(payable(_recipient), _amount); + } +} + +/** + * @title Handles deposits and withdrawals of WETH collateral. + * @dev TokenRouters must have `token() == address(0)` to use this library. + */ +library WETHCollateral { + function _transferFromSender(IWETH token, uint256 _amount) internal { + NativeCollateral._transferFromSender(_amount); + token.deposit{value: _amount}(); + } + + function _transferTo( + IWETH token, + address _recipient, + uint256 _amount + ) internal { + token.withdraw(_amount); + NativeCollateral._transferTo(_recipient, _amount); + } +} + +/** + * @title Handles deposits and withdrawals of ERC20 collateral. + */ +library ERC20Collateral { + using SafeERC20 for IERC20; + + function _transferFromSender(IERC20 token, uint256 _amount) internal { + token.safeTransferFrom(msg.sender, address(this), _amount); + } + + function _transferTo( + IERC20 token, + address _recipient, + uint256 _amount + ) internal { + token.safeTransfer(_recipient, _amount); + } +} + +/** + * @title Handles deposits and withdrawals of ERC721 collateral. + */ +library ERC721Collateral { + function _transferFromSender(IERC721 token, uint256 _tokenId) internal { + // safeTransferFrom not used here because recipient is this contract + token.transferFrom(msg.sender, address(this), _tokenId); + } + + function _transferTo( + IERC721 token, + address _recipient, + uint256 _tokenId + ) internal { + token.safeTransferFrom(address(this), _recipient, _tokenId); + } +} diff --git a/contracts/solidity/hyperlane/token/libs/TokenMessage.sol b/contracts/solidity/hyperlane/token/libs/TokenMessage.sol new file mode 100755 index 00000000..d8f837d0 --- /dev/null +++ b/contracts/solidity/hyperlane/token/libs/TokenMessage.sol @@ -0,0 +1,42 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 +pragma solidity >=0.8.0; + +library TokenMessage { + uint8 internal constant RECIPIENT_OFFSET = 0; + uint8 internal constant AMOUNT_OFFSET = 32; + uint8 internal constant METADATA_OFFSET = 64; + + function format( + bytes32 _recipient, + uint256 _amount, + bytes memory _metadata + ) internal pure returns (bytes memory) { + return abi.encodePacked(_recipient, _amount, _metadata); + } + + function format( + bytes32 _recipient, + uint256 _amount + ) internal pure returns (bytes memory) { + return abi.encodePacked(_recipient, _amount); + } + + function recipient(bytes calldata message) internal pure returns (bytes32) { + return bytes32(message[RECIPIENT_OFFSET:RECIPIENT_OFFSET + 32]); + } + + function amount(bytes calldata message) internal pure returns (uint256) { + return uint256(bytes32(message[AMOUNT_OFFSET:AMOUNT_OFFSET + 32])); + } + + // alias for ERC721 + function tokenId(bytes calldata message) internal pure returns (uint256) { + return amount(message); + } + + function metadata( + bytes calldata message + ) internal pure returns (bytes calldata) { + return message[METADATA_OFFSET:]; + } +} diff --git a/contracts/solidity/hyperlane/token/libs/TokenRouter.sol b/contracts/solidity/hyperlane/token/libs/TokenRouter.sol new file mode 100755 index 00000000..1ef56747 --- /dev/null +++ b/contracts/solidity/hyperlane/token/libs/TokenRouter.sol @@ -0,0 +1,628 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 +pragma solidity >=0.8.0; + +// ============ Internal Imports ============ +import {TypeCasts} from "../../libs/TypeCasts.sol"; +import {GasRouter} from "../../client/GasRouter.sol"; +import {TokenMessage} from "./TokenMessage.sol"; +import {Quote, ITokenBridge, ITokenFee} from "../../interfaces/ITokenBridge.sol"; +import {Quotes} from "./Quotes.sol"; +import {StandardHookMetadata} from "../../hooks/libs/StandardHookMetadata.sol"; + +// ============ External Imports ============ +import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; +import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; +import {StorageSlot} from "@openzeppelin/contracts/utils/StorageSlot.sol"; +import {Math} from "@openzeppelin/contracts/utils/math/Math.sol"; + +/** + * @title Hyperlane Token Router that extends Router with abstract token (ERC20/ERC721) remote transfer functionality. + * @dev Overridable functions: + * - token(): specify the managed token address + * - _transferFromSender(uint256): pull tokens/ETH from msg.sender + * - _transferTo(address,uint256): send tokens/ETH to the recipient + * - _externalFeeAmount(uint32,bytes32,uint256): compute external fees (default returns 0) + * @dev Override transferRemote only to implement custom logic that can't be accomplished with the above functions. + * + * @author Abacus Works + */ +abstract contract TokenRouter is GasRouter, ITokenBridge { + using TypeCasts for bytes32; + using TypeCasts for address; + using TokenMessage for bytes; + using StandardHookMetadata for bytes; + using StorageSlot for bytes32; + using Quotes for Quote[]; + using Math for uint256; + using SafeERC20 for IERC20; + + /** + * @dev Emitted on `transferRemote` when a transfer message is dispatched. + * @param destination The identifier of the destination chain. + * @param recipient The address of the recipient on the destination chain. + * @param amountOrId The amount or ID of tokens sent in to the remote recipient. + */ + event SentTransferRemote( + uint32 indexed destination, + bytes32 indexed recipient, + uint256 amountOrId + ); + + /** + * @dev Emitted on `_handle` when a transfer message is processed. + * @param origin The identifier of the origin chain. + * @param recipient The address of the recipient on the destination chain. + * @param amountOrId The amount or ID of tokens received from the remote sender. + */ + event ReceivedTransferRemote( + uint32 indexed origin, + bytes32 indexed recipient, + uint256 amountOrId + ); + + uint256 public immutable scaleNumerator; + uint256 public immutable scaleDenominator; + + // cannot use compiler assigned slot without + // breaking backwards compatibility of storage layout + bytes32 private constant FEE_RECIPIENT_SLOT = + keccak256("FungibleTokenRouter.feeRecipient"); + bytes32 private constant FEE_HOOK_SLOT = keccak256("TokenRouter.feeHook"); + + event FeeRecipientSet(address feeRecipient); + event FeeHookSet(address feeHook); + + constructor( + uint256 _scaleNumerator, + uint256 _scaleDenominator, + address _mailbox + ) GasRouter(_mailbox) { + require( + _scaleNumerator > 0 && _scaleDenominator > 0, + "TokenRouter: scale cannot be 0" + ); + scaleNumerator = _scaleNumerator; + scaleDenominator = _scaleDenominator; + } + + // =========================== + // ========== Main API ========== + // =========================== + + /** + * @notice Returns the address of the token managed by this router. It can be one of three options: + * - ERC20 token address for fungible tokens that are being collateralized (HypERC20Collateral, HypERC4626, etc.) + * - 0x0 address for native tokens (ETH, MATIC, etc.) (HypNative, etc.) + * - address(this) for synthetic ERC20 tokens (HypERC20, etc.) + * It is being used for quotes and fees from the fee recipient and pulling/push the tokens from the sender/receipient. + * @dev This function must be implemented by derived contracts to specify the token address. + * @return The address of the token contract. + */ + function token() public view virtual returns (address); + + /** + * @inheritdoc ITokenFee + * @notice Implements the standardized fee quoting interface for token transfers based on + * overridable internal functions of _quoteGasPayment, _feeRecipientAndAmount, and _externalFeeAmount. + * @param _destination The identifier of the destination chain. + * @param _recipient The address of the recipient on the destination chain. + * @param _amount The amount or identifier of tokens to be sent to the remote recipient + * @return quotes An array of Quote structs representing the fees in different tokens. + * @dev This function may return multiple quotes with the same denomination. Convention is to return: + * [index 0] native fees charged by the mailbox dispatch + * [index 1] then any internal warp route fees (amount bridged plus fee recipient) + * [index 2] then any external bridging fees (if any, else 0) + * These are surfaced as separate elements to enable clients to interpret/render fees independently. + * There is a Quotes library with an extract function for onchain quoting in a specific denomination, + * but we discourage onchain quoting in favor of offchain quoting and overpaying with refunds. + */ + function quoteTransferRemote( + uint32 _destination, + bytes32 _recipient, + uint256 _amount + ) external view override returns (Quote[] memory quotes) { + address _feeToken = feeToken(); + quotes = new Quote[](3); + quotes[0] = Quote({ + token: _feeToken, // address(0) for native, token() for ERC20 payments + amount: _quoteGasPayment( + _destination, + _recipient, + _amount, + _feeToken + ) + }); + (, uint256 feeAmount) = _feeRecipientAndAmount( + _destination, + _recipient, + _amount + ); + quotes[1] = Quote({token: token(), amount: _amount + feeAmount}); + quotes[2] = Quote({ + token: token(), + amount: _externalFeeAmount(_destination, _recipient, _amount) + }); + } + + /** + * @notice Transfers `_amount` token to `_recipient` on the `_destination` domain. + * @dev Delegates transfer logic to `_transferFromSender` implementation. + * Emits `SentTransferRemote` event on the origin chain. + * Override with custom behavior for storing or forwarding tokens. + * Known overrides: + * - OPL2ToL1TokenBridgeNative: adds hook metadata for message dispatch. + * - EverclearTokenBridge: creates Everclear intent for cross-chain token transfer. + * - TokenBridgeCctpBase: adds CCTP-specific metadata for message dispatch. + * - HypERC4626Collateral: deposits into vault and handles shares. + * When overriding, mirror the general flow of this function for consistency: + * 1. Calculate fees and charge the sender. + * 2. Prepare the token message with recipient, amount, and any additional metadata. + * 3. Emit `SentTransferRemote` event. + * 4. Dispatch the message. + * @param _destination The identifier of the destination chain. + * @param _recipient The address of the recipient on the destination chain. + * @param _amount The amount or identifier of tokens to be sent to the remote recipient. + * @return messageId The identifier of the dispatched message. + */ + function transferRemote( + uint32 _destination, + bytes32 _recipient, + uint256 _amount + ) public payable virtual returns (bytes32 messageId) { + return _transferRemote(_destination, _recipient, _amount); + } + + /// @notice Internal transfer implementation. + function _transferRemote( + uint32 _destination, + bytes32 _recipient, + uint256 _amount + ) internal virtual returns (bytes32 messageId) { + address _feeHook = feeHook(); + address _feeToken = feeToken(); + + // 1. Calculate the fee amounts, charge the sender and distribute to feeRecipient if necessary + (, uint256 remainingNativeValue) = _calculateFeesAndCharge( + _destination, + _recipient, + _amount, + msg.value, + _feeHook + ); + + uint256 scaledAmount = _outboundAmount(_amount); + + // 2. Prepare the token message with the recipient and amount + bytes memory _tokenMessage = TokenMessage.format( + _recipient, + scaledAmount + ); + + messageId = _emitAndDispatch( + _destination, + _recipient, + scaledAmount, + remainingNativeValue, + _tokenMessage, + _feeToken + ); + } + + // =========================== + // ========== Internal convenience functions for readability ========== + // ========================== + + function _calculateFeesAndCharge( + uint32 _destination, + bytes32 _recipient, + uint256 _amount, + uint256 _msgValue, + address _feeHook + ) internal returns (uint256 externalFee, uint256 remainingNativeValue) { + (address _feeRecipient, uint256 feeAmount) = _feeRecipientAndAmount( + _destination, + _recipient, + _amount + ); + externalFee = _externalFeeAmount(_destination, _recipient, _amount); + uint256 charge = _amount + feeAmount + externalFee; + + address _token = token(); + + // ERC20 fee hook: use token() for gas payments + if (_feeHook != address(0)) { + uint256 hookFee = _quoteGasPayment( + _destination, + _recipient, + _amount, + _token + ); + + // For collateral routers (token() != address(this)), we can add hook fee to charge + // because _transferFromSender pulls tokens TO the router. + // For synthetic routers (token() == address(this)), we must pull separately + // because _transferFromSender burns tokens, so router never receives them. + if (_token != address(this)) { + // Collateral router: add hook fee to charge + charge += hookFee; + } else { + // Synthetic router: pull hook fee tokens separately + IERC20(_token).safeTransferFrom( + msg.sender, + address(this), + hookFee + ); + } + + // Approve fee hook to pull fee tokens + IERC20(_token).approve(_feeHook, hookFee); + } + + _transferFromSender(charge); + + if (feeAmount > 0) { + // transfer atomically so we don't need to keep track of collateral + // and fee balances separately + _transferFee(_feeRecipient, feeAmount); + } + + // Calculate remaining native value for other hooks + // When token() is ERC20 (non-native), all native value is available for other hooks + // When token() is native (address(0)), subtract the charge from msg.value + remainingNativeValue = _token != address(0) + ? _msgValue + : _msgValue - charge; + } + + // Convenience overload that computes feeHook() internally. + function _calculateFeesAndCharge( + uint32 _destination, + bytes32 _recipient, + uint256 _amount, + uint256 _msgValue + ) internal returns (uint256 externalFee, uint256 remainingNativeValue) { + return + _calculateFeesAndCharge( + _destination, + _recipient, + _amount, + _msgValue, + feeHook() + ); + } + + // Emits the SentTransferRemote event and dispatches the message with explicit feeToken. + function _emitAndDispatch( + uint32 _destination, + bytes32 _recipient, + uint256 _amount, + uint256 _messageDispatchValue, + bytes memory _tokenMessage, + address _feeToken + ) internal returns (bytes32 messageId) { + // effects + emit SentTransferRemote(_destination, _recipient, _amount); + + // interactions + messageId = _Router_dispatch( + _destination, + _messageDispatchValue, + _tokenMessage, + _generateHookMetadata(_destination, _feeToken), + address(hook) + ); + } + + // Convenience overload that computes feeToken from feeHook(). + function _emitAndDispatch( + uint32 _destination, + bytes32 _recipient, + uint256 _amount, + uint256 _messageDispatchValue, + bytes memory _tokenMessage + ) internal returns (bytes32 messageId) { + address _feeToken = feeToken(); + return + _emitAndDispatch( + _destination, + _recipient, + _amount, + _messageDispatchValue, + _tokenMessage, + _feeToken + ); + } + + // =========================== + // ========== Fees & Quoting ========== + // =========================== + + /** + * @notice Sets the fee recipient for the router. + * @dev Allows for address(0) to be set, which disables fees. + * @param recipient The address that receives fees. + */ + function setFeeRecipient(address recipient) public onlyOwner { + require(recipient != address(this), "Fee recipient cannot be self"); + FEE_RECIPIENT_SLOT.getAddressSlot().value = recipient; + emit FeeRecipientSet(recipient); + } + + /** + * @notice Returns the address of the fee recipient. + * @dev Returns address(0) if no fee recipient is set. + * @dev Can be overridden with address(0) to disable fees entirely. + * @return address of the fee recipient. + */ + function feeRecipient() public view virtual returns (address) { + return FEE_RECIPIENT_SLOT.getAddressSlot().value; + } + + /** + * @notice Initializes the TokenRouter with fee hook configuration. + * @param _feeHook The fee hook contract address. + */ + function _TokenRouter_initialize(address _feeHook) internal { + _setFeeHook(_feeHook); + } + + /** + * @notice Sets the fee hook contract address. + * @param _feeHook The fee hook address. + */ + function setFeeHook(address _feeHook) external onlyOwner { + _setFeeHook(_feeHook); + } + + /** + * @notice Internal function to set the fee hook address. + * @param _feeHook The fee hook address. + */ + function _setFeeHook(address _feeHook) internal { + FEE_HOOK_SLOT.getAddressSlot().value = _feeHook; + emit FeeHookSet(_feeHook); + } + + /** + * @notice Returns the fee hook contract address. + * @return The fee hook address. + */ + function feeHook() public view returns (address) { + return FEE_HOOK_SLOT.getAddressSlot().value; + } + + /** + * @notice Returns the fee token address for gas payments. + * @return The token address if a fee hook is configured, otherwise address(0) for native payments. + */ + function feeToken() public view returns (address) { + return feeHook() != address(0) ? token() : address(0); + } + + // To be overridden by derived contracts if they have additional fees + /** + * @notice Returns the external fee amount for the given parameters. + * param _destination The identifier of the destination chain. + * param _recipient The address of the recipient on the destination chain. + * param _amount The amount or identifier of tokens to be sent to the remote recipient + * @return feeAmount The external fee amount. + * @dev This fee must be denominated in the `token()` defined by this router. + * @dev The default implementation returns 0, meaning no external fees are charged. + * This function is intended to be overridden by derived contracts that have additional fees. + * Known overrides: + * - TokenBridgeCctpBase: for CCTP-specific fees + * - EverclearTokenBridge: for Everclear-specific fees + */ + function _externalFeeAmount( + uint32, // _destination, + bytes32, // _recipient, + uint256 // _amount + ) internal view virtual returns (uint256 feeAmount) { + return 0; + } + + /** + * @notice Returns the fee recipient amount for the given parameters. + * @param _destination The identifier of the destination chain. + * @param _recipient The address of the recipient on the destination chain. + * @param _amount The amount or identifier of tokens to be sent to the remote recipient + * @return _feeRecipient The address of the fee recipient. + * @return feeAmount The fee recipient amount. + * @dev This function is is not intended to be overridden as storage and logic is contained in TokenRouter. + */ + function _feeRecipientAndAmount( + uint32 _destination, + bytes32 _recipient, + uint256 _amount + ) internal view returns (address _feeRecipient, uint256 feeAmount) { + _feeRecipient = feeRecipient(); + if (_feeRecipient == address(0)) { + return (_feeRecipient, 0); + } + + Quote[] memory quotes = ITokenFee(_feeRecipient).quoteTransferRemote( + _destination, + _recipient, + _amount + ); + if (quotes.length == 0) { + return (_feeRecipient, 0); + } + + require( + quotes.length == 1 && quotes[0].token == token(), + "FungibleTokenRouter: fee must match token" + ); + feeAmount = quotes[0].amount; + } + + /** + * @notice Returns the gas payment required to dispatch a message to the given domain's router. + * @param _destination The identifier of the destination chain. + * @param _recipient The address of the recipient on the destination chain. + * @param _amount The amount or identifier of tokens to be sent to the remote recipient + * @return payment How much value to send in transferRemote call (native or feeToken based on config). + * @dev This function is intended to be overridden by derived contracts that trigger multiple messages. + * Known overrides: + * - OPL2ToL1TokenBridgeNative: Quote for two messages (prove and finalize). + */ + function _quoteGasPayment( + uint32 _destination, + bytes32 _recipient, + uint256 _amount, + address _feeToken + ) internal view virtual returns (uint256) { + return + _Router_quoteDispatch( + _destination, + TokenMessage.format(_recipient, _amount), + _generateHookMetadata(_destination, _feeToken), + address(hook) + ); + } + + /** + * @notice Generates hook metadata for dispatch, including feeToken if configured. + * @param _destination The destination chain. + * @param _feeToken The fee token address (address(0) for native). + * @return Hook metadata with the specified feeToken. + */ + function _generateHookMetadata( + uint32 _destination, + address _feeToken + ) internal view returns (bytes memory) { + uint256 gasLimit = destinationGas[_destination]; + return + StandardHookMetadata.formatWithFeeToken( + 0, + gasLimit, + msg.sender, + _feeToken + ); + } + + // =========================== + // ========== Internal virtual functions for token handling ========== + // =========================== + + /** + * @dev Should transfer `_amount` of tokens from `msg.sender` to this token router. + * Called by `transferRemote` before message dispatch. + * Known overrides: + * - HypERC20: Burns the tokens from the sender. + * - HypERC20Collateral: Pulls the tokens from the sender. + * - HypNative: Asserts msg.value >= _amount + * - TokenBridgeCctpBase: (like HypERC20Collateral) Pulls the tokens from the sender. + * - EverclearEthTokenBridge: Wraps the native token (ETH) to WETH + * - HypERC4626: Converts the amounts to shares and burns from the User (via HypERC20 implementation) + * - HypFiatToken: Pulls the tokens from the sender and burns them on the FiatToken contract. + * - HypXERC20: Burns the tokens from the sender. + * - HypXERC20Lockbox: Pulls the tokens from the sender, locks them in the XERC20Lockbox contract and burns the resulting xERC20 tokens. + */ + function _transferFromSender(uint256 _amountOrId) internal virtual; + + /** + * @dev Should transfer `_amountOrId` of tokens from this token router to `_recipient`. + * @dev Called by `handle` after message decoding. + * Known overrides: + * - HypERC20: Mints the tokens to the recipient. + * - HypERC20Collateral: Releases the tokens to the recipient. + * - HypNative: Releases native tokens to the recipient. + * - TokenBridgeCctpBase: Do nothing (CCTP transfers tokens to the recipient directly). + * - EverclearEthTokenBridge: Unwraps WETH to ETH and sends to the recipient. + * - HypERC4626: Converts the amount to shares and mints to the User (via HypERC20 implementation) + * - HypFiatToken: Mints the tokens to the recipient on the FiatToken contract. + * - HypXERC20: Mints the tokens to the recipient. + * - HypXERC20Lockbox: Withdraws the underlying tokens from the Lockbox and sends to the recipient. + * - OpL1NativeTokenBridge: Do nothing (the L2 bridge transfers the native tokens to the recipient directly). + */ + function _transferTo( + address _recipient, + uint256 _amountOrId + ) internal virtual; + + /** + * @dev Should transfer `_amount` of tokens from this token router to the fee recipient. + * @dev Called by `_calculateFeesAndCharge` when fee recipient is set and feeAmount > 0. + * @dev The default implementation delegates to `_transferTo`, which works for most token routers + * where tokens are held by the router (e.g., collateral routers, synthetic token routers). + * @dev Override this function for bridges where tokens are NOT held by the router but fees still + * need to be paid (e.g., CCTP, Everclear). In those cases, use direct token transfers from the + * router's balance collected via `_transferFromSender`. + * Known overrides: + * - TokenBridgeCctpBase: Directly transfers tokens from router balance. + * - EverclearTokenBridge: Directly transfers tokens from router balance. + */ + function _transferFee( + address _recipient, + uint256 _amount + ) internal virtual { + _transferTo(_recipient, _amount); + } + + /** + * @dev Scales local amount to message amount by the scale fraction. + * Applies: messageAmount = (localAmount * scaleNumerator) / scaleDenominator + * - If scaleNumerator > scaleDenominator: scales up (e.g., 2/1) + * - If scaleNumerator < scaleDenominator: scales down (e.g., 1/2) + * - If scaleNumerator == scaleDenominator: no scaling (e.g., 1/1) + * Known overrides: + * - HypERC4626: Scales by exchange rate + */ + function _outboundAmount( + uint256 _localAmount + ) internal view virtual returns (uint256 _messageAmount) { + _messageAmount = _localAmount.mulDiv( + scaleNumerator, + scaleDenominator, + Math.Rounding.Down + ); + } + + /** + * @dev Scales message amount to local amount by the inverse scale fraction. + * Applies: localAmount = (messageAmount * scaleDenominator) / scaleNumerator + * - If scaleNumerator > scaleDenominator: scales down (e.g., 1/2 for 2/1 outbound) + * - If scaleNumerator < scaleDenominator: scales up (e.g., 2/1 for 1/2 outbound) + * - If scaleNumerator == scaleDenominator: no scaling (e.g., 1/1) + * Known overrides: + * - HypERC4626: Scales by exchange rate + */ + function _inboundAmount( + uint256 _messageAmount + ) internal view virtual returns (uint256 _localAmount) { + _localAmount = _messageAmount.mulDiv( + scaleDenominator, + scaleNumerator, + Math.Rounding.Down + ); + } + + /** + * @notice Handles the incoming transfer message. + * It decodes the message, emits the ReceivedTransferRemote event, and transfers tokens to the recipient. + * @param _origin The identifier of the origin chain. + * @dev param _sender The address of the sender router on the origin chain. + * @param _message The message data containing recipient and amount. + * @dev Override this function if custom logic is required for sending out the tokens. + * Known overrides: + * - EverclearTokenBridge: Receives the tokens and sends them to the recipient. + * - EverclearEthBridge: Receives WETH, unwraps it and sends native ETH to the recipient. + * - HypERC4626: Updates the exchange rate from the metadata + */ + // solhint-disable-next-line hyperlane/no-virtual-override + function _handle( + uint32 _origin, + bytes32, + bytes calldata _message + ) internal virtual override { + bytes32 recipient = _message.recipient(); + uint256 amount = _message.amount(); + + // effects + emit ReceivedTransferRemote(_origin, recipient, amount); + + // interactions + _transferTo(recipient.bytes32ToAddress(), _inboundAmount(amount)); + } +} diff --git a/contracts/test/bridge/HypERC20Collateral.test.js b/contracts/test/bridge/HypERC20Collateral.test.js new file mode 100644 index 00000000..39dca8fb --- /dev/null +++ b/contracts/test/bridge/HypERC20Collateral.test.js @@ -0,0 +1,97 @@ +import assert from "node:assert/strict"; +import { describe, it } from "node:test"; + +import { network } from "hardhat"; + +const ZERO_ADDRESS = "0x0000000000000000000000000000000000000000"; +const LOCAL_DOMAIN = 8453; +const REMOTE_DOMAIN = 10740; +const DISPATCH_FEE = 7n; +const REMOTE_ROUTER = "0x0000000000000000000000001111111111111111111111111111111111111111"; + +function addressToBytes32(address) { + return `0x${address.toLowerCase().replace(/^0x/, "").padStart(64, "0")}`; +} + +function encodeUint256(value) { + return value.toString(16).padStart(64, "0"); +} + +function formatTransferBody(recipientBytes32, amount) { + return `0x${recipientBytes32.slice(2)}${encodeUint256(amount)}`; +} + +describe("Hyperlane HypERC20Collateral", async function () { + const { viem, networkHelpers } = await network.connect(); + const [owner, sender, recipient] = await viem.getWalletClients(); + + async function deployOfficialHypERC20CollateralFixture() { + const token = await viem.deployContract("ERC20MinterBurnerDecimals", ["OPG", "OPG", 18]); + const mailbox = await viem.deployContract("MockMailbox", [LOCAL_DOMAIN, DISPATCH_FEE]); + const router = await viem.deployContract("OfficialHypERC20Collateral", [ + token.address, + 1n, + 1n, + mailbox.address, + ]); + const routerAsSender = await viem.getContractAt("OfficialHypERC20Collateral", router.address, { + client: { wallet: sender }, + }); + + await router.write.initialize([ZERO_ADDRESS, ZERO_ADDRESS, owner.account.address]); + await router.write.enrollRemoteRouter([REMOTE_DOMAIN, REMOTE_ROUTER]); + await token.write.mint([sender.account.address, 5_000n]); + + const tokenAsSender = await viem.getContractAt("ERC20MinterBurnerDecimals", token.address, { + client: { wallet: sender }, + }); + + return { mailbox, router, routerAsSender, token, tokenAsSender }; + } + + it("requires ERC20 approval before locking collateral", async function () { + const { routerAsSender } = await networkHelpers.loadFixture(deployOfficialHypERC20CollateralFixture); + + await viem.assertions.revertWith( + routerAsSender.write.transferRemote([REMOTE_DOMAIN, addressToBytes32(recipient.account.address), 1_000n], { + value: DISPATCH_FEE, + }), + "ERC20: insufficient allowance", + ); + }); + + it("locks collateral and dispatches on outbound transfer", async function () { + const { mailbox, router, routerAsSender, token, tokenAsSender } = + await networkHelpers.loadFixture(deployOfficialHypERC20CollateralFixture); + const amount = 1_000n; + const recipientBytes32 = addressToBytes32(recipient.account.address); + const expectedBody = formatTransferBody(recipientBytes32, amount); + + await tokenAsSender.write.approve([router.address, amount]); + await routerAsSender.write.transferRemote([REMOTE_DOMAIN, recipientBytes32, amount], { + value: DISPATCH_FEE, + }); + + assert.equal(await token.read.balanceOf([sender.account.address]), 4_000n); + assert.equal(await token.read.balanceOf([router.address]), amount); + + assert.equal((await mailbox.read.lastSender()).toLowerCase(), router.address.toLowerCase()); + assert.equal(await mailbox.read.lastDestination(), REMOTE_DOMAIN); + assert.equal(await mailbox.read.lastRecipient(), REMOTE_ROUTER); + assert.equal(await mailbox.read.lastBody(), expectedBody); + assert.equal(await mailbox.read.lastValue(), DISPATCH_FEE); + }); + + it("releases collateral on inbound delivery", async function () { + const { mailbox, router, token } = await networkHelpers.loadFixture(deployOfficialHypERC20CollateralFixture); + const amount = 750n; + const recipientBytes32 = addressToBytes32(recipient.account.address); + const body = formatTransferBody(recipientBytes32, amount); + + await token.write.mint([router.address, amount]); + await mailbox.write.deliver([router.address, REMOTE_DOMAIN, REMOTE_ROUTER, body]); + + assert.equal(await token.read.balanceOf([router.address]), 0n); + assert.equal(await token.read.balanceOf([recipient.account.address]), amount); + }); +}); diff --git a/contracts/test/bridge/HypOGNative.test.js b/contracts/test/bridge/HypOGNative.test.js new file mode 100644 index 00000000..6a3a487a --- /dev/null +++ b/contracts/test/bridge/HypOGNative.test.js @@ -0,0 +1,125 @@ +import assert from "node:assert/strict"; +import { describe, it } from "node:test"; + +import { network } from "hardhat"; + +const PRECOMPILE_ADDRESS = "0x0000000000000000000000000000000000000A00"; +const ZERO_ADDRESS = "0x0000000000000000000000000000000000000000"; +const LOCAL_DOMAIN = 10740; +const REMOTE_DOMAIN = 8453; +const DISPATCH_FEE = 7n; +const REMOTE_ROUTER = "0x0000000000000000000000001111111111111111111111111111111111111111"; +const REMOTE_RECIPIENT = "0x0000000000000000000000002222222222222222222222222222222222222222"; +const WRONG_REMOTE_ROUTER = "0x000000000000000000000000aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; +const LOCAL_RECIPIENT = "0x3333333333333333333333333333333333333333"; + +function addressToBytes32(address) { + return `0x${address.toLowerCase().replace(/^0x/, "").padStart(64, "0")}`; +} + +function encodeUint256(value) { + return value.toString(16).padStart(64, "0"); +} + +function formatTransferBody(recipientBytes32, amount) { + return `0x${recipientBytes32.slice(2)}${encodeUint256(amount)}`; +} + +describe("HypOGNative", async function () { + const { viem, networkHelpers } = await network.connect(); + const publicClient = await viem.getPublicClient(); + const [owner] = await viem.getWalletClients(); + + async function deployHypOGNativeFixture() { + const mailbox = await viem.deployContract("MockMailbox", [LOCAL_DOMAIN, DISPATCH_FEE]); + const precompileSource = await viem.deployContract("MockBridgeMint"); + const runtimeCode = await publicClient.getCode({ address: precompileSource.address }); + + assert.ok(runtimeCode !== undefined && runtimeCode !== "0x"); + + await networkHelpers.setCode(PRECOMPILE_ADDRESS, runtimeCode); + + const bridgeMint = await viem.getContractAt("MockBridgeMint", PRECOMPILE_ADDRESS); + await bridgeMint.write.initialize(); + + const router = await viem.deployContract("HypOGNative", [ + mailbox.address, + ZERO_ADDRESS, + owner.account.address, + ]); + await router.write.enrollRemoteRouter([REMOTE_DOMAIN, REMOTE_ROUTER]); + + return { bridgeMint, mailbox, router }; + } + + it("mints on inbound handle", async function () { + const { bridgeMint, mailbox, router } = + await networkHelpers.loadFixture(deployHypOGNativeFixture); + const recipientBytes32 = addressToBytes32(LOCAL_RECIPIENT); + const amount = 12345n; + const body = formatTransferBody(recipientBytes32, amount); + + await viem.assertions.emitWithArgs( + mailbox.write.deliver([router.address, REMOTE_DOMAIN, REMOTE_ROUTER, body]), + router, + "ReceivedTransferRemote", + [REMOTE_DOMAIN, recipientBytes32, amount], + ); + + assert.equal(await bridgeMint.read.lastMintRecipient(), LOCAL_RECIPIENT.toLowerCase()); + assert.equal(await bridgeMint.read.lastMintAmount(), amount); + assert.equal((await bridgeMint.read.lastMintCaller()).toLowerCase(), router.address.toLowerCase()); + assert.equal(await bridgeMint.read.mintCalls(), 1n); + }); + + it("burns and dispatches on outbound transfer", async function () { + const { bridgeMint, mailbox, router } = + await networkHelpers.loadFixture(deployHypOGNativeFixture); + const amount = 1000n; + const msgValue = amount + DISPATCH_FEE; + const expectedBody = formatTransferBody(REMOTE_RECIPIENT, amount); + + await viem.assertions.emitWithArgs( + router.write.transferRemote([REMOTE_DOMAIN, REMOTE_RECIPIENT, amount], { + value: msgValue, + }), + router, + "SentTransferRemote", + [REMOTE_DOMAIN, REMOTE_RECIPIENT, amount], + ); + + assert.equal(await bridgeMint.read.lastBurnAmount(), amount); + assert.equal((await bridgeMint.read.lastBurnCaller()).toLowerCase(), router.address.toLowerCase()); + assert.equal(await bridgeMint.read.burnCalls(), 1n); + + assert.equal(await mailbox.read.lastDestination(), REMOTE_DOMAIN); + assert.equal(await mailbox.read.lastRecipient(), REMOTE_ROUTER); + assert.equal(await mailbox.read.lastBody(), expectedBody); + assert.equal(await mailbox.read.lastValue(), DISPATCH_FEE); + }); + + it("rejects inbound messages from an unknown router", async function () { + const { mailbox, router } = await networkHelpers.loadFixture(deployHypOGNativeFixture); + const body = formatTransferBody(addressToBytes32(LOCAL_RECIPIENT), 1n); + + await viem.assertions.revertWithCustomErrorWithArgs( + mailbox.write.deliver([router.address, REMOTE_DOMAIN, WRONG_REMOTE_ROUTER, body]), + router, + "UnknownRouter", + [REMOTE_DOMAIN], + ); + }); + + it("rejects outbound transfers when the bridge is disabled", async function () { + const { bridgeMint, router } = await networkHelpers.loadFixture(deployHypOGNativeFixture); + await bridgeMint.write.setEnabled([false]); + + await viem.assertions.revertWithCustomError( + router.write.transferRemote([REMOTE_DOMAIN, REMOTE_RECIPIENT, 1000n], { + value: 1007n, + }), + router, + "BridgeDisabled", + ); + }); +}); diff --git a/contracts/test/bridge/HypOPGCollateral.test.js b/contracts/test/bridge/HypOPGCollateral.test.js new file mode 100644 index 00000000..2c82dafb --- /dev/null +++ b/contracts/test/bridge/HypOPGCollateral.test.js @@ -0,0 +1,98 @@ +import assert from "node:assert/strict"; +import { describe, it } from "node:test"; + +import { network } from "hardhat"; + +const ZERO_ADDRESS = "0x0000000000000000000000000000000000000000"; +const LOCAL_DOMAIN = 8453; +const REMOTE_DOMAIN = 10740; +const DISPATCH_FEE = 7n; +const REMOTE_ROUTER = "0x0000000000000000000000001111111111111111111111111111111111111111"; + +function addressToBytes32(address) { + return `0x${address.toLowerCase().replace(/^0x/, "").padStart(64, "0")}`; +} + +function encodeUint256(value) { + return value.toString(16).padStart(64, "0"); +} + +function formatTransferBody(recipientBytes32, amount) { + return `0x${recipientBytes32.slice(2)}${encodeUint256(amount)}`; +} + +describe("HypOPGCollateral", async function () { + const { viem, networkHelpers } = await network.connect(); + const [owner, sender, recipient] = await viem.getWalletClients(); + + async function deployHypOPGCollateralFixture() { + const token = await viem.deployContract("ERC20MinterBurnerDecimals", ["OPG", "OPG", 18]); + const mailbox = await viem.deployContract("MockMailbox", [LOCAL_DOMAIN, DISPATCH_FEE]); + const router = await viem.deployContract("HypOPGCollateral", [ + token.address, + mailbox.address, + ZERO_ADDRESS, + owner.account.address, + ]); + + await router.write.enrollRemoteRouter([REMOTE_DOMAIN, REMOTE_ROUTER]); + await token.write.mint([sender.account.address, 5_000n]); + + const tokenAsSender = await viem.getContractAt("ERC20MinterBurnerDecimals", token.address, { + client: { wallet: sender }, + }); + const routerAsSender = await viem.getContractAt("HypOPGCollateral", router.address, { + client: { wallet: sender }, + }); + + return { mailbox, router, routerAsSender, token, tokenAsSender }; + } + + it("requires ERC20 approval before locking collateral", async function () { + const { router, routerAsSender } = await networkHelpers.loadFixture(deployHypOPGCollateralFixture); + + await viem.assertions.revertWith( + routerAsSender.write.transferRemote([REMOTE_DOMAIN, addressToBytes32(recipient.account.address), 1000n], { + value: DISPATCH_FEE, + }), + "ERC20: insufficient allowance", + ); + + assert.equal(await router.read.quoteDispatchFee([REMOTE_DOMAIN, addressToBytes32(recipient.account.address), 1000n]), DISPATCH_FEE); + }); + + it("locks collateral and dispatches on outbound transfer", async function () { + const { mailbox, router, routerAsSender, token, tokenAsSender } = + await networkHelpers.loadFixture(deployHypOPGCollateralFixture); + const amount = 1_000n; + const recipientBytes32 = addressToBytes32(recipient.account.address); + const expectedBody = formatTransferBody(recipientBytes32, amount); + + await tokenAsSender.write.approve([router.address, amount]); + await routerAsSender.write.transferRemote([REMOTE_DOMAIN, recipientBytes32, amount], { + value: DISPATCH_FEE, + }); + + assert.equal(await token.read.balanceOf([sender.account.address]), 4_000n); + assert.equal(await token.read.balanceOf([router.address]), amount); + + assert.equal((await mailbox.read.lastSender()).toLowerCase(), router.address.toLowerCase()); + assert.equal(await mailbox.read.lastDestination(), REMOTE_DOMAIN); + assert.equal(await mailbox.read.lastRecipient(), REMOTE_ROUTER); + assert.equal(await mailbox.read.lastBody(), expectedBody); + assert.equal(await mailbox.read.lastValue(), DISPATCH_FEE); + }); + + it("releases collateral on inbound delivery", async function () { + const { mailbox, router, token } = await networkHelpers.loadFixture(deployHypOPGCollateralFixture); + const amount = 750n; + const recipientBytes32 = addressToBytes32(recipient.account.address); + const body = formatTransferBody(recipientBytes32, amount); + + await token.write.mint([router.address, amount]); + await mailbox.write.deliver([router.address, REMOTE_DOMAIN, REMOTE_ROUTER, body]); + + assert.equal(await token.read.balanceOf([router.address]), 0n); + assert.equal(await token.read.balanceOf([recipient.account.address]), amount); + }); +}); diff --git a/evmd/app.go b/evmd/app.go index b92e46e5..9a4e1619 100644 --- a/evmd/app.go +++ b/evmd/app.go @@ -127,6 +127,12 @@ import ( "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" + "github.com/cosmos/evm/x/bridge" + bridgekeeper "github.com/cosmos/evm/x/bridge/keeper" + bridgetypes "github.com/cosmos/evm/x/bridge/types" + "github.com/cosmos/evm/x/svip" + svipkeeper "github.com/cosmos/evm/x/svip/keeper" + sviptypes "github.com/cosmos/evm/x/svip/types" ) func init() { @@ -175,6 +181,8 @@ type EVMD struct { EvidenceKeeper evidencekeeper.Keeper FeeGrantKeeper feegrantkeeper.Keeper ConsensusParamsKeeper consensusparamkeeper.Keeper + BridgeKeeper bridgekeeper.Keeper + SvipKeeper svipkeeper.Keeper // IBC keepers IBCKeeper *ibckeeper.Keeper // IBC Keeper must be a pointer in the app, so we can SetRouter on it correctly @@ -238,6 +246,8 @@ func NewExampleApp( ibcexported.StoreKey, ibctransfertypes.StoreKey, // Cosmos EVM store keys evmtypes.StoreKey, feemarkettypes.StoreKey, erc20types.StoreKey, precisebanktypes.StoreKey, + bridgetypes.StoreKey, + sviptypes.StoreKey, ) oKeys := storetypes.NewObjectStoreKeys(banktypes.ObjectStoreKey, evmtypes.ObjectKey) @@ -446,6 +456,14 @@ func NewExampleApp( app.AccountKeeper, ) + app.BridgeKeeper = bridgekeeper.NewKeeper( + appCodec, + keys[bridgetypes.StoreKey], + authtypes.NewModuleAddress(govtypes.ModuleName), + app.PreciseBankKeeper, + app.AccountKeeper, + ) + // Set up EVM keeper tracer := cast.ToString(appOpts.Get(srvflags.EVMTracer)) @@ -467,6 +485,7 @@ func NewExampleApp( *app.StakingKeeper, app.DistrKeeper, app.PreciseBankKeeper, + app.BridgeKeeper, &app.Erc20Keeper, &app.TransferKeeper, app.IBCKeeper.ChannelKeeper, @@ -550,6 +569,14 @@ func NewExampleApp( tmLightClientModule := ibctm.NewLightClientModule(appCodec, storeProvider) clientKeeper.AddRoute(ibctm.ModuleName, &tmLightClientModule) + app.SvipKeeper = svipkeeper.NewKeeper( + appCodec, + keys[sviptypes.StoreKey], + authtypes.NewModuleAddress(govtypes.ModuleName), + app.PreciseBankKeeper, + app.AccountKeeper, + ) + // Override the ICS20 app module transferModule := transfer.NewAppModule(app.TransferKeeper) @@ -570,6 +597,8 @@ func NewExampleApp( slashing.NewAppModule(appCodec, app.SlashingKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, nil, app.interfaceRegistry), distr.NewAppModule(appCodec, app.DistrKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, nil), staking.NewAppModule(appCodec, app.StakingKeeper, app.AccountKeeper, app.BankKeeper, nil), + bridge.NewAppModule(app.BridgeKeeper), + svip.NewAppModule(app.SvipKeeper), upgrade.NewAppModule(app.UpgradeKeeper, app.AccountKeeper.AddressCodec()), evidence.NewAppModule(app.EvidenceKeeper), authzmodule.NewAppModule(appCodec, app.AuthzKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry), @@ -617,6 +646,7 @@ func NewExampleApp( // NOTE: capability module's beginblocker must come before any modules using capabilities (e.g. IBC) app.ModuleManager.SetOrderBeginBlockers( minttypes.ModuleName, + sviptypes.ModuleName, // IBC modules ibcexported.ModuleName, ibctransfertypes.ModuleName, @@ -654,6 +684,7 @@ func NewExampleApp( feegrant.ModuleName, upgradetypes.ModuleName, consensusparamtypes.ModuleName, precisebanktypes.ModuleName, vestingtypes.ModuleName, + sviptypes.ModuleName, ) // NOTE: The genutils module must occur after staking so that pools are @@ -661,6 +692,8 @@ func NewExampleApp( // NOTE: The genutils module must also occur after auth so that it can access the params from auth. genesisModuleOrder := []string{ authtypes.ModuleName, banktypes.ModuleName, + bridgetypes.ModuleName, + sviptypes.ModuleName, distrtypes.ModuleName, stakingtypes.ModuleName, slashingtypes.ModuleName, govtypes.ModuleName, minttypes.ModuleName, ibcexported.ModuleName, @@ -1011,6 +1044,10 @@ func (app *EVMD) GetBankKeeper() bankkeeper.Keeper { return app.BankKeeper } +func (app *EVMD) GetBridgeKeeper() bridgekeeper.Keeper { + return app.BridgeKeeper +} + func (app *EVMD) GetFeeMarketKeeper() *feemarketkeeper.Keeper { return &app.FeeMarketKeeper } @@ -1099,11 +1136,22 @@ func (app *EVMD) AutoCliOpts() autocli.AppOptions { } } - return autocli.AppOptions{ + opts := autocli.AppOptions{ Modules: modules, ModuleOptions: runtimeservices.ExtractAutoCLIOptions(app.ModuleManager.Modules), AddressCodec: evmaddress.NewEvmCodec(sdk.GetConfig().GetBech32AccountAddrPrefix()), ValidatorAddressCodec: evmaddress.NewEvmCodec(sdk.GetConfig().GetBech32ValidatorAddrPrefix()), ConsensusAddressCodec: evmaddress.NewEvmCodec(sdk.GetConfig().GetBech32ConsensusAddrPrefix()), } + + // Skip autocli for FundPool — it panics with repeated Coin fields. + // The manual CLI in x/svip/client/cli/tx.go handles it instead. + if svipOpts, ok := opts.ModuleOptions[sviptypes.ModuleName]; ok && svipOpts != nil && svipOpts.Tx != nil { + svipOpts.Tx.EnhanceCustomCommand = true + svipOpts.Tx.RpcCommandOptions = append(svipOpts.Tx.RpcCommandOptions, + &autocliv1.RpcCommandOptions{RpcMethod: "FundPool", Skip: true}, + ) + } + + return opts } diff --git a/evmd/config/permissions.go b/evmd/config/permissions.go index 2aa0d5fa..d50e183d 100644 --- a/evmd/config/permissions.go +++ b/evmd/config/permissions.go @@ -10,9 +10,11 @@ import ( minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" cosmosevmutils "github.com/cosmos/evm/utils" + bridgetypes "github.com/cosmos/evm/x/bridge/types" erc20types "github.com/cosmos/evm/x/erc20/types" feemarkettypes "github.com/cosmos/evm/x/feemarket/types" precisebanktypes "github.com/cosmos/evm/x/precisebank/types" + sviptypes "github.com/cosmos/evm/x/svip/types" vmtypes "github.com/cosmos/evm/x/vm/types" transfertypes "github.com/cosmos/ibc-go/v10/modules/apps/transfer/types" corevm "github.com/ethereum/go-ethereum/core/vm" @@ -65,6 +67,8 @@ var maccPerms = map[string][]string{ feemarkettypes.ModuleName: nil, erc20types.ModuleName: {authtypes.Minter, authtypes.Burner}, precisebanktypes.ModuleName: {authtypes.Minter, authtypes.Burner}, + bridgetypes.ModuleName: {authtypes.Minter, authtypes.Burner}, + sviptypes.ModuleName: nil, } // GetMaccPerms returns a copy of the module account permissions diff --git a/evmd/docs/SVIP.md b/evmd/docs/SVIP.md new file mode 100644 index 00000000..4e3ae40f --- /dev/null +++ b/evmd/docs/SVIP.md @@ -0,0 +1,404 @@ +# Sustained Validator Incentive Pool (SVIP) + +SVIP pays validators from a pre-funded token pool. The rewards start high and slowly decrease over time (exponential decay). Every block, the module sends a small amount to the FeeCollector, and the existing `x/distribution` module splits it across validators based on their voting power. + +There's no inflation. The pool is funded by bridging tokens from Base. + +Proposal templates: `evmd/docs/svip_update_params_proposal.json`, `evmd/docs/svip_activate_proposal.json` + +--- + +## How it works + +Every block, SVIP does this: + +1. Checks how much time has passed since activation. +2. Calculates the reward for this block using exponential decay: `reward = Râ‚€ × e^(-λt) × Δt`. +3. Sends that amount from the SVIP module account to the FeeCollector. +4. `x/distribution` takes it from there and pays validators. + +The starting rate `Râ‚€` comes from the pool size and half-life: `Râ‚€ = (ln2 / half_life) × pool_balance`. This math guarantees the pool can never pay out more than it holds. The total converges to exactly the pool size over infinite time. + +### Funding the pool + +You can't send tokens directly to the SVIP module address with `bank send`. That will fail with `unauthorized` (standard Cosmos SDK behavior for module accounts). Use the dedicated command instead: + +```bash +evmd tx svip fund-pool +``` + +This command uses a manual CLI handler (not the SDK's auto-generated one) to work around a known SDK compatibility issue. + +--- + +## Lifecycle + +``` +1. Genesis → Module registered, pool empty, not activated +2. Fund pool → Bridge tokens from Base, call MsgFundPool +3. Set params → Governance sets half_life_seconds via MsgUpdateParams +4. Activate → Governance activates via MsgActivate +5. Rewards flow → Every block, decayed reward → FeeCollector → validators +6. (Optional) → Pause, unpause, reactivate after refund +``` + +--- + +## Before you start + +You'll need: + +- A running node connected to the network. +- A funded account for submitting proposals, and a validator key (or coordination with validators) for voting. +- The `evmd` binary installed. +- Token amounts are always in base units with 18 decimals. Multiply by 10^18 to convert. For example, 1000 tokens = `1000000000000000000000` ogwei. + +> **Devnet:** Run `./local_node.sh -y` to start a local chain. Home dir is `~/.og-evm-devnet`, chain ID is `10740`. `mykey` is the genesis validator. `dev0` through `dev3` are funded accounts. Voting period is 30 seconds. + +--- + +## Governance basics + +Everything except funding the pool goes through governance. + +1. Someone **submits** a proposal with a deposit. +2. Validators (or delegators) **vote**: yes, no, abstain, or veto. +3. After the voting period, if quorum (33.4%) is met and >50% voted yes, the proposal **passes** and the message runs. +4. If >33.4% vote "NoWithVeto", the deposit is burned. Otherwise it's returned. + +**Get the gov module address** (you'll need this for every proposal template): + +```bash +evmd q auth module-account gov +``` + +Look for the `address` field (e.g. `og10d07y265gmmuvt4z0w9aw880jnsr700jrdya3k`). Use this wherever you see `` in the templates. + +**Get the minimum deposit:** + +```bash +evmd q gov params +``` + +Look for `min_deposit`. Use this wherever you see `` in the templates. + +**Find your proposal ID** after submitting: + +```bash +evmd q gov proposals +``` + +Your proposal is the last one in the list. Note the `id`, you'll need it to vote. + +**Check proposal outcome** with `evmd q gov proposal `: +- `PROPOSAL_STATUS_PASSED`: votes passed and the message executed successfully. +- `PROPOSAL_STATUS_REJECTED`: not enough yes votes, or quorum wasn't met. Deposit is returned (unless vetoed). +- `PROPOSAL_STATUS_FAILED`: votes passed, but the message itself failed (e.g. a guardrail blocked it, or the pool was empty). This is what you'll see when something like `MsgActivate` gets rejected at the keeper level. Fix the issue and submit a new proposal. + +> **Devnet:** Add `--home ~/.og-evm-devnet` to all commands. Only `mykey` has staking power, so use it for voting. Voting period is 30 seconds, so vote right after submitting. + +--- + +## Step 1. Fund the pool + +Anyone can do this. It's the only permissionless operation. On mainnet, tokens get bridged from Base via Hyperlane first, then the bridger calls `fund-pool`. + +```bash +evmd tx svip fund-pool \ + --from \ + --chain-id \ + --keyring-backend \ + --gas auto --gas-adjustment 1.3 \ + --yes +``` + +> **Devnet example**, fund 1000 tokens from dev0: +> ```bash +> evmd tx svip fund-pool 1000000000000000000000ogwei \ +> --from dev0 --home ~/.og-evm-devnet --chain-id 10740 \ +> --keyring-backend test --gas 200000 --gas-prices 10000000ogwei --yes +> ``` + +Verify: + +```bash +evmd q svip pool-state +``` + +You should see `pool_balance` with your funded amount. The pool must have funds before you can activate. `MsgActivate` will reject if the balance is zero. + +--- + +## Step 2. Set half-life (governance) + +Before activating, you need to set `half_life_seconds` through a governance proposal. The recommended mainnet value is **15 years** (`473364000` seconds). Minimum allowed is 1 year (`31536000` seconds). + +**2a.** Copy the template and fill in the gov module address: + +```bash +cp evmd/docs/svip_update_params_proposal.json /tmp/svip_set_params.json +``` + +Open `/tmp/svip_set_params.json` and replace `` with the address from the governance basics section. It should look like: + +```json +{ + "messages": [ + { + "@type": "/cosmos.svip.v1.MsgUpdateParams", + "authority": "og10d07y265gmmuvt4z0w9aw880jnsr700jrdya3k", + "params": { + "half_life_seconds": "473364000" + } + } + ], + "deposit": "", + "title": "Set SVIP half-life to 15 years", + "summary": "Configure the SVIP exponential decay half-life before activation." +} +``` + +**2b.** Submit: + +```bash +evmd tx gov submit-proposal /tmp/svip_set_params.json \ + --from \ + --chain-id \ + --keyring-backend \ + --gas auto --gas-adjustment 1.3 \ + --yes +``` + +**2c.** Find the proposal ID: + +```bash +evmd q gov proposals +``` + +**2d.** Get validators to vote yes before the voting period ends: + +```bash +evmd tx gov vote yes \ + --from \ + --chain-id \ + --keyring-backend \ + --gas auto --gas-adjustment 1.3 \ + --yes +``` + +**2e.** After the voting period, check the result: + +```bash +evmd q gov proposal +``` + +Status should be `PROPOSAL_STATUS_PASSED`. + +**2f.** Verify the half-life was set: + +```bash +evmd q svip params +``` + +> **Heads up:** Don't be alarmed if this shows `params: {}`. `half_life_seconds` is an integer, and proto3 serialization drops fields that equal their default value (`0`), so the whole thing looks empty even though the value is stored correctly. If you want proof, just move on to step 3. `MsgActivate` will reject with "half_life_seconds must be set before activation" if the value didn't stick. + +> **Devnet:** Use `--from mykey --home ~/.og-evm-devnet --chain-id 10740 --keyring-backend test --gas 300000 --gas-prices 10000000ogwei` for both submit and vote. Deposit is `10000000ogwei`. Wait ~35 seconds after voting. + +**Guardrails:** +- `half_life_seconds` must be at least 1 year. +- After activation, `half_life_seconds` can't change by more than 50% in a single proposal. + +--- + +## Step 3. Activate (governance) + +Activation snapshots the current pool balance and starts the decay curve. Before submitting, make sure: +- `half_life_seconds` is set (step 2). +- The pool has funds (step 1). +- You're ready. Once activated, it can't be deactivated. + +**3a.** Copy the template: + +```bash +cp evmd/docs/svip_activate_proposal.json /tmp/svip_activate.json +``` + +Open `/tmp/svip_activate.json` and replace `` with your gov address. + +**3b.** Submit: + +```bash +evmd tx gov submit-proposal /tmp/svip_activate.json \ + --from \ + --chain-id \ + --keyring-backend \ + --gas auto --gas-adjustment 1.3 \ + --yes +``` + +**3c.** Find the proposal ID: + +```bash +evmd q gov proposals +``` + +**3d.** Get validators to vote yes: + +```bash +evmd tx gov vote yes \ + --from \ + --chain-id \ + --keyring-backend \ + --gas auto --gas-adjustment 1.3 \ + --yes +``` + +**3e.** After the voting period, check that rewards are flowing: + +```bash +evmd q svip pool-state +``` + +You should see: +- `activated: true` +- `pool_balance` going down over time +- `total_distributed` going up +- `current_rate_per_second` showing a non-zero value + +To confirm validators are actually getting paid: + +```bash +evmd q distribution rewards +``` + +You should see a non-zero `total` in ogwei. + +> **Devnet:** Same flags as the step 2 devnet note. Quick rewards check: +> ```bash +> ADDR=$(evmd keys show mykey -a --keyring-backend test --home ~/.og-evm-devnet) +> evmd q distribution rewards $ADDR --home ~/.og-evm-devnet +> ``` + +--- + +## Step 4. Pause / unpause (governance) + +Emergency pause stops all rewards immediately. When you unpause later, the module skips over the paused time cleanly. There's no reward spike. + +**To pause:** + +**4a.** Copy the template: + +```bash +cp evmd/docs/svip_pause_proposal.json /tmp/svip_pause.json +``` + +Open `/tmp/svip_pause.json` and replace `` with your gov address. + +**4b.** Submit: + +```bash +evmd tx gov submit-proposal /tmp/svip_pause.json \ + --from \ + --chain-id \ + --keyring-backend \ + --gas auto --gas-adjustment 1.3 \ + --yes +``` + +**4c.** Find the proposal ID and vote: + +```bash +evmd q gov proposals +``` + +```bash +evmd tx gov vote yes \ + --from \ + --chain-id \ + --keyring-backend \ + --gas auto --gas-adjustment 1.3 \ + --yes +``` + +**4d.** Verify it's paused: + +```bash +evmd q svip pool-state +``` + +You should see `paused: true`, `current_rate_per_second: 0`, and `total_distributed` frozen. Run the query twice a few seconds apart. The number shouldn't change. + +**To unpause:** Edit `/tmp/svip_pause.json` and change `"paused": true` to `"paused": false`. Then repeat steps 4b through 4d. After unpausing, `paused` will disappear from the output (proto3 hides `false`). Confirm it worked by checking that `current_rate_per_second` is non-zero again. + +--- + +## Step 5. Reactivate (governance) + +If the pool runs dry and you refund it, use `MsgReactivate` to restart the decay curve with a fresh snapshot. This resets `ActivationTime` and `TotalDistributed`. The curve starts over as if you just activated for the first time. + +Why is this needed? The decay formula bases the reward rate on the pool snapshot from activation time. Without reactivating, refunded tokens would trickle out at the tail-end rate of the old curve (basically zero). + +**5a.** Fund the pool again (step 1). + +**5b.** Copy the template: + +```bash +cp evmd/docs/svip_reactivate_proposal.json /tmp/svip_reactivate.json +``` + +Open `/tmp/svip_reactivate.json` and replace `` with your gov address. + +**5c.** Submit: + +```bash +evmd tx gov submit-proposal /tmp/svip_reactivate.json \ + --from \ + --chain-id \ + --keyring-backend \ + --gas auto --gas-adjustment 1.3 \ + --yes +``` + +**5d.** Find the proposal ID and vote: + +```bash +evmd q gov proposals +``` + +```bash +evmd tx gov vote yes \ + --from \ + --chain-id \ + --keyring-backend \ + --gas auto --gas-adjustment 1.3 \ + --yes +``` + +**5e.** Verify: + +```bash +evmd q svip pool-state +``` + +`activation_time` should show the current time (not the original one), and `total_distributed` should be near zero (counting fresh from the new curve). + +--- + +## Queries + +```bash +# Module parameters (half_life_seconds) +evmd q svip params + +# Pool state (balance, total distributed, current rate, activation time) +evmd q svip pool-state +``` + +> **About `params: {}`:** The params query uses proto3 serialization, which drops fields that equal their default value (`0` for integers). This means you'll see `params: {}` even when `half_life_seconds` is set to 0. Don't worry, the value is stored correctly. Use `q svip pool-state` for the full picture including activated/paused status. + +--- + +## Reward math + +Rewards follow exponential decay. They start high and gradually taper off. With a 100M token pool and a 15-year half-life, roughly half the pool (50M) gets distributed in the first 15 years. After 30 years, 75% is out. The rate keeps slowing down but never hits zero, and the pool can never overpay. The math guarantees total payouts converge to exactly the pool size. diff --git a/evmd/docs/svip_activate_proposal.json b/evmd/docs/svip_activate_proposal.json new file mode 100644 index 00000000..5fe3f5be --- /dev/null +++ b/evmd/docs/svip_activate_proposal.json @@ -0,0 +1,11 @@ +{ + "messages": [ + { + "@type": "/cosmos.svip.v1.MsgActivate", + "authority": "" + } + ], + "deposit": "", + "title": "Activate SVIP reward distribution", + "summary": "Activate the Sustained Validator Incentive Pool. Snapshots the current pool balance and starts the exponential decay reward curve." +} diff --git a/evmd/docs/svip_pause_proposal.json b/evmd/docs/svip_pause_proposal.json new file mode 100644 index 00000000..1dc4205e --- /dev/null +++ b/evmd/docs/svip_pause_proposal.json @@ -0,0 +1,12 @@ +{ + "messages": [ + { + "@type": "/cosmos.svip.v1.MsgPause", + "authority": "", + "paused": true + } + ], + "deposit": "", + "title": "Pause SVIP", + "summary": "Emergency pause of SVIP reward distribution." +} diff --git a/evmd/docs/svip_reactivate_proposal.json b/evmd/docs/svip_reactivate_proposal.json new file mode 100644 index 00000000..47cfd0d8 --- /dev/null +++ b/evmd/docs/svip_reactivate_proposal.json @@ -0,0 +1,11 @@ +{ + "messages": [ + { + "@type": "/cosmos.svip.v1.MsgReactivate", + "authority": "" + } + ], + "deposit": "", + "title": "Reactivate SVIP with refunded pool", + "summary": "Re-snapshot the SVIP pool balance and restart the exponential decay curve. Use after the pool has been exhausted and refunded." +} diff --git a/evmd/docs/svip_update_params_proposal.json b/evmd/docs/svip_update_params_proposal.json new file mode 100644 index 00000000..ebf7c1e3 --- /dev/null +++ b/evmd/docs/svip_update_params_proposal.json @@ -0,0 +1,14 @@ +{ + "messages": [ + { + "@type": "/cosmos.svip.v1.MsgUpdateParams", + "authority": "", + "params": { + "half_life_seconds": "473364000" + } + } + ], + "deposit": "", + "title": "Set SVIP half-life to 15 years", + "summary": "Configure the SVIP exponential decay half-life before activation." +} diff --git a/evmd/tests/integration/bridge/bridge_test.go b/evmd/tests/integration/bridge/bridge_test.go new file mode 100644 index 00000000..e03c4d15 --- /dev/null +++ b/evmd/tests/integration/bridge/bridge_test.go @@ -0,0 +1,18 @@ +package bridge + +import ( + "testing" + + "github.com/stretchr/testify/suite" + + evm "github.com/cosmos/evm" + "github.com/cosmos/evm/evmd/tests/integration" + "github.com/cosmos/evm/tests/integration/bridge" + testapp "github.com/cosmos/evm/testutil/app" +) + +func TestBridgeIntegrationSuite(t *testing.T) { + create := testapp.ToEvmAppCreator[evm.IntegrationNetworkApp](integration.CreateEvmd, "evm.IntegrationNetworkApp") + s := bridge.NewIntegrationTestSuite(create) + suite.Run(t, s) +} diff --git a/interfaces.go b/interfaces.go index 21e3d4db..03d05200 100644 --- a/interfaces.go +++ b/interfaces.go @@ -3,6 +3,7 @@ package evm import ( "encoding/json" + bridgekeeper "github.com/cosmos/evm/x/bridge/keeper" erc20keeper "github.com/cosmos/evm/x/erc20/keeper" feemarketkeeper "github.com/cosmos/evm/x/feemarket/keeper" "github.com/cosmos/evm/x/ibc/callbacks/keeper" @@ -72,6 +73,7 @@ type EvmApp interface { //nolint:revive FeeGrantKeeperProvider FeeMarketKeeperProvider GovKeeperProvider + BridgeKeeperProvider KeyProvider MempoolProvider MintKeeperProvider @@ -94,6 +96,9 @@ type ( BankKeeperProvider interface { GetBankKeeper() bankkeeper.Keeper } + BridgeKeeperProvider interface { + GetBridgeKeeper() bridgekeeper.Keeper + } CallbackKeeperProvider interface { GetCallbackKeeper() keeper.ContractKeeper } diff --git a/precompiles/bridge/abi.json b/precompiles/bridge/abi.json new file mode 100644 index 00000000..a6dc4993 --- /dev/null +++ b/precompiles/bridge/abi.json @@ -0,0 +1,96 @@ +[ + { + "inputs": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "mintNative", + "outputs": [ + { + "internalType": "bool", + "name": "success", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "burnNative", + "outputs": [ + { + "internalType": "bool", + "name": "success", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "isEnabled", + "outputs": [ + { + "internalType": "bool", + "name": "enabled", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "MintNative", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "BurnNative", + "type": "event" + } +] diff --git a/precompiles/bridge/bridge.go b/precompiles/bridge/bridge.go new file mode 100644 index 00000000..07f65afa --- /dev/null +++ b/precompiles/bridge/bridge.go @@ -0,0 +1,157 @@ +package bridge + +import ( + "bytes" + "fmt" + "math/big" + + "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/vm" + + _ "embed" + + errorsmod "cosmossdk.io/errors" + sdkmath "cosmossdk.io/math" + storetypes "cosmossdk.io/store/types" + + cmn "github.com/cosmos/evm/precompiles/common" + "github.com/cosmos/evm/utils" + bridgekeeper "github.com/cosmos/evm/x/bridge/keeper" + bridgetypes "github.com/cosmos/evm/x/bridge/types" + evmtypes "github.com/cosmos/evm/x/vm/types" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +const ( + MintNativeMethod = "mintNative" + BurnNativeMethod = "burnNative" + IsEnabledMethod = "isEnabled" +) + +var _ vm.PrecompiledContract = &Precompile{} + +var ( + //go:embed abi.json + f []byte + ABI abi.ABI +) + +func init() { + var err error + ABI, err = abi.JSON(bytes.NewReader(f)) + if err != nil { + panic(err) + } +} + +// Precompile defines the bridge precompile. +type Precompile struct { + cmn.Precompile + + abi.ABI + bridgeKeeper bridgekeeper.Keeper +} + +// NewPrecompile creates a new bridge precompile instance. +func NewPrecompile(bridgeKeeper bridgekeeper.Keeper, bankKeeper cmn.BankKeeper) *Precompile { + return &Precompile{ + Precompile: cmn.Precompile{ + KvGasConfig: storetypes.KVGasConfig(), + TransientKVGasConfig: storetypes.TransientGasConfig(), + ContractAddress: common.HexToAddress(evmtypes.BridgePrecompileAddress), + BalanceHandlerFactory: cmn.NewBalanceHandlerFactory(bankKeeper), + }, + ABI: ABI, + bridgeKeeper: bridgeKeeper, + } +} + +// RequiredGas returns the minimum gas needed to execute the bridge precompile. +func (p Precompile) RequiredGas(input []byte) uint64 { + if len(input) < 4 { + return 0 + } + + method, err := p.MethodById(input[:4]) + if err != nil { + return 0 + } + + return p.Precompile.RequiredGas(input, p.IsTransaction(method)) +} + +func (p Precompile) Run(evm *vm.EVM, contract *vm.Contract, readonly bool) ([]byte, error) { + return p.RunNativeAction(evm, contract, func(ctx sdk.Context) ([]byte, error) { + return p.Execute(ctx, contract, readonly) + }) +} + +// Execute dispatches the bridge precompile methods defined in the ABI. +func (p Precompile) Execute(ctx sdk.Context, contract *vm.Contract, readOnly bool) ([]byte, error) { + method, args, err := cmn.SetupABI(p.ABI, contract, readOnly, p.IsTransaction) + if err != nil { + return nil, err + } + + switch method.Name { + case MintNativeMethod: + return p.MintNative(ctx, contract, method, args) + case BurnNativeMethod: + return p.BurnNative(ctx, contract, method, args) + case IsEnabledMethod: + return p.IsEnabled(ctx, method) + default: + return nil, fmt.Errorf(cmn.ErrUnknownMethod, method.Name) + } +} + +// IsTransaction returns whether the given method mutates bridge state. +func (Precompile) IsTransaction(method *abi.Method) bool { + switch method.Name { + case MintNativeMethod, BurnNativeMethod: + return true + default: + return false + } +} + +// IsEnabled returns whether the bridge is currently enabled. +func (p Precompile) IsEnabled(ctx sdk.Context, method *abi.Method) ([]byte, error) { + return method.Outputs.Pack(p.bridgeKeeper.GetParams(ctx).Enabled) +} + +func (p Precompile) ensureAuthorizedCaller(ctx sdk.Context, contract *vm.Contract) (common.Address, error) { + caller := contract.Caller() + authorizedContract := p.bridgeKeeper.GetAuthorizedContract(ctx) + if authorizedContract == "" { + return common.Address{}, errorsmod.Wrap(bridgetypes.ErrUnauthorizedCaller, "no authorized contract configured") + } + + authorizedCaller := common.HexToAddress(authorizedContract) + if caller != authorizedCaller { + return common.Address{}, errorsmod.Wrapf( + bridgetypes.ErrUnauthorizedCaller, + "caller %s is not authorized contract %s", + caller.Hex(), + authorizedCaller.Hex(), + ) + } + + return caller, nil +} + +func parseAmount(arg interface{}) (sdkmath.Int, error) { + amountBig, ok := arg.(*big.Int) + if !ok || amountBig == nil { + return sdkmath.Int{}, errorsmod.Wrap(bridgetypes.ErrInvalidAmount, "invalid uint256 amount argument") + } + + amount, err := utils.SafeNewIntFromBigInt(amountBig) + if err != nil { + return sdkmath.Int{}, errorsmod.Wrap(bridgetypes.ErrInvalidAmount, err.Error()) + } + + return amount, nil +} diff --git a/precompiles/bridge/bridge_test.go b/precompiles/bridge/bridge_test.go new file mode 100644 index 00000000..9a62e8d2 --- /dev/null +++ b/precompiles/bridge/bridge_test.go @@ -0,0 +1,188 @@ +package bridge_test + +import ( + "math/big" + "testing" + + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/vm" + "github.com/holiman/uint256" + "github.com/stretchr/testify/require" + + evmencoding "github.com/cosmos/evm/encoding" + bridgeprecompile "github.com/cosmos/evm/precompiles/bridge" + cmnmocks "github.com/cosmos/evm/precompiles/common/mocks" + testconstants "github.com/cosmos/evm/testutil/constants" + bridgekeeper "github.com/cosmos/evm/x/bridge/keeper" + bridgetypes "github.com/cosmos/evm/x/bridge/types" + bridgemocks "github.com/cosmos/evm/x/bridge/types/mocks" + vmtypes "github.com/cosmos/evm/x/vm/types" + + sdkmath "cosmossdk.io/math" + storetypes "cosmossdk.io/store/types" + + "github.com/cosmos/cosmos-sdk/testutil" + sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" +) + +type testData struct { + ctx sdk.Context + keeper bridgekeeper.Keeper + precompile *bridgeprecompile.Precompile + bridgeBank *bridgemocks.BankKeeper +} + +func newTestData(t *testing.T) testData { + t.Helper() + + storeKey := storetypes.NewKVStoreKey(bridgetypes.ModuleName) + tKey := storetypes.NewTransientStoreKey("transient_test") + ctx := testutil.DefaultContext(storeKey, tKey) //nolint:staticcheck + + bridgeBank := bridgemocks.NewBankKeeper(t) + accountKeeper := bridgemocks.NewAccountKeeper(t) + balanceBank := cmnmocks.NewBankKeeper(t) + + authority := authtypes.NewModuleAddress(govtypes.ModuleName) + cfg := evmencoding.MakeConfig(testconstants.ExampleChainID.EVMChainID) + keeper := bridgekeeper.NewKeeper(cfg.Codec, storeKey, authority, bridgeBank, accountKeeper) + vmtypes.SetDefaultEvmCoinInfo(testconstants.ExampleChainCoinInfo[testconstants.ExampleChainID]) + + return testData{ + ctx: ctx, + keeper: keeper, + precompile: bridgeprecompile.NewPrecompile(keeper, balanceBank), + bridgeBank: bridgeBank, + } +} + +func enabledParams(authorizedContract string) bridgetypes.Params { + params := bridgetypes.DefaultParams() + params.Enabled = true + params.AuthorizedContract = authorizedContract + return params +} + +func newContract(caller common.Address, precompile *bridgeprecompile.Precompile) *vm.Contract { + return vm.NewContract(caller, precompile.Address(), uint256.NewInt(0), 1_000_000, nil) +} + +func decodeBoolResult(t *testing.T, methodName string, bz []byte) bool { + t.Helper() + + method := bridgeprecompile.ABI.Methods[methodName] + outputs, err := method.Outputs.Unpack(bz) + require.NoError(t, err) + require.Len(t, outputs, 1) + + success, ok := outputs[0].(bool) + require.True(t, ok) + return success +} + +func TestMintNative_AuthorizedCaller(t *testing.T) { + td := newTestData(t) + authorizedContract := testconstants.ExampleEvmAddressAlice + require.NoError(t, td.keeper.SetParams(td.ctx, enabledParams(authorizedContract))) + + recipient := common.HexToAddress(testconstants.ExampleEvmAddressBob) + amount := sdkmath.NewInt(100) + coins := sdk.NewCoins(sdk.NewCoin(vmtypes.GetEVMCoinDenom(), amount)) + recipientAddr := sdk.AccAddress(recipient.Bytes()) + + td.bridgeBank.On("MintCoins", td.ctx, bridgetypes.ModuleName, coins).Return(nil) + td.bridgeBank.On("SendCoinsFromModuleToAccount", td.ctx, bridgetypes.ModuleName, recipientAddr, coins).Return(nil) + + method := bridgeprecompile.ABI.Methods[bridgeprecompile.MintNativeMethod] + result, err := td.precompile.MintNative( + td.ctx, + newContract(common.HexToAddress(authorizedContract), td.precompile), + &method, + []interface{}{recipient, big.NewInt(100)}, + ) + require.NoError(t, err) + require.True(t, decodeBoolResult(t, bridgeprecompile.MintNativeMethod, result)) + require.Equal(t, amount, td.keeper.GetTotalMinted(td.ctx)) +} + +func TestMintNative_UnauthorizedCaller(t *testing.T) { + td := newTestData(t) + require.NoError(t, td.keeper.SetParams(td.ctx, enabledParams(testconstants.ExampleEvmAddressAlice))) + + method := bridgeprecompile.ABI.Methods[bridgeprecompile.MintNativeMethod] + _, err := td.precompile.MintNative( + td.ctx, + newContract(common.HexToAddress(testconstants.ExampleEvmAddressBob), td.precompile), + &method, + []interface{}{common.HexToAddress("0x3333333333333333333333333333333333333333"), big.NewInt(1)}, + ) + require.ErrorIs(t, err, bridgetypes.ErrUnauthorizedCaller) +} + +func TestBurnNative_AuthorizedCaller(t *testing.T) { + td := newTestData(t) + authorizedContract := testconstants.ExampleEvmAddressAlice + require.NoError(t, td.keeper.SetParams(td.ctx, enabledParams(authorizedContract))) + + sender := sdk.AccAddress(common.HexToAddress(authorizedContract).Bytes()) + amount := sdkmath.NewInt(250) + coins := sdk.NewCoins(sdk.NewCoin(vmtypes.GetEVMCoinDenom(), amount)) + + td.bridgeBank.On("SendCoinsFromAccountToModule", td.ctx, sender, bridgetypes.ModuleName, coins).Return(nil) + td.bridgeBank.On("BurnCoins", td.ctx, bridgetypes.ModuleName, coins).Return(nil) + + method := bridgeprecompile.ABI.Methods[bridgeprecompile.BurnNativeMethod] + result, err := td.precompile.BurnNative( + td.ctx, + newContract(common.HexToAddress(authorizedContract), td.precompile), + &method, + []interface{}{big.NewInt(250)}, + ) + require.NoError(t, err) + require.True(t, decodeBoolResult(t, bridgeprecompile.BurnNativeMethod, result)) + require.Equal(t, amount, td.keeper.GetTotalBurned(td.ctx)) +} + +func TestMintNative_DisabledBridge(t *testing.T) { + td := newTestData(t) + params := bridgetypes.DefaultParams() + params.AuthorizedContract = testconstants.ExampleEvmAddressAlice + require.NoError(t, td.keeper.SetParams(td.ctx, params)) + + method := bridgeprecompile.ABI.Methods[bridgeprecompile.MintNativeMethod] + _, err := td.precompile.MintNative( + td.ctx, + newContract(common.HexToAddress(params.AuthorizedContract), td.precompile), + &method, + []interface{}{common.HexToAddress(testconstants.ExampleEvmAddressBob), big.NewInt(1)}, + ) + require.ErrorIs(t, err, bridgetypes.ErrBridgeDisabled) +} + +func TestMintNative_ExceedsMaxTransfer(t *testing.T) { + td := newTestData(t) + params := enabledParams(testconstants.ExampleEvmAddressAlice) + params.MaxTransferAmount = sdkmath.NewInt(10) + require.NoError(t, td.keeper.SetParams(td.ctx, params)) + + method := bridgeprecompile.ABI.Methods[bridgeprecompile.MintNativeMethod] + _, err := td.precompile.MintNative( + td.ctx, + newContract(common.HexToAddress(params.AuthorizedContract), td.precompile), + &method, + []interface{}{common.HexToAddress(testconstants.ExampleEvmAddressBob), big.NewInt(11)}, + ) + require.ErrorIs(t, err, bridgetypes.ErrExceedsMaxTransfer) +} + +func TestIsEnabled(t *testing.T) { + td := newTestData(t) + require.NoError(t, td.keeper.SetParams(td.ctx, enabledParams(testconstants.ExampleEvmAddressAlice))) + + method := bridgeprecompile.ABI.Methods[bridgeprecompile.IsEnabledMethod] + result, err := td.precompile.IsEnabled(td.ctx, &method) + require.NoError(t, err) + require.True(t, decodeBoolResult(t, bridgeprecompile.IsEnabledMethod, result)) +} diff --git a/precompiles/bridge/burn.go b/precompiles/bridge/burn.go new file mode 100644 index 00000000..be27def0 --- /dev/null +++ b/precompiles/bridge/burn.go @@ -0,0 +1,33 @@ +package bridge + +import ( + "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/core/vm" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// BurnNative burns native tokens from the authorized bridge contract balance. +func (p Precompile) BurnNative( + ctx sdk.Context, + contract *vm.Contract, + method *abi.Method, + args []interface{}, +) ([]byte, error) { + caller, err := p.ensureAuthorizedCaller(ctx, contract) + if err != nil { + return nil, err + } + + amount, err := parseAmount(args[0]) + if err != nil { + return nil, err + } + + senderAddr := sdk.AccAddress(caller.Bytes()) + if err := p.bridgeKeeper.BurnForBridge(ctx, senderAddr, amount); err != nil { + return nil, err + } + + return method.Outputs.Pack(true) +} diff --git a/precompiles/bridge/mint.go b/precompiles/bridge/mint.go new file mode 100644 index 00000000..c1a3cedf --- /dev/null +++ b/precompiles/bridge/mint.go @@ -0,0 +1,42 @@ +package bridge + +import ( + "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/vm" + + errorsmod "cosmossdk.io/errors" + + bridgetypes "github.com/cosmos/evm/x/bridge/types" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// MintNative mints native tokens to a recipient. Only the authorized bridge contract may call this. +func (p Precompile) MintNative( + ctx sdk.Context, + contract *vm.Contract, + method *abi.Method, + args []interface{}, +) ([]byte, error) { + if _, err := p.ensureAuthorizedCaller(ctx, contract); err != nil { + return nil, err + } + + recipient, ok := args[0].(common.Address) + if !ok { + return nil, errorsmod.Wrap(bridgetypes.ErrInvalidAddress, "invalid recipient argument") + } + + amount, err := parseAmount(args[1]) + if err != nil { + return nil, err + } + + recipientAddr := sdk.AccAddress(recipient.Bytes()) + if err := p.bridgeKeeper.MintForBridge(ctx, recipientAddr, amount); err != nil { + return nil, err + } + + return method.Outputs.Pack(true) +} diff --git a/precompiles/types/defaults.go b/precompiles/types/defaults.go index b477eb84..7c571bff 100644 --- a/precompiles/types/defaults.go +++ b/precompiles/types/defaults.go @@ -7,6 +7,7 @@ import ( evmaddress "github.com/cosmos/evm/encoding/address" ibcutils "github.com/cosmos/evm/ibc" cmn "github.com/cosmos/evm/precompiles/common" + bridgekeeper "github.com/cosmos/evm/x/bridge/keeper" erc20Keeper "github.com/cosmos/evm/x/erc20/keeper" transferkeeper "github.com/cosmos/evm/x/ibc/transfer/keeper" channelkeeper "github.com/cosmos/ibc-go/v10/modules/core/04-channel/keeper" @@ -67,6 +68,7 @@ func DefaultStaticPrecompiles( stakingKeeper stakingkeeper.Keeper, distributionKeeper distributionkeeper.Keeper, bankKeeper cmn.BankKeeper, + bridgeKeeper bridgekeeper.Keeper, erc20Keeper *erc20Keeper.Keeper, transferKeeper *transferkeeper.Keeper, channelKeeper *channelkeeper.Keeper, @@ -85,6 +87,7 @@ func DefaultStaticPrecompiles( WithICS02Precompile(codec, clientKeeper). WithICS20Precompile(bankKeeper, stakingKeeper, transferKeeper, channelKeeper). WithBankPrecompile(bankKeeper, erc20Keeper). + WithBridgePrecompile(bridgeKeeper, bankKeeper). WithGovPrecompile(govKeeper, bankKeeper, codec, opts...). WithSlashingPrecompile(slashingKeeper, bankKeeper, opts...). WithTEEPrecompile() diff --git a/precompiles/types/static_precompiles.go b/precompiles/types/static_precompiles.go index f4a9914d..0e9ee219 100644 --- a/precompiles/types/static_precompiles.go +++ b/precompiles/types/static_precompiles.go @@ -9,6 +9,7 @@ import ( ibcutils "github.com/cosmos/evm/ibc" bankprecompile "github.com/cosmos/evm/precompiles/bank" + bridgeprecompile "github.com/cosmos/evm/precompiles/bridge" "github.com/cosmos/evm/precompiles/bech32" cmn "github.com/cosmos/evm/precompiles/common" @@ -21,6 +22,7 @@ import ( stakingprecompile "github.com/cosmos/evm/precompiles/staking" teeprecompile "github.com/cosmos/evm/precompiles/tee" + bridgekeeper "github.com/cosmos/evm/x/bridge/keeper" erc20Keeper "github.com/cosmos/evm/x/erc20/keeper" transferkeeper "github.com/cosmos/evm/x/ibc/transfer/keeper" channelkeeper "github.com/cosmos/ibc-go/v10/modules/core/04-channel/keeper" @@ -143,6 +145,15 @@ func (s StaticPrecompiles) WithBankPrecompile( return s } +func (s StaticPrecompiles) WithBridgePrecompile( + bridgeKeeper bridgekeeper.Keeper, + bankKeeper cmn.BankKeeper, +) StaticPrecompiles { + bridgePrecompile := bridgeprecompile.NewPrecompile(bridgeKeeper, bankKeeper) + s[bridgePrecompile.Address()] = bridgePrecompile + return s +} + func (s StaticPrecompiles) WithGovPrecompile( govKeeper govkeeper.Keeper, bankKeeper cmn.BankKeeper, diff --git a/proto/cosmos/bridge/v1/bridge.proto b/proto/cosmos/bridge/v1/bridge.proto new file mode 100644 index 00000000..ac47e30d --- /dev/null +++ b/proto/cosmos/bridge/v1/bridge.proto @@ -0,0 +1,29 @@ + +syntax = "proto3"; +package cosmos.bridge.v1; + +import "amino/amino.proto"; +import "gogoproto/gogo.proto"; + +option go_package = "github.com/cosmos/evm/x/bridge/types"; + +// Params defines the x/bridge module parameters. +message Params { + option (amino.name) = "cosmos/x/bridge/Params"; + + // authorized_contract is the hex EVM address of the authorized bridge contract. + string authorized_contract = 1 [(amino.dont_omitempty) = true, (gogoproto.jsontag) = "authorized_contract"]; + // hyperlane_mailbox is the hex EVM address of the Hyperlane Mailbox. + string hyperlane_mailbox = 2 [(amino.dont_omitempty) = true, (gogoproto.jsontag) = "hyperlane_mailbox"]; + // base_domain_id is the Hyperlane domain ID for Base (default 8453). + uint32 base_domain_id = 3 [(amino.dont_omitempty) = true, (gogoproto.jsontag) = "base_domain_id"]; + // enabled indicates whether the bridge is active. + bool enabled = 4 [(amino.dont_omitempty) = true, (gogoproto.jsontag) = "enabled"]; + // max_transfer_amount is the maximum amount per transfer. + string max_transfer_amount = 5 [ + (gogoproto.customtype) = "cosmossdk.io/math.Int", + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true, + (gogoproto.jsontag) = "max_transfer_amount" + ]; +} diff --git a/proto/cosmos/bridge/v1/genesis.proto b/proto/cosmos/bridge/v1/genesis.proto new file mode 100644 index 00000000..55ee3f23 --- /dev/null +++ b/proto/cosmos/bridge/v1/genesis.proto @@ -0,0 +1,26 @@ + +syntax = "proto3"; +package cosmos.bridge.v1; + +import "amino/amino.proto"; +import "cosmos/bridge/v1/bridge.proto"; +import "gogoproto/gogo.proto"; + +option go_package = "github.com/cosmos/evm/x/bridge/types"; + +// GenesisState defines the bridge module's genesis state. +message GenesisState { + // params defines all the parameters of the bridge module. + Params params = 1 + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; + // total_minted is the cumulative tokens minted via bridge. + string total_minted = 2 [ + (gogoproto.customtype) = "cosmossdk.io/math.Int", + (gogoproto.nullable) = false + ]; + // total_burned is the cumulative tokens burned via bridge. + string total_burned = 3 [ + (gogoproto.customtype) = "cosmossdk.io/math.Int", + (gogoproto.nullable) = false + ]; +} diff --git a/proto/cosmos/bridge/v1/query.proto b/proto/cosmos/bridge/v1/query.proto new file mode 100644 index 00000000..0b8d2437 --- /dev/null +++ b/proto/cosmos/bridge/v1/query.proto @@ -0,0 +1,54 @@ + +syntax = "proto3"; +package cosmos.bridge.v1; + +import "amino/amino.proto"; +import "cosmos/bridge/v1/bridge.proto"; +import "gogoproto/gogo.proto"; +import "google/api/annotations.proto"; + +option go_package = "github.com/cosmos/evm/x/bridge/types"; + +// Query defines the gRPC querier service. +service Query { + // Params queries the parameters of x/bridge module. + rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { + option (google.api.http).get = "/cosmos/bridge/v1/params"; + } + + // BridgeStatus queries the current bridge status and statistics. + rpc BridgeStatus(QueryBridgeStatusRequest) returns (QueryBridgeStatusResponse) { + option (google.api.http).get = "/cosmos/bridge/v1/bridge_status"; + } +} + +// QueryParamsRequest defines the request type for querying x/bridge parameters. +message QueryParamsRequest {} + +// QueryParamsResponse defines the response type for querying x/bridge parameters. +message QueryParamsResponse { + // params define the bridge module parameters. + Params params = 1 + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; +} + +// QueryBridgeStatusRequest defines the request type for querying bridge status. +message QueryBridgeStatusRequest {} + +// QueryBridgeStatusResponse returns the current bridge status and statistics. +message QueryBridgeStatusResponse { + // enabled indicates whether the bridge is active. + bool enabled = 1; + // total_minted is the cumulative tokens minted via bridge. + string total_minted = 2 [ + (gogoproto.customtype) = "cosmossdk.io/math.Int", + (gogoproto.nullable) = false + ]; + // total_burned is the cumulative tokens burned via bridge. + string total_burned = 3 [ + (gogoproto.customtype) = "cosmossdk.io/math.Int", + (gogoproto.nullable) = false + ]; + // authorized_contract is the hex EVM address of the authorized bridge contract. + string authorized_contract = 4; +} diff --git a/proto/cosmos/bridge/v1/tx.proto b/proto/cosmos/bridge/v1/tx.proto new file mode 100644 index 00000000..59b4d928 --- /dev/null +++ b/proto/cosmos/bridge/v1/tx.proto @@ -0,0 +1,49 @@ + +syntax = "proto3"; +package cosmos.bridge.v1; + +import "amino/amino.proto"; +import "cosmos/bridge/v1/bridge.proto"; +import "cosmos/msg/v1/msg.proto"; +import "cosmos_proto/cosmos.proto"; +import "gogoproto/gogo.proto"; + +option go_package = "github.com/cosmos/evm/x/bridge/types"; + +// Msg defines the bridge Msg service. +service Msg { + option (cosmos.msg.v1.service) = true; + // UpdateParams updates the x/bridge module parameters. Governance-only. + rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); + // SetAuthorizedContract sets the authorized bridge contract address. Governance-only. + rpc SetAuthorizedContract(MsgSetAuthorizedContract) returns (MsgSetAuthorizedContractResponse); +} + +// MsgUpdateParams defines a Msg for updating the x/bridge module parameters. +message MsgUpdateParams { + option (cosmos.msg.v1.signer) = "authority"; + option (amino.name) = "cosmos/x/bridge/MsgUpdateParams"; + + // authority is the address of the governance account. + string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + // params defines the x/bridge parameters to update. + Params params = 2 + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; +} + +// MsgUpdateParamsResponse defines the response for MsgUpdateParams. +message MsgUpdateParamsResponse {} + +// MsgSetAuthorizedContract sets the authorized bridge contract address. Governance-only. +message MsgSetAuthorizedContract { + option (cosmos.msg.v1.signer) = "authority"; + option (amino.name) = "cosmos/x/bridge/MsgSetAuthorizedContract"; + + // authority is the address of the governance account. + string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + // contract_address is the hex EVM address of the authorized bridge contract. + string contract_address = 2; +} + +// MsgSetAuthorizedContractResponse defines the response for MsgSetAuthorizedContract. +message MsgSetAuthorizedContractResponse {} diff --git a/proto/cosmos/svip/v1/genesis.proto b/proto/cosmos/svip/v1/genesis.proto new file mode 100644 index 00000000..a2f3040d --- /dev/null +++ b/proto/cosmos/svip/v1/genesis.proto @@ -0,0 +1,37 @@ + +syntax = "proto3"; +package cosmos.svip.v1; + +import "amino/amino.proto"; +import "cosmos/svip/v1/svip.proto"; +import "gogoproto/gogo.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "github.com/cosmos/evm/x/svip/types"; + +// GenesisState defines the svip module's genesis state. +message GenesisState { + // params defines all the parameters of the svip module. + Params params = 1 + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; + // total_distributed is the cumulative tokens sent to FeeCollector. + string total_distributed = 2 [ + (gogoproto.customtype) = "cosmossdk.io/math.Int", + (gogoproto.nullable) = false + ]; + // activation_time is when SVIP was activated. Zero if not yet activated. + google.protobuf.Timestamp activation_time = 3 [ (gogoproto.stdtime) = true, (gogoproto.nullable) = false ]; + // pool_balance_at_activation is the pool snapshot used to derive Râ‚€. + string pool_balance_at_activation = 4 [ + (gogoproto.customtype) = "cosmossdk.io/math.Int", + (gogoproto.nullable) = false + ]; + // last_block_time is the timestamp of the last processed block. + google.protobuf.Timestamp last_block_time = 5 [ (gogoproto.stdtime) = true, (gogoproto.nullable) = false ]; + // total_paused_seconds is the cumulative seconds spent in paused state. + int64 total_paused_seconds = 6; + // activated indicates whether SVIP reward distribution is active. + bool activated = 7; + // paused is an emergency pause flag. + bool paused = 8; +} diff --git a/proto/cosmos/svip/v1/query.proto b/proto/cosmos/svip/v1/query.proto new file mode 100644 index 00000000..5677c3d1 --- /dev/null +++ b/proto/cosmos/svip/v1/query.proto @@ -0,0 +1,61 @@ + +syntax = "proto3"; +package cosmos.svip.v1; + +import "amino/amino.proto"; +import "cosmos/svip/v1/svip.proto"; +import "gogoproto/gogo.proto"; +import "google/api/annotations.proto"; +import "google/protobuf/timestamp.proto"; +import "cosmos/base/v1beta1/coin.proto"; + +option go_package = "github.com/cosmos/evm/x/svip/types"; + +// Query defines the gRPC querier service. +service Query { + // Params queries the parameters of x/svip module. + rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { + option (google.api.http).get = "/cosmos/svip/v1/params"; + } + + // PoolState queries the current SVIP pool balance, distribution stats, and + // reward rate. + rpc PoolState(QueryPoolStateRequest) returns (QueryPoolStateResponse) { + option (google.api.http).get = "/cosmos/svip/v1/pool_state"; + } +} + +// QueryParamsRequest defines the request type for querying x/svip parameters. +message QueryParamsRequest {} + +// QueryParamsResponse defines the response type for querying x/svip parameters. +message QueryParamsResponse { + // params define the svip module parameters. + Params params = 1 + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; +} + +// QueryPoolStateRequest defines the request type for querying pool state. +message QueryPoolStateRequest {} + +// QueryPoolStateResponse returns the current SVIP pool state. +message QueryPoolStateResponse { + // pool_balance is the current balance in the SVIP module account. + cosmos.base.v1beta1.Coin pool_balance = 1 [ (gogoproto.nullable) = false ]; + // total_distributed is cumulative tokens sent to FeeCollector. + string total_distributed = 2 [ + (gogoproto.customtype) = "cosmossdk.io/math.Int", + (gogoproto.nullable) = false + ]; + // current_rate_per_second is the current reward rate after decay. + string current_rate_per_second = 3 [ + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false + ]; + // activated indicates whether SVIP is active. + bool activated = 4; + // paused indicates whether SVIP is paused. + bool paused = 5; + // activation_time is when SVIP was activated. + google.protobuf.Timestamp activation_time = 6 [ (gogoproto.stdtime) = true, (gogoproto.nullable) = false ]; +} diff --git a/proto/cosmos/svip/v1/svip.proto b/proto/cosmos/svip/v1/svip.proto new file mode 100644 index 00000000..18a025d2 --- /dev/null +++ b/proto/cosmos/svip/v1/svip.proto @@ -0,0 +1,16 @@ + +syntax = "proto3"; +package cosmos.svip.v1; + +import "amino/amino.proto"; +import "gogoproto/gogo.proto"; + +option go_package = "github.com/cosmos/evm/x/svip/types"; + +// Params defines the x/svip module parameters. +message Params { + option (amino.name) = "cosmos/x/svip/Params"; + + // half_life_seconds is the half-life for exponential decay, in seconds. + int64 half_life_seconds = 3 [(amino.dont_omitempty) = true, (gogoproto.jsontag) = "half_life_seconds"]; +} diff --git a/proto/cosmos/svip/v1/tx.proto b/proto/cosmos/svip/v1/tx.proto new file mode 100644 index 00000000..290cb23e --- /dev/null +++ b/proto/cosmos/svip/v1/tx.proto @@ -0,0 +1,93 @@ + +syntax = "proto3"; +package cosmos.svip.v1; + +import "amino/amino.proto"; +import "cosmos/svip/v1/svip.proto"; +import "cosmos/msg/v1/msg.proto"; +import "cosmos_proto/cosmos.proto"; +import "gogoproto/gogo.proto"; +import "cosmos/base/v1beta1/coin.proto"; + +option go_package = "github.com/cosmos/evm/x/svip/types"; + +// Msg defines the svip Msg service. +service Msg { + option (cosmos.msg.v1.service) = true; + // UpdateParams updates the x/svip module parameters. Governance-only. + rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); + // Activate turns on reward distribution. Snapshots pool balance. + rpc Activate(MsgActivate) returns (MsgActivateResponse); + // Reactivate restarts the decay curve with a fresh pool snapshot. + rpc Reactivate(MsgReactivate) returns (MsgReactivateResponse); + // Pause toggles the emergency pause flag. Governance-only. + rpc Pause(MsgPause) returns (MsgPauseResponse); + // FundPool transfers native tokens into the SVIP pool. Permissionless. + rpc FundPool(MsgFundPool) returns (MsgFundPoolResponse); +} + +// MsgUpdateParams defines a Msg for updating the x/svip module parameters. +message MsgUpdateParams { + option (cosmos.msg.v1.signer) = "authority"; + option (amino.name) = "cosmos/x/svip/MsgUpdateParams"; + + // authority is the address of the governance account. + string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + // params defines the x/svip parameters to update. + // NOTE: Only half_life_seconds is configurable via this message. + Params params = 2 + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; +} + +// MsgUpdateParamsResponse defines the response for MsgUpdateParams. +message MsgUpdateParamsResponse {} + +// MsgActivate activates SVIP reward distribution. Governance-only. +message MsgActivate { + option (cosmos.msg.v1.signer) = "authority"; + + // authority is the address of the governance account. + string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; +} + +// MsgActivateResponse defines the response for MsgActivate. +message MsgActivateResponse {} + +// MsgReactivate restarts the decay curve with a fresh pool snapshot. +// Governance-only. Used after pool exhaustion and refund. +message MsgReactivate { + option (cosmos.msg.v1.signer) = "authority"; + + // authority is the address of the governance account. + string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; +} + +// MsgReactivateResponse defines the response for MsgReactivate. +message MsgReactivateResponse {} + +// MsgPause toggles the SVIP emergency pause flag. Governance-only. +message MsgPause { + option (cosmos.msg.v1.signer) = "authority"; + + // authority is the address of the governance account. + string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + // paused is the desired pause state. + bool paused = 2; +} + +// MsgPauseResponse defines the response for MsgPause. +message MsgPauseResponse {} + +// MsgFundPool sends native tokens to the SVIP reward pool. Permissionless. +message MsgFundPool { + option (cosmos.msg.v1.signer) = "depositor"; + + // depositor is the address funding the pool. + string depositor = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + // amount is the coins to transfer. Only the native denom is accepted. + repeated cosmos.base.v1beta1.Coin amount = 2 + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; +} + +// MsgFundPoolResponse defines the response for MsgFundPool. +message MsgFundPoolResponse {} diff --git a/scripts/bridge/config/core-config.yaml b/scripts/bridge/config/core-config.yaml new file mode 100644 index 00000000..a6234887 --- /dev/null +++ b/scripts/bridge/config/core-config.yaml @@ -0,0 +1,13 @@ +environment: ${HYPERLANE_ENVIRONMENT:-testnet} +owner: ${HYPERLANE_OWNER:-0x0000000000000000000000000000000000000000} +mailbox: + address: ${OG_EVM_MAILBOX:-0x0000000000000000000000000000000000000000} + owner: ${OG_EVM_MAILBOX_OWNER:-0x0000000000000000000000000000000000000000} +igp: + address: ${OG_EVM_IGP:-0x0000000000000000000000000000000000000000} + beneficiary: ${HYPERLANE_FEE_BENEFICIARY:-0x0000000000000000000000000000000000000000} +ism: + kind: ${HYPERLANE_ISM_KIND:-multisig} + threshold: ${HYPERLANE_ISM_THRESHOLD:-1} + validators: + - ${HYPERLANE_VALIDATOR_1:-0x0000000000000000000000000000000000000000} diff --git a/scripts/bridge/config/og-evm-metadata.yaml b/scripts/bridge/config/og-evm-metadata.yaml new file mode 100644 index 00000000..96d7adbc --- /dev/null +++ b/scripts/bridge/config/og-evm-metadata.yaml @@ -0,0 +1,10 @@ +name: og-evm +displayName: og-evm +domainId: ${OG_EVM_DOMAIN_ID:-10740} +chainId: ${OG_EVM_CHAIN_ID:-10740} +protocol: ethereum +rpcUrl: ${OG_EVM_RPC_URL:-http://127.0.0.1:8545} +mailbox: ${OG_EVM_MAILBOX:-0x0000000000000000000000000000000000000000} +interchainGasPaymaster: ${OG_EVM_IGP:-0x0000000000000000000000000000000000000000} +validatorAnnounce: ${OG_EVM_VALIDATOR_ANNOUNCE:-0x0000000000000000000000000000000000000000} +merkleTreeHook: ${OG_EVM_MERKLE_TREE_HOOK:-0x0000000000000000000000000000000000000000} diff --git a/scripts/bridge/config/warp-config.yaml b/scripts/bridge/config/warp-config.yaml new file mode 100644 index 00000000..3b9916fd --- /dev/null +++ b/scripts/bridge/config/warp-config.yaml @@ -0,0 +1,10 @@ +name: og-native +type: collateral +localDomain: ${OG_EVM_DOMAIN_ID:-10740} +remoteDomain: ${BASE_DOMAIN_ID:-8453} +mailbox: ${OG_EVM_MAILBOX:-0x0000000000000000000000000000000000000000} +bridgePrecompile: 0x0000000000000000000000000000000000000A00 +localRouter: ${HYPERLANE_LOCAL_ROUTER:-0x0000000000000000000000000000000000000000} +remoteRouter: ${BASE_COLLATERAL_ROUTER:-0x0000000000000000000000000000000000000000} +collateralToken: ${BASE_TOKEN_ADDRESS:-0x0000000000000000000000000000000000000000} +recipient: ${BASE_RECIPIENT:-0x0000000000000000000000000000000000000000} diff --git a/scripts/bridge/deploy-hyperlane-core.sh b/scripts/bridge/deploy-hyperlane-core.sh new file mode 100755 index 00000000..16f6e65e --- /dev/null +++ b/scripts/bridge/deploy-hyperlane-core.sh @@ -0,0 +1,38 @@ +#!/usr/bin/env bash + +set -euo pipefail + +ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" +GENERATED_DIR="${OUTPUT_DIR:-$ROOT_DIR/scripts/bridge/generated}" + +"$ROOT_DIR/scripts/bridge/generate-artifacts.sh" >/dev/null + +cat </dev/null + +cat <&2 + exit 1 + ;; + esac +} + +OG_EVM_RPC_URLS_JSON="$(json_array "$OG_EVM_RPC_URLS")" +BASE_RPC_URLS_JSON="$(json_array "$BASE_RPC_URLS")" +ALLOW_LOCAL_CHECKPOINT_SYNCERS_JSON="$(json_bool "$ALLOW_LOCAL_CHECKPOINT_SYNCERS")" +BRIDGE_ENABLED_JSON="$(json_bool "$BRIDGE_ENABLED")" + +cat >"$OUTPUT_DIR/og-evm-metadata.yaml" <"$OUTPUT_DIR/core-config.yaml" <"$OUTPUT_DIR/warp-config.yaml" <&2 + exit 1 +} + +trim() { + local value="$1" + value="${value#"${value%%[![:space:]]*}"}" + value="${value%"${value##*[![:space:]]}"}" + printf '%s' "$value" +} + +lower() { + printf '%s' "$1" | tr '[:upper:]' '[:lower:]' +} + +is_truthy() { + case "$(lower "$1")" in + 1|true|yes|on) + return 0 + ;; + *) + return 1 + ;; + esac +} + +yaml_scalar() { + local file="$1" + local key="$2" + local value + + value="$(sed -n "s/^${key}: //p" "$file" | head -n 1)" + value="$(trim "$value")" + [[ -n "$value" ]] || fail "missing ${key} in $(basename "$file")" + printf '%s' "$value" +} + +json_expr() { + local file="$1" + local expr="$2" + python3 - "$file" "$expr" <<'PY' +import json +import sys + +path = sys.argv[1] +expr = sys.argv[2] +data = json.load(open(path, encoding="utf-8")) +allowed = {"data": data, "len": len} +value = eval(expr, {"__builtins__": {}}, allowed) +if isinstance(value, bool): + print("true" if value else "false") +elif isinstance(value, (int, float)): + print(value) +else: + print(value) +PY +} + +http_get() { + local url="$1" + python3 - "$url" <<'PY' +import sys +import urllib.error +import urllib.request + +url = sys.argv[1] +try: + with urllib.request.urlopen(url, timeout=10) as response: + print(response.read().decode("utf-8")) +except urllib.error.URLError as exc: + print(f"http request failed: {exc}", file=sys.stderr) + sys.exit(1) +PY +} + +rpc_call() { + local url="$1" + local method="$2" + local params_json="${3:-[]}" + + python3 - "$url" "$method" "$params_json" <<'PY' +import json +import sys +import urllib.error +import urllib.request + +url = sys.argv[1] +method = sys.argv[2] +params = json.loads(sys.argv[3]) +payload = json.dumps( + {"jsonrpc": "2.0", "id": 1, "method": method, "params": params} +).encode("utf-8") +request = urllib.request.Request( + url, + data=payload, + headers={"Content-Type": "application/json"}, + method="POST", +) +try: + with urllib.request.urlopen(request, timeout=10) as response: + body = json.load(response) +except urllib.error.URLError as exc: + print(f"rpc request failed: {exc}", file=sys.stderr) + sys.exit(1) + +if "error" in body: + print(f"rpc response returned error: {body['error']}", file=sys.stderr) + sys.exit(1) +if "result" not in body: + print("rpc response missing result field", file=sys.stderr) + sys.exit(1) +print(body["result"]) +PY +} + +hex_to_dec() { + local value="$1" + python3 - "$value" <<'PY' +import sys + +value = sys.argv[1].strip() +print(int(value, 16)) +PY +} + +prom_metrics_ok() { + local url="$1" + local body + + body="$(http_get "$url")" || fail "unable to reach metrics endpoint $url" + [[ "$body" == \#\ HELP* || "$body" == *$'\n# HELP '* || "$body" == *$'\n# TYPE '* ]] || fail "metrics endpoint at $url did not return Prometheus text" +} + +docker_service_state() { + local service="$1" + docker compose -f "$COMPOSE_FILE" ps --format json \ + | python3 - "$service" <<'PY' +import json +import sys + +service = sys.argv[1] +text = sys.stdin.read().strip() +if not text: + print("") + sys.exit(0) +if text.startswith("["): + data = json.loads(text) +else: + data = [json.loads(line) for line in text.splitlines() if line.strip()] + +for item in data: + if item.get("Service") == service: + print(item.get("State", "")) + break +PY +} + +[[ -f "$AGENT_FILE" ]] || fail "missing agent config at $AGENT_FILE" +[[ -f "$WARP_FILE" ]] || fail "missing warp config at $WARP_FILE" + +og_rpc="$(json_expr "$AGENT_FILE" "data['chains']['$OG_EVM_CHAIN_NAME']['customRpcUrls'][0]")" +base_rpc="$(json_expr "$AGENT_FILE" "data['chains']['$BASE_CHAIN_NAME']['customRpcUrls'][0]")" +og_domain="$(json_expr "$AGENT_FILE" "data['chains']['$OG_EVM_CHAIN_NAME']['domain']")" +base_domain="$(json_expr "$AGENT_FILE" "data['chains']['$BASE_CHAIN_NAME']['domain']")" +og_mailbox="$(json_expr "$AGENT_FILE" "data['chains']['$OG_EVM_CHAIN_NAME']['mailbox']")" +og_router="$(yaml_scalar "$WARP_FILE" "localRouter")" +base_router="$(yaml_scalar "$WARP_FILE" "remoteRouter")" +base_token="${BASE_TOKEN_ADDRESS:-$(yaml_scalar "$WARP_FILE" "collateralToken")}" + +echo "Bridge monitor summary" +echo " og-evm domain: $og_domain" +echo " base domain: $base_domain" +echo " og-evm mailbox: $og_mailbox" +echo " og-evm router: $og_router" +echo " base router: $base_router" +echo " og-evm rpc: $og_rpc" +echo " base rpc: $base_rpc" +echo " validator metrics: $VALIDATOR_METRICS_URL" +echo " relayer metrics: $RELAYER_METRICS_URL" + +og_chain_id_hex="$(rpc_call "$og_rpc" "eth_chainId" "[]")" || fail "unable to query og-evm RPC chainId" +base_chain_id_hex="$(rpc_call "$base_rpc" "eth_chainId" "[]")" || fail "unable to query base RPC chainId" +echo "RPC chain IDs" +echo " og-evm: $(hex_to_dec "$og_chain_id_hex")" +echo " base: $(hex_to_dec "$base_chain_id_hex")" + +if [[ -n "$OG_EVM_LCD_URL" ]]; then + bridge_status="$(http_get "${OG_EVM_LCD_URL%/}/cosmos/bridge/v1/bridge_status")" || fail "unable to query og-evm bridge status from $OG_EVM_LCD_URL" + echo "Bridge module status" + python3 - "$bridge_status" <<'PY' +import json +import sys + +data = json.loads(sys.argv[1]) +print(f" enabled: {data.get('enabled')}") +print(f" total_minted: {data.get('totalMinted')}") +print(f" total_burned: {data.get('totalBurned')}") +print(f" authorized_contract: {data.get('authorizedContract')}") +PY +fi + +if [[ -n "$base_token" ]]; then + router_word="000000000000000000000000$(lower "${base_router#0x}")" + balance_word="$(rpc_call "$base_rpc" "eth_call" "[{\"to\":\"$base_token\",\"data\":\"0x70a08231${router_word}\"},\"latest\"]")" || fail "unable to query collateral balance from $base_token" + echo "Base collateral balance" + echo " token: $base_token" + echo " router: $base_router" + echo " balance_wei: $(hex_to_dec "$balance_word")" +fi + +prom_metrics_ok "$VALIDATOR_METRICS_URL" +prom_metrics_ok "$RELAYER_METRICS_URL" +echo "Metrics endpoints" +echo " validator: ok" +echo " relayer: ok" + +if is_truthy "$CHECK_DOCKER"; then + command -v docker >/dev/null 2>&1 || fail "docker is required when CHECK_DOCKER=true" + [[ -f "$COMPOSE_FILE" ]] || fail "missing compose file at $COMPOSE_FILE" + + validator_state="$(docker_service_state validator)" + relayer_state="$(docker_service_state relayer)" + [[ "$validator_state" == "running" ]] || fail "validator service is not running (state: ${validator_state:-unknown})" + [[ "$relayer_state" == "running" ]] || fail "relayer service is not running (state: ${relayer_state:-unknown})" + + echo "Docker services" + echo " validator: $validator_state" + echo " relayer: $relayer_state" +fi diff --git a/scripts/bridge/monitoring/bridge-alerts.yml b/scripts/bridge/monitoring/bridge-alerts.yml new file mode 100644 index 00000000..1b6b0af2 --- /dev/null +++ b/scripts/bridge/monitoring/bridge-alerts.yml @@ -0,0 +1,78 @@ +groups: + - name: bridge-health + rules: + - alert: OGEvmBridgeCollateralShortfall + expr: og_evm_bridge_outstanding > base_collateral_balance + for: 5m + labels: + severity: critical + annotations: + summary: "Base collateral is below outstanding bridged supply" + description: "The Base collateral router balance is lower than the outstanding native supply minted on og-evm." + + - alert: OGEvmBridgeCollateralDrift + expr: abs(bridge_collateral_surplus) > 0 + for: 10m + labels: + severity: warning + annotations: + summary: "Bridge collateral has drifted from outstanding bridged supply" + description: "Locked Base collateral no longer matches outstanding bridged native supply." + + - name: hyperlane-relayer + rules: + - alert: HyperlaneRelayerCriticalError + expr: max by (chain) (hyperlane_critical_error{job="hyperlane-relayer"}) > 0 + for: 5m + labels: + severity: critical + annotations: + summary: "Hyperlane relayer has reported a critical error" + description: "The relayer has lost liveness on at least one chain." + + - alert: HyperlaneRelayerRpcFailureRateHigh + expr: sum by (chain) (rate(hyperlane_request_count{job="hyperlane-relayer",status="failure"}[10m])) / clamp_min(sum by (chain) (rate(hyperlane_request_count{job="hyperlane-relayer",status=~"success|failure"}[10m])), 0.001) > 0.6 + for: 10m + labels: + severity: warning + annotations: + summary: "Hyperlane relayer RPC failure rate is high" + description: "More than 60% of relayer RPC requests have been failing for at least 10 minutes." + + - alert: HyperlaneRelayerPrepareQueueBacklog + expr: delta(hyperlane_submitter_queue_length{job="hyperlane-relayer",queue_name="prepare_queue"}[30m]) > 0 and max_over_time(hyperlane_submitter_queue_length{job="hyperlane-relayer",queue_name="confirm_queue"}[30m]) == 0 and increase(hyperlane_span_events_total{job="hyperlane-relayer",agent="relayer",event_level=~"error|warn"}[30m]) > 0 + for: 30m + labels: + severity: warning + annotations: + summary: "Hyperlane relayer delivery queue is backing up" + description: "The prepare queue is growing while confirmations are not moving, which usually indicates mailbox delivery failures, low balance, or a bad RPC." + + - name: hyperlane-validator + rules: + - alert: HyperlaneValidatorRpcStalled + expr: delta(hyperlane_block_height{job="hyperlane-validator"}[15m]) == 0 + for: 15m + labels: + severity: warning + annotations: + summary: "Hyperlane validator RPC height is stalled" + description: "The validator's connected RPC has not advanced its block height for at least 15 minutes." + + - alert: HyperlaneValidatorCheckpointStalled + expr: delta(hyperlane_block_height{job="hyperlane-validator"}[30m]) > 0 and delta(hyperlane_latest_checkpoint{job="hyperlane-validator"}[6h]) == 0 and increase(hyperlane_span_events_total{job="hyperlane-validator",agent="validator",event_level=~"error|warn"}[6h]) > 0 + for: 30m + labels: + severity: warning + annotations: + summary: "Hyperlane validator checkpoints have stalled" + description: "The validator is still seeing chain progress, but it has not advanced its latest checkpoint for several hours." + + - alert: HyperlaneValidatorSyncLoopStalled + expr: time() - hyperlane_contract_sync_liveness{job="hyperlane-validator"} > 900 + for: 15m + labels: + severity: warning + annotations: + summary: "Hyperlane validator sync loop has stalled" + description: "The validator contract sync liveness timestamp has not been refreshed for at least 15 minutes." diff --git a/scripts/bridge/monitoring/bridge_metrics_exporter.py b/scripts/bridge/monitoring/bridge_metrics_exporter.py new file mode 100755 index 00000000..fbc2aa11 --- /dev/null +++ b/scripts/bridge/monitoring/bridge_metrics_exporter.py @@ -0,0 +1,280 @@ +#!/usr/bin/env python3 + +import http.server +import json +import os +import socketserver +import sys +import time +import urllib.error +import urllib.request + +ZERO_ADDRESS = "0x0000000000000000000000000000000000000000" + + +def yaml_scalar(path: str, key: str) -> str: + prefix = f"{key}: " + with open(path, encoding="utf-8") as handle: + for line in handle: + if line.startswith(prefix): + return line[len(prefix):].strip() + raise ValueError(f"missing {key} in {path}") + + +def load_agent_config(path: str) -> dict: + with open(path, encoding="utf-8") as handle: + return json.load(handle) + + +def env_or_default(name: str, default: str | None = None) -> str | None: + value = os.getenv(name) + if value is None or value == "": + return default + return value + + +def normalize_address(value: str, label: str) -> str: + if not value: + raise ValueError(f"{label} is empty") + if not value.startswith("0x") or len(value) != 42: + raise ValueError(f"{label} must be a 20-byte hex address") + return value + + +def request_json(url: str, *, payload: dict | None = None, timeout: float = 10.0) -> dict: + data = None if payload is None else json.dumps(payload).encode("utf-8") + headers = {} + method = "GET" + if payload is not None: + headers["Content-Type"] = "application/json" + method = "POST" + request = urllib.request.Request(url, data=data, headers=headers, method=method) + with urllib.request.urlopen(request, timeout=timeout) as response: + return json.load(response) + + +def rpc_call(url: str, method: str, params: list, timeout: float) -> str: + body = request_json( + url, + payload={"jsonrpc": "2.0", "id": 1, "method": method, "params": params}, + timeout=timeout, + ) + if "error" in body: + raise RuntimeError(f"rpc error from {url}: {body['error']}") + if "result" not in body: + raise RuntimeError(f"rpc result missing from {url}") + return body["result"] + + +def encode_balance_of(address: str) -> str: + normalized = normalize_address(address.lower(), "balanceOf target")[2:] + return "0x70a08231" + normalized.rjust(64, "0") + + +def read_collateral_balance(rpc_url: str, token_address: str, router_address: str, timeout: float) -> int: + result = rpc_call( + rpc_url, + "eth_call", + [{"to": normalize_address(token_address, "BASE_TOKEN_ADDRESS"), "data": encode_balance_of(router_address)}, "latest"], + timeout, + ) + if not isinstance(result, str) or not result.startswith("0x"): + raise RuntimeError(f"unexpected eth_call response: {result!r}") + return int(result, 16) + + +def scrape_bridge_status(rest_url: str, timeout: float) -> dict: + payload = request_json( + rest_url.rstrip("/") + "/cosmos/bridge/v1/bridge_status", + timeout=timeout, + ) + required = ("enabled", "totalMinted", "totalBurned", "authorizedContract") + missing = [key for key in required if key not in payload] + if missing: + raise RuntimeError(f"bridge status response missing fields: {', '.join(missing)}") + return payload + + +def load_runtime_config() -> dict: + repo_root = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..", "..")) + artifact_dir = env_or_default("ARTIFACT_DIR", os.path.join(repo_root, "scripts", "bridge", "generated")) + if artifact_dir is None: + raise RuntimeError("ARTIFACT_DIR could not be resolved") + + warp_file = os.path.join(artifact_dir, "warp-config.yaml") + agent_file = os.path.join(artifact_dir, "agent-config.json") + base_chain_name = env_or_default("BASE_CHAIN_NAME", "base") + if base_chain_name is None: + raise RuntimeError("BASE_CHAIN_NAME could not be resolved") + + agent_config = load_agent_config(agent_file) + chains = agent_config.get("chains", {}) + if base_chain_name not in chains: + raise RuntimeError(f"base chain {base_chain_name!r} missing from agent-config.json") + + base_chain = chains[base_chain_name] + base_rpc_urls = base_chain.get("customRpcUrls", []) + base_rpc_url = env_or_default("BASE_RPC_URL", base_rpc_urls[0] if base_rpc_urls else None) + rest_url = env_or_default("OG_EVM_REST_URL") + token_address = env_or_default("BASE_TOKEN_ADDRESS", yaml_scalar(warp_file, "collateralToken")) + router_address = env_or_default("BASE_COLLATERAL_ROUTER", yaml_scalar(warp_file, "remoteRouter")) + + if not rest_url: + raise RuntimeError("OG_EVM_REST_URL is required") + if not base_rpc_url: + raise RuntimeError("BASE_RPC_URL is required or must be present in agent-config.json") + + normalize_address(token_address, "BASE_TOKEN_ADDRESS") + normalize_address(router_address, "BASE_COLLATERAL_ROUTER") + if token_address == ZERO_ADDRESS: + raise RuntimeError("BASE_TOKEN_ADDRESS is still the zero address") + if router_address == ZERO_ADDRESS: + raise RuntimeError("BASE_COLLATERAL_ROUTER is still the zero address") + + return { + "artifact_dir": artifact_dir, + "base_chain_name": base_chain_name, + "og_evm_rest_url": rest_url, + "base_rpc_url": base_rpc_url, + "base_token_address": token_address, + "base_collateral_router": router_address, + "timeout": float(env_or_default("BRIDGE_METRICS_TIMEOUT_SECONDS", "10") or "10"), + } + + +def escape_label_value(value: str) -> str: + return value.replace("\\", "\\\\").replace('"', '\\"').replace("\n", " ") + + +def metric_line(name: str, value: int | float, labels: dict[str, str] | None = None) -> str: + if not labels: + return f"{name} {value}" + rendered = ",".join( + f'{key}="{escape_label_value(labels[key])}"' + for key in sorted(labels) + ) + return f"{name}{{{rendered}}} {value}" + + +def render_metrics() -> str: + config = load_runtime_config() + bridge_status = scrape_bridge_status(config["og_evm_rest_url"], config["timeout"]) + collateral_balance = read_collateral_balance( + config["base_rpc_url"], + config["base_token_address"], + config["base_collateral_router"], + config["timeout"], + ) + + total_minted = int(bridge_status["totalMinted"]) + total_burned = int(bridge_status["totalBurned"]) + outstanding = total_minted - total_burned + enabled = 1 if bridge_status["enabled"] else 0 + authorized_contract = bridge_status["authorizedContract"] + collateral_surplus = collateral_balance - outstanding + + lines = [ + "# HELP bridge_scrape_success Whether the bridge metrics exporter completed the latest scrape.", + "# TYPE bridge_scrape_success gauge", + metric_line("bridge_scrape_success", 1), + "# HELP bridge_scrape_timestamp_seconds Unix timestamp of the latest successful bridge scrape.", + "# TYPE bridge_scrape_timestamp_seconds gauge", + metric_line("bridge_scrape_timestamp_seconds", int(time.time())), + "# HELP og_evm_bridge_enabled Whether the og-evm bridge module is enabled.", + "# TYPE og_evm_bridge_enabled gauge", + metric_line("og_evm_bridge_enabled", enabled), + "# HELP og_evm_bridge_total_minted Cumulative native tokens minted through the bridge.", + "# TYPE og_evm_bridge_total_minted gauge", + metric_line("og_evm_bridge_total_minted", total_minted), + "# HELP og_evm_bridge_total_burned Cumulative native tokens burned through the bridge.", + "# TYPE og_evm_bridge_total_burned gauge", + metric_line("og_evm_bridge_total_burned", total_burned), + "# HELP og_evm_bridge_outstanding Outstanding bridged native supply on og-evm.", + "# TYPE og_evm_bridge_outstanding gauge", + metric_line("og_evm_bridge_outstanding", outstanding), + "# HELP base_collateral_balance Locked collateral token balance on Base.", + "# TYPE base_collateral_balance gauge", + metric_line("base_collateral_balance", collateral_balance), + "# HELP bridge_collateral_surplus Base collateral balance minus outstanding bridged supply.", + "# TYPE bridge_collateral_surplus gauge", + metric_line("bridge_collateral_surplus", collateral_surplus), + "# HELP og_evm_bridge_authorized_contract_info Current authorized og-evm bridge contract.", + "# TYPE og_evm_bridge_authorized_contract_info gauge", + metric_line( + "og_evm_bridge_authorized_contract_info", + 1, + {"authorized_contract": authorized_contract}, + ), + "# HELP base_collateral_router_info Current Base collateral router and token wiring.", + "# TYPE base_collateral_router_info gauge", + metric_line( + "base_collateral_router_info", + 1, + { + "router": config["base_collateral_router"], + "token": config["base_token_address"], + "base_chain": config["base_chain_name"], + }, + ), + ] + return "\n".join(lines) + "\n" + + +def error_metrics(message: str) -> str: + sanitized = escape_label_value(message) + lines = [ + "# HELP bridge_scrape_success Whether the bridge metrics exporter completed the latest scrape.", + "# TYPE bridge_scrape_success gauge", + metric_line("bridge_scrape_success", 0), + "# HELP bridge_scrape_error_info Last bridge exporter scrape error.", + "# TYPE bridge_scrape_error_info gauge", + metric_line("bridge_scrape_error_info", 1, {"message": sanitized}), + ] + return "\n".join(lines) + "\n" + + +class BridgeMetricsHandler(http.server.BaseHTTPRequestHandler): + def do_GET(self) -> None: # noqa: N802 + if self.path == "/healthz": + self.send_response(200) + self.send_header("Content-Type", "text/plain; charset=utf-8") + self.end_headers() + self.wfile.write(b"ok\n") + return + + if self.path != "/metrics": + self.send_response(404) + self.end_headers() + return + + try: + payload = render_metrics().encode("utf-8") + self.send_response(200) + except Exception as exc: # noqa: BLE001 + payload = error_metrics(str(exc)).encode("utf-8") + self.send_response(500) + + self.send_header("Content-Type", "text/plain; version=0.0.4; charset=utf-8") + self.send_header("Content-Length", str(len(payload))) + self.end_headers() + self.wfile.write(payload) + + def log_message(self, format: str, *args: object) -> None: # noqa: A003 + return + + +class ThreadingTcpServer(socketserver.ThreadingMixIn, socketserver.TCPServer): + allow_reuse_address = True + + +def main() -> int: + port = int(env_or_default("BRIDGE_METRICS_PORT", "9300") or "9300") + host = env_or_default("BRIDGE_METRICS_HOST", "0.0.0.0") or "0.0.0.0" + with ThreadingTcpServer((host, port), BridgeMetricsHandler) as server: + print(f"bridge metrics exporter listening on {host}:{port}", file=sys.stderr) + server.serve_forever() + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/scripts/bridge/monitoring/prometheus.yml b/scripts/bridge/monitoring/prometheus.yml new file mode 100644 index 00000000..bd01c927 --- /dev/null +++ b/scripts/bridge/monitoring/prometheus.yml @@ -0,0 +1,22 @@ +global: + scrape_interval: 30s + evaluation_interval: 30s + +rule_files: + - /etc/prometheus/bridge-alerts.yml + +scrape_configs: + - job_name: hyperlane-validator + static_configs: + - targets: + - validator:9090 + + - job_name: hyperlane-relayer + static_configs: + - targets: + - relayer:9091 + + - job_name: og-evm-bridge + static_configs: + - targets: + - bridge-metrics:9300 diff --git a/scripts/bridge/proposals/enable-bridge.json b/scripts/bridge/proposals/enable-bridge.json new file mode 100644 index 00000000..875e4010 --- /dev/null +++ b/scripts/bridge/proposals/enable-bridge.json @@ -0,0 +1,19 @@ +{ + "messages": [ + { + "@type": "/cosmos.bridge.v1.MsgUpdateParams", + "authority": "cosmos1xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", + "params": { + "authorizedContract": "0x0000000000000000000000000000000000000000", + "hyperlaneMailbox": "0x0000000000000000000000000000000000000000", + "baseDomainId": 8453, + "enabled": true, + "maxTransferAmount": "0" + } + } + ], + "metadata": "ipfs://REPLACE_WITH_METADATA_CID", + "deposit": "10000000ogwei", + "title": "Enable Hyperlane Bridge", + "summary": "Enable the bridge module and point it at the deployed Hyperlane mailbox and router." +} diff --git a/scripts/bridge/proposals/set-authorized-contract.json b/scripts/bridge/proposals/set-authorized-contract.json new file mode 100644 index 00000000..0b8f9a77 --- /dev/null +++ b/scripts/bridge/proposals/set-authorized-contract.json @@ -0,0 +1,13 @@ +{ + "messages": [ + { + "@type": "/cosmos.bridge.v1.MsgSetAuthorizedContract", + "authority": "cosmos1xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", + "contractAddress": "0x0000000000000000000000000000000000000000" + } + ], + "metadata": "ipfs://REPLACE_WITH_METADATA_CID", + "deposit": "10000000ogwei", + "title": "Set Authorized Bridge Contract", + "summary": "Update the bridge precompile authorization target to the deployed HypOGNative contract." +} diff --git a/scripts/bridge/validate-artifacts.sh b/scripts/bridge/validate-artifacts.sh new file mode 100755 index 00000000..32bc6f60 --- /dev/null +++ b/scripts/bridge/validate-artifacts.sh @@ -0,0 +1,301 @@ +#!/usr/bin/env bash + +set -euo pipefail + +ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" +ARTIFACT_DIR="${1:-${OUTPUT_DIR:-$ROOT_DIR/scripts/bridge/generated}}" +STRICT="${STRICT:-false}" +ACTIVE_RPC_VALIDATION="${ACTIVE_RPC_VALIDATION:-false}" +RPC_TIMEOUT_SECONDS="${RPC_TIMEOUT_SECONDS:-10}" +OG_EVM_CHAIN_NAME="${OG_EVM_CHAIN_NAME:-og-evm}" +BASE_CHAIN_NAME="${BASE_CHAIN_NAME:-base}" + +METADATA_FILE="$ARTIFACT_DIR/og-evm-metadata.yaml" +CORE_FILE="$ARTIFACT_DIR/core-config.yaml" +WARP_FILE="$ARTIFACT_DIR/warp-config.yaml" +AGENT_FILE="$ARTIFACT_DIR/agent-config.json" +ENABLE_PROPOSAL_FILE="$ARTIFACT_DIR/proposals/enable-bridge.json" +AUTHORIZED_PROPOSAL_FILE="$ARTIFACT_DIR/proposals/set-authorized-contract.json" + +fail() { + echo "bridge artifact validation failed: $*" >&2 + exit 1 +} + +trim() { + local value="$1" + value="${value#"${value%%[![:space:]]*}"}" + value="${value%"${value##*[![:space:]]}"}" + printf '%s' "$value" +} + +is_truthy() { + case "$1" in + true|TRUE|True|1) return 0 ;; + *) return 1 ;; + esac +} + +lower() { + printf '%s' "$1" | tr '[:upper:]' '[:lower:]' +} + +yaml_scalar() { + local file="$1" + local key="$2" + local value + + value="$(sed -n "s/^${key}: //p" "$file" | head -n 1)" + value="$(trim "$value")" + [[ -n "$value" ]] || fail "missing ${key} in $(basename "$file")" + printf '%s' "$value" +} + +yaml_nested_scalar() { + local file="$1" + local section="$2" + local key="$3" + local value + + value="$( + awk -v section="${section}:" -v key=" ${key}: " ' + $0 == section { in_section = 1; next } + in_section && index($0, key) == 1 { + sub(key, "", $0) + print $0 + exit + } + in_section && $0 !~ /^ / { exit } + ' "$file" + )" + value="$(trim "$value")" + [[ -n "$value" ]] || fail "missing ${section}.${key} in $(basename "$file")" + printf '%s' "$value" +} + +json_expr() { + local file="$1" + local expr="$2" + python3 - "$file" "$expr" <<'PY' +import json +import sys + +path = sys.argv[1] +expr = sys.argv[2] +data = json.load(open(path, encoding="utf-8")) +allowed = {"data": data, "len": len} +value = eval(expr, {"__builtins__": {}}, allowed) +if isinstance(value, bool): + print("true" if value else "false") +elif isinstance(value, (int, float)): + print(value) +else: + print(value) +PY +} + +rpc_call() { + local url="$1" + local method="$2" + local params_json="${3:-[]}" + + python3 - "$url" "$method" "$params_json" "$RPC_TIMEOUT_SECONDS" <<'PY' +import json +import sys +import urllib.error +import urllib.request + +url = sys.argv[1] +method = sys.argv[2] +params = json.loads(sys.argv[3]) +timeout = float(sys.argv[4]) +payload = json.dumps( + {"jsonrpc": "2.0", "id": 1, "method": method, "params": params} +).encode("utf-8") +request = urllib.request.Request( + url, + data=payload, + headers={"Content-Type": "application/json"}, + method="POST", +) + +try: + with urllib.request.urlopen(request, timeout=timeout) as response: + body = json.load(response) +except urllib.error.URLError as exc: + print(f"rpc request failed: {exc}", file=sys.stderr) + sys.exit(1) + +if "error" in body: + print(f"rpc response returned error: {body['error']}", file=sys.stderr) + sys.exit(1) + +if "result" not in body: + print("rpc response missing result field", file=sys.stderr) + sys.exit(1) + +result = body["result"] +if isinstance(result, (dict, list)): + print(json.dumps(result)) +else: + print(result) +PY +} + +hex_to_dec() { + local value="$1" + python3 - "$value" <<'PY' +import sys + +value = sys.argv[1].strip() +if not value.startswith("0x"): + raise SystemExit(f"expected hex value, got: {value}") +print(int(value, 16)) +PY +} + +abi_word_to_address() { + local value="$1" + python3 - "$value" <<'PY' +import sys + +value = sys.argv[1].strip().lower() +if not value.startswith("0x"): + raise SystemExit(f"expected abi-encoded hex word, got: {value}") +raw = value[2:] +if len(raw) != 64: + raise SystemExit(f"expected 32-byte abi word, got length {len(raw)}") +print("0x" + raw[-40:]) +PY +} + +assert_equal() { + local lhs="$1" + local rhs="$2" + local message="$3" + [[ "$lhs" == "$rhs" ]] || fail "$message ($lhs != $rhs)" +} + +assert_not_zero_address() { + local value="$1" + local label="$2" + if [[ "$STRICT" == "true" || "$STRICT" == "1" ]]; then + [[ "$value" != "0x0000000000000000000000000000000000000000" ]] || fail "${label} is zero" + fi +} + +assert_nonempty() { + local value="$1" + local label="$2" + [[ -n "$value" ]] || fail "${label} is empty" +} + +for file in \ + "$METADATA_FILE" \ + "$CORE_FILE" \ + "$WARP_FILE" \ + "$AGENT_FILE" \ + "$ENABLE_PROPOSAL_FILE" \ + "$AUTHORIZED_PROPOSAL_FILE" +do + [[ -f "$file" ]] || fail "missing artifact $(basename "$file")" +done + +python3 -m json.tool "$AGENT_FILE" >/dev/null +python3 -m json.tool "$ENABLE_PROPOSAL_FILE" >/dev/null +python3 -m json.tool "$AUTHORIZED_PROPOSAL_FILE" >/dev/null + +metadata_name="$(yaml_scalar "$METADATA_FILE" "name")" +metadata_domain="$(yaml_scalar "$METADATA_FILE" "domainId")" +metadata_chain_id="$(yaml_scalar "$METADATA_FILE" "chainId")" +metadata_rpc="$(yaml_scalar "$METADATA_FILE" "rpcUrl")" +metadata_mailbox="$(yaml_scalar "$METADATA_FILE" "mailbox")" +metadata_igp="$(yaml_scalar "$METADATA_FILE" "interchainGasPaymaster")" +metadata_validator_announce="$(yaml_scalar "$METADATA_FILE" "validatorAnnounce")" +metadata_merkle_hook="$(yaml_scalar "$METADATA_FILE" "merkleTreeHook")" + +core_environment="$(yaml_scalar "$CORE_FILE" "environment")" +core_owner="$(yaml_scalar "$CORE_FILE" "owner")" +core_mailbox_address="$(yaml_nested_scalar "$CORE_FILE" "mailbox" "address")" +core_mailbox_owner="$(yaml_nested_scalar "$CORE_FILE" "mailbox" "owner")" +core_igp_address="$(yaml_nested_scalar "$CORE_FILE" "igp" "address")" + +warp_local_domain="$(yaml_scalar "$WARP_FILE" "localDomain")" +warp_remote_domain="$(yaml_scalar "$WARP_FILE" "remoteDomain")" +warp_mailbox="$(yaml_scalar "$WARP_FILE" "mailbox")" +warp_local_router="$(yaml_scalar "$WARP_FILE" "localRouter")" +warp_remote_router="$(yaml_scalar "$WARP_FILE" "remoteRouter")" +warp_collateral_token="$(yaml_scalar "$WARP_FILE" "collateralToken")" +warp_recipient="$(yaml_scalar "$WARP_FILE" "recipient")" + +agent_og_domain="$(json_expr "$AGENT_FILE" "data['chains']['$OG_EVM_CHAIN_NAME']['domain']")" +agent_base_domain="$(json_expr "$AGENT_FILE" "data['chains']['$BASE_CHAIN_NAME']['domain']")" +agent_og_mailbox="$(json_expr "$AGENT_FILE" "data['chains']['$OG_EVM_CHAIN_NAME']['mailbox']")" +agent_og_igp="$(json_expr "$AGENT_FILE" "data['chains']['$OG_EVM_CHAIN_NAME']['interchainGasPaymaster']")" +agent_og_rpc_len="$(json_expr "$AGENT_FILE" "len(data['chains']['$OG_EVM_CHAIN_NAME']['customRpcUrls'])")" +agent_base_rpc_len="$(json_expr "$AGENT_FILE" "len(data['chains']['$BASE_CHAIN_NAME']['customRpcUrls'])")" +agent_og_rpc_0="$(json_expr "$AGENT_FILE" "data['chains']['$OG_EVM_CHAIN_NAME']['customRpcUrls'][0]")" +agent_base_rpc_0="$(json_expr "$AGENT_FILE" "data['chains']['$BASE_CHAIN_NAME']['customRpcUrls'][0]")" +agent_og_has_metadata_rpc="$(json_expr "$AGENT_FILE" "'true' if '$metadata_rpc' in data['chains']['$OG_EVM_CHAIN_NAME']['customRpcUrls'] else 'false'")" + +enable_authorized_contract="$(json_expr "$ENABLE_PROPOSAL_FILE" "data['messages'][0]['params']['authorizedContract']")" +enable_mailbox="$(json_expr "$ENABLE_PROPOSAL_FILE" "data['messages'][0]['params']['hyperlaneMailbox']")" +enable_base_domain="$(json_expr "$ENABLE_PROPOSAL_FILE" "data['messages'][0]['params']['baseDomainId']")" +authorized_contract="$(json_expr "$AUTHORIZED_PROPOSAL_FILE" "data['messages'][0]['contractAddress']")" + +assert_equal "$metadata_name" "$OG_EVM_CHAIN_NAME" "metadata chain name mismatch" +assert_equal "$metadata_domain" "$warp_local_domain" "og-evm domain mismatch between metadata and warp config" +assert_equal "$metadata_domain" "$agent_og_domain" "og-evm domain mismatch between metadata and agent config" +assert_equal "$warp_remote_domain" "$agent_base_domain" "base domain mismatch between warp config and agent config" +assert_equal "$metadata_mailbox" "$core_mailbox_address" "mailbox mismatch between metadata and core config" +assert_equal "$metadata_mailbox" "$warp_mailbox" "mailbox mismatch between metadata and warp config" +assert_equal "$metadata_mailbox" "$agent_og_mailbox" "mailbox mismatch between metadata and agent config" +assert_equal "$metadata_igp" "$core_igp_address" "IGP mismatch between metadata and core config" +assert_equal "$metadata_igp" "$agent_og_igp" "IGP mismatch between metadata and agent config" +assert_equal "$warp_local_router" "$enable_authorized_contract" "local router mismatch between warp config and enable proposal" +assert_equal "$warp_local_router" "$authorized_contract" "local router mismatch between warp config and authorized-contract proposal" +assert_equal "$metadata_mailbox" "$enable_mailbox" "mailbox mismatch between metadata and enable proposal" +assert_equal "$warp_remote_domain" "$enable_base_domain" "base domain mismatch between warp config and enable proposal" + +[[ "$metadata_domain" != "$warp_remote_domain" ]] || fail "og-evm and base domains must differ" +[[ "$metadata_chain_id" =~ ^[0-9]+$ ]] || fail "metadata chainId must be numeric" +[[ "$metadata_domain" =~ ^[0-9]+$ ]] || fail "metadata domainId must be numeric" +[[ "$warp_remote_domain" =~ ^[0-9]+$ ]] || fail "warp remoteDomain must be numeric" +[[ "$agent_og_rpc_len" -gt 0 ]] || fail "agent config is missing og-evm RPC URLs" +[[ "$agent_base_rpc_len" -gt 0 ]] || fail "agent config is missing base RPC URLs" +[[ "$agent_og_has_metadata_rpc" == "true" ]] || fail "metadata rpcUrl is not included in the og-evm agent RPC list" + +assert_nonempty "$metadata_rpc" "metadata rpcUrl" +assert_nonempty "$agent_og_rpc_0" "agent og-evm RPC URL" +assert_nonempty "$agent_base_rpc_0" "agent base RPC URL" +assert_nonempty "$core_environment" "core environment" +assert_nonempty "$core_owner" "core owner" +assert_nonempty "$core_mailbox_owner" "core mailbox owner" +assert_nonempty "$metadata_validator_announce" "validatorAnnounce" +assert_nonempty "$metadata_merkle_hook" "merkleTreeHook" + +assert_not_zero_address "$metadata_mailbox" "metadata mailbox" +assert_not_zero_address "$metadata_igp" "metadata IGP" +assert_not_zero_address "$core_owner" "core owner" +assert_not_zero_address "$core_mailbox_owner" "core mailbox owner" +assert_not_zero_address "$metadata_validator_announce" "validatorAnnounce" +assert_not_zero_address "$metadata_merkle_hook" "merkleTreeHook" +assert_not_zero_address "$warp_local_router" "warp localRouter" +assert_not_zero_address "$warp_remote_router" "warp remoteRouter" +assert_not_zero_address "$warp_collateral_token" "warp collateralToken" +assert_not_zero_address "$warp_recipient" "warp recipient" + +if is_truthy "$ACTIVE_RPC_VALIDATION"; then + og_chain_id_hex="$(rpc_call "$metadata_rpc" "eth_chainId" "[]")" || fail "unable to query og-evm eth_chainId from $metadata_rpc" + og_chain_id="$(hex_to_dec "$og_chain_id_hex")" || fail "unable to decode og-evm eth_chainId response" + assert_equal "$metadata_chain_id" "$og_chain_id" "og-evm chainId mismatch between metadata and live RPC" + + rpc_call "$agent_base_rpc_0" "eth_chainId" "[]" >/dev/null || fail "unable to query base eth_chainId from $agent_base_rpc_0" + + [[ "$metadata_mailbox" != "0x0000000000000000000000000000000000000000" ]] || fail "cannot live-validate mailbox ownership with zero mailbox address" + mailbox_owner_word="$(rpc_call "$metadata_rpc" "eth_call" "[{\"to\":\"$metadata_mailbox\",\"data\":\"0x8da5cb5b\"},\"latest\"]")" || fail "unable to call mailbox owner() on $metadata_mailbox" + mailbox_owner="$(abi_word_to_address "$mailbox_owner_word")" || fail "unable to decode mailbox owner() response" + assert_equal "$(lower "$core_mailbox_owner")" "$(lower "$mailbox_owner")" "mailbox owner mismatch between core config and live RPC" +fi + +echo "bridge artifact validation passed for $ARTIFACT_DIR" diff --git a/tests/integration/bridge/test_integration.go b/tests/integration/bridge/test_integration.go new file mode 100644 index 00000000..fe9bc358 --- /dev/null +++ b/tests/integration/bridge/test_integration.go @@ -0,0 +1,172 @@ +package bridge + +import ( + "math/big" + + "github.com/ethereum/go-ethereum/common" + + "github.com/cosmos/evm/contracts" + testutiltypes "github.com/cosmos/evm/testutil/types" + evmtypes "github.com/cosmos/evm/x/vm/types" +) + +func (s *IntegrationTestSuite) TestHandleMintsNativeTokens() { + owner := s.keyring.GetKey(0) + recipient := s.keyring.GetKey(1) + + expectedMailboxAddr, expectedRouterAddr := s.setupBridgeNetwork(true) + mailboxAddr := s.deployMockMailbox(owner, 7) + s.Require().Equal(expectedMailboxAddr, mailboxAddr) + routerAddr := s.deployHypOGNative(owner, mailboxAddr) + s.Require().Equal(expectedRouterAddr, routerAddr) + + remoteRouter := common.HexToHash("0x0000000000000000000000001111111111111111111111111111111111111111") + s.executeContract( + owner, + routerAddr, + contracts.HypOGNativeContract.ABI, + "enrollRemoteRouter", + nil, + remoteDomain, + remoteRouter, + ) + + beforeBalance := s.network.App.GetBankKeeper().GetBalance( + s.network.GetContext(), + recipient.AccAddr, + s.network.GetBaseDenom(), + ).Amount + + amount := big.NewInt(12345) + body := packTransferBody(recipient.Addr, amount) + s.executeContract( + owner, + mailboxAddr, + contracts.MockMailboxContract.ABI, + "deliver", + nil, + routerAddr, + remoteDomain, + remoteRouter, + body, + ) + + afterBalance := s.network.App.GetBankKeeper().GetBalance( + s.network.GetContext(), + recipient.AccAddr, + s.network.GetBaseDenom(), + ).Amount + + s.Require().Equal(0, afterBalance.Sub(beforeBalance).BigInt().Cmp(amount)) + s.Require().Equal(0, s.network.App.GetBridgeKeeper().GetTotalMinted(s.network.GetContext()).BigInt().Cmp(amount)) +} + +func (s *IntegrationTestSuite) TestTransferRemoteBurnsAndDispatches() { + owner := s.keyring.GetKey(0) + expectedMailboxAddr, expectedRouterAddr := s.setupBridgeNetwork(true) + mailboxAddr := s.deployMockMailbox(owner, 7) + s.Require().Equal(expectedMailboxAddr, mailboxAddr) + routerAddr := s.deployHypOGNative(owner, mailboxAddr) + s.Require().Equal(expectedRouterAddr, routerAddr) + + remoteRouter := common.HexToHash("0x0000000000000000000000002222222222222222222222222222222222222222") + remoteRecipient := common.HexToHash("0x0000000000000000000000003333333333333333333333333333333333333333") + s.executeContract( + owner, + routerAddr, + contracts.HypOGNativeContract.ABI, + "enrollRemoteRouter", + nil, + remoteDomain, + remoteRouter, + ) + + amount := big.NewInt(1000) + dispatchFee := big.NewInt(7) + msgValue := new(big.Int).Add(amount, dispatchFee) + s.executeContract( + owner, + routerAddr, + contracts.HypOGNativeContract.ABI, + "transferRemote", + msgValue, + remoteDomain, + remoteRecipient, + amount, + ) + + s.Require().Equal(0, s.network.App.GetBridgeKeeper().GetTotalBurned(s.network.GetContext()).BigInt().Cmp(amount)) + + mailboxBalance := s.network.App.GetBankKeeper().GetBalance( + s.network.GetContext(), + mailboxAddr.Bytes(), + s.network.GetBaseDenom(), + ).Amount + s.Require().Equal(0, mailboxBalance.BigInt().Cmp(dispatchFee)) + + routerBalance := s.network.App.GetBankKeeper().GetBalance( + s.network.GetContext(), + routerAddr.Bytes(), + s.network.GetBaseDenom(), + ).Amount + s.Require().True(routerBalance.IsZero()) + + lastDestination := s.queryContract( + mailboxAddr, + contracts.MockMailboxContract.ABI, + "lastDestination", + )[0].(uint32) + s.Require().Equal(remoteDomain, lastDestination) + + lastRecipient := s.queryContract( + mailboxAddr, + contracts.MockMailboxContract.ABI, + "lastRecipient", + )[0].([32]byte) + s.Require().Equal(remoteRouter, common.BytesToHash(lastRecipient[:])) + + lastBody := s.queryContract( + mailboxAddr, + contracts.MockMailboxContract.ABI, + "lastBody", + )[0].([]byte) + bodyRecipient, bodyAmount := unpackTransferBody(lastBody) + s.Require().Equal(remoteRecipient, bodyRecipient) + s.Require().Equal(0, bodyAmount.Cmp(amount)) +} + +func (s *IntegrationTestSuite) TestTransferRemoteFailsWhenBridgeDisabled() { + owner := s.keyring.GetKey(0) + expectedMailboxAddr, expectedRouterAddr := s.setupBridgeNetwork(false) + mailboxAddr := s.deployMockMailbox(owner, 7) + s.Require().Equal(expectedMailboxAddr, mailboxAddr) + routerAddr := s.deployHypOGNative(owner, mailboxAddr) + s.Require().Equal(expectedRouterAddr, routerAddr) + + remoteRouter := common.HexToHash("0x0000000000000000000000004444444444444444444444444444444444444444") + remoteRecipient := common.HexToHash("0x0000000000000000000000005555555555555555555555555555555555555555") + s.executeContract( + owner, + routerAddr, + contracts.HypOGNativeContract.ABI, + "enrollRemoteRouter", + nil, + remoteDomain, + remoteRouter, + ) + + _, err := s.factory.ExecuteContractCall( + owner.Priv, + evmtypes.EvmTxArgs{ + To: &routerAddr, + Amount: big.NewInt(1007), + }, + testutiltypes.CallArgs{ + ContractABI: contracts.HypOGNativeContract.ABI, + MethodName: "transferRemote", + Args: []interface{}{remoteDomain, remoteRecipient, big.NewInt(1000)}, + }, + ) + s.Require().Error(err) + s.Require().True(s.network.App.GetBridgeKeeper().GetTotalBurned(s.network.GetContext()).IsZero()) +} diff --git a/tests/integration/bridge/test_setup.go b/tests/integration/bridge/test_setup.go new file mode 100644 index 00000000..78997eb5 --- /dev/null +++ b/tests/integration/bridge/test_setup.go @@ -0,0 +1,178 @@ +package bridge + +import ( + "math/big" + + "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/crypto" + "github.com/stretchr/testify/suite" + + "github.com/cosmos/evm/contracts" + testfactory "github.com/cosmos/evm/testutil/integration/evm/factory" + testgrpc "github.com/cosmos/evm/testutil/integration/evm/grpc" + testnetwork "github.com/cosmos/evm/testutil/integration/evm/network" + testkeyring "github.com/cosmos/evm/testutil/keyring" + testutiltypes "github.com/cosmos/evm/testutil/types" + bridgetypes "github.com/cosmos/evm/x/bridge/types" + evmtypes "github.com/cosmos/evm/x/vm/types" +) + +const ( + localDomain uint32 = 10740 + remoteDomain uint32 = 8453 +) + +type IntegrationTestSuite struct { + suite.Suite + + create testnetwork.CreateEvmApp + options []testnetwork.ConfigOption + + network *testnetwork.UnitTestNetwork + factory testfactory.TxFactory + keyring testkeyring.Keyring +} + +func NewIntegrationTestSuite(create testnetwork.CreateEvmApp, options ...testnetwork.ConfigOption) *IntegrationTestSuite { + return &IntegrationTestSuite{ + create: create, + options: options, + } +} + +func (s *IntegrationTestSuite) SetupTest() { + s.keyring = testkeyring.New(2) + s.factory = nil + s.network = nil +} + +func (s *IntegrationTestSuite) deployMockMailbox(sender testkeyring.Key, quoteFee int64) common.Address { + addr, err := s.factory.DeployContract( + sender.Priv, + evmtypes.EvmTxArgs{}, + testutiltypes.ContractDeploymentData{ + Contract: contracts.MockMailboxContract, + ConstructorArgs: []interface{}{localDomain, big.NewInt(quoteFee)}, + }, + ) + s.Require().NoError(err) + s.Require().NoError(s.network.NextBlock()) + + return addr +} + +func (s *IntegrationTestSuite) deployHypOGNative(sender testkeyring.Key, mailbox common.Address) common.Address { + zeroAddress := common.Address{} + addr, err := s.factory.DeployContract( + sender.Priv, + evmtypes.EvmTxArgs{}, + testutiltypes.ContractDeploymentData{ + Contract: contracts.HypOGNativeContract, + ConstructorArgs: []interface{}{ + mailbox, + zeroAddress, + sender.Addr, + }, + }, + ) + s.Require().NoError(err) + s.Require().NoError(s.network.NextBlock()) + + return addr +} + +func predictBridgeDeployments(owner common.Address) (common.Address, common.Address) { + mailboxAddr := crypto.CreateAddress(owner, 0) + routerAddr := crypto.CreateAddress(owner, 1) + return mailboxAddr, routerAddr +} + +func (s *IntegrationTestSuite) setupBridgeNetwork(enabled bool) (common.Address, common.Address) { + owner := s.keyring.GetKey(0) + mailboxAddr, routerAddr := predictBridgeDeployments(owner.Addr) + + bridgeGenesis := bridgetypes.DefaultGenesisState() + bridgeGenesis.Params.Enabled = enabled + bridgeGenesis.Params.HyperlaneMailbox = mailboxAddr.Hex() + bridgeGenesis.Params.AuthorizedContract = routerAddr.Hex() + + options := []testnetwork.ConfigOption{ + testnetwork.WithPreFundedAccounts(s.keyring.GetAllAccAddrs()...), + testnetwork.WithCustomGenesis(testnetwork.CustomGenesisState{ + bridgetypes.ModuleName: bridgeGenesis, + }), + } + options = append(options, s.options...) + + nw := testnetwork.NewUnitTestNetwork(s.create, options...) + handler := testgrpc.NewIntegrationHandler(nw) + s.factory = testfactory.New(nw, handler) + s.network = nw + s.Require().Equal(bridgeGenesis.Params, nw.App.GetBridgeKeeper().GetParams(nw.GetContext())) + + return mailboxAddr, routerAddr +} + +func (s *IntegrationTestSuite) executeContract( + sender testkeyring.Key, + contract common.Address, + contractABI abi.ABI, + method string, + value *big.Int, + args ...interface{}, +) { + _, err := s.factory.ExecuteContractCall( + sender.Priv, + evmtypes.EvmTxArgs{ + To: &contract, + Amount: value, + GasLimit: 5_000_000, + }, + testutiltypes.CallArgs{ + ContractABI: contractABI, + MethodName: method, + Args: args, + }, + ) + s.Require().NoError(err) + s.Require().NoError(s.network.NextBlock()) +} + +func (s *IntegrationTestSuite) queryContract( + contract common.Address, + contractABI abi.ABI, + method string, + args ...interface{}, +) []interface{} { + res, err := s.factory.QueryContract( + evmtypes.EvmTxArgs{ + To: &contract, + }, + testutiltypes.CallArgs{ + ContractABI: contractABI, + MethodName: method, + Args: args, + }, + 0, + ) + s.Require().NoError(err) + + methodDef := contractABI.Methods[method] + values, err := methodDef.Outputs.Unpack(res.Ret) + s.Require().NoError(err) + return values +} + +func packTransferBody(recipient common.Address, amount *big.Int) []byte { + body := common.LeftPadBytes(recipient.Bytes(), 32) + return append(body, common.LeftPadBytes(amount.Bytes(), 32)...) +} + +func unpackTransferBody(body []byte) (common.Hash, *big.Int) { + if len(body) != 64 { + panic("unexpected transfer body length") + } + + return common.BytesToHash(body[:32]), new(big.Int).SetBytes(body[32:]) +} diff --git a/testutil/app/adapter.go b/testutil/app/adapter.go index c84649d3..923bb9c6 100644 --- a/testutil/app/adapter.go +++ b/testutil/app/adapter.go @@ -5,6 +5,7 @@ import ( "fmt" evm "github.com/cosmos/evm" + bridgekeeper "github.com/cosmos/evm/x/bridge/keeper" erc20keeper "github.com/cosmos/evm/x/erc20/keeper" feemarketkeeper "github.com/cosmos/evm/x/feemarket/keeper" "github.com/cosmos/evm/x/ibc/callbacks/keeper" @@ -139,6 +140,14 @@ func (a *EvmAppAdapter) GetBankKeeper() bankkeeper.Keeper { return bankkeeper.BaseKeeper{} } +func (a *EvmAppAdapter) GetBridgeKeeper() bridgekeeper.Keeper { + if provider, ok := a.TestApp.(evm.BridgeKeeperProvider); ok { + return provider.GetBridgeKeeper() + } + panicMissingProvider("BridgeKeeperProvider") + return bridgekeeper.Keeper{} +} + func (a *EvmAppAdapter) GetFeeMarketKeeper() *feemarketkeeper.Keeper { if provider, ok := a.TestApp.(evm.FeeMarketKeeperProvider); ok { return provider.GetFeeMarketKeeper() diff --git a/testutil/integration/evm/network/setup.go b/testutil/integration/evm/network/setup.go index 5a7a74d9..26cbc8f5 100644 --- a/testutil/integration/evm/network/setup.go +++ b/testutil/integration/evm/network/setup.go @@ -11,6 +11,7 @@ import ( "github.com/cosmos/evm" "github.com/cosmos/evm/testutil" testconstants "github.com/cosmos/evm/testutil/constants" + bridgetypes "github.com/cosmos/evm/x/bridge/types" erc20types "github.com/cosmos/evm/x/erc20/types" feemarkettypes "github.com/cosmos/evm/x/feemarket/types" evmtypes "github.com/cosmos/evm/x/vm/types" @@ -51,6 +52,7 @@ type defaultGenesisParams struct { // genesisSetupFunctions contains the available genesis setup functions // that can be used to customize the network genesis var genesisSetupFunctions = map[string]genSetupFn{ + bridgetypes.ModuleName: genStateSetter[*bridgetypes.GenesisState](bridgetypes.ModuleName), evmtypes.ModuleName: genStateSetter[*evmtypes.GenesisState](evmtypes.ModuleName), erc20types.ModuleName: genStateSetter[*erc20types.GenesisState](erc20types.ModuleName), govtypes.ModuleName: genStateSetter[*govtypesv1.GenesisState](govtypes.ModuleName), diff --git a/x/bridge/genesis.go b/x/bridge/genesis.go new file mode 100644 index 00000000..2d7cce8d --- /dev/null +++ b/x/bridge/genesis.go @@ -0,0 +1,35 @@ +package bridge + +import ( + abci "github.com/cometbft/cometbft/abci/types" + "github.com/cosmos/evm/x/bridge/keeper" + "github.com/cosmos/evm/x/bridge/types" + + errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// InitGenesis initializes the bridge module state from genesis. +func InitGenesis(ctx sdk.Context, k keeper.Keeper, data types.GenesisState) []abci.ValidatorUpdate { + if err := k.SetParams(ctx, data.Params); err != nil { + panic(errorsmod.Wrap(err, "could not set bridge parameters at genesis")) + } + + if data.TotalMinted.IsPositive() { + k.SetTotalMinted(ctx, data.TotalMinted) + } + if data.TotalBurned.IsPositive() { + k.SetTotalBurned(ctx, data.TotalBurned) + } + + return []abci.ValidatorUpdate{} +} + +// ExportGenesis exports the current bridge module state. +func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { + return &types.GenesisState{ + Params: k.GetParams(ctx), + TotalMinted: k.GetTotalMinted(ctx), + TotalBurned: k.GetTotalBurned(ctx), + } +} diff --git a/x/bridge/keeper/bridge.go b/x/bridge/keeper/bridge.go new file mode 100644 index 00000000..67ed3588 --- /dev/null +++ b/x/bridge/keeper/bridge.go @@ -0,0 +1,94 @@ +package keeper + +import ( + "github.com/cosmos/evm/x/bridge/types" + + errorsmod "cosmossdk.io/errors" + sdkmath "cosmossdk.io/math" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// MintForBridge mints native tokens to the recipient after an inbound bridge transfer. +func (k Keeper) MintForBridge(ctx sdk.Context, recipient sdk.AccAddress, amount sdkmath.Int) error { + if err := sdk.VerifyAddressFormat(recipient); err != nil { + return errorsmod.Wrap(types.ErrInvalidAddress, err.Error()) + } + if err := k.validateBridgeTransfer(ctx, amount); err != nil { + return err + } + + denom := k.getDenom() + coins := sdk.NewCoins(sdk.NewCoin(denom, amount)) + + if err := k.bk.MintCoins(ctx, types.ModuleName, coins); err != nil { + return errorsmod.Wrap(err, "failed to mint bridge coins") + } + if err := k.bk.SendCoinsFromModuleToAccount(ctx, types.ModuleName, recipient, coins); err != nil { + return errorsmod.Wrap(err, "failed to send bridge coins to recipient") + } + + k.AddTotalMinted(ctx, amount) + types.EmitBridgeMintEvent(ctx, recipient.String(), amount.String(), denom) + + k.Logger(ctx).Info( + "minted bridge tokens", + "recipient", recipient.String(), + "amount", amount.String(), + "denom", denom, + ) + + return nil +} + +// BurnForBridge burns native tokens from the sender before an outbound bridge transfer. +func (k Keeper) BurnForBridge(ctx sdk.Context, sender sdk.AccAddress, amount sdkmath.Int) error { + if err := sdk.VerifyAddressFormat(sender); err != nil { + return errorsmod.Wrap(types.ErrInvalidAddress, err.Error()) + } + if err := k.validateBridgeTransfer(ctx, amount); err != nil { + return err + } + + denom := k.getDenom() + coins := sdk.NewCoins(sdk.NewCoin(denom, amount)) + + if err := k.bk.SendCoinsFromAccountToModule(ctx, sender, types.ModuleName, coins); err != nil { + return errorsmod.Wrap(err, "failed to move bridge coins into module account") + } + if err := k.bk.BurnCoins(ctx, types.ModuleName, coins); err != nil { + return errorsmod.Wrap(err, "failed to burn bridge coins") + } + + k.AddTotalBurned(ctx, amount) + types.EmitBridgeBurnEvent(ctx, sender.String(), amount.String(), denom) + + k.Logger(ctx).Info( + "burned bridge tokens", + "sender", sender.String(), + "amount", amount.String(), + "denom", denom, + ) + + return nil +} + +func (k Keeper) validateBridgeTransfer(ctx sdk.Context, amount sdkmath.Int) error { + params := k.GetParams(ctx) + if !params.Enabled { + return types.ErrBridgeDisabled + } + if !amount.IsPositive() { + return errorsmod.Wrapf(types.ErrInvalidAmount, "amount must be positive: %s", amount.String()) + } + if params.MaxTransferAmount.IsPositive() && amount.GT(params.MaxTransferAmount) { + return errorsmod.Wrapf( + types.ErrExceedsMaxTransfer, + "amount %s exceeds max transfer amount %s", + amount.String(), + params.MaxTransferAmount.String(), + ) + } + + return nil +} diff --git a/x/bridge/keeper/keeper.go b/x/bridge/keeper/keeper.go new file mode 100644 index 00000000..8f6935b0 --- /dev/null +++ b/x/bridge/keeper/keeper.go @@ -0,0 +1,107 @@ +package keeper + +import ( + "github.com/cosmos/evm/x/bridge/types" + evmtypes "github.com/cosmos/evm/x/vm/types" + + "cosmossdk.io/log" + sdkmath "cosmossdk.io/math" + storetypes "cosmossdk.io/store/types" + + "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// Keeper grants access to the bridge module state. +type Keeper struct { + cdc codec.BinaryCodec + storeKey storetypes.StoreKey + authority sdk.AccAddress + bk types.BankKeeper + ak types.AccountKeeper +} + +// NewKeeper creates a new bridge keeper. +func NewKeeper( + cdc codec.BinaryCodec, + storeKey storetypes.StoreKey, + authority sdk.AccAddress, + bk types.BankKeeper, + ak types.AccountKeeper, +) Keeper { + if err := sdk.VerifyAddressFormat(authority); err != nil { + panic(err) + } + + return Keeper{ + cdc: cdc, + storeKey: storeKey, + authority: authority, + bk: bk, + ak: ak, + } +} + +// Logger returns a module-specific logger. +func (k Keeper) Logger(ctx sdk.Context) log.Logger { + return ctx.Logger().With("module", types.ModuleName) +} + +// GetTotalMinted returns the cumulative amount minted by the bridge. +func (k Keeper) GetTotalMinted(ctx sdk.Context) sdkmath.Int { + return k.getInt(ctx, types.TotalMintedStoreKey) +} + +// SetTotalMinted stores the cumulative amount minted by the bridge. +func (k Keeper) SetTotalMinted(ctx sdk.Context, amount sdkmath.Int) { + k.setInt(ctx, types.TotalMintedStoreKey, amount) +} + +// AddTotalMinted increments the cumulative minted amount. +func (k Keeper) AddTotalMinted(ctx sdk.Context, amount sdkmath.Int) { + k.SetTotalMinted(ctx, k.GetTotalMinted(ctx).Add(amount)) +} + +// GetTotalBurned returns the cumulative amount burned by the bridge. +func (k Keeper) GetTotalBurned(ctx sdk.Context) sdkmath.Int { + return k.getInt(ctx, types.TotalBurnedStoreKey) +} + +// SetTotalBurned stores the cumulative amount burned by the bridge. +func (k Keeper) SetTotalBurned(ctx sdk.Context, amount sdkmath.Int) { + k.setInt(ctx, types.TotalBurnedStoreKey, amount) +} + +// AddTotalBurned increments the cumulative burned amount. +func (k Keeper) AddTotalBurned(ctx sdk.Context, amount sdkmath.Int) { + k.SetTotalBurned(ctx, k.GetTotalBurned(ctx).Add(amount)) +} + +func (k Keeper) getDenom() string { + return evmtypes.GetEVMCoinDenom() +} + +func (k Keeper) getInt(ctx sdk.Context, key []byte) sdkmath.Int { + store := ctx.KVStore(k.storeKey) + bz := store.Get(key) + if bz == nil { + return sdkmath.ZeroInt() + } + + var amount sdkmath.Int + if err := amount.Unmarshal(bz); err != nil { + panic(err) + } + + return amount +} + +func (k Keeper) setInt(ctx sdk.Context, key []byte, amount sdkmath.Int) { + store := ctx.KVStore(k.storeKey) + bz, err := amount.Marshal() + if err != nil { + panic(err) + } + + store.Set(key, bz) +} diff --git a/x/bridge/keeper/keeper_test.go b/x/bridge/keeper/keeper_test.go new file mode 100644 index 00000000..a0a379a8 --- /dev/null +++ b/x/bridge/keeper/keeper_test.go @@ -0,0 +1,153 @@ +package keeper_test + +import ( + "testing" + + "github.com/ethereum/go-ethereum/common" + "github.com/stretchr/testify/require" + + evmencoding "github.com/cosmos/evm/encoding" + testconstants "github.com/cosmos/evm/testutil/constants" + "github.com/cosmos/evm/x/bridge/keeper" + "github.com/cosmos/evm/x/bridge/types" + "github.com/cosmos/evm/x/bridge/types/mocks" + vmtypes "github.com/cosmos/evm/x/vm/types" + + sdkmath "cosmossdk.io/math" + storetypes "cosmossdk.io/store/types" + + "github.com/cosmos/cosmos-sdk/testutil" + sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" +) + +type testData struct { + ctx sdk.Context + keeper keeper.Keeper + bk *mocks.BankKeeper + ak *mocks.AccountKeeper +} + +func newMockedTestData(t *testing.T) testData { + t.Helper() + + storeKey := storetypes.NewKVStoreKey(types.ModuleName) + tKey := storetypes.NewTransientStoreKey("transient_test") + ctx := testutil.DefaultContext(storeKey, tKey) //nolint:staticcheck + + bk := mocks.NewBankKeeper(t) + ak := mocks.NewAccountKeeper(t) + + authority := authtypes.NewModuleAddress(govtypes.ModuleName) + + cfg := evmencoding.MakeConfig(testconstants.ExampleChainID.EVMChainID) + k := keeper.NewKeeper(cfg.Codec, storeKey, authority, bk, ak) + vmtypes.SetDefaultEvmCoinInfo(testconstants.ExampleChainCoinInfo[testconstants.ExampleChainID]) + + return testData{ + ctx: ctx, + keeper: k, + bk: bk, + ak: ak, + } +} + +func govAuthority() string { + return authtypes.NewModuleAddress(govtypes.ModuleName).String() +} + +func enabledParams() types.Params { + params := types.DefaultParams() + params.Enabled = true + return params +} + +func TestGetSetParamsAndTotals(t *testing.T) { + td := newMockedTestData(t) + + require.Equal(t, types.DefaultParams(), td.keeper.GetParams(td.ctx)) + require.True(t, td.keeper.GetTotalMinted(td.ctx).IsZero()) + require.True(t, td.keeper.GetTotalBurned(td.ctx).IsZero()) + + params := enabledParams() + params.AuthorizedContract = testconstants.ExampleEvmAddressAlice + params.HyperlaneMailbox = testconstants.ExampleEvmAddressBob + params.MaxTransferAmount = sdkmath.NewInt(12345) + require.NoError(t, td.keeper.SetParams(td.ctx, params)) + + td.keeper.SetTotalMinted(td.ctx, sdkmath.NewInt(50)) + td.keeper.AddTotalMinted(td.ctx, sdkmath.NewInt(20)) + td.keeper.SetTotalBurned(td.ctx, sdkmath.NewInt(11)) + td.keeper.AddTotalBurned(td.ctx, sdkmath.NewInt(9)) + + require.Equal(t, params, td.keeper.GetParams(td.ctx)) + require.Equal(t, sdkmath.NewInt(70), td.keeper.GetTotalMinted(td.ctx)) + require.Equal(t, sdkmath.NewInt(20), td.keeper.GetTotalBurned(td.ctx)) + require.Equal(t, params.AuthorizedContract, td.keeper.GetAuthorizedContract(td.ctx)) +} + +func TestMintForBridge(t *testing.T) { + td := newMockedTestData(t) + require.NoError(t, td.keeper.SetParams(td.ctx, enabledParams())) + + recipient := sdk.AccAddress(common.HexToAddress(testconstants.ExampleEvmAddressAlice).Bytes()) + amount := sdkmath.NewInt(100) + denom := vmtypes.GetEVMCoinDenom() + coins := sdk.NewCoins(sdk.NewCoin(denom, amount)) + + td.bk.On("MintCoins", td.ctx, types.ModuleName, coins).Return(nil) + td.bk.On("SendCoinsFromModuleToAccount", td.ctx, types.ModuleName, recipient, coins).Return(nil) + + err := td.keeper.MintForBridge(td.ctx, recipient, amount) + require.NoError(t, err) + require.Equal(t, amount, td.keeper.GetTotalMinted(td.ctx)) +} + +func TestBurnForBridge(t *testing.T) { + td := newMockedTestData(t) + require.NoError(t, td.keeper.SetParams(td.ctx, enabledParams())) + + sender := sdk.AccAddress(common.HexToAddress(testconstants.ExampleEvmAddressBob).Bytes()) + amount := sdkmath.NewInt(250) + denom := vmtypes.GetEVMCoinDenom() + coins := sdk.NewCoins(sdk.NewCoin(denom, amount)) + + td.bk.On("SendCoinsFromAccountToModule", td.ctx, sender, types.ModuleName, coins).Return(nil) + td.bk.On("BurnCoins", td.ctx, types.ModuleName, coins).Return(nil) + + err := td.keeper.BurnForBridge(td.ctx, sender, amount) + require.NoError(t, err) + require.Equal(t, amount, td.keeper.GetTotalBurned(td.ctx)) +} + +func TestMintForBridge_Disabled(t *testing.T) { + td := newMockedTestData(t) + + recipient := sdk.AccAddress(common.HexToAddress(testconstants.ExampleEvmAddressAlice).Bytes()) + err := td.keeper.MintForBridge(td.ctx, recipient, sdkmath.NewInt(1)) + require.ErrorIs(t, err, types.ErrBridgeDisabled) + + td.bk.AssertNotCalled(t, "MintCoins") + td.bk.AssertNotCalled(t, "SendCoinsFromModuleToAccount") +} + +func TestBridgeTransfer_RejectsZeroAmount(t *testing.T) { + td := newMockedTestData(t) + require.NoError(t, td.keeper.SetParams(td.ctx, enabledParams())) + + recipient := sdk.AccAddress(common.HexToAddress(testconstants.ExampleEvmAddressAlice).Bytes()) + err := td.keeper.MintForBridge(td.ctx, recipient, sdkmath.ZeroInt()) + require.ErrorIs(t, err, types.ErrInvalidAmount) +} + +func TestBridgeTransfer_RejectsOverMaxAmount(t *testing.T) { + td := newMockedTestData(t) + params := enabledParams() + params.MaxTransferAmount = sdkmath.NewInt(10) + require.NoError(t, td.keeper.SetParams(td.ctx, params)) + + recipient := sdk.AccAddress(common.HexToAddress(testconstants.ExampleEvmAddressAlice).Bytes()) + err := td.keeper.MintForBridge(td.ctx, recipient, sdkmath.NewInt(11)) + require.ErrorIs(t, err, types.ErrExceedsMaxTransfer) +} diff --git a/x/bridge/keeper/msg_server.go b/x/bridge/keeper/msg_server.go new file mode 100644 index 00000000..3bea1042 --- /dev/null +++ b/x/bridge/keeper/msg_server.go @@ -0,0 +1,52 @@ +package keeper + +import ( + "context" + + "github.com/cosmos/evm/x/bridge/types" + + errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" +) + +type msgServer struct { + Keeper +} + +// NewMsgServerImpl returns an implementation of the bridge MsgServer interface. +func NewMsgServerImpl(k Keeper) types.MsgServer { + return &msgServer{Keeper: k} +} + +var _ types.MsgServer = msgServer{} + +// UpdateParams updates the bridge module parameters. Governance-only. +func (s msgServer) UpdateParams(goCtx context.Context, msg *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { + if s.authority.String() != msg.Authority { + return nil, errorsmod.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", s.authority.String(), msg.Authority) + } + + ctx := sdk.UnwrapSDKContext(goCtx) + if err := s.SetParams(ctx, msg.Params); err != nil { + return nil, err + } + + return &types.MsgUpdateParamsResponse{}, nil +} + +// SetAuthorizedContract updates only the authorized bridge contract address. Governance-only. +func (s msgServer) SetAuthorizedContract(goCtx context.Context, msg *types.MsgSetAuthorizedContract) (*types.MsgSetAuthorizedContractResponse, error) { + if s.authority.String() != msg.Authority { + return nil, errorsmod.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", s.authority.String(), msg.Authority) + } + + ctx := sdk.UnwrapSDKContext(goCtx) + params := s.GetParams(ctx) + params.AuthorizedContract = msg.ContractAddress + if err := s.SetParams(ctx, params); err != nil { + return nil, err + } + + return &types.MsgSetAuthorizedContractResponse{}, nil +} diff --git a/x/bridge/keeper/msg_server_test.go b/x/bridge/keeper/msg_server_test.go new file mode 100644 index 00000000..1e007cb7 --- /dev/null +++ b/x/bridge/keeper/msg_server_test.go @@ -0,0 +1,65 @@ +package keeper_test + +import ( + "testing" + + "github.com/stretchr/testify/require" + + "github.com/cosmos/evm/x/bridge/keeper" + "github.com/cosmos/evm/x/bridge/types" + + sdkmath "cosmossdk.io/math" +) + +func TestUpdateParams_InvalidAuthority(t *testing.T) { + td := newMockedTestData(t) + srv := keeper.NewMsgServerImpl(td.keeper) + + _, err := srv.UpdateParams(td.ctx, &types.MsgUpdateParams{ + Authority: "invalid", + Params: types.DefaultParams(), + }) + require.ErrorContains(t, err, "invalid authority") +} + +func TestUpdateParams_HappyPath(t *testing.T) { + td := newMockedTestData(t) + srv := keeper.NewMsgServerImpl(td.keeper) + + params := enabledParams() + params.AuthorizedContract = "0x1111111111111111111111111111111111111111" + params.HyperlaneMailbox = "0x2222222222222222222222222222222222222222" + params.MaxTransferAmount = sdkmath.NewInt(999) + + _, err := srv.UpdateParams(td.ctx, &types.MsgUpdateParams{ + Authority: govAuthority(), + Params: params, + }) + require.NoError(t, err) + require.Equal(t, params, td.keeper.GetParams(td.ctx)) +} + +func TestSetAuthorizedContract_HappyPath(t *testing.T) { + td := newMockedTestData(t) + srv := keeper.NewMsgServerImpl(td.keeper) + + require.NoError(t, td.keeper.SetParams(td.ctx, enabledParams())) + + _, err := srv.SetAuthorizedContract(td.ctx, &types.MsgSetAuthorizedContract{ + Authority: govAuthority(), + ContractAddress: "0x3333333333333333333333333333333333333333", + }) + require.NoError(t, err) + require.Equal(t, "0x3333333333333333333333333333333333333333", td.keeper.GetParams(td.ctx).AuthorizedContract) +} + +func TestSetAuthorizedContract_InvalidAuthority(t *testing.T) { + td := newMockedTestData(t) + srv := keeper.NewMsgServerImpl(td.keeper) + + _, err := srv.SetAuthorizedContract(td.ctx, &types.MsgSetAuthorizedContract{ + Authority: "invalid", + ContractAddress: "0x3333333333333333333333333333333333333333", + }) + require.ErrorContains(t, err, "invalid authority") +} diff --git a/x/bridge/keeper/params.go b/x/bridge/keeper/params.go new file mode 100644 index 00000000..f927147f --- /dev/null +++ b/x/bridge/keeper/params.go @@ -0,0 +1,36 @@ +package keeper + +import ( + "github.com/cosmos/evm/x/bridge/types" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// GetParams returns the current bridge module parameters. +func (k Keeper) GetParams(ctx sdk.Context) types.Params { + store := ctx.KVStore(k.storeKey) + bz := store.Get(types.ParamsStoreKey) + if bz == nil { + return types.DefaultParams() + } + + var params types.Params + k.cdc.MustUnmarshal(bz, ¶ms) + return params +} + +// SetParams validates and stores the current bridge module parameters. +func (k Keeper) SetParams(ctx sdk.Context, params types.Params) error { + if err := params.Validate(); err != nil { + return err + } + + store := ctx.KVStore(k.storeKey) + store.Set(types.ParamsStoreKey, k.cdc.MustMarshal(¶ms)) + return nil +} + +// GetAuthorizedContract returns the currently authorized bridge contract address. +func (k Keeper) GetAuthorizedContract(ctx sdk.Context) string { + return k.GetParams(ctx).AuthorizedContract +} diff --git a/x/bridge/keeper/query_server.go b/x/bridge/keeper/query_server.go new file mode 100644 index 00000000..8ab51ada --- /dev/null +++ b/x/bridge/keeper/query_server.go @@ -0,0 +1,39 @@ +package keeper + +import ( + "context" + + "github.com/cosmos/evm/x/bridge/types" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +type queryServer struct { + Keeper +} + +// NewQueryServerImpl returns an implementation of the bridge QueryServer interface. +func NewQueryServerImpl(k Keeper) types.QueryServer { + return &queryServer{Keeper: k} +} + +var _ types.QueryServer = queryServer{} + +// Params returns the current bridge module parameters. +func (s queryServer) Params(goCtx context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + return &types.QueryParamsResponse{Params: s.GetParams(ctx)}, nil +} + +// BridgeStatus returns the current bridge status and aggregate counters. +func (s queryServer) BridgeStatus(goCtx context.Context, _ *types.QueryBridgeStatusRequest) (*types.QueryBridgeStatusResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + params := s.GetParams(ctx) + + return &types.QueryBridgeStatusResponse{ + Enabled: params.Enabled, + TotalMinted: s.GetTotalMinted(ctx), + TotalBurned: s.GetTotalBurned(ctx), + AuthorizedContract: params.AuthorizedContract, + }, nil +} diff --git a/x/bridge/module.go b/x/bridge/module.go new file mode 100644 index 00000000..d40d9d17 --- /dev/null +++ b/x/bridge/module.go @@ -0,0 +1,112 @@ +package bridge + +import ( + "context" + "encoding/json" + "fmt" + + "github.com/grpc-ecosystem/grpc-gateway/runtime" + + abci "github.com/cometbft/cometbft/abci/types" + + "github.com/cosmos/evm/x/bridge/keeper" + "github.com/cosmos/evm/x/bridge/types" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/codec" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" +) + +const consensusVersion = 1 + +var ( + _ module.AppModule = AppModule{} + _ module.AppModuleBasic = AppModuleBasic{} + _ module.HasABCIGenesis = AppModule{} +) + +// AppModuleBasic defines the basic application module used by the bridge module. +type AppModuleBasic struct{} + +// Name returns the bridge module's name. +func (AppModuleBasic) Name() string { return types.ModuleName } + +// RegisterLegacyAminoCodec registers the bridge module's amino types. +func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { + types.RegisterLegacyAminoCodec(cdc) +} + +// ConsensusVersion returns the bridge module consensus version. +func (AppModuleBasic) ConsensusVersion() uint64 { return consensusVersion } + +// DefaultGenesis returns the default bridge genesis state as raw bytes. +func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { + return cdc.MustMarshalJSON(types.DefaultGenesisState()) +} + +// ValidateGenesis validates bridge genesis state. +func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, _ client.TxEncodingConfig, bz json.RawMessage) error { + var gs types.GenesisState + if err := cdc.UnmarshalJSON(bz, &gs); err != nil { + return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) + } + + return gs.Validate() +} + +// RegisterGRPCGatewayRoutes registers the gRPC gateway routes for the bridge module. +func (AppModuleBasic) RegisterGRPCGatewayRoutes(c client.Context, mux *runtime.ServeMux) { + if err := types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(c)); err != nil { + panic(err) + } +} + +// RegisterInterfaces registers interfaces and implementations of the bridge module. +func (AppModuleBasic) RegisterInterfaces(registry codectypes.InterfaceRegistry) { + types.RegisterInterfaces(registry) +} + +// AppModule implements an application module for the bridge module. +type AppModule struct { + AppModuleBasic + keeper keeper.Keeper +} + +// NewAppModule creates a new AppModule object. +func NewAppModule(k keeper.Keeper) AppModule { + return AppModule{ + AppModuleBasic: AppModuleBasic{}, + keeper: k, + } +} + +// Name returns the bridge module's name. +func (AppModule) Name() string { return types.ModuleName } + +// RegisterServices registers the GRPC query and msg services for the bridge module. +func (am AppModule) RegisterServices(cfg module.Configurator) { + types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) + types.RegisterQueryServer(cfg.QueryServer(), keeper.NewQueryServerImpl(am.keeper)) +} + +// InitGenesis performs genesis initialization for the bridge module. +func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, data json.RawMessage) []abci.ValidatorUpdate { + var gs types.GenesisState + cdc.MustUnmarshalJSON(data, &gs) + InitGenesis(ctx, am.keeper, gs) + return []abci.ValidatorUpdate{} +} + +// ExportGenesis returns the bridge module's exported genesis state as raw bytes. +func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { + gs := ExportGenesis(ctx, am.keeper) + return cdc.MustMarshalJSON(gs) +} + +// IsAppModule implements the appmodule.AppModule interface. +func (am AppModule) IsAppModule() {} + +// IsOnePerModuleType implements the depinject.OnePerModuleType interface. +func (am AppModule) IsOnePerModuleType() {} diff --git a/x/bridge/types/bridge.pb.go b/x/bridge/types/bridge.pb.go new file mode 100644 index 00000000..e3b3052b --- /dev/null +++ b/x/bridge/types/bridge.pb.go @@ -0,0 +1,512 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: cosmos/bridge/v1/bridge.proto + +package types + +import ( + cosmossdk_io_math "cosmossdk.io/math" + 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 + +// Params defines the x/bridge module parameters. +type Params struct { + // authorized_contract is the hex EVM address of the authorized bridge contract. + AuthorizedContract string `protobuf:"bytes,1,opt,name=authorized_contract,json=authorizedContract,proto3" json:"authorized_contract"` + // hyperlane_mailbox is the hex EVM address of the Hyperlane Mailbox. + HyperlaneMailbox string `protobuf:"bytes,2,opt,name=hyperlane_mailbox,json=hyperlaneMailbox,proto3" json:"hyperlane_mailbox"` + // base_domain_id is the Hyperlane domain ID for Base (default 8453). + BaseDomainId uint32 `protobuf:"varint,3,opt,name=base_domain_id,json=baseDomainId,proto3" json:"base_domain_id"` + // enabled indicates whether the bridge is active. + Enabled bool `protobuf:"varint,4,opt,name=enabled,proto3" json:"enabled"` + // max_transfer_amount is the maximum amount per transfer. + MaxTransferAmount cosmossdk_io_math.Int `protobuf:"bytes,5,opt,name=max_transfer_amount,json=maxTransferAmount,proto3,customtype=cosmossdk.io/math.Int" json:"max_transfer_amount"` +} + +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_487e8d07176c0b42, []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) GetAuthorizedContract() string { + if m != nil { + return m.AuthorizedContract + } + return "" +} + +func (m *Params) GetHyperlaneMailbox() string { + if m != nil { + return m.HyperlaneMailbox + } + return "" +} + +func (m *Params) GetBaseDomainId() uint32 { + if m != nil { + return m.BaseDomainId + } + return 0 +} + +func (m *Params) GetEnabled() bool { + if m != nil { + return m.Enabled + } + return false +} + +func init() { + proto.RegisterType((*Params)(nil), "cosmos.bridge.v1.Params") +} + +func init() { proto.RegisterFile("cosmos/bridge/v1/bridge.proto", fileDescriptor_487e8d07176c0b42) } + +var fileDescriptor_487e8d07176c0b42 = []byte{ + // 392 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x91, 0xcf, 0x4a, 0xe3, 0x40, + 0x1c, 0xc7, 0x33, 0xdb, 0xdd, 0xee, 0x6e, 0xd8, 0x5d, 0xda, 0x74, 0xff, 0x84, 0xae, 0x26, 0x45, + 0x3c, 0x94, 0x1e, 0x12, 0x8a, 0x27, 0x05, 0x05, 0xa3, 0x20, 0x3d, 0x14, 0x44, 0x3c, 0x79, 0x09, + 0x93, 0x64, 0x4c, 0x06, 0x3b, 0x33, 0x65, 0x32, 0x2d, 0xa9, 0x8f, 0xe0, 0x49, 0xf0, 0x25, 0x3c, + 0xf6, 0x31, 0x7a, 0xec, 0x51, 0x3c, 0x04, 0x69, 0x0f, 0x85, 0x3c, 0x85, 0x34, 0x93, 0x5a, 0xd0, + 0x5e, 0xc2, 0x2f, 0x9f, 0x4f, 0x7e, 0xdf, 0x0c, 0xf3, 0x55, 0xb7, 0x7d, 0x16, 0x13, 0x16, 0xdb, + 0x1e, 0xc7, 0x41, 0x88, 0xec, 0x61, 0xbb, 0x98, 0xac, 0x3e, 0x67, 0x82, 0x69, 0x15, 0xa9, 0xad, + 0x02, 0x0e, 0xdb, 0xf5, 0x2a, 0x24, 0x98, 0x32, 0x3b, 0x7f, 0xca, 0x8f, 0xea, 0xbf, 0x43, 0x16, + 0xb2, 0x7c, 0xb4, 0x97, 0x93, 0xa4, 0x3b, 0x0f, 0x25, 0xb5, 0x7c, 0x0e, 0x39, 0x24, 0xb1, 0xd6, + 0x55, 0x6b, 0x70, 0x20, 0x22, 0xc6, 0xf1, 0x2d, 0x0a, 0x5c, 0x9f, 0x51, 0xc1, 0xa1, 0x2f, 0x74, + 0xd0, 0x00, 0xcd, 0xef, 0xce, 0x56, 0x96, 0x9a, 0x9b, 0xf4, 0xe3, 0x62, 0xdc, 0x02, 0x17, 0xda, + 0xda, 0x9c, 0x14, 0x42, 0x3b, 0x53, 0xab, 0xd1, 0xa8, 0x8f, 0x78, 0x0f, 0x52, 0xe4, 0x12, 0x88, + 0x7b, 0x1e, 0x4b, 0xf4, 0x4f, 0x79, 0x58, 0x3d, 0x4b, 0xcd, 0x8f, 0x52, 0x46, 0x55, 0xde, 0x78, + 0x57, 0x62, 0xed, 0x50, 0xfd, 0xe5, 0xc1, 0x18, 0xb9, 0x01, 0x23, 0x10, 0x53, 0x17, 0x07, 0x7a, + 0xa9, 0x01, 0x9a, 0x3f, 0x9d, 0x7f, 0x59, 0x6a, 0xbe, 0x33, 0x32, 0xe2, 0xc7, 0x12, 0x9e, 0xe6, + 0xac, 0x13, 0x68, 0x2d, 0xf5, 0x2b, 0xa2, 0xd0, 0xeb, 0xa1, 0x40, 0xff, 0xdc, 0x00, 0xcd, 0x6f, + 0x4e, 0x25, 0x4b, 0xcd, 0x15, 0x92, 0x0b, 0xab, 0x37, 0x0d, 0xab, 0x35, 0x02, 0x13, 0x57, 0x70, + 0x48, 0xe3, 0x6b, 0xc4, 0x5d, 0x48, 0xd8, 0x80, 0x0a, 0xfd, 0x4b, 0x7e, 0xea, 0xfd, 0x49, 0x6a, + 0x2a, 0xcf, 0xa9, 0xf9, 0x47, 0xde, 0x76, 0x1c, 0xdc, 0x58, 0x98, 0xd9, 0x04, 0x8a, 0xc8, 0xea, + 0x50, 0xb1, 0xbc, 0x9f, 0x0d, 0xbb, 0xf2, 0x07, 0x55, 0x02, 0x93, 0xcb, 0x42, 0x1c, 0xe7, 0xfc, + 0xe0, 0xff, 0xdd, 0x62, 0xdc, 0xfa, 0x5b, 0xf4, 0x9a, 0xac, 0x9a, 0x95, 0x55, 0x38, 0x47, 0x93, + 0x99, 0x01, 0xa6, 0x33, 0x03, 0xbc, 0xcc, 0x0c, 0x70, 0x3f, 0x37, 0x94, 0xe9, 0xdc, 0x50, 0x9e, + 0xe6, 0x86, 0x72, 0xb5, 0x1b, 0x62, 0x11, 0x0d, 0x3c, 0xcb, 0x67, 0xc4, 0x2e, 0x96, 0xd1, 0x90, + 0xac, 0x03, 0xc4, 0xa8, 0x8f, 0x62, 0xaf, 0x9c, 0x97, 0xbb, 0xf7, 0x1a, 0x00, 0x00, 0xff, 0xff, + 0xfa, 0xee, 0xf9, 0x6f, 0x38, 0x02, 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 + { + size := m.MaxTransferAmount.Size() + i -= size + if _, err := m.MaxTransferAmount.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintBridge(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + if m.Enabled { + i-- + if m.Enabled { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x20 + } + if m.BaseDomainId != 0 { + i = encodeVarintBridge(dAtA, i, uint64(m.BaseDomainId)) + i-- + dAtA[i] = 0x18 + } + if len(m.HyperlaneMailbox) > 0 { + i -= len(m.HyperlaneMailbox) + copy(dAtA[i:], m.HyperlaneMailbox) + i = encodeVarintBridge(dAtA, i, uint64(len(m.HyperlaneMailbox))) + i-- + dAtA[i] = 0x12 + } + if len(m.AuthorizedContract) > 0 { + i -= len(m.AuthorizedContract) + copy(dAtA[i:], m.AuthorizedContract) + i = encodeVarintBridge(dAtA, i, uint64(len(m.AuthorizedContract))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintBridge(dAtA []byte, offset int, v uint64) int { + offset -= sovBridge(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 = len(m.AuthorizedContract) + if l > 0 { + n += 1 + l + sovBridge(uint64(l)) + } + l = len(m.HyperlaneMailbox) + if l > 0 { + n += 1 + l + sovBridge(uint64(l)) + } + if m.BaseDomainId != 0 { + n += 1 + sovBridge(uint64(m.BaseDomainId)) + } + if m.Enabled { + n += 2 + } + l = m.MaxTransferAmount.Size() + n += 1 + l + sovBridge(uint64(l)) + return n +} + +func sovBridge(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozBridge(x uint64) (n int) { + return sovBridge(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 ErrIntOverflowBridge + } + 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 AuthorizedContract", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBridge + } + 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 ErrInvalidLengthBridge + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthBridge + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AuthorizedContract = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field HyperlaneMailbox", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBridge + } + 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 ErrInvalidLengthBridge + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthBridge + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.HyperlaneMailbox = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BaseDomainId", wireType) + } + m.BaseDomainId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBridge + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BaseDomainId |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Enabled", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBridge + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Enabled = bool(v != 0) + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxTransferAmount", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBridge + } + 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 ErrInvalidLengthBridge + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthBridge + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.MaxTransferAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipBridge(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthBridge + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipBridge(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, ErrIntOverflowBridge + } + 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, ErrIntOverflowBridge + } + 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, ErrIntOverflowBridge + } + 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, ErrInvalidLengthBridge + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupBridge + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthBridge + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthBridge = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowBridge = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupBridge = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/bridge/types/codec.go b/x/bridge/types/codec.go new file mode 100644 index 00000000..55a12efd --- /dev/null +++ b/x/bridge/types/codec.go @@ -0,0 +1,40 @@ +package types + +import ( + "github.com/cosmos/cosmos-sdk/codec" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/msgservice" +) + +var ( + amino = codec.NewLegacyAmino() + ModuleCdc = codec.NewProtoCodec(codectypes.NewInterfaceRegistry()) + AminoCdc = codec.NewAminoCodec(amino) +) + +const ( + updateParamsName = "cosmos/bridge/MsgUpdateParams" + setAuthorizedContractName = "cosmos/bridge/MsgSetAuthorizedContract" +) + +func init() { + RegisterLegacyAminoCodec(amino) + amino.Seal() +} + +// RegisterInterfaces registers the bridge module's interface types. +func RegisterInterfaces(registry codectypes.InterfaceRegistry) { + registry.RegisterImplementations( + (*sdk.Msg)(nil), + &MsgUpdateParams{}, + &MsgSetAuthorizedContract{}, + ) + msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) +} + +// RegisterLegacyAminoCodec registers the bridge module's types on the given LegacyAmino codec. +func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { + cdc.RegisterConcrete(&MsgUpdateParams{}, updateParamsName, nil) + cdc.RegisterConcrete(&MsgSetAuthorizedContract{}, setAuthorizedContractName, nil) +} diff --git a/x/bridge/types/errors.go b/x/bridge/types/errors.go new file mode 100644 index 00000000..34942ea4 --- /dev/null +++ b/x/bridge/types/errors.go @@ -0,0 +1,13 @@ +package types + +import errorsmod "cosmossdk.io/errors" + +var ( + ErrBridgeDisabled = errorsmod.Register(ModuleName, 2, "bridge is disabled") + ErrUnauthorizedCaller = errorsmod.Register(ModuleName, 3, "unauthorized caller") + ErrInvalidAmount = errorsmod.Register(ModuleName, 4, "invalid amount") + ErrExceedsMaxTransfer = errorsmod.Register(ModuleName, 5, "exceeds max transfer amount") + ErrInvalidAddress = errorsmod.Register(ModuleName, 6, "invalid address") + ErrInvalidParams = errorsmod.Register(ModuleName, 7, "invalid params") + ErrInvalidAuthority = errorsmod.Register(ModuleName, 8, "invalid authority") +) diff --git a/x/bridge/types/events.go b/x/bridge/types/events.go new file mode 100644 index 00000000..85659366 --- /dev/null +++ b/x/bridge/types/events.go @@ -0,0 +1,39 @@ +package types + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// Event types for the bridge module. +const ( + EventTypeBridgeMint = "bridge_mint" + EventTypeBridgeBurn = "bridge_burn" +) + +// Attribute keys for bridge events. +const ( + AttributeKeyRecipient = "recipient" + AttributeKeySender = "sender" + AttributeKeyAmount = "amount" + AttributeKeyDenom = "denom" +) + +// EmitBridgeMintEvent emits an event when tokens are minted via bridge. +func EmitBridgeMintEvent(ctx sdk.Context, recipient string, amount string, denom string) { + ctx.EventManager().EmitEvent(sdk.NewEvent( + EventTypeBridgeMint, + sdk.NewAttribute(AttributeKeyRecipient, recipient), + sdk.NewAttribute(AttributeKeyAmount, amount), + sdk.NewAttribute(AttributeKeyDenom, denom), + )) +} + +// EmitBridgeBurnEvent emits an event when tokens are burned via bridge. +func EmitBridgeBurnEvent(ctx sdk.Context, sender string, amount string, denom string) { + ctx.EventManager().EmitEvent(sdk.NewEvent( + EventTypeBridgeBurn, + sdk.NewAttribute(AttributeKeySender, sender), + sdk.NewAttribute(AttributeKeyAmount, amount), + sdk.NewAttribute(AttributeKeyDenom, denom), + )) +} diff --git a/x/bridge/types/expected_keepers.go b/x/bridge/types/expected_keepers.go new file mode 100644 index 00000000..0d635f33 --- /dev/null +++ b/x/bridge/types/expected_keepers.go @@ -0,0 +1,22 @@ +package types + +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// AccountKeeper defines the expected account keeper interface. +type AccountKeeper interface { + GetModuleAddress(moduleName string) sdk.AccAddress +} + +// BankKeeper defines the expected bank keeper interface. +// In app.go, pass PreciseBankKeeper which implements this for 18-decimal support. +type BankKeeper interface { + MintCoins(ctx context.Context, moduleName string, amounts sdk.Coins) error + BurnCoins(ctx context.Context, moduleName string, amounts 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 + GetBalance(ctx context.Context, addr sdk.AccAddress, denom string) sdk.Coin +} diff --git a/x/bridge/types/genesis.pb.go b/x/bridge/types/genesis.pb.go new file mode 100644 index 00000000..42345942 --- /dev/null +++ b/x/bridge/types/genesis.pb.go @@ -0,0 +1,425 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: cosmos/bridge/v1/genesis.proto + +package types + +import ( + cosmossdk_io_math "cosmossdk.io/math" + 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 bridge module's genesis state. +type GenesisState struct { + // params defines all the parameters of the bridge module. + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` + // total_minted is the cumulative tokens minted via bridge. + TotalMinted cosmossdk_io_math.Int `protobuf:"bytes,2,opt,name=total_minted,json=totalMinted,proto3,customtype=cosmossdk.io/math.Int" json:"total_minted"` + // total_burned is the cumulative tokens burned via bridge. + TotalBurned cosmossdk_io_math.Int `protobuf:"bytes,3,opt,name=total_burned,json=totalBurned,proto3,customtype=cosmossdk.io/math.Int" json:"total_burned"` +} + +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_26dcb9026f169a99, []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), "cosmos.bridge.v1.GenesisState") +} + +func init() { proto.RegisterFile("cosmos/bridge/v1/genesis.proto", fileDescriptor_26dcb9026f169a99) } + +var fileDescriptor_26dcb9026f169a99 = []byte{ + // 281 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4b, 0xce, 0x2f, 0xce, + 0xcd, 0x2f, 0xd6, 0x4f, 0x2a, 0xca, 0x4c, 0x49, 0x4f, 0xd5, 0x2f, 0x33, 0xd4, 0x4f, 0x4f, 0xcd, + 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x80, 0xc8, 0xeb, 0x41, + 0xe4, 0xf5, 0xca, 0x0c, 0xa5, 0x04, 0x13, 0x73, 0x33, 0xf3, 0xf2, 0xf5, 0xc1, 0x24, 0x44, 0x91, + 0x94, 0x2c, 0x86, 0x21, 0x50, 0xe5, 0x10, 0x69, 0x91, 0xf4, 0xfc, 0xf4, 0x7c, 0x30, 0x53, 0x1f, + 0xc4, 0x82, 0x88, 0x2a, 0x9d, 0x67, 0xe4, 0xe2, 0x71, 0x87, 0xd8, 0x15, 0x5c, 0x92, 0x58, 0x92, + 0x2a, 0x64, 0xcd, 0xc5, 0x56, 0x90, 0x58, 0x94, 0x98, 0x5b, 0x2c, 0xc1, 0xa8, 0xc0, 0xa8, 0xc1, + 0x6d, 0x24, 0xa1, 0x87, 0x6e, 0xb7, 0x5e, 0x00, 0x58, 0xde, 0x89, 0xf3, 0xc4, 0x3d, 0x79, 0x86, + 0x15, 0xcf, 0x37, 0x68, 0x31, 0x06, 0x41, 0xb5, 0x08, 0x39, 0x70, 0xf1, 0x94, 0xe4, 0x97, 0x24, + 0xe6, 0xc4, 0xe7, 0x66, 0xe6, 0x95, 0xa4, 0xa6, 0x48, 0x30, 0x29, 0x30, 0x6a, 0x70, 0x3a, 0xc9, + 0x82, 0x14, 0xde, 0xba, 0x27, 0x2f, 0x0a, 0x31, 0xa9, 0x38, 0x25, 0x5b, 0x2f, 0x33, 0x5f, 0x3f, + 0x37, 0xb1, 0x24, 0x43, 0xcf, 0x33, 0xaf, 0x24, 0x88, 0x1b, 0xac, 0xc5, 0x17, 0xac, 0x03, 0x61, + 0x42, 0x52, 0x69, 0x51, 0x5e, 0x6a, 0x8a, 0x04, 0x33, 0xf1, 0x26, 0x38, 0x81, 0x75, 0x38, 0xd9, + 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, 0x4a, 0x7a, 0x66, 0x49, 0x46, + 0x69, 0x92, 0x5e, 0x72, 0x7e, 0xae, 0x3e, 0x34, 0xac, 0x52, 0xcb, 0x72, 0xf5, 0x2b, 0x60, 0x21, + 0x56, 0x52, 0x59, 0x90, 0x5a, 0x9c, 0xc4, 0x06, 0x0e, 0x18, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, + 0xff, 0x02, 0x06, 0x6b, 0x52, 0x94, 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 := m.TotalBurned.Size() + i -= size + if _, err := m.TotalBurned.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + { + size := m.TotalMinted.Size() + i -= size + if _, err := m.TotalMinted.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + 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)) + l = m.TotalMinted.Size() + n += 1 + l + sovGenesis(uint64(l)) + l = m.TotalBurned.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 TotalMinted", 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.TotalMinted.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TotalBurned", 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.TotalBurned.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/bridge/types/genesis_logic.go b/x/bridge/types/genesis_logic.go new file mode 100644 index 00000000..3b4d97af --- /dev/null +++ b/x/bridge/types/genesis_logic.go @@ -0,0 +1,28 @@ +package types + +import ( + sdkmath "cosmossdk.io/math" +) + +// DefaultGenesisState returns the default bridge genesis state. +func DefaultGenesisState() *GenesisState { + return &GenesisState{ + Params: DefaultParams(), + TotalMinted: sdkmath.ZeroInt(), + TotalBurned: sdkmath.ZeroInt(), + } +} + +// Validate performs basic genesis state validation. +func (gs GenesisState) Validate() error { + if err := gs.Params.Validate(); err != nil { + return err + } + if gs.TotalMinted.IsNegative() { + return ErrInvalidAmount.Wrap("total_minted cannot be negative") + } + if gs.TotalBurned.IsNegative() { + return ErrInvalidAmount.Wrap("total_burned cannot be negative") + } + return nil +} diff --git a/x/bridge/types/keys.go b/x/bridge/types/keys.go new file mode 100644 index 00000000..a32aa8fc --- /dev/null +++ b/x/bridge/types/keys.go @@ -0,0 +1,20 @@ +package types + +const ( + ModuleName = "bridge" + StoreKey = ModuleName + RouterKey = ModuleName +) + +// KV store key prefixes +const ( + prefixParams = iota + 1 + prefixTotalMinted + prefixTotalBurned +) + +var ( + ParamsStoreKey = []byte{prefixParams} + TotalMintedStoreKey = []byte{prefixTotalMinted} + TotalBurnedStoreKey = []byte{prefixTotalBurned} +) diff --git a/x/bridge/types/mocks/MockAccountKeeper.go b/x/bridge/types/mocks/MockAccountKeeper.go new file mode 100644 index 00000000..b90e7423 --- /dev/null +++ b/x/bridge/types/mocks/MockAccountKeeper.go @@ -0,0 +1,28 @@ +package mocks + +import ( + mock "github.com/stretchr/testify/mock" + + types "github.com/cosmos/cosmos-sdk/types" +) + +// AccountKeeper is a mock type for the bridge AccountKeeper interface. +type AccountKeeper struct { + mock.Mock +} + +// NewAccountKeeper creates a new AccountKeeper mock and registers cleanup. +func NewAccountKeeper(t interface { + mock.TestingT + Cleanup(func()) +}) *AccountKeeper { + m := &AccountKeeper{} + m.Mock.Test(t) + t.Cleanup(func() { m.AssertExpectations(t) }) + return m +} + +func (_m *AccountKeeper) GetModuleAddress(moduleName string) types.AccAddress { + ret := _m.Called(moduleName) + return ret.Get(0).(types.AccAddress) +} diff --git a/x/bridge/types/mocks/MockBankKeeper.go b/x/bridge/types/mocks/MockBankKeeper.go new file mode 100644 index 00000000..b4a3b353 --- /dev/null +++ b/x/bridge/types/mocks/MockBankKeeper.go @@ -0,0 +1,50 @@ +package mocks + +import ( + "context" + + mock "github.com/stretchr/testify/mock" + + types "github.com/cosmos/cosmos-sdk/types" +) + +// BankKeeper is a mock type for the bridge BankKeeper interface. +type BankKeeper struct { + mock.Mock +} + +// NewBankKeeper creates a new BankKeeper mock and registers cleanup. +func NewBankKeeper(t interface { + mock.TestingT + Cleanup(func()) +}) *BankKeeper { + m := &BankKeeper{} + m.Mock.Test(t) + t.Cleanup(func() { m.AssertExpectations(t) }) + return m +} + +func (_m *BankKeeper) MintCoins(ctx context.Context, moduleName string, amounts types.Coins) error { + ret := _m.Called(ctx, moduleName, amounts) + return ret.Error(0) +} + +func (_m *BankKeeper) BurnCoins(ctx context.Context, moduleName string, amounts types.Coins) error { + ret := _m.Called(ctx, moduleName, amounts) + return ret.Error(0) +} + +func (_m *BankKeeper) SendCoinsFromModuleToAccount(ctx context.Context, senderModule string, recipientAddr types.AccAddress, amt types.Coins) error { + ret := _m.Called(ctx, senderModule, recipientAddr, amt) + return ret.Error(0) +} + +func (_m *BankKeeper) SendCoinsFromAccountToModule(ctx context.Context, senderAddr types.AccAddress, recipientModule string, amt types.Coins) error { + ret := _m.Called(ctx, senderAddr, recipientModule, amt) + return ret.Error(0) +} + +func (_m *BankKeeper) GetBalance(ctx context.Context, addr types.AccAddress, denom string) types.Coin { + ret := _m.Called(ctx, addr, denom) + return ret.Get(0).(types.Coin) +} diff --git a/x/bridge/types/msgs.go b/x/bridge/types/msgs.go new file mode 100644 index 00000000..593f92cb --- /dev/null +++ b/x/bridge/types/msgs.go @@ -0,0 +1,39 @@ +package types + +import ( + errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/ethereum/go-ethereum/common" +) + +var ( + _ sdk.Msg = &MsgUpdateParams{} + _ sdk.Msg = &MsgSetAuthorizedContract{} +) + +func (m *MsgUpdateParams) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(m.Authority); err != nil { + return errorsmod.Wrap(err, "invalid authority address") + } + return m.Params.Validate() +} + +func (m *MsgSetAuthorizedContract) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(m.Authority); err != nil { + return errorsmod.Wrap(err, "invalid authority address") + } + if m.ContractAddress != "" && !common.IsHexAddress(m.ContractAddress) { + return errorsmod.Wrap(ErrInvalidAddress, "invalid contract address") + } + return nil +} + +// GetSignBytes implements the LegacyMsg interface for EIP-712 support. +func (m MsgUpdateParams) GetSignBytes() []byte { + return AminoCdc.MustMarshalJSON(&m) +} + +// GetSignBytes implements the LegacyMsg interface for EIP-712 support. +func (m MsgSetAuthorizedContract) GetSignBytes() []byte { + return AminoCdc.MustMarshalJSON(&m) +} diff --git a/x/bridge/types/params.go b/x/bridge/types/params.go new file mode 100644 index 00000000..a1d672f7 --- /dev/null +++ b/x/bridge/types/params.go @@ -0,0 +1,33 @@ +package types + +import ( + "fmt" + + "cosmossdk.io/math" + "github.com/ethereum/go-ethereum/common" +) + +// DefaultParams returns the default bridge module parameters. +func DefaultParams() Params { + return Params{ + AuthorizedContract: "", + HyperlaneMailbox: "", + BaseDomainId: 8453, + Enabled: false, + MaxTransferAmount: math.ZeroInt(), + } +} + +// Validate checks that the bridge parameters are valid. +func (p Params) Validate() error { + if p.AuthorizedContract != "" && !common.IsHexAddress(p.AuthorizedContract) { + return fmt.Errorf("invalid authorized_contract address: %s", p.AuthorizedContract) + } + if p.HyperlaneMailbox != "" && !common.IsHexAddress(p.HyperlaneMailbox) { + return fmt.Errorf("invalid hyperlane_mailbox address: %s", p.HyperlaneMailbox) + } + if p.MaxTransferAmount.IsNegative() { + return fmt.Errorf("max_transfer_amount cannot be negative: %s", p.MaxTransferAmount) + } + return nil +} diff --git a/x/bridge/types/query.pb.go b/x/bridge/types/query.pb.go new file mode 100644 index 00000000..a8b5cd12 --- /dev/null +++ b/x/bridge/types/query.pb.go @@ -0,0 +1,1016 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: cosmos/bridge/v1/query.proto + +package types + +import ( + context "context" + cosmossdk_io_math "cosmossdk.io/math" + fmt "fmt" + _ "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 defines the request type for querying x/bridge parameters. +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_58b2118298851dfe, []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 defines the response type for querying x/bridge parameters. +type QueryParamsResponse struct { + // params define the bridge module parameters. + 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_58b2118298851dfe, []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{} +} + +// QueryBridgeStatusRequest defines the request type for querying bridge status. +type QueryBridgeStatusRequest struct { +} + +func (m *QueryBridgeStatusRequest) Reset() { *m = QueryBridgeStatusRequest{} } +func (m *QueryBridgeStatusRequest) String() string { return proto.CompactTextString(m) } +func (*QueryBridgeStatusRequest) ProtoMessage() {} +func (*QueryBridgeStatusRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_58b2118298851dfe, []int{2} +} +func (m *QueryBridgeStatusRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryBridgeStatusRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryBridgeStatusRequest.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 *QueryBridgeStatusRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryBridgeStatusRequest.Merge(m, src) +} +func (m *QueryBridgeStatusRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryBridgeStatusRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryBridgeStatusRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryBridgeStatusRequest proto.InternalMessageInfo + +// QueryBridgeStatusResponse returns the current bridge status and statistics. +type QueryBridgeStatusResponse struct { + // enabled indicates whether the bridge is active. + Enabled bool `protobuf:"varint,1,opt,name=enabled,proto3" json:"enabled,omitempty"` + // total_minted is the cumulative tokens minted via bridge. + TotalMinted cosmossdk_io_math.Int `protobuf:"bytes,2,opt,name=total_minted,json=totalMinted,proto3,customtype=cosmossdk.io/math.Int" json:"total_minted"` + // total_burned is the cumulative tokens burned via bridge. + TotalBurned cosmossdk_io_math.Int `protobuf:"bytes,3,opt,name=total_burned,json=totalBurned,proto3,customtype=cosmossdk.io/math.Int" json:"total_burned"` + // authorized_contract is the hex EVM address of the authorized bridge contract. + AuthorizedContract string `protobuf:"bytes,4,opt,name=authorized_contract,json=authorizedContract,proto3" json:"authorized_contract,omitempty"` +} + +func (m *QueryBridgeStatusResponse) Reset() { *m = QueryBridgeStatusResponse{} } +func (m *QueryBridgeStatusResponse) String() string { return proto.CompactTextString(m) } +func (*QueryBridgeStatusResponse) ProtoMessage() {} +func (*QueryBridgeStatusResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_58b2118298851dfe, []int{3} +} +func (m *QueryBridgeStatusResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryBridgeStatusResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryBridgeStatusResponse.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 *QueryBridgeStatusResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryBridgeStatusResponse.Merge(m, src) +} +func (m *QueryBridgeStatusResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryBridgeStatusResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryBridgeStatusResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryBridgeStatusResponse proto.InternalMessageInfo + +func (m *QueryBridgeStatusResponse) GetEnabled() bool { + if m != nil { + return m.Enabled + } + return false +} + +func (m *QueryBridgeStatusResponse) GetAuthorizedContract() string { + if m != nil { + return m.AuthorizedContract + } + return "" +} + +func init() { + proto.RegisterType((*QueryParamsRequest)(nil), "cosmos.bridge.v1.QueryParamsRequest") + proto.RegisterType((*QueryParamsResponse)(nil), "cosmos.bridge.v1.QueryParamsResponse") + proto.RegisterType((*QueryBridgeStatusRequest)(nil), "cosmos.bridge.v1.QueryBridgeStatusRequest") + proto.RegisterType((*QueryBridgeStatusResponse)(nil), "cosmos.bridge.v1.QueryBridgeStatusResponse") +} + +func init() { proto.RegisterFile("cosmos/bridge/v1/query.proto", fileDescriptor_58b2118298851dfe) } + +var fileDescriptor_58b2118298851dfe = []byte{ + // 459 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x52, 0x4f, 0x6b, 0x13, 0x41, + 0x14, 0xcf, 0x44, 0x8d, 0x76, 0xda, 0x83, 0x4e, 0x2b, 0xac, 0x4b, 0xbb, 0x89, 0xa1, 0x62, 0xa9, + 0xb0, 0x43, 0xeb, 0x51, 0x10, 0x59, 0x4f, 0x1e, 0x04, 0x5d, 0x6f, 0x5e, 0xc2, 0x6c, 0x76, 0xd8, + 0x0c, 0x66, 0xe7, 0x6d, 0x77, 0xde, 0x46, 0xeb, 0xd1, 0x4f, 0x50, 0xe8, 0x97, 0xf0, 0xe8, 0xc7, + 0xe8, 0xb1, 0xe0, 0x45, 0x3c, 0x14, 0x49, 0x04, 0xc1, 0x4f, 0x21, 0x99, 0xd9, 0x58, 0x75, 0x5b, + 0xcc, 0x25, 0x4c, 0xde, 0xef, 0xcf, 0xfb, 0xed, 0x7b, 0x8f, 0x6e, 0x0e, 0xc1, 0xe4, 0x60, 0x78, + 0x52, 0xaa, 0x34, 0x93, 0x7c, 0xb2, 0xc7, 0x0f, 0x2a, 0x59, 0x1e, 0x86, 0x45, 0x09, 0x08, 0xec, + 0xa6, 0x43, 0x43, 0x87, 0x86, 0x93, 0x3d, 0xff, 0x96, 0xc8, 0x95, 0x06, 0x6e, 0x7f, 0x1d, 0xc9, + 0xdf, 0x6a, 0x58, 0xd4, 0x74, 0x07, 0x6f, 0x64, 0x90, 0x81, 0x7d, 0xf2, 0xf9, 0xab, 0xae, 0x6e, + 0x66, 0x00, 0xd9, 0x58, 0x72, 0x51, 0x28, 0x2e, 0xb4, 0x06, 0x14, 0xa8, 0x40, 0x1b, 0x87, 0xf6, + 0x37, 0x28, 0x7b, 0x39, 0x8f, 0xf1, 0x42, 0x94, 0x22, 0x37, 0xb1, 0x3c, 0xa8, 0xa4, 0xc1, 0x7e, + 0x4c, 0xd7, 0xff, 0xaa, 0x9a, 0x02, 0xb4, 0x91, 0xec, 0x11, 0xed, 0x14, 0xb6, 0xe2, 0x91, 0x1e, + 0xd9, 0x59, 0xdd, 0xf7, 0xc2, 0x7f, 0x53, 0x87, 0x4e, 0x11, 0xad, 0x9c, 0x9c, 0x75, 0x5b, 0x1f, + 0x7f, 0x7c, 0xda, 0x25, 0x71, 0x2d, 0xe9, 0xfb, 0xd4, 0xb3, 0x9e, 0x91, 0xe5, 0xbe, 0x42, 0x81, + 0xd5, 0xef, 0x7e, 0x3f, 0x09, 0xbd, 0x73, 0x01, 0x58, 0xb7, 0xf5, 0xe8, 0x75, 0xa9, 0x45, 0x32, + 0x96, 0xa9, 0xed, 0x7b, 0x23, 0x5e, 0xfc, 0x65, 0x4f, 0xe8, 0x1a, 0x02, 0x8a, 0xf1, 0x20, 0x57, + 0x1a, 0x65, 0xea, 0xb5, 0x7b, 0x64, 0x67, 0x25, 0xda, 0x9a, 0x37, 0xff, 0x7a, 0xd6, 0xbd, 0xed, + 0xd2, 0x99, 0xf4, 0x4d, 0xa8, 0x80, 0xe7, 0x02, 0x47, 0xe1, 0x33, 0x8d, 0xf1, 0xaa, 0x95, 0x3c, + 0xb7, 0x8a, 0x73, 0x87, 0xa4, 0x2a, 0xb5, 0x4c, 0xbd, 0x2b, 0xcb, 0x3b, 0x44, 0x56, 0xc1, 0x38, + 0x5d, 0x17, 0x15, 0x8e, 0xa0, 0x54, 0xef, 0x65, 0x3a, 0x18, 0x82, 0xc6, 0x52, 0x0c, 0xd1, 0xbb, + 0x3a, 0x37, 0x8a, 0xd9, 0x39, 0xf4, 0xb4, 0x46, 0xf6, 0x8f, 0xdb, 0xf4, 0x9a, 0xfd, 0x58, 0xf6, + 0x96, 0x76, 0xdc, 0xbc, 0xd8, 0x76, 0x73, 0x92, 0xcd, 0xb5, 0xf8, 0xf7, 0xfe, 0xc3, 0x72, 0xf3, + 0xea, 0xf7, 0x3e, 0x7c, 0xfe, 0x7e, 0xdc, 0xf6, 0x99, 0xc7, 0x1b, 0xf7, 0xe2, 0x76, 0xc1, 0x8e, + 0x08, 0x5d, 0xfb, 0x73, 0xd4, 0x6c, 0xf7, 0x12, 0xe7, 0x0b, 0x96, 0xe5, 0x3f, 0x58, 0x8a, 0x5b, + 0x67, 0xb9, 0x6f, 0xb3, 0xdc, 0x65, 0x5d, 0x7e, 0xc9, 0xed, 0x0e, 0x8c, 0x15, 0x44, 0x8f, 0x4f, + 0xa6, 0x01, 0x39, 0x9d, 0x06, 0xe4, 0xdb, 0x34, 0x20, 0x47, 0xb3, 0xa0, 0x75, 0x3a, 0x0b, 0x5a, + 0x5f, 0x66, 0x41, 0xeb, 0xf5, 0x76, 0xa6, 0x70, 0x54, 0x25, 0xe1, 0x10, 0xf2, 0x85, 0x89, 0x9c, + 0xe4, 0xfc, 0xdd, 0xc2, 0x0a, 0x0f, 0x0b, 0x69, 0x92, 0x8e, 0xbd, 0xe7, 0x87, 0xbf, 0x02, 0x00, + 0x00, 0xff, 0xff, 0x74, 0x31, 0xf4, 0x81, 0x67, 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 { + // Params queries the parameters of x/bridge module. + Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) + // BridgeStatus queries the current bridge status and statistics. + BridgeStatus(ctx context.Context, in *QueryBridgeStatusRequest, opts ...grpc.CallOption) (*QueryBridgeStatusResponse, 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, "/cosmos.bridge.v1.Query/Params", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) BridgeStatus(ctx context.Context, in *QueryBridgeStatusRequest, opts ...grpc.CallOption) (*QueryBridgeStatusResponse, error) { + out := new(QueryBridgeStatusResponse) + err := c.cc.Invoke(ctx, "/cosmos.bridge.v1.Query/BridgeStatus", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// QueryServer is the server API for Query service. +type QueryServer interface { + // Params queries the parameters of x/bridge module. + Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) + // BridgeStatus queries the current bridge status and statistics. + BridgeStatus(context.Context, *QueryBridgeStatusRequest) (*QueryBridgeStatusResponse, 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) BridgeStatus(ctx context.Context, req *QueryBridgeStatusRequest) (*QueryBridgeStatusResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method BridgeStatus 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: "/cosmos.bridge.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_BridgeStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryBridgeStatusRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).BridgeStatus(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.bridge.v1.Query/BridgeStatus", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).BridgeStatus(ctx, req.(*QueryBridgeStatusRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "cosmos.bridge.v1.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Params", + Handler: _Query_Params_Handler, + }, + { + MethodName: "BridgeStatus", + Handler: _Query_BridgeStatus_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "cosmos/bridge/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 *QueryBridgeStatusRequest) 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 *QueryBridgeStatusRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryBridgeStatusRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryBridgeStatusResponse) 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 *QueryBridgeStatusResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryBridgeStatusResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.AuthorizedContract) > 0 { + i -= len(m.AuthorizedContract) + copy(dAtA[i:], m.AuthorizedContract) + i = encodeVarintQuery(dAtA, i, uint64(len(m.AuthorizedContract))) + i-- + dAtA[i] = 0x22 + } + { + size := m.TotalBurned.Size() + i -= size + if _, err := m.TotalBurned.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + { + size := m.TotalMinted.Size() + i -= size + if _, err := m.TotalMinted.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if m.Enabled { + i-- + if m.Enabled { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x8 + } + 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 *QueryBridgeStatusRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryBridgeStatusResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Enabled { + n += 2 + } + l = m.TotalMinted.Size() + n += 1 + l + sovQuery(uint64(l)) + l = m.TotalBurned.Size() + n += 1 + l + sovQuery(uint64(l)) + l = len(m.AuthorizedContract) + if l > 0 { + 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 *QueryBridgeStatusRequest) 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: QueryBridgeStatusRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryBridgeStatusRequest: 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 *QueryBridgeStatusResponse) 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: QueryBridgeStatusResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryBridgeStatusResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Enabled", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Enabled = bool(v != 0) + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TotalMinted", 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 + } + if err := m.TotalMinted.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TotalBurned", 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 + } + if err := m.TotalBurned.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AuthorizedContract", 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.AuthorizedContract = 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 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/bridge/types/query.pb.gw.go b/x/bridge/types/query.pb.gw.go new file mode 100644 index 00000000..2a477aa5 --- /dev/null +++ b/x/bridge/types/query.pb.gw.go @@ -0,0 +1,218 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: cosmos/bridge/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_BridgeStatus_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryBridgeStatusRequest + var metadata runtime.ServerMetadata + + msg, err := client.BridgeStatus(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_BridgeStatus_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryBridgeStatusRequest + var metadata runtime.ServerMetadata + + msg, err := server.BridgeStatus(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_BridgeStatus_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_BridgeStatus_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_BridgeStatus_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_BridgeStatus_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_BridgeStatus_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_BridgeStatus_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}, []string{"cosmos", "bridge", "v1", "params"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_BridgeStatus_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"cosmos", "bridge", "v1", "bridge_status"}, "", runtime.AssumeColonVerbOpt(false))) +) + +var ( + forward_Query_Params_0 = runtime.ForwardResponseMessage + + forward_Query_BridgeStatus_0 = runtime.ForwardResponseMessage +) diff --git a/x/bridge/types/tx.pb.go b/x/bridge/types/tx.pb.go new file mode 100644 index 00000000..4eeeb004 --- /dev/null +++ b/x/bridge/types/tx.pb.go @@ -0,0 +1,980 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: cosmos/bridge/v1/tx.proto + +package types + +import ( + context "context" + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + _ "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 defines a Msg for updating the x/bridge module parameters. +type MsgUpdateParams struct { + // authority is the address of the governance account. + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // params defines the x/bridge parameters to update. + 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_1c43fe62d5663eab, []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 for MsgUpdateParams. +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_1c43fe62d5663eab, []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 + +// MsgSetAuthorizedContract sets the authorized bridge contract address. Governance-only. +type MsgSetAuthorizedContract struct { + // authority is the address of the governance account. + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // contract_address is the hex EVM address of the authorized bridge contract. + ContractAddress string `protobuf:"bytes,2,opt,name=contract_address,json=contractAddress,proto3" json:"contract_address,omitempty"` +} + +func (m *MsgSetAuthorizedContract) Reset() { *m = MsgSetAuthorizedContract{} } +func (m *MsgSetAuthorizedContract) String() string { return proto.CompactTextString(m) } +func (*MsgSetAuthorizedContract) ProtoMessage() {} +func (*MsgSetAuthorizedContract) Descriptor() ([]byte, []int) { + return fileDescriptor_1c43fe62d5663eab, []int{2} +} +func (m *MsgSetAuthorizedContract) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSetAuthorizedContract) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSetAuthorizedContract.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 *MsgSetAuthorizedContract) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSetAuthorizedContract.Merge(m, src) +} +func (m *MsgSetAuthorizedContract) XXX_Size() int { + return m.Size() +} +func (m *MsgSetAuthorizedContract) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSetAuthorizedContract.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSetAuthorizedContract proto.InternalMessageInfo + +func (m *MsgSetAuthorizedContract) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" +} + +func (m *MsgSetAuthorizedContract) GetContractAddress() string { + if m != nil { + return m.ContractAddress + } + return "" +} + +// MsgSetAuthorizedContractResponse defines the response for MsgSetAuthorizedContract. +type MsgSetAuthorizedContractResponse struct { +} + +func (m *MsgSetAuthorizedContractResponse) Reset() { *m = MsgSetAuthorizedContractResponse{} } +func (m *MsgSetAuthorizedContractResponse) String() string { return proto.CompactTextString(m) } +func (*MsgSetAuthorizedContractResponse) ProtoMessage() {} +func (*MsgSetAuthorizedContractResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_1c43fe62d5663eab, []int{3} +} +func (m *MsgSetAuthorizedContractResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSetAuthorizedContractResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSetAuthorizedContractResponse.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 *MsgSetAuthorizedContractResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSetAuthorizedContractResponse.Merge(m, src) +} +func (m *MsgSetAuthorizedContractResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgSetAuthorizedContractResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSetAuthorizedContractResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSetAuthorizedContractResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*MsgUpdateParams)(nil), "cosmos.bridge.v1.MsgUpdateParams") + proto.RegisterType((*MsgUpdateParamsResponse)(nil), "cosmos.bridge.v1.MsgUpdateParamsResponse") + proto.RegisterType((*MsgSetAuthorizedContract)(nil), "cosmos.bridge.v1.MsgSetAuthorizedContract") + proto.RegisterType((*MsgSetAuthorizedContractResponse)(nil), "cosmos.bridge.v1.MsgSetAuthorizedContractResponse") +} + +func init() { proto.RegisterFile("cosmos/bridge/v1/tx.proto", fileDescriptor_1c43fe62d5663eab) } + +var fileDescriptor_1c43fe62d5663eab = []byte{ + // 423 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x52, 0x31, 0xeb, 0xd3, 0x40, + 0x1c, 0xcd, 0x29, 0xfe, 0x21, 0xa7, 0xd0, 0x1a, 0x2a, 0x4d, 0x03, 0xa6, 0x35, 0x38, 0xb4, 0x01, + 0x13, 0x1a, 0xc1, 0xa1, 0x05, 0xa1, 0x75, 0x2e, 0x48, 0x8a, 0x8b, 0x08, 0x25, 0x4d, 0x8e, 0x6b, + 0x86, 0xe4, 0x42, 0xee, 0x5a, 0x5b, 0x27, 0x71, 0x74, 0xf2, 0x63, 0x38, 0x76, 0x70, 0xf2, 0x13, + 0x74, 0x2c, 0x4e, 0x4e, 0x22, 0xcd, 0xd0, 0xaf, 0x21, 0xc9, 0x5d, 0x28, 0xa6, 0x11, 0xc5, 0x25, + 0x24, 0xbf, 0xf7, 0xee, 0xbd, 0x7b, 0x2f, 0x3f, 0xd8, 0xf1, 0x09, 0x8d, 0x08, 0xb5, 0x97, 0x69, + 0x18, 0x60, 0x64, 0x6f, 0x86, 0x36, 0xdb, 0x5a, 0x49, 0x4a, 0x18, 0x51, 0x9a, 0x1c, 0xb2, 0x38, + 0x64, 0x6d, 0x86, 0xda, 0x7d, 0x2f, 0x0a, 0x63, 0x62, 0x17, 0x4f, 0x4e, 0xd2, 0x1e, 0x5e, 0x9d, + 0x17, 0x74, 0x0e, 0xb7, 0x05, 0x1c, 0x51, 0x9c, 0x63, 0x11, 0xc5, 0x02, 0x10, 0xbe, 0x8b, 0xe2, + 0xcb, 0x16, 0x4e, 0x1c, 0x6a, 0x61, 0x82, 0x09, 0x9f, 0xe7, 0x6f, 0x7c, 0x6a, 0x7c, 0x05, 0xb0, + 0x31, 0xa3, 0xf8, 0x55, 0x12, 0x78, 0x0c, 0xbd, 0xf4, 0x52, 0x2f, 0xa2, 0xca, 0x33, 0x28, 0x7b, + 0x6b, 0xb6, 0x22, 0x69, 0xc8, 0x76, 0x2a, 0xe8, 0x81, 0xbe, 0x3c, 0x55, 0xbf, 0x7d, 0x79, 0xd2, + 0x12, 0x72, 0x93, 0x20, 0x48, 0x11, 0xa5, 0x73, 0x96, 0x86, 0x31, 0x76, 0x2f, 0x54, 0x65, 0x0c, + 0x6f, 0x92, 0x42, 0x41, 0xbd, 0xd5, 0x03, 0xfd, 0xbb, 0x8e, 0x6a, 0x55, 0xa3, 0x5a, 0xdc, 0x61, + 0x2a, 0x1f, 0x7e, 0x74, 0xa5, 0xcf, 0xe7, 0xbd, 0x09, 0x5c, 0x71, 0x64, 0xe4, 0x7c, 0x38, 0xef, + 0xcd, 0x8b, 0xd8, 0xc7, 0xf3, 0xde, 0xec, 0x8a, 0x94, 0xdb, 0xb2, 0x86, 0xca, 0x45, 0x8d, 0x0e, + 0x6c, 0x57, 0x46, 0x2e, 0xa2, 0x09, 0x89, 0x29, 0xca, 0x73, 0xa9, 0x33, 0x8a, 0xe7, 0x88, 0x4d, + 0xb8, 0xe4, 0x3b, 0x14, 0xbc, 0x20, 0x31, 0x4b, 0x3d, 0x9f, 0xfd, 0x77, 0xc0, 0x01, 0x6c, 0xfa, + 0x42, 0x63, 0xe1, 0x71, 0x52, 0x11, 0x55, 0x76, 0x1b, 0xe5, 0x5c, 0x9c, 0x1d, 0x8d, 0xaf, 0xe3, + 0xf4, 0x6b, 0xe2, 0xd4, 0xde, 0xcf, 0x30, 0x60, 0xef, 0x4f, 0x58, 0x19, 0xd0, 0xc9, 0x00, 0xbc, + 0x3d, 0xa3, 0x58, 0x79, 0x03, 0xef, 0xfd, 0xf6, 0xf3, 0x1e, 0x5d, 0x97, 0x5e, 0xe9, 0x48, 0x1b, + 0xfc, 0x95, 0x52, 0xba, 0x28, 0x6f, 0xe1, 0x83, 0xfa, 0x0a, 0xcd, 0x5a, 0x8d, 0x5a, 0xae, 0xe6, + 0xfc, 0x3b, 0xb7, 0x34, 0xd6, 0xee, 0xbc, 0xcf, 0xb7, 0x63, 0xfa, 0xfc, 0x70, 0xd2, 0xc1, 0xf1, + 0xa4, 0x83, 0x9f, 0x27, 0x1d, 0x7c, 0xca, 0x74, 0xe9, 0x98, 0xe9, 0xd2, 0xf7, 0x4c, 0x97, 0x5e, + 0x3f, 0xc6, 0x21, 0x5b, 0xad, 0x97, 0x96, 0x4f, 0x22, 0xb1, 0xe7, 0x36, 0xda, 0x44, 0x97, 0x72, + 0xd9, 0x2e, 0x41, 0x74, 0x79, 0x53, 0x6c, 0xf9, 0xd3, 0x5f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xa3, + 0xd8, 0xcd, 0xbf, 0x90, 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 + +// 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 updates the x/bridge module parameters. Governance-only. + UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) + // SetAuthorizedContract sets the authorized bridge contract address. Governance-only. + SetAuthorizedContract(ctx context.Context, in *MsgSetAuthorizedContract, opts ...grpc.CallOption) (*MsgSetAuthorizedContractResponse, 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, "/cosmos.bridge.v1.Msg/UpdateParams", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) SetAuthorizedContract(ctx context.Context, in *MsgSetAuthorizedContract, opts ...grpc.CallOption) (*MsgSetAuthorizedContractResponse, error) { + out := new(MsgSetAuthorizedContractResponse) + err := c.cc.Invoke(ctx, "/cosmos.bridge.v1.Msg/SetAuthorizedContract", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// MsgServer is the server API for Msg service. +type MsgServer interface { + // UpdateParams updates the x/bridge module parameters. Governance-only. + UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) + // SetAuthorizedContract sets the authorized bridge contract address. Governance-only. + SetAuthorizedContract(context.Context, *MsgSetAuthorizedContract) (*MsgSetAuthorizedContractResponse, 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) SetAuthorizedContract(ctx context.Context, req *MsgSetAuthorizedContract) (*MsgSetAuthorizedContractResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SetAuthorizedContract 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: "/cosmos.bridge.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_SetAuthorizedContract_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgSetAuthorizedContract) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).SetAuthorizedContract(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.bridge.v1.Msg/SetAuthorizedContract", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).SetAuthorizedContract(ctx, req.(*MsgSetAuthorizedContract)) + } + return interceptor(ctx, in, info, handler) +} + +var _Msg_serviceDesc = grpc.ServiceDesc{ + ServiceName: "cosmos.bridge.v1.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "UpdateParams", + Handler: _Msg_UpdateParams_Handler, + }, + { + MethodName: "SetAuthorizedContract", + Handler: _Msg_SetAuthorizedContract_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "cosmos/bridge/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 *MsgSetAuthorizedContract) 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 *MsgSetAuthorizedContract) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSetAuthorizedContract) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ContractAddress) > 0 { + i -= len(m.ContractAddress) + copy(dAtA[i:], m.ContractAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.ContractAddress))) + 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 *MsgSetAuthorizedContractResponse) 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 *MsgSetAuthorizedContractResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSetAuthorizedContractResponse) 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 *MsgSetAuthorizedContract) 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.ContractAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgSetAuthorizedContractResponse) 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 *MsgSetAuthorizedContract) 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: MsgSetAuthorizedContract: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSetAuthorizedContract: 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 ContractAddress", 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.ContractAddress = 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 *MsgSetAuthorizedContractResponse) 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: MsgSetAuthorizedContractResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSetAuthorizedContractResponse: 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/svip/client/cli/tx.go b/x/svip/client/cli/tx.go new file mode 100644 index 00000000..a484cc21 --- /dev/null +++ b/x/svip/client/cli/tx.go @@ -0,0 +1,63 @@ +package cli + +import ( + "github.com/spf13/cobra" + + "github.com/cosmos/evm/x/svip/types" + + "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" +) + +// NewTxCmd returns a root CLI command handler for svip transaction commands. +func NewTxCmd() *cobra.Command { + txCmd := &cobra.Command{ + Use: types.ModuleName, + Short: "svip subcommands", + DisableFlagParsing: true, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + + txCmd.AddCommand( + NewFundPoolCmd(), + ) + return txCmd +} + +// NewFundPoolCmd returns a CLI command handler for funding the SVIP reward pool. +func NewFundPoolCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "fund-pool COINS", + Short: "Fund the SVIP reward pool", + Long: "Fund the SVIP reward pool with the specified coins. Example: ogd tx svip fund-pool 1000000000000000000000ogwei --from dev0", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + cliCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + coins, err := sdk.ParseCoinsNormalized(args[0]) + if err != nil { + return err + } + + msg := &types.MsgFundPool{ + Depositor: cliCtx.GetFromAddress().String(), + Amount: coins, + } + + if err := msg.ValidateBasic(); err != nil { + return err + } + + return tx.GenerateOrBroadcastTxCLI(cliCtx, cmd.Flags(), msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + return cmd +} diff --git a/x/svip/genesis.go b/x/svip/genesis.go new file mode 100644 index 00000000..cc7346c9 --- /dev/null +++ b/x/svip/genesis.go @@ -0,0 +1,51 @@ +package svip + +import ( + abci "github.com/cometbft/cometbft/abci/types" + "github.com/cosmos/evm/x/svip/keeper" + "github.com/cosmos/evm/x/svip/types" + + errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// InitGenesis initializes the SVIP module genesis state. +func InitGenesis(ctx sdk.Context, k keeper.Keeper, data types.GenesisState) []abci.ValidatorUpdate { + if err := k.SetParams(ctx, data.Params); err != nil { + panic(errorsmod.Wrap(err, "could not set parameters at genesis")) + } + k.SetActivated(ctx, data.Activated) + k.SetPaused(ctx, data.Paused) + if data.TotalDistributed.IsPositive() { + k.SetTotalDistributed(ctx, data.TotalDistributed) + } + if !data.ActivationTime.IsZero() { + k.SetActivationTime(ctx, data.ActivationTime) + if !data.LastBlockTime.IsZero() { + k.SetLastBlockTime(ctx, data.LastBlockTime) + } else { + k.SetLastBlockTime(ctx, data.ActivationTime) + } + } + if data.TotalPausedSeconds > 0 { + k.SetTotalPausedSeconds(ctx, data.TotalPausedSeconds) + } + if data.PoolBalanceAtActivation.IsPositive() { + k.SetPoolBalanceAtActivation(ctx, data.PoolBalanceAtActivation) + } + return []abci.ValidatorUpdate{} +} + +// ExportGenesis exports the SVIP module genesis state. +func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { + return &types.GenesisState{ + Params: k.GetParams(ctx), + TotalDistributed: k.GetTotalDistributed(ctx), + ActivationTime: k.GetActivationTime(ctx), + PoolBalanceAtActivation: k.GetPoolBalanceAtActivation(ctx), + LastBlockTime: k.GetLastBlockTime(ctx), + TotalPausedSeconds: k.GetTotalPausedSeconds(ctx), + Activated: k.GetActivated(ctx), + Paused: k.GetPaused(ctx), + } +} diff --git a/x/svip/keeper/abci.go b/x/svip/keeper/abci.go new file mode 100644 index 00000000..742bd064 --- /dev/null +++ b/x/svip/keeper/abci.go @@ -0,0 +1,75 @@ +package keeper + +import ( + "github.com/cosmos/evm/x/svip/types" + + sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" +) + +// BeginBlock distributes decayed rewards to FeeCollector. +func (k Keeper) BeginBlock(ctx sdk.Context) error { + // 1. Guard: skip if not active + if !k.GetActivated(ctx) || k.GetPaused(ctx) { + return nil + } + + params := k.GetParams(ctx) + + // 2. Time context + now := ctx.BlockTime() + activationTime := k.GetActivationTime(ctx) + lastBlockTime := k.GetLastBlockTime(ctx) + + totalPausedSec := float64(k.GetTotalPausedSeconds(ctx)) + totalElapsed := now.Sub(activationTime).Seconds() - totalPausedSec + blockDelta := now.Sub(lastBlockTime).Seconds() + + if totalElapsed <= 0 || blockDelta <= 0 { + return nil + } + + // 3. Calculate reward (exponential decay, hardcoded) + poolAtActivation := k.GetPoolBalanceAtActivation(ctx) + reward := CalculateBlockReward(params.HalfLifeSeconds, poolAtActivation, totalElapsed, blockDelta) + + if reward.IsZero() || reward.IsNegative() { + k.SetLastBlockTime(ctx, now) + return nil + } + + // 4. Cap at actual pool balance + poolBalance := k.getPoolBalance(ctx) + if poolBalance.LT(reward) { + reward = poolBalance + } + if reward.IsZero() { + k.SetLastBlockTime(ctx, now) + return nil + } + + // 5. Transfer: svip → fee_collector + denom := k.getDenom(ctx) + coins := sdk.NewCoins(sdk.NewCoin(denom, reward)) + err := k.bk.SendCoinsFromModuleToModule( + ctx, + types.ModuleName, + authtypes.FeeCollectorName, + coins, + ) + if err != nil { + return err + } + + // 6. Bookkeeping + events + k.AddTotalDistributed(ctx, reward) + k.SetLastBlockTime(ctx, now) + + ctx.EventManager().EmitEvent(sdk.NewEvent( + "svip_reward", + sdk.NewAttribute("amount", coins.String()), + sdk.NewAttribute("pool_remaining", k.getPoolBalance(ctx).String()), + )) + + return nil +} diff --git a/x/svip/keeper/keeper.go b/x/svip/keeper/keeper.go new file mode 100644 index 00000000..7abcf594 --- /dev/null +++ b/x/svip/keeper/keeper.go @@ -0,0 +1,221 @@ +package keeper + +import ( + "time" + + "github.com/cosmos/evm/x/svip/types" + evmtypes "github.com/cosmos/evm/x/vm/types" + + "cosmossdk.io/log" + sdkmath "cosmossdk.io/math" + storetypes "cosmossdk.io/store/types" + + "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// Keeper grants access to the SVIP module state. +type Keeper struct { + cdc codec.BinaryCodec + storeKey storetypes.StoreKey + authority sdk.AccAddress + bk types.BankKeeper + ak types.AccountKeeper +} + +// NewKeeper creates a new SVIP keeper. +func NewKeeper( + cdc codec.BinaryCodec, + storeKey storetypes.StoreKey, + authority sdk.AccAddress, + bk types.BankKeeper, + ak types.AccountKeeper, +) Keeper { + if err := sdk.VerifyAddressFormat(authority); err != nil { + panic(err) + } + return Keeper{ + cdc: cdc, + storeKey: storeKey, + authority: authority, + bk: bk, + ak: ak, + } +} + +// Logger returns a module-specific logger. +func (k Keeper) Logger(ctx sdk.Context) log.Logger { + return ctx.Logger().With("module", types.ModuleName) +} + +// --- State accessors --- + +// GetTotalDistributed returns the cumulative amount of tokens distributed. +func (k Keeper) GetTotalDistributed(ctx sdk.Context) sdkmath.Int { + store := ctx.KVStore(k.storeKey) + bz := store.Get(types.TotalDistributedKey) + if bz == nil { + return sdkmath.ZeroInt() + } + var val sdkmath.Int + if err := val.Unmarshal(bz); err != nil { + panic(err) + } + return val +} + +// SetTotalDistributed sets the cumulative amount of tokens distributed. +func (k Keeper) SetTotalDistributed(ctx sdk.Context, val sdkmath.Int) { + store := ctx.KVStore(k.storeKey) + bz, err := val.Marshal() + if err != nil { + panic(err) + } + store.Set(types.TotalDistributedKey, bz) +} + +// AddTotalDistributed increments the total distributed counter by amount. +func (k Keeper) AddTotalDistributed(ctx sdk.Context, amount sdkmath.Int) { + current := k.GetTotalDistributed(ctx) + k.SetTotalDistributed(ctx, current.Add(amount)) +} + +// GetActivationTime returns the time SVIP was activated. +func (k Keeper) GetActivationTime(ctx sdk.Context) time.Time { + store := ctx.KVStore(k.storeKey) + bz := store.Get(types.ActivationTimeKey) + if bz == nil { + return time.Time{} + } + var t time.Time + if err := t.UnmarshalBinary(bz); err != nil { + panic(err) + } + return t +} + +// SetActivationTime stores the time SVIP was activated. +func (k Keeper) SetActivationTime(ctx sdk.Context, t time.Time) { + store := ctx.KVStore(k.storeKey) + bz, err := t.MarshalBinary() + if err != nil { + panic(err) + } + store.Set(types.ActivationTimeKey, bz) +} + +// GetLastBlockTime returns the timestamp of the last processed block. +func (k Keeper) GetLastBlockTime(ctx sdk.Context) time.Time { + store := ctx.KVStore(k.storeKey) + bz := store.Get(types.LastBlockTimeKey) + if bz == nil { + return time.Time{} + } + var t time.Time + if err := t.UnmarshalBinary(bz); err != nil { + panic(err) + } + return t +} + +// SetLastBlockTime stores the timestamp of the last processed block. +func (k Keeper) SetLastBlockTime(ctx sdk.Context, t time.Time) { + store := ctx.KVStore(k.storeKey) + bz, err := t.MarshalBinary() + if err != nil { + panic(err) + } + store.Set(types.LastBlockTimeKey, bz) +} + +// GetPoolBalanceAtActivation returns the pool balance snapshot at activation time. +func (k Keeper) GetPoolBalanceAtActivation(ctx sdk.Context) sdkmath.Int { + store := ctx.KVStore(k.storeKey) + bz := store.Get(types.PoolBalanceAtActivationKey) + if bz == nil { + return sdkmath.ZeroInt() + } + var val sdkmath.Int + if err := val.Unmarshal(bz); err != nil { + panic(err) + } + return val +} + +// SetPoolBalanceAtActivation stores the pool balance snapshot at activation time. +func (k Keeper) SetPoolBalanceAtActivation(ctx sdk.Context, val sdkmath.Int) { + store := ctx.KVStore(k.storeKey) + bz, err := val.Marshal() + if err != nil { + panic(err) + } + store.Set(types.PoolBalanceAtActivationKey, bz) +} + +// GetTotalPausedSeconds returns the cumulative seconds SVIP has been paused. +func (k Keeper) GetTotalPausedSeconds(ctx sdk.Context) int64 { + store := ctx.KVStore(k.storeKey) + bz := store.Get(types.TotalPausedSecondsKey) + if bz == nil { + return 0 + } + var val sdkmath.Int + if err := val.Unmarshal(bz); err != nil { + panic(err) + } + return val.Int64() +} + +// SetTotalPausedSeconds stores the cumulative seconds SVIP has been paused. +func (k Keeper) SetTotalPausedSeconds(ctx sdk.Context, secs int64) { + store := ctx.KVStore(k.storeKey) + val := sdkmath.NewInt(secs) + bz, err := val.Marshal() + if err != nil { + panic(err) + } + store.Set(types.TotalPausedSecondsKey, bz) +} + +var isTrue = []byte("0x01") + +// GetActivated returns whether SVIP reward distribution is active. +func (k Keeper) GetActivated(ctx sdk.Context) bool { + return ctx.KVStore(k.storeKey).Has(types.ActivatedKey) +} + +// SetActivated stores the activated flag using a presence-based pattern. +func (k Keeper) SetActivated(ctx sdk.Context, activated bool) { + store := ctx.KVStore(k.storeKey) + if activated { + store.Set(types.ActivatedKey, isTrue) + return + } + store.Delete(types.ActivatedKey) +} + +// GetPaused returns whether SVIP is in emergency pause state. +func (k Keeper) GetPaused(ctx sdk.Context) bool { + return ctx.KVStore(k.storeKey).Has(types.PausedKey) +} + +// SetPaused stores the paused flag using a presence-based pattern. +func (k Keeper) SetPaused(ctx sdk.Context, paused bool) { + store := ctx.KVStore(k.storeKey) + if paused { + store.Set(types.PausedKey, isTrue) + return + } + store.Delete(types.PausedKey) +} + +// getPoolBalance reads the live pool balance from x/bank (not from custom state). +func (k Keeper) getPoolBalance(ctx sdk.Context) sdkmath.Int { + moduleAddr := k.ak.GetModuleAddress(types.ModuleName) + return k.bk.GetBalance(ctx, moduleAddr, k.getDenom(ctx)).Amount +} + +// getDenom returns the native denom at runtime via the EVM module's global config. +func (k Keeper) getDenom(_ sdk.Context) string { + return evmtypes.GetEVMCoinDenom() +} diff --git a/x/svip/keeper/keeper_test.go b/x/svip/keeper/keeper_test.go new file mode 100644 index 00000000..add652d2 --- /dev/null +++ b/x/svip/keeper/keeper_test.go @@ -0,0 +1,275 @@ +package keeper_test + +import ( + "testing" + "time" + + "github.com/stretchr/testify/require" + + evmencoding "github.com/cosmos/evm/encoding" + testconstants "github.com/cosmos/evm/testutil/constants" + "github.com/cosmos/evm/x/svip/keeper" + "github.com/cosmos/evm/x/svip/types" + "github.com/cosmos/evm/x/svip/types/mocks" + vmtypes "github.com/cosmos/evm/x/vm/types" + + sdkmath "cosmossdk.io/math" + storetypes "cosmossdk.io/store/types" + + "github.com/cosmos/cosmos-sdk/testutil" + sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" +) + +type testData struct { + ctx sdk.Context + keeper keeper.Keeper + storeKey *storetypes.KVStoreKey + bk *mocks.BankKeeper + ak *mocks.AccountKeeper +} + +func newMockedTestData(t *testing.T) testData { + t.Helper() + + storeKey := storetypes.NewKVStoreKey(types.ModuleName) + tKey := storetypes.NewTransientStoreKey("transient_test") + ctx := testutil.DefaultContext(storeKey, tKey) //nolint: staticcheck + + bk := mocks.NewBankKeeper(t) + ak := mocks.NewAccountKeeper(t) + + authority := authtypes.NewModuleAddress(govtypes.ModuleName) + + chainID := testconstants.SixDecimalsChainID.EVMChainID + cfg := evmencoding.MakeConfig(chainID) + cdc := cfg.Codec + k := keeper.NewKeeper(cdc, storeKey, authority, bk, ak) //nolint: staticcheck + evmConfigurator := vmtypes.NewEVMConfigurator(). + WithEVMCoinInfo(testconstants.ExampleChainCoinInfo[testconstants.SixDecimalsChainID]) + evmConfigurator.ResetTestConfig() + err := evmConfigurator.Configure() + require.NoError(t, err) + + return testData{ + ctx: ctx, + keeper: k, + storeKey: storeKey, + bk: bk, + ak: ak, + } +} + +func TestGetSetParams(t *testing.T) { + td := newMockedTestData(t) + + // Default params when nothing set + params := td.keeper.GetParams(td.ctx) + require.Equal(t, types.DefaultParams(), params) + + // Set custom params and read back + custom := types.Params{ + HalfLifeSeconds: 31536000, + } + require.NoError(t, td.keeper.SetParams(td.ctx, custom)) + got := td.keeper.GetParams(td.ctx) + require.Equal(t, custom, got) +} + +func TestGetSetActivated(t *testing.T) { + td := newMockedTestData(t) + + // Default is false + require.False(t, td.keeper.GetActivated(td.ctx)) + + // Set true and read back + td.keeper.SetActivated(td.ctx, true) + require.True(t, td.keeper.GetActivated(td.ctx)) + + // Set false and read back + td.keeper.SetActivated(td.ctx, false) + require.False(t, td.keeper.GetActivated(td.ctx)) +} + +func TestGetSetPaused(t *testing.T) { + td := newMockedTestData(t) + + // Default is false + require.False(t, td.keeper.GetPaused(td.ctx)) + + // Set true and read back + td.keeper.SetPaused(td.ctx, true) + require.True(t, td.keeper.GetPaused(td.ctx)) + + // Set false and read back + td.keeper.SetPaused(td.ctx, false) + require.False(t, td.keeper.GetPaused(td.ctx)) +} + +func TestGetSetTotalDistributed(t *testing.T) { + td := newMockedTestData(t) + + // Default is zero + require.True(t, td.keeper.GetTotalDistributed(td.ctx).IsZero()) + + // Set and read back + td.keeper.SetTotalDistributed(td.ctx, sdkmath.NewInt(500)) + require.Equal(t, sdkmath.NewInt(500), td.keeper.GetTotalDistributed(td.ctx)) + + // AddTotalDistributed accumulates + td.keeper.AddTotalDistributed(td.ctx, sdkmath.NewInt(300)) + require.Equal(t, sdkmath.NewInt(800), td.keeper.GetTotalDistributed(td.ctx)) +} + +func TestGetSetActivationTime(t *testing.T) { + td := newMockedTestData(t) + + // Default is zero time + require.True(t, td.keeper.GetActivationTime(td.ctx).IsZero()) + + // Set and read back + now := time.Now().UTC().Truncate(time.Second) + td.keeper.SetActivationTime(td.ctx, now) + require.Equal(t, now, td.keeper.GetActivationTime(td.ctx).UTC().Truncate(time.Second)) +} + +func TestGetSetLastBlockTime(t *testing.T) { + td := newMockedTestData(t) + + // Default is zero time + require.True(t, td.keeper.GetLastBlockTime(td.ctx).IsZero()) + + // Set and read back + now := time.Now().UTC().Truncate(time.Second) + td.keeper.SetLastBlockTime(td.ctx, now) + require.Equal(t, now, td.keeper.GetLastBlockTime(td.ctx).UTC().Truncate(time.Second)) +} + +func TestGetSetPoolBalanceAtActivation(t *testing.T) { + td := newMockedTestData(t) + + // Default is zero + require.True(t, td.keeper.GetPoolBalanceAtActivation(td.ctx).IsZero()) + + // Set and read back + val := sdkmath.NewInt(1_000_000_000) + td.keeper.SetPoolBalanceAtActivation(td.ctx, val) + require.Equal(t, val, td.keeper.GetPoolBalanceAtActivation(td.ctx)) +} + +func TestBeginBlock_NotActivated(t *testing.T) { + td := newMockedTestData(t) + + // Default params: not activated — should skip without any bank calls + err := td.keeper.BeginBlock(td.ctx) + require.NoError(t, err) + + // Bank keeper should not have been called + td.bk.AssertNotCalled(t, "SendCoinsFromModuleToModule") +} + +func TestBeginBlock_Paused(t *testing.T) { + td := newMockedTestData(t) + + require.NoError(t, td.keeper.SetParams(td.ctx, types.Params{HalfLifeSeconds: 31536000})) + td.keeper.SetActivated(td.ctx, true) + td.keeper.SetPaused(td.ctx, true) + + err := td.keeper.BeginBlock(td.ctx) + require.NoError(t, err) + + td.bk.AssertNotCalled(t, "SendCoinsFromModuleToModule") +} + +func TestBeginBlock_Distributes(t *testing.T) { + td := newMockedTestData(t) + + denom := vmtypes.GetEVMCoinDenom() + halfLife := int64(31536000) + poolBalance := sdkmath.NewInt(1_000_000_000_000) + + // Set params and activate + require.NoError(t, td.keeper.SetParams(td.ctx, types.Params{HalfLifeSeconds: halfLife})) + td.keeper.SetActivated(td.ctx, true) + + // Set activation state + activationTime := time.Date(2025, 1, 1, 0, 0, 0, 0, time.UTC) + td.keeper.SetActivationTime(td.ctx, activationTime) + td.keeper.SetLastBlockTime(td.ctx, activationTime.Add(95*time.Second)) + td.keeper.SetPoolBalanceAtActivation(td.ctx, poolBalance) + + // Set block time to 100s after activation + blockTime := activationTime.Add(100 * time.Second) + ctx := td.ctx.WithBlockTime(blockTime) + + // Calculate expected reward + reward := keeper.CalculateBlockReward(halfLife, poolBalance, 100, 5) + require.True(t, reward.IsPositive()) + + moduleAddr := authtypes.NewModuleAddress(types.ModuleName) + + // Mock: GetModuleAddress returns the svip module addr + td.ak.On("GetModuleAddress", types.ModuleName).Return(moduleAddr) + // Mock: GetBalance returns the pool balance + td.bk.On("GetBalance", ctx, moduleAddr, denom).Return(sdk.NewCoin(denom, poolBalance)) + // Mock: SendCoinsFromModuleToModule succeeds + td.bk.On("SendCoinsFromModuleToModule", + ctx, + types.ModuleName, + authtypes.FeeCollectorName, + sdk.NewCoins(sdk.NewCoin(denom, reward)), + ).Return(nil) + // Mock: GetBalance for post-distribution event (pool_remaining) + td.bk.On("GetBalance", ctx, moduleAddr, denom).Return(sdk.NewCoin(denom, poolBalance.Sub(reward))) + + err := td.keeper.BeginBlock(ctx) + require.NoError(t, err) + + // Verify bookkeeping + require.Equal(t, reward, td.keeper.GetTotalDistributed(ctx)) + require.Equal(t, blockTime, td.keeper.GetLastBlockTime(ctx).UTC()) + + td.bk.AssertCalled(t, "SendCoinsFromModuleToModule", + ctx, types.ModuleName, authtypes.FeeCollectorName, + sdk.NewCoins(sdk.NewCoin(denom, reward)), + ) +} + +func TestBeginBlock_CapsAtPoolBalance(t *testing.T) { + td := newMockedTestData(t) + + denom := vmtypes.GetEVMCoinDenom() + halfLife := int64(31536000) + poolAtActivation := sdkmath.NewInt(1_000_000_000_000) + // Remaining pool balance is tiny — smaller than calculated reward + tinyBalance := sdkmath.NewInt(1) + + require.NoError(t, td.keeper.SetParams(td.ctx, types.Params{HalfLifeSeconds: halfLife})) + td.keeper.SetActivated(td.ctx, true) + + activationTime := time.Date(2025, 1, 1, 0, 0, 0, 0, time.UTC) + td.keeper.SetActivationTime(td.ctx, activationTime) + td.keeper.SetLastBlockTime(td.ctx, activationTime.Add(95*time.Second)) + td.keeper.SetPoolBalanceAtActivation(td.ctx, poolAtActivation) + + blockTime := activationTime.Add(100 * time.Second) + ctx := td.ctx.WithBlockTime(blockTime) + + moduleAddr := authtypes.NewModuleAddress(types.ModuleName) + + td.ak.On("GetModuleAddress", types.ModuleName).Return(moduleAddr) + td.bk.On("GetBalance", ctx, moduleAddr, denom).Return(sdk.NewCoin(denom, tinyBalance)) + // The send should use tinyBalance (the cap), not the calculated reward + td.bk.On("SendCoinsFromModuleToModule", + ctx, + types.ModuleName, + authtypes.FeeCollectorName, + sdk.NewCoins(sdk.NewCoin(denom, tinyBalance)), + ).Return(nil) + + err := td.keeper.BeginBlock(ctx) + require.NoError(t, err) + + require.Equal(t, tinyBalance, td.keeper.GetTotalDistributed(ctx)) +} diff --git a/x/svip/keeper/msg_server.go b/x/svip/keeper/msg_server.go new file mode 100644 index 00000000..41625c28 --- /dev/null +++ b/x/svip/keeper/msg_server.go @@ -0,0 +1,172 @@ +package keeper + +import ( + "context" + "fmt" + + "github.com/cosmos/evm/x/svip/types" + + errorsmod "cosmossdk.io/errors" + sdkmath "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" +) + +// msgServer implements the SVIP MsgServer interface. +type msgServer struct { + Keeper +} + +// NewMsgServerImpl returns an implementation of the SVIP MsgServer interface. +func NewMsgServerImpl(k Keeper) types.MsgServer { + return &msgServer{Keeper: k} +} + +var _ types.MsgServer = msgServer{} + +// UpdateParams updates the SVIP module parameters. Governance-only. +func (s msgServer) UpdateParams(goCtx context.Context, msg *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { + if s.authority.String() != msg.Authority { + return nil, errorsmod.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", s.authority.String(), msg.Authority) + } + ctx := sdk.UnwrapSDKContext(goCtx) + + // Governance guardrails + current := s.GetParams(ctx) + if s.GetActivated(ctx) && current.HalfLifeSeconds > 0 && msg.Params.HalfLifeSeconds > 0 { + // Reject if half_life changes by more than 50% + oldHL := float64(current.HalfLifeSeconds) + newHL := float64(msg.Params.HalfLifeSeconds) + ratio := newHL / oldHL + if ratio < 0.5 || ratio > 1.5 { + return nil, types.ErrHalfLifeChange + } + } + if msg.Params.HalfLifeSeconds > 0 && msg.Params.HalfLifeSeconds < 31536000 { + return nil, errorsmod.Wrap(govtypes.ErrInvalidProposalMsg, "half_life_seconds must be >= 1 year (31536000s)") + } + + if err := s.SetParams(ctx, msg.Params); err != nil { + return nil, err + } + return &types.MsgUpdateParamsResponse{}, nil +} + +// Activate activates SVIP reward distribution. Governance-only. +func (s msgServer) Activate(goCtx context.Context, msg *types.MsgActivate) (*types.MsgActivateResponse, error) { + if s.authority.String() != msg.Authority { + return nil, errorsmod.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", s.authority.String(), msg.Authority) + } + ctx := sdk.UnwrapSDKContext(goCtx) + + if s.GetActivated(ctx) { + return nil, types.ErrAlreadyActivated + } + + params := s.GetParams(ctx) + if params.HalfLifeSeconds <= 0 { + return nil, errorsmod.Wrap(govtypes.ErrInvalidProposalMsg, "half_life_seconds must be set before activation") + } + + // Snapshot pool balance + poolBalance := s.getPoolBalance(ctx) + if poolBalance.IsZero() { + return nil, types.ErrPoolNotFunded + } + s.SetPoolBalanceAtActivation(ctx, poolBalance) + + // Activate + s.SetActivated(ctx, true) + s.SetActivationTime(ctx, ctx.BlockTime()) + s.SetLastBlockTime(ctx, ctx.BlockTime()) + + ctx.EventManager().EmitEvent(sdk.NewEvent( + "svip_activated", + sdk.NewAttribute("pool_balance", poolBalance.String()), + sdk.NewAttribute("half_life_seconds", fmt.Sprintf("%d", params.HalfLifeSeconds)), + )) + + return &types.MsgActivateResponse{}, nil +} + +// Reactivate restarts the SVIP decay curve with a fresh pool snapshot. Governance-only. +func (s msgServer) Reactivate(goCtx context.Context, msg *types.MsgReactivate) (*types.MsgReactivateResponse, error) { + if s.authority.String() != msg.Authority { + return nil, errorsmod.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", s.authority.String(), msg.Authority) + } + ctx := sdk.UnwrapSDKContext(goCtx) + + if !s.GetActivated(ctx) { + return nil, types.ErrNotYetActivated + } + + // Re-snapshot pool balance and restart the decay curve + poolBalance := s.getPoolBalance(ctx) + if poolBalance.IsZero() { + return nil, types.ErrPoolNotFunded + } + s.SetPoolBalanceAtActivation(ctx, poolBalance) + s.SetActivationTime(ctx, ctx.BlockTime()) + s.SetLastBlockTime(ctx, ctx.BlockTime()) + + // Reset cumulative counters for the new curve + s.SetTotalDistributed(ctx, sdkmath.ZeroInt()) + s.SetTotalPausedSeconds(ctx, 0) + + // Clear paused state if reactivating while paused + s.SetPaused(ctx, false) + + params := s.GetParams(ctx) + ctx.EventManager().EmitEvent(sdk.NewEvent( + "svip_reactivated", + sdk.NewAttribute("pool_balance", poolBalance.String()), + sdk.NewAttribute("half_life_seconds", fmt.Sprintf("%d", params.HalfLifeSeconds)), + )) + + return &types.MsgReactivateResponse{}, nil +} + +// Pause sets or clears the emergency pause flag. Governance-only. +func (s msgServer) Pause(goCtx context.Context, msg *types.MsgPause) (*types.MsgPauseResponse, error) { + if s.authority.String() != msg.Authority { + return nil, errorsmod.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", s.authority.String(), msg.Authority) + } + ctx := sdk.UnwrapSDKContext(goCtx) + wasPaused := s.GetPaused(ctx) + s.SetPaused(ctx, msg.Paused) + + // On unpause: accumulate paused duration + reset LastBlockTime + if wasPaused && !msg.Paused { + lastBlock := s.GetLastBlockTime(ctx) + pausedGap := int64(ctx.BlockTime().Sub(lastBlock).Seconds()) + if pausedGap > 0 { + s.SetTotalPausedSeconds(ctx, s.GetTotalPausedSeconds(ctx)+pausedGap) + } + s.SetLastBlockTime(ctx, ctx.BlockTime()) + } + + return &types.MsgPauseResponse{}, nil +} + +// FundPool deposits coins into the SVIP reward pool. +func (s msgServer) FundPool(goCtx context.Context, msg *types.MsgFundPool) (*types.MsgFundPoolResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + depositor, err := sdk.AccAddressFromBech32(msg.Depositor) + if err != nil { + return nil, err + } + + // Validate that only the native denom is sent to the pool + denom := s.getDenom(ctx) + for _, coin := range msg.Amount { + if coin.Denom != denom { + return nil, errorsmod.Wrapf(sdkerrors.ErrInvalidCoins, "invalid denom %s, expected %s", coin.Denom, denom) + } + } + + if err := s.bk.SendCoinsFromAccountToModule(ctx, depositor, types.ModuleName, msg.Amount); err != nil { + return nil, err + } + return &types.MsgFundPoolResponse{}, nil +} diff --git a/x/svip/keeper/msg_server_test.go b/x/svip/keeper/msg_server_test.go new file mode 100644 index 00000000..e525963e --- /dev/null +++ b/x/svip/keeper/msg_server_test.go @@ -0,0 +1,408 @@ +package keeper_test + +import ( + "testing" + "time" + + "github.com/stretchr/testify/mock" + "github.com/stretchr/testify/require" + + "github.com/cosmos/evm/x/svip/keeper" + "github.com/cosmos/evm/x/svip/types" + vmtypes "github.com/cosmos/evm/x/vm/types" + + sdkmath "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" +) + +func govAuthority() string { + return authtypes.NewModuleAddress(govtypes.ModuleName).String() +} + +func TestUpdateParams_InvalidAuthority(t *testing.T) { + td := newMockedTestData(t) + srv := keeper.NewMsgServerImpl(td.keeper) + + _, err := srv.UpdateParams(td.ctx, &types.MsgUpdateParams{ + Authority: "invalid", + Params: types.DefaultParams(), + }) + require.ErrorContains(t, err, "invalid authority") +} + +func TestUpdateParams_HalfLifeChangeCap(t *testing.T) { + td := newMockedTestData(t) + srv := keeper.NewMsgServerImpl(td.keeper) + + require.NoError(t, td.keeper.SetParams(td.ctx, types.Params{HalfLifeSeconds: 100_000_000})) + td.keeper.SetActivated(td.ctx, true) + + // >50% increase (1.6x) should fail + _, err := srv.UpdateParams(td.ctx, &types.MsgUpdateParams{ + Authority: govAuthority(), + Params: types.Params{HalfLifeSeconds: 160_000_000}, + }) + require.ErrorIs(t, err, types.ErrHalfLifeChange) + + // >50% decrease (0.4x) should fail + _, err = srv.UpdateParams(td.ctx, &types.MsgUpdateParams{ + Authority: govAuthority(), + Params: types.Params{HalfLifeSeconds: 40_000_000}, + }) + require.ErrorIs(t, err, types.ErrHalfLifeChange) + + // Exact 0.5x boundary (ratio == 0.5) should pass + _, err = srv.UpdateParams(td.ctx, &types.MsgUpdateParams{ + Authority: govAuthority(), + Params: types.Params{HalfLifeSeconds: 50_000_000}, + }) + require.NoError(t, err) + + // Reset to 100M for next boundary test + require.NoError(t, td.keeper.SetParams(td.ctx, types.Params{HalfLifeSeconds: 100_000_000})) + + // Exact 1.5x boundary (ratio == 1.5) should pass + _, err = srv.UpdateParams(td.ctx, &types.MsgUpdateParams{ + Authority: govAuthority(), + Params: types.Params{HalfLifeSeconds: 150_000_000}, + }) + require.NoError(t, err) + + // Reset to 100M for next test + require.NoError(t, td.keeper.SetParams(td.ctx, types.Params{HalfLifeSeconds: 100_000_000})) + + // Within 50% (1.3x) should pass + _, err = srv.UpdateParams(td.ctx, &types.MsgUpdateParams{ + Authority: govAuthority(), + Params: types.Params{HalfLifeSeconds: 130_000_000}, + }) + require.NoError(t, err) +} + +func TestUpdateParams_HalfLifeMinimum(t *testing.T) { + td := newMockedTestData(t) + srv := keeper.NewMsgServerImpl(td.keeper) + + _, err := srv.UpdateParams(td.ctx, &types.MsgUpdateParams{ + Authority: govAuthority(), + Params: types.Params{HalfLifeSeconds: 1000}, // < 1 year + }) + require.ErrorContains(t, err, "half_life_seconds must be >= 1 year") +} + +func TestUpdateParams_HappyPath(t *testing.T) { + td := newMockedTestData(t) + srv := keeper.NewMsgServerImpl(td.keeper) + + newParams := types.Params{HalfLifeSeconds: 63072000} // 2 years + _, err := srv.UpdateParams(td.ctx, &types.MsgUpdateParams{ + Authority: govAuthority(), + Params: newParams, + }) + require.NoError(t, err) + require.Equal(t, newParams, td.keeper.GetParams(td.ctx)) +} + +func TestActivate_InvalidAuthority(t *testing.T) { + td := newMockedTestData(t) + srv := keeper.NewMsgServerImpl(td.keeper) + + _, err := srv.Activate(td.ctx, &types.MsgActivate{Authority: "bad"}) + require.ErrorContains(t, err, "invalid authority") +} + +func TestActivate_AlreadyActivated(t *testing.T) { + td := newMockedTestData(t) + srv := keeper.NewMsgServerImpl(td.keeper) + + require.NoError(t, td.keeper.SetParams(td.ctx, types.Params{HalfLifeSeconds: 31536000})) + td.keeper.SetActivated(td.ctx, true) + + _, err := srv.Activate(td.ctx, &types.MsgActivate{Authority: govAuthority()}) + require.ErrorIs(t, err, types.ErrAlreadyActivated) +} + +func TestActivate_MissingHalfLife(t *testing.T) { + td := newMockedTestData(t) + srv := keeper.NewMsgServerImpl(td.keeper) + + // Default params: half_life = 0 + _, err := srv.Activate(td.ctx, &types.MsgActivate{Authority: govAuthority()}) + require.ErrorContains(t, err, "half_life_seconds must be set") +} + +func TestActivate_PoolNotFunded(t *testing.T) { + td := newMockedTestData(t) + srv := keeper.NewMsgServerImpl(td.keeper) + + require.NoError(t, td.keeper.SetParams(td.ctx, types.Params{HalfLifeSeconds: 31536000})) + + denom := vmtypes.GetEVMCoinDenom() + moduleAddr := authtypes.NewModuleAddress(types.ModuleName) + td.ak.On("GetModuleAddress", types.ModuleName).Return(moduleAddr) + td.bk.On("GetBalance", mock.Anything, moduleAddr, denom).Return(sdk.NewCoin(denom, sdkmath.ZeroInt())) + + _, err := srv.Activate(td.ctx, &types.MsgActivate{Authority: govAuthority()}) + require.ErrorIs(t, err, types.ErrPoolNotFunded) +} + +func TestActivate_HappyPath(t *testing.T) { + td := newMockedTestData(t) + srv := keeper.NewMsgServerImpl(td.keeper) + + halfLife := int64(31536000) + poolBalance := sdkmath.NewInt(1_000_000_000_000) + + require.NoError(t, td.keeper.SetParams(td.ctx, types.Params{HalfLifeSeconds: halfLife})) + + denom := vmtypes.GetEVMCoinDenom() + moduleAddr := authtypes.NewModuleAddress(types.ModuleName) + td.ak.On("GetModuleAddress", types.ModuleName).Return(moduleAddr) + td.bk.On("GetBalance", mock.Anything, moduleAddr, denom).Return(sdk.NewCoin(denom, poolBalance)) + + blockTime := time.Date(2025, 6, 1, 0, 0, 0, 0, time.UTC) + ctx := td.ctx.WithBlockTime(blockTime) + + _, err := srv.Activate(ctx, &types.MsgActivate{Authority: govAuthority()}) + require.NoError(t, err) + + require.True(t, td.keeper.GetActivated(ctx)) + require.Equal(t, poolBalance, td.keeper.GetPoolBalanceAtActivation(ctx)) + require.Equal(t, blockTime, td.keeper.GetActivationTime(ctx).UTC()) + require.Equal(t, blockTime, td.keeper.GetLastBlockTime(ctx).UTC()) +} + +func TestReactivate_NotActivated(t *testing.T) { + td := newMockedTestData(t) + srv := keeper.NewMsgServerImpl(td.keeper) + + _, err := srv.Reactivate(td.ctx, &types.MsgReactivate{Authority: govAuthority()}) + require.ErrorIs(t, err, types.ErrNotYetActivated) +} + +func TestReactivate_PoolNotFunded(t *testing.T) { + td := newMockedTestData(t) + srv := keeper.NewMsgServerImpl(td.keeper) + + require.NoError(t, td.keeper.SetParams(td.ctx, types.Params{HalfLifeSeconds: 31536000})) + td.keeper.SetActivated(td.ctx, true) + + denom := vmtypes.GetEVMCoinDenom() + moduleAddr := authtypes.NewModuleAddress(types.ModuleName) + td.ak.On("GetModuleAddress", types.ModuleName).Return(moduleAddr) + td.bk.On("GetBalance", mock.Anything, moduleAddr, denom).Return(sdk.NewCoin(denom, sdkmath.ZeroInt())) + + _, err := srv.Reactivate(td.ctx, &types.MsgReactivate{Authority: govAuthority()}) + require.ErrorIs(t, err, types.ErrPoolNotFunded) +} + +func TestReactivate_ClearsPaused(t *testing.T) { + td := newMockedTestData(t) + srv := keeper.NewMsgServerImpl(td.keeper) + + require.NoError(t, td.keeper.SetParams(td.ctx, types.Params{HalfLifeSeconds: 31536000})) + td.keeper.SetActivated(td.ctx, true) + td.keeper.SetPaused(td.ctx, true) + td.keeper.SetTotalPausedSeconds(td.ctx, 500) + + poolBalance := sdkmath.NewInt(1_000_000_000_000) + denom := vmtypes.GetEVMCoinDenom() + moduleAddr := authtypes.NewModuleAddress(types.ModuleName) + td.ak.On("GetModuleAddress", types.ModuleName).Return(moduleAddr) + td.bk.On("GetBalance", mock.Anything, moduleAddr, denom).Return(sdk.NewCoin(denom, poolBalance)) + + blockTime := time.Date(2025, 7, 1, 0, 0, 0, 0, time.UTC) + ctx := td.ctx.WithBlockTime(blockTime) + + _, err := srv.Reactivate(ctx, &types.MsgReactivate{Authority: govAuthority()}) + require.NoError(t, err) + + require.False(t, td.keeper.GetPaused(ctx), "reactivate should clear paused flag") + require.Equal(t, int64(0), td.keeper.GetTotalPausedSeconds(ctx)) + require.True(t, td.keeper.GetTotalDistributed(ctx).IsZero()) +} + +func TestReactivate_HappyPath(t *testing.T) { + td := newMockedTestData(t) + srv := keeper.NewMsgServerImpl(td.keeper) + + require.NoError(t, td.keeper.SetParams(td.ctx, types.Params{HalfLifeSeconds: 31536000})) + td.keeper.SetActivated(td.ctx, true) + td.keeper.SetTotalDistributed(td.ctx, sdkmath.NewInt(5000)) + + newPoolBalance := sdkmath.NewInt(500_000_000_000) + denom := vmtypes.GetEVMCoinDenom() + moduleAddr := authtypes.NewModuleAddress(types.ModuleName) + td.ak.On("GetModuleAddress", types.ModuleName).Return(moduleAddr) + td.bk.On("GetBalance", mock.Anything, moduleAddr, denom).Return(sdk.NewCoin(denom, newPoolBalance)) + + blockTime := time.Date(2025, 8, 1, 0, 0, 0, 0, time.UTC) + ctx := td.ctx.WithBlockTime(blockTime) + + _, err := srv.Reactivate(ctx, &types.MsgReactivate{Authority: govAuthority()}) + require.NoError(t, err) + + require.Equal(t, newPoolBalance, td.keeper.GetPoolBalanceAtActivation(ctx)) + require.Equal(t, blockTime, td.keeper.GetActivationTime(ctx).UTC()) + require.True(t, td.keeper.GetTotalDistributed(ctx).IsZero()) + require.Equal(t, int64(0), td.keeper.GetTotalPausedSeconds(ctx)) +} + +func TestPause_InvalidAuthority(t *testing.T) { + td := newMockedTestData(t) + srv := keeper.NewMsgServerImpl(td.keeper) + + _, err := srv.Pause(td.ctx, &types.MsgPause{Authority: "bad", Paused: true}) + require.ErrorContains(t, err, "invalid authority") +} + +func TestPause_AccumulatesPausedDuration(t *testing.T) { + td := newMockedTestData(t) + srv := keeper.NewMsgServerImpl(td.keeper) + + // Start with activated + paused + require.NoError(t, td.keeper.SetParams(td.ctx, types.Params{HalfLifeSeconds: 31536000})) + td.keeper.SetActivated(td.ctx, true) + td.keeper.SetPaused(td.ctx, true) + + pauseStart := time.Date(2025, 1, 1, 0, 0, 0, 0, time.UTC) + td.keeper.SetLastBlockTime(td.ctx, pauseStart) + + // Unpause 100 seconds later + unpauseTime := pauseStart.Add(100 * time.Second) + ctx := td.ctx.WithBlockTime(unpauseTime) + + _, err := srv.Pause(ctx, &types.MsgPause{Authority: govAuthority(), Paused: false}) + require.NoError(t, err) + + require.Equal(t, int64(100), td.keeper.GetTotalPausedSeconds(ctx)) + require.Equal(t, unpauseTime, td.keeper.GetLastBlockTime(ctx).UTC()) + + // Verify paused flag cleared + require.False(t, td.keeper.GetPaused(ctx)) +} + +func TestPause_HappyPath(t *testing.T) { + td := newMockedTestData(t) + srv := keeper.NewMsgServerImpl(td.keeper) + + // Set LastBlockTime so unpause has a valid reference point + td.keeper.SetLastBlockTime(td.ctx, td.ctx.BlockTime()) + + // Pause + _, err := srv.Pause(td.ctx, &types.MsgPause{Authority: govAuthority(), Paused: true}) + require.NoError(t, err) + require.True(t, td.keeper.GetPaused(td.ctx)) + + // Unpause + _, err = srv.Pause(td.ctx, &types.MsgPause{Authority: govAuthority(), Paused: false}) + require.NoError(t, err) + require.False(t, td.keeper.GetPaused(td.ctx)) +} + +func TestFundPool_InvalidDepositor(t *testing.T) { + td := newMockedTestData(t) + srv := keeper.NewMsgServerImpl(td.keeper) + + _, err := srv.FundPool(td.ctx, &types.MsgFundPool{ + Depositor: "invalid", + Amount: sdk.NewCoins(sdk.NewInt64Coin("ogwei", 1000)), + }) + require.Error(t, err) +} + +func TestFundPool_WrongDenom(t *testing.T) { + td := newMockedTestData(t) + srv := keeper.NewMsgServerImpl(td.keeper) + + depositor := authtypes.NewModuleAddress(govtypes.ModuleName).String() + + _, err := srv.FundPool(td.ctx, &types.MsgFundPool{ + Depositor: depositor, + Amount: sdk.NewCoins(sdk.NewInt64Coin("wrongdenom", 1000)), + }) + require.ErrorContains(t, err, "invalid denom") +} + +func TestFundPool_HappyPath(t *testing.T) { + td := newMockedTestData(t) + srv := keeper.NewMsgServerImpl(td.keeper) + + denom := vmtypes.GetEVMCoinDenom() + depositor := authtypes.NewModuleAddress(govtypes.ModuleName) + amount := sdk.NewCoins(sdk.NewInt64Coin(denom, 1000)) + + td.bk.On("SendCoinsFromAccountToModule", td.ctx, depositor, types.ModuleName, amount).Return(nil) + + _, err := srv.FundPool(td.ctx, &types.MsgFundPool{ + Depositor: depositor.String(), + Amount: amount, + }) + require.NoError(t, err) + + td.bk.AssertCalled(t, "SendCoinsFromAccountToModule", td.ctx, depositor, types.ModuleName, amount) +} + +func TestBeginBlock_AfterPauseUnpause(t *testing.T) { + td := newMockedTestData(t) + srv := keeper.NewMsgServerImpl(td.keeper) + + denom := vmtypes.GetEVMCoinDenom() + halfLife := int64(31536000) // 1 year + poolBalance := sdkmath.NewInt(1_000_000_000_000_000) + moduleAddr := authtypes.NewModuleAddress(types.ModuleName) + + td.ak.On("GetModuleAddress", types.ModuleName).Return(moduleAddr) + td.bk.On("GetBalance", mock.Anything, moduleAddr, denom).Return(sdk.NewCoin(denom, poolBalance)) + td.bk.On("SendCoinsFromModuleToModule", + mock.Anything, types.ModuleName, authtypes.FeeCollectorName, mock.Anything, + ).Return(nil) + + // 1. Activate at T=0 + require.NoError(t, td.keeper.SetParams(td.ctx, types.Params{HalfLifeSeconds: halfLife})) + activationTime := time.Date(2025, 1, 1, 0, 0, 0, 0, time.UTC) + ctx := td.ctx.WithBlockTime(activationTime) + _, err := srv.Activate(ctx, &types.MsgActivate{Authority: govAuthority()}) + require.NoError(t, err) + + // 2. Run BeginBlock at T=100s (normal distribution) + t100 := activationTime.Add(100 * time.Second) + ctx100 := td.ctx.WithBlockTime(t100) + err = td.keeper.BeginBlock(ctx100) + require.NoError(t, err) + + step2Reward := td.keeper.GetTotalDistributed(ctx100) + + // 3. Pause at T=100s + _, err = srv.Pause(ctx100, &types.MsgPause{Authority: govAuthority(), Paused: true}) + require.NoError(t, err) + + // 4. Unpause after a full half-life of pause + pauseDuration := time.Duration(halfLife) * time.Second + tUnpause := activationTime.Add(100*time.Second + pauseDuration) + ctxUnpause := td.ctx.WithBlockTime(tUnpause) + _, err = srv.Pause(ctxUnpause, &types.MsgPause{Authority: govAuthority(), Paused: false}) + require.NoError(t, err) + require.Equal(t, int64(halfLife), td.keeper.GetTotalPausedSeconds(ctxUnpause)) + + // 5. Run BeginBlock 5s after unpause + // Active time = (100 + halfLife + 5) - 0 - halfLife(paused) = 105s, blockDelta = 5s + tPost := tUnpause.Add(5 * time.Second) + ctxPost := td.ctx.WithBlockTime(tPost) + err = td.keeper.BeginBlock(ctxPost) + require.NoError(t, err) + + // 6. Verify the exact reward distributed matches elapsed=105s (not halfLife+105s) + correctReward := keeper.CalculateBlockReward(halfLife, poolBalance, 105, 5) + buggyReward := keeper.CalculateBlockReward(halfLife, poolBalance, float64(halfLife)+105, 5) + + expectedTotal := step2Reward.Add(correctReward) + require.Equal(t, expectedTotal, td.keeper.GetTotalDistributed(ctxPost), + "total distributed should match correct elapsed, not buggy elapsed") + + // Sanity: correct reward must be ~2x buggy reward after 1 half-life pause + require.True(t, correctReward.GT(buggyReward), + "correct reward (%s) should be ~2x buggy reward (%s)", correctReward, buggyReward) +} diff --git a/x/svip/keeper/params.go b/x/svip/keeper/params.go new file mode 100644 index 00000000..266e3498 --- /dev/null +++ b/x/svip/keeper/params.go @@ -0,0 +1,29 @@ +package keeper + +import ( + "github.com/cosmos/evm/x/svip/types" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// GetParams returns the total set of SVIP parameters. +func (k Keeper) GetParams(ctx sdk.Context) (params types.Params) { + store := ctx.KVStore(k.storeKey) + bz := store.Get(types.ParamsKey) + if bz == nil { + return types.DefaultParams() + } + k.cdc.MustUnmarshal(bz, ¶ms) + return params +} + +// SetParams sets the SVIP parameters. +func (k Keeper) SetParams(ctx sdk.Context, params types.Params) error { + store := ctx.KVStore(k.storeKey) + bz, err := k.cdc.Marshal(¶ms) + if err != nil { + return err + } + store.Set(types.ParamsKey, bz) + return nil +} diff --git a/x/svip/keeper/query_server.go b/x/svip/keeper/query_server.go new file mode 100644 index 00000000..d8017896 --- /dev/null +++ b/x/svip/keeper/query_server.go @@ -0,0 +1,60 @@ +package keeper + +import ( + "context" + + "github.com/cosmos/evm/x/svip/types" + + "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// queryServer implements the SVIP QueryServer interface. +type queryServer struct { + Keeper +} + +// NewQueryServerImpl returns an implementation of the SVIP QueryServer interface. +func NewQueryServerImpl(k Keeper) types.QueryServer { + return &queryServer{Keeper: k} +} + +var _ types.QueryServer = queryServer{} + +// Params returns the current SVIP module parameters. +func (s queryServer) Params(goCtx context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + return &types.QueryParamsResponse{Params: s.GetParams(ctx)}, nil +} + +// PoolState returns the current SVIP pool state including balance and distribution info. +func (s queryServer) PoolState(goCtx context.Context, _ *types.QueryPoolStateRequest) (*types.QueryPoolStateResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + activated := s.GetActivated(ctx) + paused := s.GetPaused(ctx) + denom := s.getDenom(ctx) + moduleAddr := s.ak.GetModuleAddress(types.ModuleName) + balance := s.bk.GetBalance(ctx, moduleAddr, denom) + + var currentRate math.LegacyDec + if activated && !paused { + params := s.GetParams(ctx) + totalPausedSec := float64(s.GetTotalPausedSeconds(ctx)) + elapsed := ctx.BlockTime().Sub(s.GetActivationTime(ctx)).Seconds() - totalPausedSec + poolAtAct := s.GetPoolBalanceAtActivation(ctx) + // Calculate tokens per second at current time + reward := CalculateBlockReward(params.HalfLifeSeconds, poolAtAct, elapsed, 1.0) + currentRate = math.LegacyNewDecFromInt(reward) + } else { + currentRate = math.LegacyZeroDec() + } + + return &types.QueryPoolStateResponse{ + PoolBalance: balance, + TotalDistributed: s.GetTotalDistributed(ctx), + CurrentRatePerSecond: currentRate, + Activated: activated, + Paused: paused, + ActivationTime: s.GetActivationTime(ctx), + }, nil +} diff --git a/x/svip/keeper/reward.go b/x/svip/keeper/reward.go new file mode 100644 index 00000000..6e7cff93 --- /dev/null +++ b/x/svip/keeper/reward.go @@ -0,0 +1,54 @@ +package keeper + +import ( + "fmt" + "math" + + sdkmath "cosmossdk.io/math" +) + +// CalculateBlockReward returns how many tokens (in base denom units) to +// distribute for this block using exponential decay. +// +// poolAtActivation — token balance when SVIP was activated (base denom) +// totalElapsedSec — seconds since SVIP activation +// blockDeltaSec — seconds since the previous block +// +// Exponential decay formula: +// +// Râ‚€ = (ln2 / half_life) × poolAtActivation +// rate(t) = Râ‚€ × e^(-λ × t) +// blockReward = rate(t) × blockDelta +func CalculateBlockReward( + halfLifeSeconds int64, + poolAtActivation sdkmath.Int, + totalElapsedSec float64, + blockDeltaSec float64, +) sdkmath.Int { + if poolAtActivation.IsZero() || blockDeltaSec <= 0 || totalElapsedSec < 0 { + return sdkmath.ZeroInt() + } + + halfLifeSec := float64(halfLifeSeconds) + if halfLifeSec <= 0 { + return sdkmath.ZeroInt() + } + + lambda := math.Log(2) / halfLifeSec + poolFloat := poolAtActivation.ToLegacyDec().MustFloat64() + initialRate := lambda * poolFloat // tokens per second at t=0 + currentRate := initialRate * math.Exp(-lambda*totalElapsedSec) // tokens/sec now + blockReward := currentRate * blockDeltaSec + + if blockReward <= 0 { + return sdkmath.ZeroInt() + } + + // Truncate to integer — we never over-distribute. + rewardStr := fmt.Sprintf("%.0f", math.Floor(blockReward)) + reward, ok := sdkmath.NewIntFromString(rewardStr) + if !ok { + return sdkmath.ZeroInt() + } + return reward +} diff --git a/x/svip/keeper/reward_test.go b/x/svip/keeper/reward_test.go new file mode 100644 index 00000000..1589b12e --- /dev/null +++ b/x/svip/keeper/reward_test.go @@ -0,0 +1,153 @@ +package keeper_test + +import ( + "math" + "testing" + + "github.com/cosmos/evm/x/svip/keeper" + "github.com/stretchr/testify/require" + + sdkmath "cosmossdk.io/math" +) + +func TestCalculateBlockReward(t *testing.T) { + halfLife := int64(31536000) // 1 year in seconds + pool := sdkmath.NewInt(1_000_000_000_000) + + testCases := []struct { + name string + halfLifeSeconds int64 + poolAtActivation sdkmath.Int + totalElapsedSec float64 + blockDeltaSec float64 + expectZero bool + }{ + { + name: "zero pool balance", + halfLifeSeconds: halfLife, + poolAtActivation: sdkmath.ZeroInt(), + totalElapsedSec: 100, + blockDeltaSec: 5, + expectZero: true, + }, + { + name: "zero block delta", + halfLifeSeconds: halfLife, + poolAtActivation: pool, + totalElapsedSec: 100, + blockDeltaSec: 0, + expectZero: true, + }, + { + name: "negative block delta", + halfLifeSeconds: halfLife, + poolAtActivation: pool, + totalElapsedSec: 100, + blockDeltaSec: -5, + expectZero: true, + }, + { + name: "negative elapsed", + halfLifeSeconds: halfLife, + poolAtActivation: pool, + totalElapsedSec: -100, + blockDeltaSec: 5, + expectZero: true, + }, + { + name: "zero half_life", + halfLifeSeconds: 0, + poolAtActivation: pool, + totalElapsedSec: 100, + blockDeltaSec: 5, + expectZero: true, + }, + { + name: "negative half_life", + halfLifeSeconds: -1, + poolAtActivation: pool, + totalElapsedSec: 100, + blockDeltaSec: 5, + expectZero: true, + }, + { + name: "normal case - first block", + halfLifeSeconds: halfLife, + poolAtActivation: pool, + totalElapsedSec: 5, + blockDeltaSec: 5, + expectZero: false, + }, + { + name: "normal case - mid life", + halfLifeSeconds: halfLife, + poolAtActivation: pool, + totalElapsedSec: 1000, + blockDeltaSec: 5, + expectZero: false, + }, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + reward := keeper.CalculateBlockReward( + tc.halfLifeSeconds, + tc.poolAtActivation, + tc.totalElapsedSec, + tc.blockDeltaSec, + ) + if tc.expectZero { + require.True(t, reward.IsZero(), "expected zero reward, got %s", reward) + } else { + require.True(t, reward.IsPositive(), "expected positive reward, got %s", reward) + } + }) + } +} + +func TestCalculateBlockReward_HalfLifeDecay(t *testing.T) { + halfLife := int64(31536000) + pool := sdkmath.NewInt(1_000_000_000_000_000) // large pool for precision + blockDelta := float64(5) + + // Reward at t=0 + r0 := keeper.CalculateBlockReward(halfLife, pool, blockDelta, blockDelta) + require.True(t, r0.IsPositive()) + + // Reward at t=halfLife + rHalf := keeper.CalculateBlockReward(halfLife, pool, float64(halfLife), blockDelta) + require.True(t, rHalf.IsPositive()) + + // After one half-life, the rate should be ~half of the initial rate. + // Allow 5% tolerance for truncation. + r0Float := r0.ToLegacyDec().MustFloat64() + rHalfFloat := rHalf.ToLegacyDec().MustFloat64() + ratio := rHalfFloat / r0Float + require.InDelta(t, 0.5, ratio, 0.05, "reward after one half-life should be ~50%% of initial, got ratio %f", ratio) +} + +func TestCalculateBlockReward_VeryLargeElapsed(t *testing.T) { + halfLife := int64(31536000) + pool := sdkmath.NewInt(1_000_000_000_000) + + // After 100 half-lives, reward should be effectively zero + elapsed := float64(halfLife) * 100 + reward := keeper.CalculateBlockReward(halfLife, pool, elapsed, 5) + require.True(t, reward.IsZero(), "reward after 100 half-lives should be zero, got %s", reward) +} + +func TestCalculateBlockReward_Monotonic(t *testing.T) { + halfLife := int64(31536000) + pool := sdkmath.NewInt(1_000_000_000_000_000) + blockDelta := float64(5) + + // Rewards should decrease monotonically over time + var prev sdkmath.Int + for elapsed := float64(0); elapsed < float64(halfLife)*3; elapsed += float64(halfLife) / 10 { + r := keeper.CalculateBlockReward(halfLife, pool, math.Max(elapsed, blockDelta), blockDelta) + if !prev.IsNil() && prev.IsPositive() && r.IsPositive() { + require.True(t, r.LTE(prev), "reward should decrease: at elapsed=%f got %s > prev %s", elapsed, r, prev) + } + prev = r + } +} diff --git a/x/svip/module.go b/x/svip/module.go new file mode 100644 index 00000000..b0c593ce --- /dev/null +++ b/x/svip/module.go @@ -0,0 +1,122 @@ +package svip + +import ( + "context" + "encoding/json" + "fmt" + + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/spf13/cobra" + + abci "github.com/cometbft/cometbft/abci/types" + + "github.com/cosmos/evm/x/svip/client/cli" + "github.com/cosmos/evm/x/svip/keeper" + "github.com/cosmos/evm/x/svip/types" + + "cosmossdk.io/core/appmodule" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/codec" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" +) + +const consensusVersion = 2 + +var ( + _ module.AppModule = AppModule{} + _ module.AppModuleBasic = AppModuleBasic{} + _ module.HasABCIGenesis = AppModule{} + _ appmodule.HasBeginBlocker = AppModule{} +) + +// AppModuleBasic defines the basic application module used by the SVIP module. +type AppModuleBasic struct{} + +// Name returns the SVIP module's name. +func (AppModuleBasic) Name() string { return types.ModuleName } + +// RegisterLegacyAminoCodec registers the SVIP module's types on the given LegacyAmino codec. +func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { types.RegisterLegacyAminoCodec(cdc) } + +// ConsensusVersion returns the consensus state-breaking version for the module. +func (AppModuleBasic) ConsensusVersion() uint64 { return consensusVersion } + +// DefaultGenesis returns default genesis state as raw bytes for the SVIP module. +func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { + return cdc.MustMarshalJSON(types.DefaultGenesisState()) +} + +// ValidateGenesis performs genesis state validation for the SVIP module. +func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, _ client.TxEncodingConfig, bz json.RawMessage) error { + var gs types.GenesisState + if err := cdc.UnmarshalJSON(bz, &gs); err != nil { + return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) + } + return gs.Validate() +} + +// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the SVIP module. +func (AppModuleBasic) RegisterGRPCGatewayRoutes(c client.Context, mux *runtime.ServeMux) { + if err := types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(c)); err != nil { + panic(err) + } +} + +// RegisterInterfaces registers interfaces and implementations of the SVIP module. +func (AppModuleBasic) RegisterInterfaces(registry codectypes.InterfaceRegistry) { + types.RegisterInterfaces(registry) +} + +// GetTxCmd returns the root tx command for the svip module. +func (AppModuleBasic) GetTxCmd() *cobra.Command { + return cli.NewTxCmd() +} + +// AppModule implements an application module for the SVIP module. +type AppModule struct { + AppModuleBasic + keeper keeper.Keeper +} + +// NewAppModule creates a new AppModule object. +func NewAppModule(k keeper.Keeper) AppModule { + return AppModule{AppModuleBasic: AppModuleBasic{}, keeper: k} +} + +// Name returns the SVIP module's name. +func (AppModule) Name() string { return types.ModuleName } + +// RegisterServices registers the GRPC query and msg services for the SVIP module. +func (am AppModule) RegisterServices(cfg module.Configurator) { + types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) + types.RegisterQueryServer(cfg.QueryServer(), keeper.NewQueryServerImpl(am.keeper)) +} + +// BeginBlock returns the begin blocker for the SVIP module. +func (am AppModule) BeginBlock(ctx context.Context) error { + c := sdk.UnwrapSDKContext(ctx) + return am.keeper.BeginBlock(c) +} + +// InitGenesis performs genesis initialization for the SVIP module. +func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, data json.RawMessage) []abci.ValidatorUpdate { + var gs types.GenesisState + cdc.MustUnmarshalJSON(data, &gs) + InitGenesis(ctx, am.keeper, gs) + return []abci.ValidatorUpdate{} +} + +// ExportGenesis returns the exported genesis state as raw bytes for the SVIP module. +func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { + gs := ExportGenesis(ctx, am.keeper) + return cdc.MustMarshalJSON(gs) +} + +// IsAppModule implements the appmodule.AppModule interface. +func (am AppModule) IsAppModule() {} + +// IsOnePerModuleType implements the depinject.OnePerModuleType interface. +func (am AppModule) IsOnePerModuleType() {} diff --git a/x/svip/types/codec.go b/x/svip/types/codec.go new file mode 100644 index 00000000..f0547721 --- /dev/null +++ b/x/svip/types/codec.go @@ -0,0 +1,49 @@ +package types + +import ( + "github.com/cosmos/cosmos-sdk/codec" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/msgservice" +) + +var ( + amino = codec.NewLegacyAmino() + ModuleCdc = codec.NewProtoCodec(codectypes.NewInterfaceRegistry()) + AminoCdc = codec.NewAminoCodec(amino) +) + +const ( + updateParamsName = "cosmos/svip/MsgUpdateParams" + activateName = "cosmos/svip/MsgActivate" + reactivateName = "cosmos/svip/MsgReactivate" + pauseName = "cosmos/svip/MsgPause" + fundPoolName = "cosmos/svip/MsgFundPool" +) + +func init() { + RegisterLegacyAminoCodec(amino) + amino.Seal() +} + +// RegisterInterfaces registers the SVIP module's interface types. +func RegisterInterfaces(registry codectypes.InterfaceRegistry) { + registry.RegisterImplementations( + (*sdk.Msg)(nil), + &MsgUpdateParams{}, + &MsgActivate{}, + &MsgReactivate{}, + &MsgPause{}, + &MsgFundPool{}, + ) + msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) +} + +// RegisterLegacyAminoCodec registers the SVIP module's types on the given LegacyAmino codec. +func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { + cdc.RegisterConcrete(&MsgUpdateParams{}, updateParamsName, nil) + cdc.RegisterConcrete(&MsgActivate{}, activateName, nil) + cdc.RegisterConcrete(&MsgReactivate{}, reactivateName, nil) + cdc.RegisterConcrete(&MsgPause{}, pauseName, nil) + cdc.RegisterConcrete(&MsgFundPool{}, fundPoolName, nil) +} diff --git a/x/svip/types/errors.go b/x/svip/types/errors.go new file mode 100644 index 00000000..262d2536 --- /dev/null +++ b/x/svip/types/errors.go @@ -0,0 +1,14 @@ +package types + +import errorsmod "cosmossdk.io/errors" + +var ( + ErrNotActivated = errorsmod.Register(ModuleName, 2, "svip is not activated") + ErrPaused = errorsmod.Register(ModuleName, 3, "svip is paused") + ErrPoolExhausted = errorsmod.Register(ModuleName, 4, "svip pool is exhausted") + ErrInvalidAuthority = errorsmod.Register(ModuleName, 5, "invalid authority") + ErrAlreadyActivated = errorsmod.Register(ModuleName, 6, "svip is already activated") + ErrPoolNotFunded = errorsmod.Register(ModuleName, 7, "svip pool has no funds") + ErrNotYetActivated = errorsmod.Register(ModuleName, 8, "svip has not been activated yet") + ErrHalfLifeChange = errorsmod.Register(ModuleName, 9, "half_life_seconds change exceeds 50% limit") +) diff --git a/x/svip/types/expected_keepers.go b/x/svip/types/expected_keepers.go new file mode 100644 index 00000000..da3824ad --- /dev/null +++ b/x/svip/types/expected_keepers.go @@ -0,0 +1,20 @@ +package types + +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// BankKeeper defines the expected bank keeper interface. +// In app.go, pass PreciseBankKeeper which implements this. +type BankKeeper interface { + SendCoinsFromModuleToModule(ctx context.Context, senderModule, recipientModule string, amt sdk.Coins) error + SendCoinsFromAccountToModule(ctx context.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error + GetBalance(ctx context.Context, addr sdk.AccAddress, denom string) sdk.Coin +} + +// AccountKeeper defines the expected account keeper interface. +type AccountKeeper interface { + GetModuleAddress(moduleName string) sdk.AccAddress +} diff --git a/x/svip/types/genesis.pb.go b/x/svip/types/genesis.pb.go new file mode 100644 index 00000000..8a9dad36 --- /dev/null +++ b/x/svip/types/genesis.pb.go @@ -0,0 +1,664 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: cosmos/svip/v1/genesis.proto + +package types + +import ( + cosmossdk_io_math "cosmossdk.io/math" + fmt "fmt" + _ "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 + +// GenesisState defines the svip module's genesis state. +type GenesisState struct { + // params defines all the parameters of the svip module. + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` + // total_distributed is the cumulative tokens sent to FeeCollector. + TotalDistributed cosmossdk_io_math.Int `protobuf:"bytes,2,opt,name=total_distributed,json=totalDistributed,proto3,customtype=cosmossdk.io/math.Int" json:"total_distributed"` + // activation_time is when SVIP was activated. Zero if not yet activated. + ActivationTime time.Time `protobuf:"bytes,3,opt,name=activation_time,json=activationTime,proto3,stdtime" json:"activation_time"` + // pool_balance_at_activation is the pool snapshot used to derive Râ‚€. + PoolBalanceAtActivation cosmossdk_io_math.Int `protobuf:"bytes,4,opt,name=pool_balance_at_activation,json=poolBalanceAtActivation,proto3,customtype=cosmossdk.io/math.Int" json:"pool_balance_at_activation"` + // last_block_time is the timestamp of the last processed block. + LastBlockTime time.Time `protobuf:"bytes,5,opt,name=last_block_time,json=lastBlockTime,proto3,stdtime" json:"last_block_time"` + // total_paused_seconds is the cumulative seconds spent in paused state. + TotalPausedSeconds int64 `protobuf:"varint,6,opt,name=total_paused_seconds,json=totalPausedSeconds,proto3" json:"total_paused_seconds,omitempty"` + // activated indicates whether SVIP reward distribution is active. + Activated bool `protobuf:"varint,7,opt,name=activated,proto3" json:"activated,omitempty"` + // paused is an emergency pause flag. + Paused bool `protobuf:"varint,8,opt,name=paused,proto3" json:"paused,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_9fc4f2cc3c482b1c, []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) GetActivationTime() time.Time { + if m != nil { + return m.ActivationTime + } + return time.Time{} +} + +func (m *GenesisState) GetLastBlockTime() time.Time { + if m != nil { + return m.LastBlockTime + } + return time.Time{} +} + +func (m *GenesisState) GetTotalPausedSeconds() int64 { + if m != nil { + return m.TotalPausedSeconds + } + return 0 +} + +func (m *GenesisState) GetActivated() bool { + if m != nil { + return m.Activated + } + return false +} + +func (m *GenesisState) GetPaused() bool { + if m != nil { + return m.Paused + } + return false +} + +func init() { + proto.RegisterType((*GenesisState)(nil), "cosmos.svip.v1.GenesisState") +} + +func init() { proto.RegisterFile("cosmos/svip/v1/genesis.proto", fileDescriptor_9fc4f2cc3c482b1c) } + +var fileDescriptor_9fc4f2cc3c482b1c = []byte{ + // 449 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x92, 0xb1, 0x6e, 0xd4, 0x30, + 0x1c, 0xc6, 0xcf, 0x1c, 0x1c, 0x77, 0x06, 0x5a, 0x6a, 0x95, 0x12, 0x4e, 0x25, 0x77, 0xea, 0x74, + 0x62, 0xb0, 0x29, 0x4c, 0x48, 0x2c, 0x8d, 0x90, 0x10, 0x08, 0xa4, 0x2a, 0x65, 0xea, 0x12, 0x39, + 0x89, 0x49, 0xad, 0x26, 0xf9, 0x47, 0xe7, 0xff, 0x45, 0xf0, 0x16, 0x7d, 0x0c, 0x46, 0x1e, 0xa3, + 0x63, 0x47, 0xc4, 0x50, 0xd0, 0xdd, 0xc0, 0x1b, 0x30, 0x23, 0xdb, 0x29, 0x27, 0x98, 0x60, 0x89, + 0x6c, 0x7f, 0xdf, 0xef, 0x9f, 0xef, 0x4b, 0x4c, 0x77, 0x33, 0x30, 0x15, 0x18, 0x61, 0x5a, 0xdd, + 0x88, 0x76, 0x5f, 0x14, 0xaa, 0x56, 0x46, 0x1b, 0xde, 0xcc, 0x01, 0x81, 0x6d, 0x78, 0x95, 0x5b, + 0x95, 0xb7, 0xfb, 0xe3, 0x2d, 0x59, 0xe9, 0x1a, 0x84, 0x7b, 0x7a, 0xcb, 0xf8, 0xc1, 0x5f, 0x03, + 0x9c, 0xd5, 0x4b, 0xdb, 0x05, 0x14, 0xe0, 0x96, 0xc2, 0xae, 0xba, 0xd3, 0x49, 0x01, 0x50, 0x94, + 0x4a, 0xb8, 0x5d, 0xba, 0x78, 0x2f, 0x50, 0x57, 0xca, 0xa0, 0xac, 0x3a, 0x6c, 0xef, 0x67, 0x9f, + 0xde, 0x7e, 0xe9, 0x63, 0x1c, 0xa1, 0x44, 0xc5, 0x9e, 0xd1, 0x41, 0x23, 0xe7, 0xb2, 0x32, 0x01, + 0x99, 0x92, 0xd9, 0xad, 0x27, 0x3b, 0xfc, 0xcf, 0x58, 0xfc, 0xd0, 0xa9, 0xd1, 0xe8, 0xfc, 0x72, + 0xd2, 0xfb, 0xf4, 0xe3, 0xf3, 0x23, 0x12, 0x77, 0x00, 0x7b, 0x4d, 0xb7, 0x10, 0x50, 0x96, 0x49, + 0xae, 0x0d, 0xce, 0x75, 0xba, 0x40, 0x95, 0x07, 0xd7, 0xa6, 0x64, 0x36, 0x8a, 0x1e, 0x5a, 0xf7, + 0xd7, 0xcb, 0xc9, 0x3d, 0x3f, 0xcc, 0xe4, 0xa7, 0x5c, 0x83, 0xa8, 0x24, 0x9e, 0xf0, 0x57, 0x35, + 0xc6, 0x77, 0x1d, 0xf7, 0x62, 0x8d, 0xb1, 0xb7, 0x74, 0x53, 0x66, 0xa8, 0x5b, 0x89, 0x1a, 0xea, + 0xc4, 0xa6, 0x0e, 0xfa, 0x2e, 0xcf, 0x98, 0xfb, 0x4a, 0xfc, 0xaa, 0x12, 0x7f, 0x77, 0x55, 0x29, + 0x1a, 0xda, 0xb7, 0x9c, 0x7d, 0x9b, 0x90, 0x78, 0x63, 0x0d, 0x5b, 0x99, 0x1d, 0xd3, 0x71, 0x03, + 0x50, 0x26, 0xa9, 0x2c, 0x65, 0x9d, 0xa9, 0x44, 0x62, 0xb2, 0x76, 0x04, 0xd7, 0xff, 0x25, 0xe3, + 0x7d, 0x3b, 0x20, 0xf2, 0xfc, 0x01, 0x1e, 0xfc, 0xa6, 0xd9, 0x1b, 0xba, 0x59, 0x4a, 0x83, 0x49, + 0x5a, 0x42, 0x76, 0xea, 0xa3, 0xde, 0xf8, 0x8f, 0xa8, 0x77, 0x2c, 0x1c, 0x59, 0xd6, 0x25, 0x7d, + 0x4c, 0xb7, 0xfd, 0x47, 0x6c, 0xe4, 0xc2, 0xa8, 0x3c, 0x31, 0x2a, 0x83, 0x3a, 0x37, 0xc1, 0x60, + 0x4a, 0x66, 0xfd, 0x98, 0x39, 0xed, 0xd0, 0x49, 0x47, 0x5e, 0x61, 0xbb, 0x74, 0xd4, 0x75, 0x51, + 0x79, 0x70, 0x73, 0x4a, 0x66, 0xc3, 0x78, 0x7d, 0xc0, 0x76, 0xec, 0xff, 0xb4, 0xf6, 0x60, 0xe8, + 0xa4, 0x6e, 0x17, 0x3d, 0x3f, 0x5f, 0x86, 0xe4, 0x62, 0x19, 0x92, 0xef, 0xcb, 0x90, 0x9c, 0xad, + 0xc2, 0xde, 0xc5, 0x2a, 0xec, 0x7d, 0x59, 0x85, 0xbd, 0xe3, 0xbd, 0x42, 0xe3, 0xc9, 0x22, 0xe5, + 0x19, 0x54, 0xa2, 0xbb, 0x6f, 0xaa, 0xad, 0xc4, 0x07, 0x7f, 0xeb, 0xf0, 0x63, 0xa3, 0x4c, 0x3a, + 0x70, 0x95, 0x9e, 0xfe, 0x0a, 0x00, 0x00, 0xff, 0xff, 0x5b, 0xbd, 0x69, 0x30, 0xd2, 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 + if m.Paused { + i-- + if m.Paused { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x40 + } + if m.Activated { + i-- + if m.Activated { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x38 + } + if m.TotalPausedSeconds != 0 { + i = encodeVarintGenesis(dAtA, i, uint64(m.TotalPausedSeconds)) + i-- + dAtA[i] = 0x30 + } + n1, err1 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.LastBlockTime, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.LastBlockTime):]) + if err1 != nil { + return 0, err1 + } + i -= n1 + i = encodeVarintGenesis(dAtA, i, uint64(n1)) + i-- + dAtA[i] = 0x2a + { + size := m.PoolBalanceAtActivation.Size() + i -= size + if _, err := m.PoolBalanceAtActivation.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + n2, err2 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.ActivationTime, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.ActivationTime):]) + if err2 != nil { + return 0, err2 + } + i -= n2 + i = encodeVarintGenesis(dAtA, i, uint64(n2)) + i-- + dAtA[i] = 0x1a + { + size := m.TotalDistributed.Size() + i -= size + if _, err := m.TotalDistributed.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + 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)) + l = m.TotalDistributed.Size() + n += 1 + l + sovGenesis(uint64(l)) + l = github_com_cosmos_gogoproto_types.SizeOfStdTime(m.ActivationTime) + n += 1 + l + sovGenesis(uint64(l)) + l = m.PoolBalanceAtActivation.Size() + n += 1 + l + sovGenesis(uint64(l)) + l = github_com_cosmos_gogoproto_types.SizeOfStdTime(m.LastBlockTime) + n += 1 + l + sovGenesis(uint64(l)) + if m.TotalPausedSeconds != 0 { + n += 1 + sovGenesis(uint64(m.TotalPausedSeconds)) + } + if m.Activated { + n += 2 + } + if m.Paused { + n += 2 + } + 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 TotalDistributed", 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.TotalDistributed.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ActivationTime", 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 := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(&m.ActivationTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PoolBalanceAtActivation", 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.PoolBalanceAtActivation.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LastBlockTime", 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 := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(&m.LastBlockTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TotalPausedSeconds", wireType) + } + m.TotalPausedSeconds = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TotalPausedSeconds |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Activated", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Activated = bool(v != 0) + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Paused", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Paused = bool(v != 0) + 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/svip/types/genesis_logic.go b/x/svip/types/genesis_logic.go new file mode 100644 index 00000000..f74dc793 --- /dev/null +++ b/x/svip/types/genesis_logic.go @@ -0,0 +1,39 @@ +package types + +import ( + "fmt" + "time" + + sdkmath "cosmossdk.io/math" +) + +// DefaultGenesisState returns the default SVIP genesis state. +func DefaultGenesisState() *GenesisState { + return &GenesisState{ + Params: DefaultParams(), + TotalDistributed: sdkmath.ZeroInt(), + ActivationTime: time.Time{}, + PoolBalanceAtActivation: sdkmath.ZeroInt(), + LastBlockTime: time.Time{}, + TotalPausedSeconds: 0, + Activated: false, + Paused: false, + } +} + +// Validate performs basic genesis state validation. +func (gs GenesisState) Validate() error { + if err := gs.Params.Validate(); err != nil { + return err + } + if gs.TotalDistributed.IsNegative() { + return ErrPoolExhausted.Wrap("total_distributed cannot be negative") + } + if gs.TotalPausedSeconds < 0 { + return fmt.Errorf("total_paused_seconds cannot be negative: %d", gs.TotalPausedSeconds) + } + if gs.Activated && gs.Params.HalfLifeSeconds == 0 { + return fmt.Errorf("half_life_seconds must be set when activated") + } + return nil +} diff --git a/x/svip/types/genesis_test.go b/x/svip/types/genesis_test.go new file mode 100644 index 00000000..2af46862 --- /dev/null +++ b/x/svip/types/genesis_test.go @@ -0,0 +1,85 @@ +package types_test + +import ( + "testing" + + "github.com/cosmos/evm/x/svip/types" + "github.com/stretchr/testify/suite" + + sdkmath "cosmossdk.io/math" +) + +type GenesisTestSuite struct { + suite.Suite +} + +func TestGenesisTestSuite(t *testing.T) { + suite.Run(t, new(GenesisTestSuite)) +} + +func (suite *GenesisTestSuite) TestDefaultGenesisState() { + gs := types.DefaultGenesisState() + suite.Require().NotNil(gs) + suite.Require().NoError(gs.Validate()) +} + +func (suite *GenesisTestSuite) TestGenesisStateValidate() { + testCases := []struct { + name string + genesis types.GenesisState + expError bool + }{ + { + "valid - default genesis", + *types.DefaultGenesisState(), + false, + }, + { + "valid - positive total_distributed", + types.GenesisState{ + Params: types.DefaultParams(), + TotalDistributed: sdkmath.NewInt(1000), + PoolBalanceAtActivation: sdkmath.ZeroInt(), + }, + false, + }, + { + "invalid - negative total_distributed", + types.GenesisState{ + Params: types.DefaultParams(), + TotalDistributed: sdkmath.NewInt(-1), + PoolBalanceAtActivation: sdkmath.ZeroInt(), + }, + true, + }, + { + "invalid - activated with half_life=0", + types.GenesisState{ + Params: types.Params{HalfLifeSeconds: 0}, + Activated: true, + TotalDistributed: sdkmath.ZeroInt(), + PoolBalanceAtActivation: sdkmath.ZeroInt(), + }, + true, + }, + { + "valid - activated with half_life set", + types.GenesisState{ + Params: types.Params{HalfLifeSeconds: 31536000}, + Activated: true, + TotalDistributed: sdkmath.ZeroInt(), + PoolBalanceAtActivation: sdkmath.ZeroInt(), + }, + false, + }, + } + + for _, tc := range testCases { + err := tc.genesis.Validate() + if tc.expError { + suite.Require().Error(err, tc.name) + } else { + suite.Require().NoError(err, tc.name) + } + } +} diff --git a/x/svip/types/keys.go b/x/svip/types/keys.go new file mode 100644 index 00000000..6fab1871 --- /dev/null +++ b/x/svip/types/keys.go @@ -0,0 +1,30 @@ +package types + +const ( + ModuleName = "svip" + StoreKey = ModuleName + RouterKey = ModuleName +) + +// KV store key prefixes +const ( + prefixParams = iota + 1 + prefixTotalDistributed + prefixActivationTime + prefixLastBlockTime + prefixPoolBalanceAtActivation + prefixTotalPausedSeconds + prefixActivated + prefixPaused +) + +var ( + ParamsKey = []byte{prefixParams} + TotalDistributedKey = []byte{prefixTotalDistributed} + ActivationTimeKey = []byte{prefixActivationTime} + LastBlockTimeKey = []byte{prefixLastBlockTime} + PoolBalanceAtActivationKey = []byte{prefixPoolBalanceAtActivation} + TotalPausedSecondsKey = []byte{prefixTotalPausedSeconds} + ActivatedKey = []byte{prefixActivated} + PausedKey = []byte{prefixPaused} +) diff --git a/x/svip/types/mocks/MockAccountKeeper.go b/x/svip/types/mocks/MockAccountKeeper.go new file mode 100644 index 00000000..8ad9ca22 --- /dev/null +++ b/x/svip/types/mocks/MockAccountKeeper.go @@ -0,0 +1,28 @@ +package mocks + +import ( + mock "github.com/stretchr/testify/mock" + + types "github.com/cosmos/cosmos-sdk/types" +) + +// AccountKeeper is a mock type for the AccountKeeper interface. +type AccountKeeper struct { + mock.Mock +} + +// NewAccountKeeper creates a new AccountKeeper mock and registers cleanup. +func NewAccountKeeper(t interface { + mock.TestingT + Cleanup(func()) +}) *AccountKeeper { + m := &AccountKeeper{} + m.Mock.Test(t) + t.Cleanup(func() { m.AssertExpectations(t) }) + return m +} + +func (_m *AccountKeeper) GetModuleAddress(moduleName string) types.AccAddress { + ret := _m.Called(moduleName) + return ret.Get(0).(types.AccAddress) +} diff --git a/x/svip/types/mocks/MockBankKeeper.go b/x/svip/types/mocks/MockBankKeeper.go new file mode 100644 index 00000000..892a1e49 --- /dev/null +++ b/x/svip/types/mocks/MockBankKeeper.go @@ -0,0 +1,40 @@ +package mocks + +import ( + "context" + + mock "github.com/stretchr/testify/mock" + + types "github.com/cosmos/cosmos-sdk/types" +) + +// BankKeeper is a mock type for the BankKeeper interface. +type BankKeeper struct { + mock.Mock +} + +// NewBankKeeper creates a new BankKeeper mock and registers cleanup. +func NewBankKeeper(t interface { + mock.TestingT + Cleanup(func()) +}) *BankKeeper { + m := &BankKeeper{} + m.Mock.Test(t) + t.Cleanup(func() { m.AssertExpectations(t) }) + return m +} + +func (_m *BankKeeper) SendCoinsFromModuleToModule(ctx context.Context, senderModule, recipientModule string, amt types.Coins) error { + ret := _m.Called(ctx, senderModule, recipientModule, amt) + return ret.Error(0) +} + +func (_m *BankKeeper) SendCoinsFromAccountToModule(ctx context.Context, senderAddr types.AccAddress, recipientModule string, amt types.Coins) error { + ret := _m.Called(ctx, senderAddr, recipientModule, amt) + return ret.Error(0) +} + +func (_m *BankKeeper) GetBalance(ctx context.Context, addr types.AccAddress, denom string) types.Coin { + ret := _m.Called(ctx, addr, denom) + return ret.Get(0).(types.Coin) +} diff --git a/x/svip/types/msgs.go b/x/svip/types/msgs.go new file mode 100644 index 00000000..1d9746ea --- /dev/null +++ b/x/svip/types/msgs.go @@ -0,0 +1,61 @@ +package types + +import ( + errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" +) + +var ( + _ sdk.Msg = &MsgUpdateParams{} + _ sdk.Msg = &MsgActivate{} + _ sdk.Msg = &MsgReactivate{} + _ sdk.Msg = &MsgPause{} + _ sdk.Msg = &MsgFundPool{} +) + +func (m *MsgUpdateParams) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(m.Authority); err != nil { + return errorsmod.Wrap(err, "invalid authority address") + } + return m.Params.Validate() +} + +func (m *MsgActivate) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(m.Authority); err != nil { + return errorsmod.Wrap(err, "invalid authority address") + } + return nil +} + +func (m *MsgReactivate) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(m.Authority); err != nil { + return errorsmod.Wrap(err, "invalid authority address") + } + return nil +} + +func (m *MsgPause) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(m.Authority); err != nil { + return errorsmod.Wrap(err, "invalid authority address") + } + return nil +} + +func (m *MsgFundPool) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(m.Depositor); err != nil { + return errorsmod.Wrap(err, "invalid depositor address") + } + coins := sdk.Coins(m.Amount) + if !coins.IsValid() || coins.IsZero() { + return errorsmod.Wrap(sdkerrors.ErrInvalidCoins, "invalid fund amount") + } + return nil +} + +// GetSignBytes implementations for EIP-712 support +func (m MsgUpdateParams) GetSignBytes() []byte { return AminoCdc.MustMarshalJSON(&m) } +func (m MsgActivate) GetSignBytes() []byte { return AminoCdc.MustMarshalJSON(&m) } +func (m MsgReactivate) GetSignBytes() []byte { return AminoCdc.MustMarshalJSON(&m) } +func (m MsgPause) GetSignBytes() []byte { return AminoCdc.MustMarshalJSON(&m) } +func (m MsgFundPool) GetSignBytes() []byte { return AminoCdc.MustMarshalJSON(&m) } diff --git a/x/svip/types/msgs_test.go b/x/svip/types/msgs_test.go new file mode 100644 index 00000000..9ba31b46 --- /dev/null +++ b/x/svip/types/msgs_test.go @@ -0,0 +1,185 @@ +package types_test + +import ( + "testing" + + "github.com/cosmos/evm/x/svip/types" + "github.com/stretchr/testify/suite" + + sdkmath "cosmossdk.io/math" + + sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" +) + +type MsgsTestSuite struct { + suite.Suite +} + +func TestMsgsTestSuite(t *testing.T) { + suite.Run(t, new(MsgsTestSuite)) +} + +func (suite *MsgsTestSuite) TestMsgUpdateParamsValidateBasic() { + govAddr := authtypes.NewModuleAddress(govtypes.ModuleName).String() + + testCases := []struct { + name string + msg *types.MsgUpdateParams + expPass bool + }{ + { + "fail - invalid authority", + &types.MsgUpdateParams{Authority: "invalid", Params: types.DefaultParams()}, + false, + }, + { + "fail - valid authority but invalid params", + &types.MsgUpdateParams{Authority: govAddr, Params: types.Params{HalfLifeSeconds: -1}}, + false, + }, + { + "pass - valid authority and params", + &types.MsgUpdateParams{Authority: govAddr, Params: types.DefaultParams()}, + true, + }, + } + + for _, tc := range testCases { + suite.Run(tc.name, func() { + err := tc.msg.ValidateBasic() + if tc.expPass { + suite.NoError(err) + } else { + suite.Error(err) + } + }) + } +} + +func (suite *MsgsTestSuite) TestMsgActivateValidateBasic() { + govAddr := authtypes.NewModuleAddress(govtypes.ModuleName).String() + + testCases := []struct { + name string + msg *types.MsgActivate + expPass bool + }{ + {"fail - invalid authority", &types.MsgActivate{Authority: "invalid"}, false}, + {"pass - valid authority", &types.MsgActivate{Authority: govAddr}, true}, + } + + for _, tc := range testCases { + suite.Run(tc.name, func() { + err := tc.msg.ValidateBasic() + if tc.expPass { + suite.NoError(err) + } else { + suite.Error(err) + } + }) + } +} + +func (suite *MsgsTestSuite) TestMsgReactivateValidateBasic() { + govAddr := authtypes.NewModuleAddress(govtypes.ModuleName).String() + + testCases := []struct { + name string + msg *types.MsgReactivate + expPass bool + }{ + {"fail - invalid authority", &types.MsgReactivate{Authority: "invalid"}, false}, + {"pass - valid authority", &types.MsgReactivate{Authority: govAddr}, true}, + } + + for _, tc := range testCases { + suite.Run(tc.name, func() { + err := tc.msg.ValidateBasic() + if tc.expPass { + suite.NoError(err) + } else { + suite.Error(err) + } + }) + } +} + +func (suite *MsgsTestSuite) TestMsgPauseValidateBasic() { + govAddr := authtypes.NewModuleAddress(govtypes.ModuleName).String() + + testCases := []struct { + name string + msg *types.MsgPause + expPass bool + }{ + {"fail - invalid authority", &types.MsgPause{Authority: "invalid"}, false}, + {"pass - valid authority", &types.MsgPause{Authority: govAddr, Paused: true}, true}, + } + + for _, tc := range testCases { + suite.Run(tc.name, func() { + err := tc.msg.ValidateBasic() + if tc.expPass { + suite.NoError(err) + } else { + suite.Error(err) + } + }) + } +} + +func (suite *MsgsTestSuite) TestMsgFundPoolValidateBasic() { + validAddr := authtypes.NewModuleAddress(govtypes.ModuleName).String() + + testCases := []struct { + name string + msg *types.MsgFundPool + expPass bool + }{ + { + "fail - invalid depositor", + &types.MsgFundPool{ + Depositor: "invalid", + Amount: sdk.NewCoins(sdk.NewInt64Coin("aevmos", 1000)), + }, + false, + }, + { + "fail - zero coins", + &types.MsgFundPool{ + Depositor: validAddr, + Amount: sdk.Coins{}, + }, + false, + }, + { + "fail - invalid coins (negative)", + &types.MsgFundPool{ + Depositor: validAddr, + Amount: sdk.Coins{sdk.Coin{Denom: "aevmos", Amount: sdkmath.NewInt(-1)}}, + }, + false, + }, + { + "pass - valid msg", + &types.MsgFundPool{ + Depositor: validAddr, + Amount: sdk.NewCoins(sdk.NewInt64Coin("aevmos", 1000)), + }, + true, + }, + } + + for _, tc := range testCases { + suite.Run(tc.name, func() { + err := tc.msg.ValidateBasic() + if tc.expPass { + suite.NoError(err) + } else { + suite.Error(err) + } + }) + } +} diff --git a/x/svip/types/params.go b/x/svip/types/params.go new file mode 100644 index 00000000..ebe9ac25 --- /dev/null +++ b/x/svip/types/params.go @@ -0,0 +1,18 @@ +package types + +import "fmt" + +// DefaultParams returns the default SVIP module parameters. +func DefaultParams() Params { + return Params{ + HalfLifeSeconds: 0, // set before activation + } +} + +// Validate checks that the SVIP parameters are valid. +func (p Params) Validate() error { + if p.HalfLifeSeconds < 0 { + return fmt.Errorf("half_life_seconds cannot be negative: %d", p.HalfLifeSeconds) + } + return nil +} diff --git a/x/svip/types/params_test.go b/x/svip/types/params_test.go new file mode 100644 index 00000000..0390b41f --- /dev/null +++ b/x/svip/types/params_test.go @@ -0,0 +1,54 @@ +package types_test + +import ( + "testing" + + "github.com/cosmos/evm/x/svip/types" + "github.com/stretchr/testify/suite" +) + +type ParamsTestSuite struct { + suite.Suite +} + +func TestParamsTestSuite(t *testing.T) { + suite.Run(t, new(ParamsTestSuite)) +} + +func (suite *ParamsTestSuite) TestParamsValidate() { + testCases := []struct { + name string + params types.Params + expError bool + }{ + { + "default params valid", + types.DefaultParams(), + false, + }, + { + "negative half_life", + types.Params{HalfLifeSeconds: -1}, + true, + }, + { + "half_life=0 valid", + types.Params{HalfLifeSeconds: 0}, + false, + }, + { + "valid half_life", + types.Params{HalfLifeSeconds: 31536000}, + false, + }, + } + + for _, tc := range testCases { + err := tc.params.Validate() + if tc.expError { + suite.Require().Error(err, tc.name) + } else { + suite.Require().NoError(err, tc.name) + } + } +} diff --git a/x/svip/types/query.pb.go b/x/svip/types/query.pb.go new file mode 100644 index 00000000..858cddea --- /dev/null +++ b/x/svip/types/query.pb.go @@ -0,0 +1,1127 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: cosmos/svip/v1/query.proto + +package types + +import ( + context "context" + cosmossdk_io_math "cosmossdk.io/math" + fmt "fmt" + types "github.com/cosmos/cosmos-sdk/types" + _ "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" + github_com_cosmos_gogoproto_types "github.com/cosmos/gogoproto/types" + _ "google.golang.org/genproto/googleapis/api/annotations" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + _ "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 + +// QueryParamsRequest defines the request type for querying x/svip parameters. +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_fcdeace1067afd47, []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 defines the response type for querying x/svip parameters. +type QueryParamsResponse struct { + // params define the svip module parameters. + 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_fcdeace1067afd47, []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{} +} + +// QueryPoolStateRequest defines the request type for querying pool state. +type QueryPoolStateRequest struct { +} + +func (m *QueryPoolStateRequest) Reset() { *m = QueryPoolStateRequest{} } +func (m *QueryPoolStateRequest) String() string { return proto.CompactTextString(m) } +func (*QueryPoolStateRequest) ProtoMessage() {} +func (*QueryPoolStateRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_fcdeace1067afd47, []int{2} +} +func (m *QueryPoolStateRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryPoolStateRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryPoolStateRequest.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 *QueryPoolStateRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryPoolStateRequest.Merge(m, src) +} +func (m *QueryPoolStateRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryPoolStateRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryPoolStateRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryPoolStateRequest proto.InternalMessageInfo + +// QueryPoolStateResponse returns the current SVIP pool state. +type QueryPoolStateResponse struct { + // pool_balance is the current balance in the SVIP module account. + PoolBalance types.Coin `protobuf:"bytes,1,opt,name=pool_balance,json=poolBalance,proto3" json:"pool_balance"` + // total_distributed is cumulative tokens sent to FeeCollector. + TotalDistributed cosmossdk_io_math.Int `protobuf:"bytes,2,opt,name=total_distributed,json=totalDistributed,proto3,customtype=cosmossdk.io/math.Int" json:"total_distributed"` + // current_rate_per_second is the current reward rate after decay. + CurrentRatePerSecond cosmossdk_io_math.LegacyDec `protobuf:"bytes,3,opt,name=current_rate_per_second,json=currentRatePerSecond,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"current_rate_per_second"` + // activated indicates whether SVIP is active. + Activated bool `protobuf:"varint,4,opt,name=activated,proto3" json:"activated,omitempty"` + // paused indicates whether SVIP is paused. + Paused bool `protobuf:"varint,5,opt,name=paused,proto3" json:"paused,omitempty"` + // activation_time is when SVIP was activated. + ActivationTime time.Time `protobuf:"bytes,6,opt,name=activation_time,json=activationTime,proto3,stdtime" json:"activation_time"` +} + +func (m *QueryPoolStateResponse) Reset() { *m = QueryPoolStateResponse{} } +func (m *QueryPoolStateResponse) String() string { return proto.CompactTextString(m) } +func (*QueryPoolStateResponse) ProtoMessage() {} +func (*QueryPoolStateResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_fcdeace1067afd47, []int{3} +} +func (m *QueryPoolStateResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryPoolStateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryPoolStateResponse.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 *QueryPoolStateResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryPoolStateResponse.Merge(m, src) +} +func (m *QueryPoolStateResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryPoolStateResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryPoolStateResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryPoolStateResponse proto.InternalMessageInfo + +func (m *QueryPoolStateResponse) GetPoolBalance() types.Coin { + if m != nil { + return m.PoolBalance + } + return types.Coin{} +} + +func (m *QueryPoolStateResponse) GetActivated() bool { + if m != nil { + return m.Activated + } + return false +} + +func (m *QueryPoolStateResponse) GetPaused() bool { + if m != nil { + return m.Paused + } + return false +} + +func (m *QueryPoolStateResponse) GetActivationTime() time.Time { + if m != nil { + return m.ActivationTime + } + return time.Time{} +} + +func init() { + proto.RegisterType((*QueryParamsRequest)(nil), "cosmos.svip.v1.QueryParamsRequest") + proto.RegisterType((*QueryParamsResponse)(nil), "cosmos.svip.v1.QueryParamsResponse") + proto.RegisterType((*QueryPoolStateRequest)(nil), "cosmos.svip.v1.QueryPoolStateRequest") + proto.RegisterType((*QueryPoolStateResponse)(nil), "cosmos.svip.v1.QueryPoolStateResponse") +} + +func init() { proto.RegisterFile("cosmos/svip/v1/query.proto", fileDescriptor_fcdeace1067afd47) } + +var fileDescriptor_fcdeace1067afd47 = []byte{ + // 586 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x53, 0x3d, 0x6f, 0xd3, 0x4c, + 0x1c, 0x8f, 0xfb, 0x12, 0x35, 0xd7, 0x47, 0x7d, 0xe8, 0xd1, 0xa6, 0xa9, 0x29, 0x4e, 0xe5, 0x0a, + 0x54, 0x31, 0xdc, 0x29, 0x65, 0x42, 0x62, 0x32, 0x5d, 0x40, 0x20, 0x15, 0x97, 0xa9, 0x4b, 0x74, + 0x76, 0x0e, 0xf7, 0x44, 0x7c, 0xe7, 0xfa, 0xce, 0x16, 0x5d, 0x18, 0xd8, 0xd8, 0x2a, 0xf1, 0x25, + 0x18, 0xf9, 0x18, 0x1d, 0x2b, 0xb1, 0x20, 0x86, 0x82, 0x5a, 0x24, 0xbe, 0x03, 0x13, 0xba, 0x17, + 0x53, 0x35, 0x41, 0xb0, 0x44, 0xf6, 0xfd, 0xde, 0xfc, 0xbf, 0xff, 0x2f, 0xc0, 0x4f, 0x85, 0xcc, + 0x85, 0xc4, 0xb2, 0x66, 0x05, 0xae, 0x07, 0xf8, 0xa8, 0xa2, 0xe5, 0x31, 0x2a, 0x4a, 0xa1, 0x04, + 0x5c, 0xb2, 0x18, 0xd2, 0x18, 0xaa, 0x07, 0xfe, 0x32, 0xc9, 0x19, 0x17, 0xd8, 0xfc, 0x5a, 0x8a, + 0xbf, 0x3e, 0x21, 0x37, 0x54, 0x0b, 0xad, 0x64, 0x22, 0x13, 0xe6, 0x11, 0xeb, 0x27, 0x77, 0xba, + 0x91, 0x09, 0x91, 0x8d, 0x29, 0x26, 0x05, 0xc3, 0x84, 0x73, 0xa1, 0x88, 0x62, 0x82, 0x4b, 0x87, + 0xf6, 0x1d, 0x6a, 0xde, 0x92, 0xea, 0x25, 0x56, 0x2c, 0xa7, 0x52, 0x91, 0xbc, 0x31, 0x0d, 0x5c, + 0x5e, 0x42, 0x24, 0xc5, 0xf5, 0x20, 0xa1, 0x8a, 0x0c, 0x70, 0x2a, 0x18, 0xb7, 0x78, 0xb8, 0x02, + 0xe0, 0x73, 0x3d, 0xc1, 0x1e, 0x29, 0x49, 0x2e, 0x63, 0x7a, 0x54, 0x51, 0xa9, 0xc2, 0x3d, 0x70, + 0xf3, 0xda, 0xa9, 0x2c, 0x04, 0x97, 0x14, 0x3e, 0x00, 0xed, 0xc2, 0x9c, 0xf4, 0xbc, 0x4d, 0x6f, + 0x7b, 0x71, 0xa7, 0x8b, 0xae, 0x0f, 0x8c, 0x2c, 0x3f, 0xea, 0x9c, 0x9e, 0xf7, 0x5b, 0x1f, 0x7e, + 0x7c, 0xbc, 0xe7, 0xc5, 0x4e, 0x10, 0xae, 0x81, 0x55, 0xeb, 0x28, 0xc4, 0x78, 0x5f, 0x11, 0x45, + 0x9b, 0xa8, 0x77, 0xb3, 0xa0, 0x3b, 0x89, 0xb8, 0xb8, 0x08, 0xfc, 0x57, 0x08, 0x31, 0x1e, 0x26, + 0x64, 0x4c, 0x78, 0x4a, 0x5d, 0xe8, 0x7a, 0x13, 0xaa, 0x47, 0x42, 0x6e, 0x24, 0xf4, 0x48, 0x30, + 0x1e, 0xcd, 0xe9, 0xdc, 0x78, 0x51, 0x8b, 0x22, 0xab, 0x81, 0x4f, 0xc0, 0xb2, 0x12, 0x8a, 0x8c, + 0x87, 0x23, 0x26, 0x55, 0xc9, 0x92, 0x4a, 0xd1, 0x51, 0x6f, 0x66, 0xd3, 0xdb, 0xee, 0x44, 0xb7, + 0x35, 0xfb, 0xcb, 0x79, 0x7f, 0xd5, 0xfa, 0xc9, 0xd1, 0x2b, 0xc4, 0x04, 0xce, 0x89, 0x3a, 0x44, + 0x8f, 0xb9, 0x8a, 0x6f, 0x18, 0xdd, 0xee, 0x95, 0x0c, 0x1e, 0x80, 0xb5, 0xb4, 0x2a, 0x4b, 0xca, + 0xd5, 0xb0, 0x24, 0x8a, 0x0e, 0x0b, 0x5a, 0x0e, 0x25, 0x4d, 0x05, 0x1f, 0xf5, 0x66, 0x8d, 0xe3, + 0x96, 0x73, 0xbc, 0x35, 0xed, 0xf8, 0x94, 0x66, 0x24, 0x3d, 0xde, 0xa5, 0x69, 0xbc, 0xe2, 0x3c, + 0x62, 0xa2, 0xe8, 0x1e, 0x2d, 0xf7, 0x8d, 0x01, 0xdc, 0x00, 0x1d, 0x92, 0x2a, 0x56, 0x13, 0xfd, + 0x7d, 0x73, 0x9b, 0xde, 0xf6, 0x42, 0x7c, 0x75, 0x00, 0xbb, 0xfa, 0xe2, 0x2b, 0x49, 0x47, 0xbd, + 0x79, 0x03, 0xb9, 0x37, 0xf8, 0x0c, 0xfc, 0xef, 0x48, 0x4c, 0xf0, 0xa1, 0xde, 0x7d, 0xaf, 0x6d, + 0x2e, 0xc9, 0x47, 0xb6, 0x18, 0xa8, 0x29, 0x06, 0x7a, 0xd1, 0x14, 0x23, 0x5a, 0xd0, 0x5f, 0x79, + 0xf2, 0xb5, 0xef, 0xc5, 0x4b, 0x57, 0x62, 0x0d, 0xef, 0xfc, 0xf4, 0xc0, 0xbc, 0xd9, 0x05, 0x3c, + 0x02, 0x6d, 0xbb, 0x4b, 0x18, 0x4e, 0xee, 0x78, 0xba, 0x2e, 0xfe, 0xd6, 0x5f, 0x39, 0x76, 0x9b, + 0x61, 0xf0, 0xf6, 0xd3, 0xf7, 0xf7, 0x33, 0x3d, 0xd8, 0xc5, 0x13, 0x7f, 0x01, 0xdb, 0x10, 0xf8, + 0x06, 0x74, 0x7e, 0x57, 0x00, 0xde, 0xf9, 0xb3, 0xe3, 0x44, 0x79, 0xfc, 0xbb, 0xff, 0xa2, 0xb9, + 0xec, 0xd0, 0x64, 0x6f, 0x40, 0x7f, 0x2a, 0x5b, 0xf7, 0x4b, 0x6a, 0x6e, 0xf4, 0xf0, 0xf4, 0x22, + 0xf0, 0xce, 0x2e, 0x02, 0xef, 0xdb, 0x45, 0xe0, 0x9d, 0x5c, 0x06, 0xad, 0xb3, 0xcb, 0xa0, 0xf5, + 0xf9, 0x32, 0x68, 0x1d, 0x84, 0x19, 0x53, 0x87, 0x55, 0x82, 0x52, 0x91, 0x37, 0x7a, 0x5a, 0xe7, + 0xf8, 0xb5, 0x75, 0x51, 0xc7, 0x05, 0x95, 0x49, 0xdb, 0x5c, 0xf4, 0xfd, 0x5f, 0x01, 0x00, 0x00, + 0xff, 0xff, 0xa5, 0x62, 0xe6, 0x7b, 0x1f, 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 { + // Params queries the parameters of x/svip module. + Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) + // PoolState queries the current SVIP pool balance, distribution stats, and + // reward rate. + PoolState(ctx context.Context, in *QueryPoolStateRequest, opts ...grpc.CallOption) (*QueryPoolStateResponse, 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, "/cosmos.svip.v1.Query/Params", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) PoolState(ctx context.Context, in *QueryPoolStateRequest, opts ...grpc.CallOption) (*QueryPoolStateResponse, error) { + out := new(QueryPoolStateResponse) + err := c.cc.Invoke(ctx, "/cosmos.svip.v1.Query/PoolState", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// QueryServer is the server API for Query service. +type QueryServer interface { + // Params queries the parameters of x/svip module. + Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) + // PoolState queries the current SVIP pool balance, distribution stats, and + // reward rate. + PoolState(context.Context, *QueryPoolStateRequest) (*QueryPoolStateResponse, 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) PoolState(ctx context.Context, req *QueryPoolStateRequest) (*QueryPoolStateResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method PoolState 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: "/cosmos.svip.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_PoolState_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryPoolStateRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).PoolState(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.svip.v1.Query/PoolState", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).PoolState(ctx, req.(*QueryPoolStateRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "cosmos.svip.v1.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Params", + Handler: _Query_Params_Handler, + }, + { + MethodName: "PoolState", + Handler: _Query_PoolState_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "cosmos/svip/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 *QueryPoolStateRequest) 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 *QueryPoolStateRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryPoolStateRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryPoolStateResponse) 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 *QueryPoolStateResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryPoolStateResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + n2, err2 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.ActivationTime, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.ActivationTime):]) + if err2 != nil { + return 0, err2 + } + i -= n2 + i = encodeVarintQuery(dAtA, i, uint64(n2)) + i-- + dAtA[i] = 0x32 + if m.Paused { + i-- + if m.Paused { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x28 + } + if m.Activated { + i-- + if m.Activated { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x20 + } + { + size := m.CurrentRatePerSecond.Size() + i -= size + if _, err := m.CurrentRatePerSecond.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + { + size := m.TotalDistributed.Size() + i -= size + if _, err := m.TotalDistributed.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size, err := m.PoolBalance.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 *QueryPoolStateRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryPoolStateResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.PoolBalance.Size() + n += 1 + l + sovQuery(uint64(l)) + l = m.TotalDistributed.Size() + n += 1 + l + sovQuery(uint64(l)) + l = m.CurrentRatePerSecond.Size() + n += 1 + l + sovQuery(uint64(l)) + if m.Activated { + n += 2 + } + if m.Paused { + n += 2 + } + l = github_com_cosmos_gogoproto_types.SizeOfStdTime(m.ActivationTime) + 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 *QueryPoolStateRequest) 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: QueryPoolStateRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryPoolStateRequest: 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 *QueryPoolStateResponse) 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: QueryPoolStateResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryPoolStateResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PoolBalance", 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.PoolBalance.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TotalDistributed", 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 + } + if err := m.TotalDistributed.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CurrentRatePerSecond", 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 + } + if err := m.CurrentRatePerSecond.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Activated", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Activated = bool(v != 0) + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Paused", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Paused = bool(v != 0) + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ActivationTime", 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 := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(&m.ActivationTime, 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/svip/types/query.pb.gw.go b/x/svip/types/query.pb.gw.go new file mode 100644 index 00000000..a2052090 --- /dev/null +++ b/x/svip/types/query.pb.gw.go @@ -0,0 +1,218 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: cosmos/svip/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_PoolState_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryPoolStateRequest + var metadata runtime.ServerMetadata + + msg, err := client.PoolState(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_PoolState_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryPoolStateRequest + var metadata runtime.ServerMetadata + + msg, err := server.PoolState(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_PoolState_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_PoolState_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_PoolState_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_PoolState_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_PoolState_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_PoolState_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}, []string{"cosmos", "svip", "v1", "params"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_PoolState_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"cosmos", "svip", "v1", "pool_state"}, "", runtime.AssumeColonVerbOpt(false))) +) + +var ( + forward_Query_Params_0 = runtime.ForwardResponseMessage + + forward_Query_PoolState_0 = runtime.ForwardResponseMessage +) diff --git a/x/svip/types/svip.pb.go b/x/svip/types/svip.pb.go new file mode 100644 index 00000000..ee86760a --- /dev/null +++ b/x/svip/types/svip.pb.go @@ -0,0 +1,306 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: cosmos/svip/v1/svip.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 + +// Params defines the x/svip module parameters. +type Params struct { + // half_life_seconds is the half-life for exponential decay, in seconds. + HalfLifeSeconds int64 `protobuf:"varint,3,opt,name=half_life_seconds,json=halfLifeSeconds,proto3" json:"half_life_seconds"` +} + +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_37b8c507ba0d74ab, []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) GetHalfLifeSeconds() int64 { + if m != nil { + return m.HalfLifeSeconds + } + return 0 +} + +func init() { + proto.RegisterType((*Params)(nil), "cosmos.svip.v1.Params") +} + +func init() { proto.RegisterFile("cosmos/svip/v1/svip.proto", fileDescriptor_37b8c507ba0d74ab) } + +var fileDescriptor_37b8c507ba0d74ab = []byte{ + // 213 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4c, 0xce, 0x2f, 0xce, + 0xcd, 0x2f, 0xd6, 0x2f, 0x2e, 0xcb, 0x2c, 0xd0, 0x2f, 0x33, 0x04, 0xd3, 0x7a, 0x05, 0x45, 0xf9, + 0x25, 0xf9, 0x42, 0x7c, 0x10, 0x29, 0x3d, 0xb0, 0x50, 0x99, 0xa1, 0x94, 0x60, 0x62, 0x6e, 0x66, + 0x5e, 0xbe, 0x3e, 0x98, 0x84, 0x28, 0x91, 0x12, 0x49, 0xcf, 0x4f, 0xcf, 0x07, 0x33, 0xf5, 0x41, + 0x2c, 0x88, 0xa8, 0x52, 0x36, 0x17, 0x5b, 0x40, 0x62, 0x51, 0x62, 0x6e, 0xb1, 0x90, 0x1b, 0x97, + 0x60, 0x46, 0x62, 0x4e, 0x5a, 0x7c, 0x4e, 0x66, 0x5a, 0x6a, 0x7c, 0x71, 0x6a, 0x72, 0x7e, 0x5e, + 0x4a, 0xb1, 0x04, 0xb3, 0x02, 0xa3, 0x06, 0xb3, 0x93, 0xd4, 0xab, 0x7b, 0xf2, 0x98, 0x92, 0x2b, + 0x9e, 0x6f, 0xd0, 0x62, 0x0c, 0xe2, 0x07, 0x89, 0xfb, 0x64, 0xa6, 0xa5, 0x06, 0x43, 0x44, 0xad, + 0x24, 0xbb, 0x9e, 0x6f, 0xd0, 0x12, 0x81, 0x3a, 0xb5, 0x02, 0xe2, 0x58, 0x88, 0x15, 0x4e, 0x36, + 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, 0x94, 0x9e, 0x59, 0x92, 0x51, + 0x9a, 0xa4, 0x97, 0x9c, 0x9f, 0xab, 0x0f, 0xd5, 0x9a, 0x5a, 0x96, 0x0b, 0xd3, 0x5e, 0x52, 0x59, + 0x90, 0x5a, 0x9c, 0xc4, 0x06, 0x76, 0xb1, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0x8d, 0xf7, 0x95, + 0x32, 0x07, 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.HalfLifeSeconds != 0 { + i = encodeVarintSvip(dAtA, i, uint64(m.HalfLifeSeconds)) + i-- + dAtA[i] = 0x18 + } + return len(dAtA) - i, nil +} + +func encodeVarintSvip(dAtA []byte, offset int, v uint64) int { + offset -= sovSvip(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 + if m.HalfLifeSeconds != 0 { + n += 1 + sovSvip(uint64(m.HalfLifeSeconds)) + } + return n +} + +func sovSvip(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozSvip(x uint64) (n int) { + return sovSvip(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 ErrIntOverflowSvip + } + 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 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field HalfLifeSeconds", wireType) + } + m.HalfLifeSeconds = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSvip + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.HalfLifeSeconds |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipSvip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthSvip + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipSvip(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, ErrIntOverflowSvip + } + 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, ErrIntOverflowSvip + } + 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, ErrIntOverflowSvip + } + 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, ErrInvalidLengthSvip + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupSvip + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthSvip + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthSvip = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowSvip = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupSvip = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/svip/types/tx.pb.go b/x/svip/types/tx.pb.go new file mode 100644 index 00000000..59a3788a --- /dev/null +++ b/x/svip/types/tx.pb.go @@ -0,0 +1,2035 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: cosmos/svip/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 defines a Msg for updating the x/svip module parameters. +type MsgUpdateParams struct { + // authority is the address of the governance account. + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // params defines the x/svip parameters to update. + // NOTE: Only half_life_seconds is configurable via this message. + 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_53f7d4525d63aef9, []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 for MsgUpdateParams. +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_53f7d4525d63aef9, []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 + +// MsgActivate activates SVIP reward distribution. Governance-only. +type MsgActivate struct { + // authority is the address of the governance account. + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` +} + +func (m *MsgActivate) Reset() { *m = MsgActivate{} } +func (m *MsgActivate) String() string { return proto.CompactTextString(m) } +func (*MsgActivate) ProtoMessage() {} +func (*MsgActivate) Descriptor() ([]byte, []int) { + return fileDescriptor_53f7d4525d63aef9, []int{2} +} +func (m *MsgActivate) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgActivate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgActivate.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 *MsgActivate) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgActivate.Merge(m, src) +} +func (m *MsgActivate) XXX_Size() int { + return m.Size() +} +func (m *MsgActivate) XXX_DiscardUnknown() { + xxx_messageInfo_MsgActivate.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgActivate proto.InternalMessageInfo + +func (m *MsgActivate) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" +} + +// MsgActivateResponse defines the response for MsgActivate. +type MsgActivateResponse struct { +} + +func (m *MsgActivateResponse) Reset() { *m = MsgActivateResponse{} } +func (m *MsgActivateResponse) String() string { return proto.CompactTextString(m) } +func (*MsgActivateResponse) ProtoMessage() {} +func (*MsgActivateResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_53f7d4525d63aef9, []int{3} +} +func (m *MsgActivateResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgActivateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgActivateResponse.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 *MsgActivateResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgActivateResponse.Merge(m, src) +} +func (m *MsgActivateResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgActivateResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgActivateResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgActivateResponse proto.InternalMessageInfo + +// MsgReactivate restarts the decay curve with a fresh pool snapshot. +// Governance-only. Used after pool exhaustion and refund. +type MsgReactivate struct { + // authority is the address of the governance account. + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` +} + +func (m *MsgReactivate) Reset() { *m = MsgReactivate{} } +func (m *MsgReactivate) String() string { return proto.CompactTextString(m) } +func (*MsgReactivate) ProtoMessage() {} +func (*MsgReactivate) Descriptor() ([]byte, []int) { + return fileDescriptor_53f7d4525d63aef9, []int{4} +} +func (m *MsgReactivate) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgReactivate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgReactivate.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 *MsgReactivate) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgReactivate.Merge(m, src) +} +func (m *MsgReactivate) XXX_Size() int { + return m.Size() +} +func (m *MsgReactivate) XXX_DiscardUnknown() { + xxx_messageInfo_MsgReactivate.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgReactivate proto.InternalMessageInfo + +func (m *MsgReactivate) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" +} + +// MsgReactivateResponse defines the response for MsgReactivate. +type MsgReactivateResponse struct { +} + +func (m *MsgReactivateResponse) Reset() { *m = MsgReactivateResponse{} } +func (m *MsgReactivateResponse) String() string { return proto.CompactTextString(m) } +func (*MsgReactivateResponse) ProtoMessage() {} +func (*MsgReactivateResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_53f7d4525d63aef9, []int{5} +} +func (m *MsgReactivateResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgReactivateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgReactivateResponse.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 *MsgReactivateResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgReactivateResponse.Merge(m, src) +} +func (m *MsgReactivateResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgReactivateResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgReactivateResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgReactivateResponse proto.InternalMessageInfo + +// MsgPause toggles the SVIP emergency pause flag. Governance-only. +type MsgPause struct { + // authority is the address of the governance account. + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // paused is the desired pause state. + Paused bool `protobuf:"varint,2,opt,name=paused,proto3" json:"paused,omitempty"` +} + +func (m *MsgPause) Reset() { *m = MsgPause{} } +func (m *MsgPause) String() string { return proto.CompactTextString(m) } +func (*MsgPause) ProtoMessage() {} +func (*MsgPause) Descriptor() ([]byte, []int) { + return fileDescriptor_53f7d4525d63aef9, []int{6} +} +func (m *MsgPause) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgPause) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgPause.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 *MsgPause) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgPause.Merge(m, src) +} +func (m *MsgPause) XXX_Size() int { + return m.Size() +} +func (m *MsgPause) XXX_DiscardUnknown() { + xxx_messageInfo_MsgPause.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgPause proto.InternalMessageInfo + +func (m *MsgPause) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" +} + +func (m *MsgPause) GetPaused() bool { + if m != nil { + return m.Paused + } + return false +} + +// MsgPauseResponse defines the response for MsgPause. +type MsgPauseResponse struct { +} + +func (m *MsgPauseResponse) Reset() { *m = MsgPauseResponse{} } +func (m *MsgPauseResponse) String() string { return proto.CompactTextString(m) } +func (*MsgPauseResponse) ProtoMessage() {} +func (*MsgPauseResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_53f7d4525d63aef9, []int{7} +} +func (m *MsgPauseResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgPauseResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgPauseResponse.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 *MsgPauseResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgPauseResponse.Merge(m, src) +} +func (m *MsgPauseResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgPauseResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgPauseResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgPauseResponse proto.InternalMessageInfo + +// MsgFundPool sends native tokens to the SVIP reward pool. Permissionless. +type MsgFundPool struct { + // depositor is the address funding the pool. + Depositor string `protobuf:"bytes,1,opt,name=depositor,proto3" json:"depositor,omitempty"` + // amount is the coins to transfer. Only the native denom is accepted. + Amount []types.Coin `protobuf:"bytes,2,rep,name=amount,proto3" json:"amount"` +} + +func (m *MsgFundPool) Reset() { *m = MsgFundPool{} } +func (m *MsgFundPool) String() string { return proto.CompactTextString(m) } +func (*MsgFundPool) ProtoMessage() {} +func (*MsgFundPool) Descriptor() ([]byte, []int) { + return fileDescriptor_53f7d4525d63aef9, []int{8} +} +func (m *MsgFundPool) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgFundPool) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgFundPool.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 *MsgFundPool) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgFundPool.Merge(m, src) +} +func (m *MsgFundPool) XXX_Size() int { + return m.Size() +} +func (m *MsgFundPool) XXX_DiscardUnknown() { + xxx_messageInfo_MsgFundPool.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgFundPool proto.InternalMessageInfo + +func (m *MsgFundPool) GetDepositor() string { + if m != nil { + return m.Depositor + } + return "" +} + +func (m *MsgFundPool) GetAmount() []types.Coin { + if m != nil { + return m.Amount + } + return nil +} + +// MsgFundPoolResponse defines the response for MsgFundPool. +type MsgFundPoolResponse struct { +} + +func (m *MsgFundPoolResponse) Reset() { *m = MsgFundPoolResponse{} } +func (m *MsgFundPoolResponse) String() string { return proto.CompactTextString(m) } +func (*MsgFundPoolResponse) ProtoMessage() {} +func (*MsgFundPoolResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_53f7d4525d63aef9, []int{9} +} +func (m *MsgFundPoolResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgFundPoolResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgFundPoolResponse.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 *MsgFundPoolResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgFundPoolResponse.Merge(m, src) +} +func (m *MsgFundPoolResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgFundPoolResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgFundPoolResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgFundPoolResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*MsgUpdateParams)(nil), "cosmos.svip.v1.MsgUpdateParams") + proto.RegisterType((*MsgUpdateParamsResponse)(nil), "cosmos.svip.v1.MsgUpdateParamsResponse") + proto.RegisterType((*MsgActivate)(nil), "cosmos.svip.v1.MsgActivate") + proto.RegisterType((*MsgActivateResponse)(nil), "cosmos.svip.v1.MsgActivateResponse") + proto.RegisterType((*MsgReactivate)(nil), "cosmos.svip.v1.MsgReactivate") + proto.RegisterType((*MsgReactivateResponse)(nil), "cosmos.svip.v1.MsgReactivateResponse") + proto.RegisterType((*MsgPause)(nil), "cosmos.svip.v1.MsgPause") + proto.RegisterType((*MsgPauseResponse)(nil), "cosmos.svip.v1.MsgPauseResponse") + proto.RegisterType((*MsgFundPool)(nil), "cosmos.svip.v1.MsgFundPool") + proto.RegisterType((*MsgFundPoolResponse)(nil), "cosmos.svip.v1.MsgFundPoolResponse") +} + +func init() { proto.RegisterFile("cosmos/svip/v1/tx.proto", fileDescriptor_53f7d4525d63aef9) } + +var fileDescriptor_53f7d4525d63aef9 = []byte{ + // 571 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0x41, 0x8b, 0xd3, 0x40, + 0x14, 0x6e, 0xb6, 0x6c, 0x69, 0xa7, 0xba, 0x6a, 0xdc, 0xdd, 0xb6, 0x91, 0xcd, 0x96, 0x8a, 0x58, + 0x0a, 0x26, 0xb6, 0x82, 0xe0, 0xb2, 0x97, 0xed, 0x82, 0x27, 0x0b, 0x25, 0xb2, 0x28, 0x5e, 0x64, + 0xda, 0x0c, 0xb3, 0x11, 0x93, 0x09, 0x79, 0x93, 0xb0, 0x7b, 0x13, 0x8f, 0x9e, 0x04, 0x8f, 0xfe, + 0x01, 0x8f, 0x3d, 0x88, 0xbf, 0x61, 0x8f, 0x8b, 0x27, 0x4f, 0x22, 0xed, 0xa1, 0x7f, 0x43, 0x92, + 0x4c, 0xd2, 0x26, 0xd6, 0x5d, 0x58, 0xf6, 0x52, 0x9a, 0xf9, 0xde, 0xfb, 0xbe, 0xef, 0xcd, 0xfb, + 0x18, 0x54, 0x1b, 0x33, 0xb0, 0x19, 0xe8, 0x10, 0x58, 0xae, 0x1e, 0x74, 0x75, 0x7e, 0xa2, 0xb9, + 0x1e, 0xe3, 0x4c, 0xde, 0x88, 0x01, 0x2d, 0x04, 0xb4, 0xa0, 0xab, 0xdc, 0xc1, 0xb6, 0xe5, 0x30, + 0x3d, 0xfa, 0x8d, 0x4b, 0x94, 0x46, 0xae, 0x37, 0x2a, 0x8d, 0xa1, 0x84, 0xd6, 0x06, 0x1a, 0x22, + 0x36, 0xd0, 0x6c, 0xcf, 0xdb, 0xe8, 0x4b, 0x17, 0x1a, 0x31, 0xb4, 0x49, 0x19, 0x65, 0xf1, 0x79, + 0xf8, 0x4f, 0x9c, 0xaa, 0x82, 0x69, 0x84, 0x81, 0xe8, 0x41, 0x77, 0x44, 0x38, 0xee, 0xea, 0x63, + 0x66, 0x39, 0x31, 0xde, 0xfa, 0x21, 0xa1, 0x5b, 0x03, 0xa0, 0x47, 0xae, 0x89, 0x39, 0x19, 0x62, + 0x0f, 0xdb, 0x20, 0x3f, 0x45, 0x15, 0xec, 0xf3, 0x63, 0xe6, 0x59, 0xfc, 0xb4, 0x2e, 0x35, 0xa5, + 0x76, 0xa5, 0x5f, 0xff, 0xf9, 0xfd, 0xd1, 0xa6, 0x90, 0x3b, 0x30, 0x4d, 0x8f, 0x00, 0xbc, 0xe4, + 0x9e, 0xe5, 0x50, 0x63, 0x51, 0x2a, 0x3f, 0x43, 0x25, 0x37, 0x62, 0xa8, 0xaf, 0x35, 0xa5, 0x76, + 0xb5, 0xb7, 0xad, 0x65, 0x2f, 0x41, 0x8b, 0xf9, 0xfb, 0x95, 0xb3, 0xdf, 0xbb, 0x85, 0x6f, 0xf3, + 0x49, 0x47, 0x32, 0x44, 0xc3, 0xde, 0xe3, 0x8f, 0xf3, 0x49, 0x67, 0x41, 0xf5, 0x69, 0x3e, 0xe9, + 0xec, 0x08, 0xe7, 0x27, 0xf1, 0x05, 0xe5, 0x4c, 0xb6, 0x1a, 0xa8, 0x96, 0x3b, 0x32, 0x08, 0xb8, + 0xcc, 0x01, 0xd2, 0x3a, 0x42, 0xd5, 0x01, 0xd0, 0x83, 0x31, 0xb7, 0x02, 0xcc, 0xc9, 0x55, 0xc7, + 0xd9, 0xdb, 0xc8, 0x7a, 0x6a, 0x6d, 0xa1, 0xbb, 0x4b, 0xb4, 0xa9, 0xda, 0x2b, 0x74, 0x73, 0x00, + 0xd4, 0x20, 0xf8, 0xba, 0xf5, 0x6a, 0x68, 0x2b, 0x43, 0x9c, 0x2a, 0xbe, 0x43, 0xe5, 0x01, 0xd0, + 0x21, 0xf6, 0xe1, 0xca, 0x62, 0xf2, 0x76, 0xb8, 0x2b, 0x1f, 0x88, 0x19, 0xed, 0xaa, 0x6c, 0x88, + 0xaf, 0x7f, 0x4c, 0xc8, 0xe8, 0x76, 0xa2, 0x95, 0xea, 0x7f, 0x91, 0xa2, 0x0b, 0x7e, 0xee, 0x3b, + 0xe6, 0x90, 0xb1, 0xf7, 0xa1, 0x07, 0x93, 0xb8, 0x0c, 0x2c, 0xce, 0xbc, 0xcb, 0x3d, 0xa4, 0xa5, + 0xf2, 0x3e, 0x2a, 0x61, 0x9b, 0xf9, 0x0e, 0xaf, 0xaf, 0x35, 0x8b, 0xed, 0x6a, 0xaf, 0x91, 0xe4, + 0x25, 0x0c, 0xab, 0x26, 0xc2, 0xaa, 0x1d, 0x32, 0xcb, 0xc9, 0x44, 0x26, 0xee, 0x11, 0x4e, 0x53, + 0x36, 0xb1, 0x9e, 0xc4, 0x54, 0x62, 0xb6, 0xf7, 0xb5, 0x88, 0x8a, 0x03, 0xa0, 0xf2, 0x6b, 0x74, + 0x23, 0x13, 0xf2, 0xdd, 0x7c, 0x38, 0x73, 0x69, 0x52, 0x1e, 0x5e, 0x52, 0x90, 0x28, 0xc8, 0x2f, + 0x50, 0x39, 0xcd, 0xda, 0xbd, 0x15, 0x4d, 0x09, 0xa8, 0xdc, 0xbf, 0x00, 0x4c, 0xd9, 0x0c, 0x84, + 0x96, 0xb2, 0xb4, 0xb3, 0xa2, 0x65, 0x01, 0x2b, 0x0f, 0x2e, 0x84, 0x53, 0xce, 0x43, 0xb4, 0x1e, + 0xa7, 0xa5, 0xbe, 0xa2, 0x3e, 0x42, 0x94, 0xe6, 0xff, 0x90, 0xe5, 0x31, 0xd3, 0x8d, 0xaf, 0x1a, + 0x33, 0x01, 0x57, 0x8e, 0x99, 0x5f, 0x8b, 0xb2, 0xfe, 0x21, 0x5c, 0x66, 0x7f, 0xff, 0x6c, 0xaa, + 0x4a, 0xe7, 0x53, 0x55, 0xfa, 0x33, 0x55, 0xa5, 0xcf, 0x33, 0xb5, 0x70, 0x3e, 0x53, 0x0b, 0xbf, + 0x66, 0x6a, 0xe1, 0x4d, 0x8b, 0x5a, 0xfc, 0xd8, 0x1f, 0x69, 0x63, 0x66, 0x8b, 0x77, 0x4e, 0x27, + 0x81, 0x9d, 0xbc, 0x06, 0xfc, 0xd4, 0x25, 0x30, 0x2a, 0x45, 0x6f, 0xd8, 0x93, 0xbf, 0x01, 0x00, + 0x00, 0xff, 0xff, 0x52, 0xb7, 0xef, 0x3f, 0x86, 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 updates the x/svip module parameters. Governance-only. + UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) + // Activate turns on reward distribution. Snapshots pool balance. + Activate(ctx context.Context, in *MsgActivate, opts ...grpc.CallOption) (*MsgActivateResponse, error) + // Reactivate restarts the decay curve with a fresh pool snapshot. + Reactivate(ctx context.Context, in *MsgReactivate, opts ...grpc.CallOption) (*MsgReactivateResponse, error) + // Pause toggles the emergency pause flag. Governance-only. + Pause(ctx context.Context, in *MsgPause, opts ...grpc.CallOption) (*MsgPauseResponse, error) + // FundPool transfers native tokens into the SVIP pool. Permissionless. + FundPool(ctx context.Context, in *MsgFundPool, opts ...grpc.CallOption) (*MsgFundPoolResponse, 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, "/cosmos.svip.v1.Msg/UpdateParams", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) Activate(ctx context.Context, in *MsgActivate, opts ...grpc.CallOption) (*MsgActivateResponse, error) { + out := new(MsgActivateResponse) + err := c.cc.Invoke(ctx, "/cosmos.svip.v1.Msg/Activate", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) Reactivate(ctx context.Context, in *MsgReactivate, opts ...grpc.CallOption) (*MsgReactivateResponse, error) { + out := new(MsgReactivateResponse) + err := c.cc.Invoke(ctx, "/cosmos.svip.v1.Msg/Reactivate", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) Pause(ctx context.Context, in *MsgPause, opts ...grpc.CallOption) (*MsgPauseResponse, error) { + out := new(MsgPauseResponse) + err := c.cc.Invoke(ctx, "/cosmos.svip.v1.Msg/Pause", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) FundPool(ctx context.Context, in *MsgFundPool, opts ...grpc.CallOption) (*MsgFundPoolResponse, error) { + out := new(MsgFundPoolResponse) + err := c.cc.Invoke(ctx, "/cosmos.svip.v1.Msg/FundPool", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// MsgServer is the server API for Msg service. +type MsgServer interface { + // UpdateParams updates the x/svip module parameters. Governance-only. + UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) + // Activate turns on reward distribution. Snapshots pool balance. + Activate(context.Context, *MsgActivate) (*MsgActivateResponse, error) + // Reactivate restarts the decay curve with a fresh pool snapshot. + Reactivate(context.Context, *MsgReactivate) (*MsgReactivateResponse, error) + // Pause toggles the emergency pause flag. Governance-only. + Pause(context.Context, *MsgPause) (*MsgPauseResponse, error) + // FundPool transfers native tokens into the SVIP pool. Permissionless. + FundPool(context.Context, *MsgFundPool) (*MsgFundPoolResponse, 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) Activate(ctx context.Context, req *MsgActivate) (*MsgActivateResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Activate not implemented") +} +func (*UnimplementedMsgServer) Reactivate(ctx context.Context, req *MsgReactivate) (*MsgReactivateResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Reactivate not implemented") +} +func (*UnimplementedMsgServer) Pause(ctx context.Context, req *MsgPause) (*MsgPauseResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Pause not implemented") +} +func (*UnimplementedMsgServer) FundPool(ctx context.Context, req *MsgFundPool) (*MsgFundPoolResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method FundPool 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: "/cosmos.svip.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_Activate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgActivate) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).Activate(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.svip.v1.Msg/Activate", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).Activate(ctx, req.(*MsgActivate)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_Reactivate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgReactivate) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).Reactivate(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.svip.v1.Msg/Reactivate", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).Reactivate(ctx, req.(*MsgReactivate)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_Pause_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgPause) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).Pause(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.svip.v1.Msg/Pause", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).Pause(ctx, req.(*MsgPause)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_FundPool_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgFundPool) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).FundPool(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.svip.v1.Msg/FundPool", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).FundPool(ctx, req.(*MsgFundPool)) + } + return interceptor(ctx, in, info, handler) +} + +var _Msg_serviceDesc = grpc.ServiceDesc{ + ServiceName: "cosmos.svip.v1.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "UpdateParams", + Handler: _Msg_UpdateParams_Handler, + }, + { + MethodName: "Activate", + Handler: _Msg_Activate_Handler, + }, + { + MethodName: "Reactivate", + Handler: _Msg_Reactivate_Handler, + }, + { + MethodName: "Pause", + Handler: _Msg_Pause_Handler, + }, + { + MethodName: "FundPool", + Handler: _Msg_FundPool_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "cosmos/svip/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 *MsgActivate) 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 *MsgActivate) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgActivate) 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] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgActivateResponse) 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 *MsgActivateResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgActivateResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgReactivate) 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 *MsgReactivate) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgReactivate) 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] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgReactivateResponse) 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 *MsgReactivateResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgReactivateResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgPause) 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 *MsgPause) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgPause) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Paused { + i-- + if m.Paused { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x10 + } + 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 *MsgPauseResponse) 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 *MsgPauseResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgPauseResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgFundPool) 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 *MsgFundPool) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgFundPool) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Amount) > 0 { + for iNdEx := len(m.Amount) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Amount[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if len(m.Depositor) > 0 { + i -= len(m.Depositor) + copy(dAtA[i:], m.Depositor) + i = encodeVarintTx(dAtA, i, uint64(len(m.Depositor))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgFundPoolResponse) 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 *MsgFundPoolResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgFundPoolResponse) 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 *MsgActivate) 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)) + } + return n +} + +func (m *MsgActivateResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgReactivate) 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)) + } + return n +} + +func (m *MsgReactivateResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgPause) 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)) + } + if m.Paused { + n += 2 + } + return n +} + +func (m *MsgPauseResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgFundPool) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Depositor) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if len(m.Amount) > 0 { + for _, e := range m.Amount { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } + return n +} + +func (m *MsgFundPoolResponse) 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 *MsgActivate) 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: MsgActivate: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgActivate: 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 + 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 *MsgActivateResponse) 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: MsgActivateResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgActivateResponse: 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 *MsgReactivate) 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: MsgReactivate: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgReactivate: 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 + 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 *MsgReactivateResponse) 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: MsgReactivateResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgReactivateResponse: 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 *MsgPause) 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: MsgPause: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgPause: 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 != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Paused", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Paused = bool(v != 0) + 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 *MsgPauseResponse) 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: MsgPauseResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgPauseResponse: 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 *MsgFundPool) 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: MsgFundPool: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgFundPool: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Depositor", 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.Depositor = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + 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 + } + m.Amount = append(m.Amount, types.Coin{}) + if err := m.Amount[len(m.Amount)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgFundPoolResponse) 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: MsgFundPoolResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgFundPoolResponse: 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/vm/types/precompiles.go b/x/vm/types/precompiles.go index 391eb960..c48f2b08 100644 --- a/x/vm/types/precompiles.go +++ b/x/vm/types/precompiles.go @@ -15,6 +15,7 @@ const ( SlashingPrecompileAddress = "0x0000000000000000000000000000000000000806" ICS02PrecompileAddress = "0x0000000000000000000000000000000000000807" TEEPrecompileAddress = "0x0000000000000000000000000000000000000900" + BridgePrecompileAddress = "0x0000000000000000000000000000000000000A00" ) // AvailableStaticPrecompiles defines the full list of all available EVM extension addresses. @@ -33,4 +34,5 @@ var AvailableStaticPrecompiles = []string{ SlashingPrecompileAddress, ICS02PrecompileAddress, TEEPrecompileAddress, + BridgePrecompileAddress, }