diff --git a/api/band/tunnel/v1beta1/route.pulsar.go b/api/band/tunnel/v1beta1/route.pulsar.go index 246162753..a999f6669 100644 --- a/api/band/tunnel/v1beta1/route.pulsar.go +++ b/api/band/tunnel/v1beta1/route.pulsar.go @@ -2413,6 +2413,2698 @@ func (x *fastReflection_TunnelPricesPacketData) ProtoMethods() *protoiface.Metho } } +var ( + md_IBCHookRoute protoreflect.MessageDescriptor + fd_IBCHookRoute_channel_id protoreflect.FieldDescriptor + fd_IBCHookRoute_destination_contract_address protoreflect.FieldDescriptor +) + +func init() { + file_band_tunnel_v1beta1_route_proto_init() + md_IBCHookRoute = File_band_tunnel_v1beta1_route_proto.Messages().ByName("IBCHookRoute") + fd_IBCHookRoute_channel_id = md_IBCHookRoute.Fields().ByName("channel_id") + fd_IBCHookRoute_destination_contract_address = md_IBCHookRoute.Fields().ByName("destination_contract_address") +} + +var _ protoreflect.Message = (*fastReflection_IBCHookRoute)(nil) + +type fastReflection_IBCHookRoute IBCHookRoute + +func (x *IBCHookRoute) ProtoReflect() protoreflect.Message { + return (*fastReflection_IBCHookRoute)(x) +} + +func (x *IBCHookRoute) slowProtoReflect() protoreflect.Message { + mi := &file_band_tunnel_v1beta1_route_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_IBCHookRoute_messageType fastReflection_IBCHookRoute_messageType +var _ protoreflect.MessageType = fastReflection_IBCHookRoute_messageType{} + +type fastReflection_IBCHookRoute_messageType struct{} + +func (x fastReflection_IBCHookRoute_messageType) Zero() protoreflect.Message { + return (*fastReflection_IBCHookRoute)(nil) +} +func (x fastReflection_IBCHookRoute_messageType) New() protoreflect.Message { + return new(fastReflection_IBCHookRoute) +} +func (x fastReflection_IBCHookRoute_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_IBCHookRoute +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_IBCHookRoute) Descriptor() protoreflect.MessageDescriptor { + return md_IBCHookRoute +} + +// 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_IBCHookRoute) Type() protoreflect.MessageType { + return _fastReflection_IBCHookRoute_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_IBCHookRoute) New() protoreflect.Message { + return new(fastReflection_IBCHookRoute) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_IBCHookRoute) Interface() protoreflect.ProtoMessage { + return (*IBCHookRoute)(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_IBCHookRoute) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.ChannelId != "" { + value := protoreflect.ValueOfString(x.ChannelId) + if !f(fd_IBCHookRoute_channel_id, value) { + return + } + } + if x.DestinationContractAddress != "" { + value := protoreflect.ValueOfString(x.DestinationContractAddress) + if !f(fd_IBCHookRoute_destination_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_IBCHookRoute) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "band.tunnel.v1beta1.IBCHookRoute.channel_id": + return x.ChannelId != "" + case "band.tunnel.v1beta1.IBCHookRoute.destination_contract_address": + return x.DestinationContractAddress != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: band.tunnel.v1beta1.IBCHookRoute")) + } + panic(fmt.Errorf("message band.tunnel.v1beta1.IBCHookRoute 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_IBCHookRoute) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "band.tunnel.v1beta1.IBCHookRoute.channel_id": + x.ChannelId = "" + case "band.tunnel.v1beta1.IBCHookRoute.destination_contract_address": + x.DestinationContractAddress = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: band.tunnel.v1beta1.IBCHookRoute")) + } + panic(fmt.Errorf("message band.tunnel.v1beta1.IBCHookRoute 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_IBCHookRoute) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "band.tunnel.v1beta1.IBCHookRoute.channel_id": + value := x.ChannelId + return protoreflect.ValueOfString(value) + case "band.tunnel.v1beta1.IBCHookRoute.destination_contract_address": + value := x.DestinationContractAddress + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: band.tunnel.v1beta1.IBCHookRoute")) + } + panic(fmt.Errorf("message band.tunnel.v1beta1.IBCHookRoute 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_IBCHookRoute) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "band.tunnel.v1beta1.IBCHookRoute.channel_id": + x.ChannelId = value.Interface().(string) + case "band.tunnel.v1beta1.IBCHookRoute.destination_contract_address": + x.DestinationContractAddress = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: band.tunnel.v1beta1.IBCHookRoute")) + } + panic(fmt.Errorf("message band.tunnel.v1beta1.IBCHookRoute 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_IBCHookRoute) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "band.tunnel.v1beta1.IBCHookRoute.channel_id": + panic(fmt.Errorf("field channel_id of message band.tunnel.v1beta1.IBCHookRoute is not mutable")) + case "band.tunnel.v1beta1.IBCHookRoute.destination_contract_address": + panic(fmt.Errorf("field destination_contract_address of message band.tunnel.v1beta1.IBCHookRoute is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: band.tunnel.v1beta1.IBCHookRoute")) + } + panic(fmt.Errorf("message band.tunnel.v1beta1.IBCHookRoute 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_IBCHookRoute) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "band.tunnel.v1beta1.IBCHookRoute.channel_id": + return protoreflect.ValueOfString("") + case "band.tunnel.v1beta1.IBCHookRoute.destination_contract_address": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: band.tunnel.v1beta1.IBCHookRoute")) + } + panic(fmt.Errorf("message band.tunnel.v1beta1.IBCHookRoute 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_IBCHookRoute) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in band.tunnel.v1beta1.IBCHookRoute", 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_IBCHookRoute) 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_IBCHookRoute) 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_IBCHookRoute) 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_IBCHookRoute) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*IBCHookRoute) + 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.ChannelId) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.DestinationContractAddress) + 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().(*IBCHookRoute) + 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.DestinationContractAddress) > 0 { + i -= len(x.DestinationContractAddress) + copy(dAtA[i:], x.DestinationContractAddress) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.DestinationContractAddress))) + i-- + dAtA[i] = 0x12 + } + if len(x.ChannelId) > 0 { + i -= len(x.ChannelId) + copy(dAtA[i:], x.ChannelId) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.ChannelId))) + 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().(*IBCHookRoute) + 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: IBCHookRoute: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: IBCHookRoute: 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 ChannelId", 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.ChannelId = 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 DestinationContractAddress", 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.DestinationContractAddress = 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_IBCHookPacketReceipt protoreflect.MessageDescriptor + fd_IBCHookPacketReceipt_sequence protoreflect.FieldDescriptor +) + +func init() { + file_band_tunnel_v1beta1_route_proto_init() + md_IBCHookPacketReceipt = File_band_tunnel_v1beta1_route_proto.Messages().ByName("IBCHookPacketReceipt") + fd_IBCHookPacketReceipt_sequence = md_IBCHookPacketReceipt.Fields().ByName("sequence") +} + +var _ protoreflect.Message = (*fastReflection_IBCHookPacketReceipt)(nil) + +type fastReflection_IBCHookPacketReceipt IBCHookPacketReceipt + +func (x *IBCHookPacketReceipt) ProtoReflect() protoreflect.Message { + return (*fastReflection_IBCHookPacketReceipt)(x) +} + +func (x *IBCHookPacketReceipt) slowProtoReflect() protoreflect.Message { + mi := &file_band_tunnel_v1beta1_route_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_IBCHookPacketReceipt_messageType fastReflection_IBCHookPacketReceipt_messageType +var _ protoreflect.MessageType = fastReflection_IBCHookPacketReceipt_messageType{} + +type fastReflection_IBCHookPacketReceipt_messageType struct{} + +func (x fastReflection_IBCHookPacketReceipt_messageType) Zero() protoreflect.Message { + return (*fastReflection_IBCHookPacketReceipt)(nil) +} +func (x fastReflection_IBCHookPacketReceipt_messageType) New() protoreflect.Message { + return new(fastReflection_IBCHookPacketReceipt) +} +func (x fastReflection_IBCHookPacketReceipt_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_IBCHookPacketReceipt +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_IBCHookPacketReceipt) Descriptor() protoreflect.MessageDescriptor { + return md_IBCHookPacketReceipt +} + +// 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_IBCHookPacketReceipt) Type() protoreflect.MessageType { + return _fastReflection_IBCHookPacketReceipt_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_IBCHookPacketReceipt) New() protoreflect.Message { + return new(fastReflection_IBCHookPacketReceipt) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_IBCHookPacketReceipt) Interface() protoreflect.ProtoMessage { + return (*IBCHookPacketReceipt)(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_IBCHookPacketReceipt) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Sequence != uint64(0) { + value := protoreflect.ValueOfUint64(x.Sequence) + if !f(fd_IBCHookPacketReceipt_sequence, 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_IBCHookPacketReceipt) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "band.tunnel.v1beta1.IBCHookPacketReceipt.sequence": + return x.Sequence != uint64(0) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: band.tunnel.v1beta1.IBCHookPacketReceipt")) + } + panic(fmt.Errorf("message band.tunnel.v1beta1.IBCHookPacketReceipt 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_IBCHookPacketReceipt) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "band.tunnel.v1beta1.IBCHookPacketReceipt.sequence": + x.Sequence = uint64(0) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: band.tunnel.v1beta1.IBCHookPacketReceipt")) + } + panic(fmt.Errorf("message band.tunnel.v1beta1.IBCHookPacketReceipt 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_IBCHookPacketReceipt) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "band.tunnel.v1beta1.IBCHookPacketReceipt.sequence": + value := x.Sequence + return protoreflect.ValueOfUint64(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: band.tunnel.v1beta1.IBCHookPacketReceipt")) + } + panic(fmt.Errorf("message band.tunnel.v1beta1.IBCHookPacketReceipt 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_IBCHookPacketReceipt) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "band.tunnel.v1beta1.IBCHookPacketReceipt.sequence": + x.Sequence = value.Uint() + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: band.tunnel.v1beta1.IBCHookPacketReceipt")) + } + panic(fmt.Errorf("message band.tunnel.v1beta1.IBCHookPacketReceipt 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_IBCHookPacketReceipt) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "band.tunnel.v1beta1.IBCHookPacketReceipt.sequence": + panic(fmt.Errorf("field sequence of message band.tunnel.v1beta1.IBCHookPacketReceipt is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: band.tunnel.v1beta1.IBCHookPacketReceipt")) + } + panic(fmt.Errorf("message band.tunnel.v1beta1.IBCHookPacketReceipt 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_IBCHookPacketReceipt) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "band.tunnel.v1beta1.IBCHookPacketReceipt.sequence": + return protoreflect.ValueOfUint64(uint64(0)) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: band.tunnel.v1beta1.IBCHookPacketReceipt")) + } + panic(fmt.Errorf("message band.tunnel.v1beta1.IBCHookPacketReceipt 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_IBCHookPacketReceipt) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in band.tunnel.v1beta1.IBCHookPacketReceipt", 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_IBCHookPacketReceipt) 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_IBCHookPacketReceipt) 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_IBCHookPacketReceipt) 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_IBCHookPacketReceipt) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*IBCHookPacketReceipt) + 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.Sequence != 0 { + n += 1 + runtime.Sov(uint64(x.Sequence)) + } + 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().(*IBCHookPacketReceipt) + 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.Sequence != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.Sequence)) + 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().(*IBCHookPacketReceipt) + 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: IBCHookPacketReceipt: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: IBCHookPacketReceipt: 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 Sequence", wireType) + } + x.Sequence = 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.Sequence |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_IBCHookPacket protoreflect.MessageDescriptor + fd_IBCHookPacket_packet protoreflect.FieldDescriptor +) + +func init() { + file_band_tunnel_v1beta1_route_proto_init() + md_IBCHookPacket = File_band_tunnel_v1beta1_route_proto.Messages().ByName("IBCHookPacket") + fd_IBCHookPacket_packet = md_IBCHookPacket.Fields().ByName("packet") +} + +var _ protoreflect.Message = (*fastReflection_IBCHookPacket)(nil) + +type fastReflection_IBCHookPacket IBCHookPacket + +func (x *IBCHookPacket) ProtoReflect() protoreflect.Message { + return (*fastReflection_IBCHookPacket)(x) +} + +func (x *IBCHookPacket) slowProtoReflect() protoreflect.Message { + mi := &file_band_tunnel_v1beta1_route_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_IBCHookPacket_messageType fastReflection_IBCHookPacket_messageType +var _ protoreflect.MessageType = fastReflection_IBCHookPacket_messageType{} + +type fastReflection_IBCHookPacket_messageType struct{} + +func (x fastReflection_IBCHookPacket_messageType) Zero() protoreflect.Message { + return (*fastReflection_IBCHookPacket)(nil) +} +func (x fastReflection_IBCHookPacket_messageType) New() protoreflect.Message { + return new(fastReflection_IBCHookPacket) +} +func (x fastReflection_IBCHookPacket_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_IBCHookPacket +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_IBCHookPacket) Descriptor() protoreflect.MessageDescriptor { + return md_IBCHookPacket +} + +// 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_IBCHookPacket) Type() protoreflect.MessageType { + return _fastReflection_IBCHookPacket_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_IBCHookPacket) New() protoreflect.Message { + return new(fastReflection_IBCHookPacket) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_IBCHookPacket) Interface() protoreflect.ProtoMessage { + return (*IBCHookPacket)(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_IBCHookPacket) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Packet != nil { + value := protoreflect.ValueOfMessage(x.Packet.ProtoReflect()) + if !f(fd_IBCHookPacket_packet, 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_IBCHookPacket) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "band.tunnel.v1beta1.IBCHookPacket.packet": + return x.Packet != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: band.tunnel.v1beta1.IBCHookPacket")) + } + panic(fmt.Errorf("message band.tunnel.v1beta1.IBCHookPacket 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_IBCHookPacket) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "band.tunnel.v1beta1.IBCHookPacket.packet": + x.Packet = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: band.tunnel.v1beta1.IBCHookPacket")) + } + panic(fmt.Errorf("message band.tunnel.v1beta1.IBCHookPacket 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_IBCHookPacket) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "band.tunnel.v1beta1.IBCHookPacket.packet": + value := x.Packet + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: band.tunnel.v1beta1.IBCHookPacket")) + } + panic(fmt.Errorf("message band.tunnel.v1beta1.IBCHookPacket 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_IBCHookPacket) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "band.tunnel.v1beta1.IBCHookPacket.packet": + x.Packet = value.Message().Interface().(*TunnelPricesPacketData) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: band.tunnel.v1beta1.IBCHookPacket")) + } + panic(fmt.Errorf("message band.tunnel.v1beta1.IBCHookPacket 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_IBCHookPacket) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "band.tunnel.v1beta1.IBCHookPacket.packet": + if x.Packet == nil { + x.Packet = new(TunnelPricesPacketData) + } + return protoreflect.ValueOfMessage(x.Packet.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: band.tunnel.v1beta1.IBCHookPacket")) + } + panic(fmt.Errorf("message band.tunnel.v1beta1.IBCHookPacket 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_IBCHookPacket) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "band.tunnel.v1beta1.IBCHookPacket.packet": + m := new(TunnelPricesPacketData) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: band.tunnel.v1beta1.IBCHookPacket")) + } + panic(fmt.Errorf("message band.tunnel.v1beta1.IBCHookPacket 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_IBCHookPacket) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in band.tunnel.v1beta1.IBCHookPacket", 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_IBCHookPacket) 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_IBCHookPacket) 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_IBCHookPacket) 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_IBCHookPacket) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*IBCHookPacket) + 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.Packet != nil { + l = options.Size(x.Packet) + 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().(*IBCHookPacket) + 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.Packet != nil { + encoded, err := options.Marshal(x.Packet) + 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().(*IBCHookPacket) + 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: IBCHookPacket: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: IBCHookPacket: 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 Packet", 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.Packet == nil { + x.Packet = &TunnelPricesPacketData{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Packet); 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_IBCHookMsg protoreflect.MessageDescriptor + fd_IBCHookMsg_receive_packet protoreflect.FieldDescriptor +) + +func init() { + file_band_tunnel_v1beta1_route_proto_init() + md_IBCHookMsg = File_band_tunnel_v1beta1_route_proto.Messages().ByName("IBCHookMsg") + fd_IBCHookMsg_receive_packet = md_IBCHookMsg.Fields().ByName("receive_packet") +} + +var _ protoreflect.Message = (*fastReflection_IBCHookMsg)(nil) + +type fastReflection_IBCHookMsg IBCHookMsg + +func (x *IBCHookMsg) ProtoReflect() protoreflect.Message { + return (*fastReflection_IBCHookMsg)(x) +} + +func (x *IBCHookMsg) slowProtoReflect() protoreflect.Message { + mi := &file_band_tunnel_v1beta1_route_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_IBCHookMsg_messageType fastReflection_IBCHookMsg_messageType +var _ protoreflect.MessageType = fastReflection_IBCHookMsg_messageType{} + +type fastReflection_IBCHookMsg_messageType struct{} + +func (x fastReflection_IBCHookMsg_messageType) Zero() protoreflect.Message { + return (*fastReflection_IBCHookMsg)(nil) +} +func (x fastReflection_IBCHookMsg_messageType) New() protoreflect.Message { + return new(fastReflection_IBCHookMsg) +} +func (x fastReflection_IBCHookMsg_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_IBCHookMsg +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_IBCHookMsg) Descriptor() protoreflect.MessageDescriptor { + return md_IBCHookMsg +} + +// 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_IBCHookMsg) Type() protoreflect.MessageType { + return _fastReflection_IBCHookMsg_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_IBCHookMsg) New() protoreflect.Message { + return new(fastReflection_IBCHookMsg) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_IBCHookMsg) Interface() protoreflect.ProtoMessage { + return (*IBCHookMsg)(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_IBCHookMsg) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.ReceivePacket != nil { + value := protoreflect.ValueOfMessage(x.ReceivePacket.ProtoReflect()) + if !f(fd_IBCHookMsg_receive_packet, 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_IBCHookMsg) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "band.tunnel.v1beta1.IBCHookMsg.receive_packet": + return x.ReceivePacket != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: band.tunnel.v1beta1.IBCHookMsg")) + } + panic(fmt.Errorf("message band.tunnel.v1beta1.IBCHookMsg 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_IBCHookMsg) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "band.tunnel.v1beta1.IBCHookMsg.receive_packet": + x.ReceivePacket = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: band.tunnel.v1beta1.IBCHookMsg")) + } + panic(fmt.Errorf("message band.tunnel.v1beta1.IBCHookMsg 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_IBCHookMsg) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "band.tunnel.v1beta1.IBCHookMsg.receive_packet": + value := x.ReceivePacket + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: band.tunnel.v1beta1.IBCHookMsg")) + } + panic(fmt.Errorf("message band.tunnel.v1beta1.IBCHookMsg 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_IBCHookMsg) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "band.tunnel.v1beta1.IBCHookMsg.receive_packet": + x.ReceivePacket = value.Message().Interface().(*IBCHookPacket) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: band.tunnel.v1beta1.IBCHookMsg")) + } + panic(fmt.Errorf("message band.tunnel.v1beta1.IBCHookMsg 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_IBCHookMsg) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "band.tunnel.v1beta1.IBCHookMsg.receive_packet": + if x.ReceivePacket == nil { + x.ReceivePacket = new(IBCHookPacket) + } + return protoreflect.ValueOfMessage(x.ReceivePacket.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: band.tunnel.v1beta1.IBCHookMsg")) + } + panic(fmt.Errorf("message band.tunnel.v1beta1.IBCHookMsg 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_IBCHookMsg) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "band.tunnel.v1beta1.IBCHookMsg.receive_packet": + m := new(IBCHookPacket) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: band.tunnel.v1beta1.IBCHookMsg")) + } + panic(fmt.Errorf("message band.tunnel.v1beta1.IBCHookMsg 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_IBCHookMsg) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in band.tunnel.v1beta1.IBCHookMsg", 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_IBCHookMsg) 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_IBCHookMsg) 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_IBCHookMsg) 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_IBCHookMsg) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*IBCHookMsg) + 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.ReceivePacket != nil { + l = options.Size(x.ReceivePacket) + 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().(*IBCHookMsg) + 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.ReceivePacket != nil { + encoded, err := options.Marshal(x.ReceivePacket) + 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().(*IBCHookMsg) + 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: IBCHookMsg: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: IBCHookMsg: 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 ReceivePacket", 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.ReceivePacket == nil { + x.ReceivePacket = &IBCHookPacket{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.ReceivePacket); 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_IBCHookWasm protoreflect.MessageDescriptor + fd_IBCHookWasm_contract protoreflect.FieldDescriptor + fd_IBCHookWasm_msg protoreflect.FieldDescriptor +) + +func init() { + file_band_tunnel_v1beta1_route_proto_init() + md_IBCHookWasm = File_band_tunnel_v1beta1_route_proto.Messages().ByName("IBCHookWasm") + fd_IBCHookWasm_contract = md_IBCHookWasm.Fields().ByName("contract") + fd_IBCHookWasm_msg = md_IBCHookWasm.Fields().ByName("msg") +} + +var _ protoreflect.Message = (*fastReflection_IBCHookWasm)(nil) + +type fastReflection_IBCHookWasm IBCHookWasm + +func (x *IBCHookWasm) ProtoReflect() protoreflect.Message { + return (*fastReflection_IBCHookWasm)(x) +} + +func (x *IBCHookWasm) slowProtoReflect() protoreflect.Message { + mi := &file_band_tunnel_v1beta1_route_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_IBCHookWasm_messageType fastReflection_IBCHookWasm_messageType +var _ protoreflect.MessageType = fastReflection_IBCHookWasm_messageType{} + +type fastReflection_IBCHookWasm_messageType struct{} + +func (x fastReflection_IBCHookWasm_messageType) Zero() protoreflect.Message { + return (*fastReflection_IBCHookWasm)(nil) +} +func (x fastReflection_IBCHookWasm_messageType) New() protoreflect.Message { + return new(fastReflection_IBCHookWasm) +} +func (x fastReflection_IBCHookWasm_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_IBCHookWasm +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_IBCHookWasm) Descriptor() protoreflect.MessageDescriptor { + return md_IBCHookWasm +} + +// 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_IBCHookWasm) Type() protoreflect.MessageType { + return _fastReflection_IBCHookWasm_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_IBCHookWasm) New() protoreflect.Message { + return new(fastReflection_IBCHookWasm) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_IBCHookWasm) Interface() protoreflect.ProtoMessage { + return (*IBCHookWasm)(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_IBCHookWasm) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Contract != "" { + value := protoreflect.ValueOfString(x.Contract) + if !f(fd_IBCHookWasm_contract, value) { + return + } + } + if x.Msg != nil { + value := protoreflect.ValueOfMessage(x.Msg.ProtoReflect()) + if !f(fd_IBCHookWasm_msg, 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_IBCHookWasm) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "band.tunnel.v1beta1.IBCHookWasm.contract": + return x.Contract != "" + case "band.tunnel.v1beta1.IBCHookWasm.msg": + return x.Msg != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: band.tunnel.v1beta1.IBCHookWasm")) + } + panic(fmt.Errorf("message band.tunnel.v1beta1.IBCHookWasm 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_IBCHookWasm) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "band.tunnel.v1beta1.IBCHookWasm.contract": + x.Contract = "" + case "band.tunnel.v1beta1.IBCHookWasm.msg": + x.Msg = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: band.tunnel.v1beta1.IBCHookWasm")) + } + panic(fmt.Errorf("message band.tunnel.v1beta1.IBCHookWasm 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_IBCHookWasm) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "band.tunnel.v1beta1.IBCHookWasm.contract": + value := x.Contract + return protoreflect.ValueOfString(value) + case "band.tunnel.v1beta1.IBCHookWasm.msg": + value := x.Msg + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: band.tunnel.v1beta1.IBCHookWasm")) + } + panic(fmt.Errorf("message band.tunnel.v1beta1.IBCHookWasm 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_IBCHookWasm) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "band.tunnel.v1beta1.IBCHookWasm.contract": + x.Contract = value.Interface().(string) + case "band.tunnel.v1beta1.IBCHookWasm.msg": + x.Msg = value.Message().Interface().(*IBCHookMsg) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: band.tunnel.v1beta1.IBCHookWasm")) + } + panic(fmt.Errorf("message band.tunnel.v1beta1.IBCHookWasm 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_IBCHookWasm) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "band.tunnel.v1beta1.IBCHookWasm.msg": + if x.Msg == nil { + x.Msg = new(IBCHookMsg) + } + return protoreflect.ValueOfMessage(x.Msg.ProtoReflect()) + case "band.tunnel.v1beta1.IBCHookWasm.contract": + panic(fmt.Errorf("field contract of message band.tunnel.v1beta1.IBCHookWasm is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: band.tunnel.v1beta1.IBCHookWasm")) + } + panic(fmt.Errorf("message band.tunnel.v1beta1.IBCHookWasm 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_IBCHookWasm) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "band.tunnel.v1beta1.IBCHookWasm.contract": + return protoreflect.ValueOfString("") + case "band.tunnel.v1beta1.IBCHookWasm.msg": + m := new(IBCHookMsg) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: band.tunnel.v1beta1.IBCHookWasm")) + } + panic(fmt.Errorf("message band.tunnel.v1beta1.IBCHookWasm 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_IBCHookWasm) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in band.tunnel.v1beta1.IBCHookWasm", 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_IBCHookWasm) 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_IBCHookWasm) 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_IBCHookWasm) 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_IBCHookWasm) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*IBCHookWasm) + 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.Contract) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.Msg != nil { + l = options.Size(x.Msg) + 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().(*IBCHookWasm) + 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.Msg != nil { + encoded, err := options.Marshal(x.Msg) + 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.Contract) > 0 { + i -= len(x.Contract) + copy(dAtA[i:], x.Contract) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Contract))) + 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().(*IBCHookWasm) + 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: IBCHookWasm: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: IBCHookWasm: 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 Contract", 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.Contract = 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 Msg", 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.Msg == nil { + x.Msg = &IBCHookMsg{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Msg); 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_IBCHookMemo protoreflect.MessageDescriptor + fd_IBCHookMemo_wasm protoreflect.FieldDescriptor +) + +func init() { + file_band_tunnel_v1beta1_route_proto_init() + md_IBCHookMemo = File_band_tunnel_v1beta1_route_proto.Messages().ByName("IBCHookMemo") + fd_IBCHookMemo_wasm = md_IBCHookMemo.Fields().ByName("wasm") +} + +var _ protoreflect.Message = (*fastReflection_IBCHookMemo)(nil) + +type fastReflection_IBCHookMemo IBCHookMemo + +func (x *IBCHookMemo) ProtoReflect() protoreflect.Message { + return (*fastReflection_IBCHookMemo)(x) +} + +func (x *IBCHookMemo) slowProtoReflect() protoreflect.Message { + mi := &file_band_tunnel_v1beta1_route_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_IBCHookMemo_messageType fastReflection_IBCHookMemo_messageType +var _ protoreflect.MessageType = fastReflection_IBCHookMemo_messageType{} + +type fastReflection_IBCHookMemo_messageType struct{} + +func (x fastReflection_IBCHookMemo_messageType) Zero() protoreflect.Message { + return (*fastReflection_IBCHookMemo)(nil) +} +func (x fastReflection_IBCHookMemo_messageType) New() protoreflect.Message { + return new(fastReflection_IBCHookMemo) +} +func (x fastReflection_IBCHookMemo_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_IBCHookMemo +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_IBCHookMemo) Descriptor() protoreflect.MessageDescriptor { + return md_IBCHookMemo +} + +// 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_IBCHookMemo) Type() protoreflect.MessageType { + return _fastReflection_IBCHookMemo_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_IBCHookMemo) New() protoreflect.Message { + return new(fastReflection_IBCHookMemo) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_IBCHookMemo) Interface() protoreflect.ProtoMessage { + return (*IBCHookMemo)(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_IBCHookMemo) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Wasm != nil { + value := protoreflect.ValueOfMessage(x.Wasm.ProtoReflect()) + if !f(fd_IBCHookMemo_wasm, 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_IBCHookMemo) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "band.tunnel.v1beta1.IBCHookMemo.wasm": + return x.Wasm != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: band.tunnel.v1beta1.IBCHookMemo")) + } + panic(fmt.Errorf("message band.tunnel.v1beta1.IBCHookMemo 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_IBCHookMemo) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "band.tunnel.v1beta1.IBCHookMemo.wasm": + x.Wasm = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: band.tunnel.v1beta1.IBCHookMemo")) + } + panic(fmt.Errorf("message band.tunnel.v1beta1.IBCHookMemo 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_IBCHookMemo) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "band.tunnel.v1beta1.IBCHookMemo.wasm": + value := x.Wasm + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: band.tunnel.v1beta1.IBCHookMemo")) + } + panic(fmt.Errorf("message band.tunnel.v1beta1.IBCHookMemo 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_IBCHookMemo) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "band.tunnel.v1beta1.IBCHookMemo.wasm": + x.Wasm = value.Message().Interface().(*IBCHookWasm) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: band.tunnel.v1beta1.IBCHookMemo")) + } + panic(fmt.Errorf("message band.tunnel.v1beta1.IBCHookMemo 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_IBCHookMemo) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "band.tunnel.v1beta1.IBCHookMemo.wasm": + if x.Wasm == nil { + x.Wasm = new(IBCHookWasm) + } + return protoreflect.ValueOfMessage(x.Wasm.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: band.tunnel.v1beta1.IBCHookMemo")) + } + panic(fmt.Errorf("message band.tunnel.v1beta1.IBCHookMemo 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_IBCHookMemo) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "band.tunnel.v1beta1.IBCHookMemo.wasm": + m := new(IBCHookWasm) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: band.tunnel.v1beta1.IBCHookMemo")) + } + panic(fmt.Errorf("message band.tunnel.v1beta1.IBCHookMemo 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_IBCHookMemo) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in band.tunnel.v1beta1.IBCHookMemo", 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_IBCHookMemo) 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_IBCHookMemo) 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_IBCHookMemo) 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_IBCHookMemo) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*IBCHookMemo) + 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.Wasm != nil { + l = options.Size(x.Wasm) + 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().(*IBCHookMemo) + 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.Wasm != nil { + encoded, err := options.Marshal(x.Wasm) + 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().(*IBCHookMemo) + 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: IBCHookMemo: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: IBCHookMemo: 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 Wasm", 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.Wasm == nil { + x.Wasm = &IBCHookWasm{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Wasm); 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 @@ -2656,6 +5348,246 @@ func (x *TunnelPricesPacketData) GetCreatedAt() int64 { return 0 } +// IBCHookRoute is the type for an IBC hook route +type IBCHookRoute struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // channel_id is the IBC channel ID + ChannelId string `protobuf:"bytes,1,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"` + // destination_contract_address is the destination contract address + DestinationContractAddress string `protobuf:"bytes,2,opt,name=destination_contract_address,json=destinationContractAddress,proto3" json:"destination_contract_address,omitempty"` +} + +func (x *IBCHookRoute) Reset() { + *x = IBCHookRoute{} + if protoimpl.UnsafeEnabled { + mi := &file_band_tunnel_v1beta1_route_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *IBCHookRoute) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*IBCHookRoute) ProtoMessage() {} + +// Deprecated: Use IBCHookRoute.ProtoReflect.Descriptor instead. +func (*IBCHookRoute) Descriptor() ([]byte, []int) { + return file_band_tunnel_v1beta1_route_proto_rawDescGZIP(), []int{5} +} + +func (x *IBCHookRoute) GetChannelId() string { + if x != nil { + return x.ChannelId + } + return "" +} + +func (x *IBCHookRoute) GetDestinationContractAddress() string { + if x != nil { + return x.DestinationContractAddress + } + return "" +} + +// IBCHookPacketReceipt represents a receipt for a IBC hook packet and implements the PacketReceiptI interface. +type IBCHookPacketReceipt struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // sequence is representing the sequence of the IBC packet. + Sequence uint64 `protobuf:"varint,1,opt,name=sequence,proto3" json:"sequence,omitempty"` +} + +func (x *IBCHookPacketReceipt) Reset() { + *x = IBCHookPacketReceipt{} + if protoimpl.UnsafeEnabled { + mi := &file_band_tunnel_v1beta1_route_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *IBCHookPacketReceipt) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*IBCHookPacketReceipt) ProtoMessage() {} + +// Deprecated: Use IBCHookPacketReceipt.ProtoReflect.Descriptor instead. +func (*IBCHookPacketReceipt) Descriptor() ([]byte, []int) { + return file_band_tunnel_v1beta1_route_proto_rawDescGZIP(), []int{6} +} + +func (x *IBCHookPacketReceipt) GetSequence() uint64 { + if x != nil { + return x.Sequence + } + return 0 +} + +// IBCHookPacket represents the IBC packet payload for the IBC hook packet. +type IBCHookPacket struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // packet is the packet data + Packet *TunnelPricesPacketData `protobuf:"bytes,1,opt,name=packet,proto3" json:"packet,omitempty"` +} + +func (x *IBCHookPacket) Reset() { + *x = IBCHookPacket{} + if protoimpl.UnsafeEnabled { + mi := &file_band_tunnel_v1beta1_route_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *IBCHookPacket) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*IBCHookPacket) ProtoMessage() {} + +// Deprecated: Use IBCHookPacket.ProtoReflect.Descriptor instead. +func (*IBCHookPacket) Descriptor() ([]byte, []int) { + return file_band_tunnel_v1beta1_route_proto_rawDescGZIP(), []int{7} +} + +func (x *IBCHookPacket) GetPacket() *TunnelPricesPacketData { + if x != nil { + return x.Packet + } + return nil +} + +// IBCHookMsg represents the message structure of the IBC hook message. +type IBCHookMsg struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // receive_packet is the function name on the destination contract + ReceivePacket *IBCHookPacket `protobuf:"bytes,1,opt,name=receive_packet,json=receivePacket,proto3" json:"receive_packet,omitempty"` +} + +func (x *IBCHookMsg) Reset() { + *x = IBCHookMsg{} + if protoimpl.UnsafeEnabled { + mi := &file_band_tunnel_v1beta1_route_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *IBCHookMsg) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*IBCHookMsg) ProtoMessage() {} + +// Deprecated: Use IBCHookMsg.ProtoReflect.Descriptor instead. +func (*IBCHookMsg) Descriptor() ([]byte, []int) { + return file_band_tunnel_v1beta1_route_proto_rawDescGZIP(), []int{8} +} + +func (x *IBCHookMsg) GetReceivePacket() *IBCHookPacket { + if x != nil { + return x.ReceivePacket + } + return nil +} + +// IBCHookWasm represents the WASM contract and its associated message. +type IBCHookWasm struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // contract is destination contract address + Contract string `protobuf:"bytes,1,opt,name=contract,proto3" json:"contract,omitempty"` + // msg is the IBC hook message + Msg *IBCHookMsg `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg,omitempty"` +} + +func (x *IBCHookWasm) Reset() { + *x = IBCHookWasm{} + if protoimpl.UnsafeEnabled { + mi := &file_band_tunnel_v1beta1_route_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *IBCHookWasm) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*IBCHookWasm) ProtoMessage() {} + +// Deprecated: Use IBCHookWasm.ProtoReflect.Descriptor instead. +func (*IBCHookWasm) Descriptor() ([]byte, []int) { + return file_band_tunnel_v1beta1_route_proto_rawDescGZIP(), []int{9} +} + +func (x *IBCHookWasm) GetContract() string { + if x != nil { + return x.Contract + } + return "" +} + +func (x *IBCHookWasm) GetMsg() *IBCHookMsg { + if x != nil { + return x.Msg + } + return nil +} + +// IBCHookMemo is the type for an IBC hook memo +type IBCHookMemo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // wasm is the wasm memo struct for IBC hook + Wasm *IBCHookWasm `protobuf:"bytes,1,opt,name=wasm,proto3" json:"wasm,omitempty"` +} + +func (x *IBCHookMemo) Reset() { + *x = IBCHookMemo{} + if protoimpl.UnsafeEnabled { + mi := &file_band_tunnel_v1beta1_route_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *IBCHookMemo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*IBCHookMemo) ProtoMessage() {} + +// Deprecated: Use IBCHookMemo.ProtoReflect.Descriptor instead. +func (*IBCHookMemo) Descriptor() ([]byte, []int) { + return file_band_tunnel_v1beta1_route_proto_rawDescGZIP(), []int{10} +} + +func (x *IBCHookMemo) GetWasm() *IBCHookWasm { + if x != nil { + return x.Wasm + } + return nil +} + var File_band_tunnel_v1beta1_route_proto protoreflect.FileDescriptor var file_band_tunnel_v1beta1_route_proto_rawDesc = []byte{ @@ -2712,22 +5644,56 @@ var file_band_tunnel_v1beta1_route_proto_rawDesc = []byte{ 0x65, 0x64, 0x73, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x50, 0x72, 0x69, 0x63, 0x65, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x06, 0x70, 0x72, 0x69, 0x63, 0x65, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x04, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x42, 0xdf, - 0x01, 0x0a, 0x17, 0x63, 0x6f, 0x6d, 0x2e, 0x62, 0x61, 0x6e, 0x64, 0x2e, 0x74, 0x75, 0x6e, 0x6e, - 0x65, 0x6c, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x42, 0x0a, 0x52, 0x6f, 0x75, 0x74, - 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x46, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, - 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x61, 0x6e, 0x64, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, - 0x6c, 0x2f, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x2f, 0x76, 0x33, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x62, - 0x61, 0x6e, 0x64, 0x2f, 0x74, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, - 0x61, 0x31, 0x3b, 0x74, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, - 0xa2, 0x02, 0x03, 0x42, 0x54, 0x58, 0xaa, 0x02, 0x13, 0x42, 0x61, 0x6e, 0x64, 0x2e, 0x54, 0x75, - 0x6e, 0x6e, 0x65, 0x6c, 0x2e, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xca, 0x02, 0x13, 0x42, - 0x61, 0x6e, 0x64, 0x5c, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, - 0x61, 0x31, 0xe2, 0x02, 0x1f, 0x42, 0x61, 0x6e, 0x64, 0x5c, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, - 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, - 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x15, 0x42, 0x61, 0x6e, 0x64, 0x3a, 0x3a, 0x54, 0x75, 0x6e, - 0x6e, 0x65, 0x6c, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xa8, 0xe2, 0x1e, 0x01, - 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x01, 0x28, 0x03, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x22, 0x8a, + 0x01, 0x0a, 0x0c, 0x49, 0x42, 0x43, 0x48, 0x6f, 0x6f, 0x6b, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x12, + 0x2c, 0x0a, 0x0a, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x42, 0x0d, 0xe2, 0xde, 0x1f, 0x09, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, + 0x49, 0x44, 0x52, 0x09, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x64, 0x12, 0x40, 0x0a, + 0x1c, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x6f, 0x6e, + 0x74, 0x72, 0x61, 0x63, 0x74, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x1a, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x3a, + 0x0a, 0xca, 0xb4, 0x2d, 0x06, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x49, 0x22, 0x46, 0x0a, 0x14, 0x49, + 0x42, 0x43, 0x48, 0x6f, 0x6f, 0x6b, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x52, 0x65, 0x63, 0x65, + 0x69, 0x70, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x3a, + 0x12, 0xca, 0xb4, 0x2d, 0x0e, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x65, + 0x6e, 0x74, 0x49, 0x22, 0x54, 0x0a, 0x0d, 0x49, 0x42, 0x43, 0x48, 0x6f, 0x6f, 0x6b, 0x50, 0x61, + 0x63, 0x6b, 0x65, 0x74, 0x12, 0x43, 0x0a, 0x06, 0x70, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x62, 0x61, 0x6e, 0x64, 0x2e, 0x74, 0x75, 0x6e, 0x6e, + 0x65, 0x6c, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x54, 0x75, 0x6e, 0x6e, 0x65, + 0x6c, 0x50, 0x72, 0x69, 0x63, 0x65, 0x73, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x44, 0x61, 0x74, + 0x61, 0x52, 0x06, 0x70, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x22, 0x57, 0x0a, 0x0a, 0x49, 0x42, 0x43, + 0x48, 0x6f, 0x6f, 0x6b, 0x4d, 0x73, 0x67, 0x12, 0x49, 0x0a, 0x0e, 0x72, 0x65, 0x63, 0x65, 0x69, + 0x76, 0x65, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x22, 0x2e, 0x62, 0x61, 0x6e, 0x64, 0x2e, 0x74, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x2e, 0x76, 0x31, + 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x49, 0x42, 0x43, 0x48, 0x6f, 0x6f, 0x6b, 0x50, 0x61, 0x63, + 0x6b, 0x65, 0x74, 0x52, 0x0d, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x50, 0x61, 0x63, 0x6b, + 0x65, 0x74, 0x22, 0x5c, 0x0a, 0x0b, 0x49, 0x42, 0x43, 0x48, 0x6f, 0x6f, 0x6b, 0x57, 0x61, 0x73, + 0x6d, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x08, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x12, 0x31, 0x0a, + 0x03, 0x6d, 0x73, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x62, 0x61, 0x6e, + 0x64, 0x2e, 0x74, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, + 0x2e, 0x49, 0x42, 0x43, 0x48, 0x6f, 0x6f, 0x6b, 0x4d, 0x73, 0x67, 0x52, 0x03, 0x6d, 0x73, 0x67, + 0x22, 0x43, 0x0a, 0x0b, 0x49, 0x42, 0x43, 0x48, 0x6f, 0x6f, 0x6b, 0x4d, 0x65, 0x6d, 0x6f, 0x12, + 0x34, 0x0a, 0x04, 0x77, 0x61, 0x73, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, + 0x62, 0x61, 0x6e, 0x64, 0x2e, 0x74, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x2e, 0x76, 0x31, 0x62, 0x65, + 0x74, 0x61, 0x31, 0x2e, 0x49, 0x42, 0x43, 0x48, 0x6f, 0x6f, 0x6b, 0x57, 0x61, 0x73, 0x6d, 0x52, + 0x04, 0x77, 0x61, 0x73, 0x6d, 0x42, 0xdf, 0x01, 0x0a, 0x17, 0x63, 0x6f, 0x6d, 0x2e, 0x62, 0x61, + 0x6e, 0x64, 0x2e, 0x74, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, + 0x31, 0x42, 0x0a, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, + 0x46, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x61, 0x6e, 0x64, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2f, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x2f, 0x76, + 0x33, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x62, 0x61, 0x6e, 0x64, 0x2f, 0x74, 0x75, 0x6e, 0x6e, 0x65, + 0x6c, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x3b, 0x74, 0x75, 0x6e, 0x6e, 0x65, 0x6c, + 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xa2, 0x02, 0x03, 0x42, 0x54, 0x58, 0xaa, 0x02, 0x13, + 0x42, 0x61, 0x6e, 0x64, 0x2e, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x2e, 0x56, 0x31, 0x62, 0x65, + 0x74, 0x61, 0x31, 0xca, 0x02, 0x13, 0x42, 0x61, 0x6e, 0x64, 0x5c, 0x54, 0x75, 0x6e, 0x6e, 0x65, + 0x6c, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xe2, 0x02, 0x1f, 0x42, 0x61, 0x6e, 0x64, + 0x5c, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x5c, + 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x15, 0x42, 0x61, + 0x6e, 0x64, 0x3a, 0x3a, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x65, + 0x74, 0x61, 0x31, 0xa8, 0xe2, 0x1e, 0x01, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -2742,24 +5708,34 @@ func file_band_tunnel_v1beta1_route_proto_rawDescGZIP() []byte { return file_band_tunnel_v1beta1_route_proto_rawDescData } -var file_band_tunnel_v1beta1_route_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_band_tunnel_v1beta1_route_proto_msgTypes = make([]protoimpl.MessageInfo, 11) var file_band_tunnel_v1beta1_route_proto_goTypes = []interface{}{ (*TSSRoute)(nil), // 0: band.tunnel.v1beta1.TSSRoute (*TSSPacketReceipt)(nil), // 1: band.tunnel.v1beta1.TSSPacketReceipt (*IBCRoute)(nil), // 2: band.tunnel.v1beta1.IBCRoute (*IBCPacketReceipt)(nil), // 3: band.tunnel.v1beta1.IBCPacketReceipt (*TunnelPricesPacketData)(nil), // 4: band.tunnel.v1beta1.TunnelPricesPacketData - (v1beta1.Encoder)(0), // 5: band.feeds.v1beta1.Encoder - (*v1beta1.Price)(nil), // 6: band.feeds.v1beta1.Price + (*IBCHookRoute)(nil), // 5: band.tunnel.v1beta1.IBCHookRoute + (*IBCHookPacketReceipt)(nil), // 6: band.tunnel.v1beta1.IBCHookPacketReceipt + (*IBCHookPacket)(nil), // 7: band.tunnel.v1beta1.IBCHookPacket + (*IBCHookMsg)(nil), // 8: band.tunnel.v1beta1.IBCHookMsg + (*IBCHookWasm)(nil), // 9: band.tunnel.v1beta1.IBCHookWasm + (*IBCHookMemo)(nil), // 10: band.tunnel.v1beta1.IBCHookMemo + (v1beta1.Encoder)(0), // 11: band.feeds.v1beta1.Encoder + (*v1beta1.Price)(nil), // 12: band.feeds.v1beta1.Price } var file_band_tunnel_v1beta1_route_proto_depIdxs = []int32{ - 5, // 0: band.tunnel.v1beta1.TSSRoute.encoder:type_name -> band.feeds.v1beta1.Encoder - 6, // 1: band.tunnel.v1beta1.TunnelPricesPacketData.prices:type_name -> band.feeds.v1beta1.Price - 2, // [2:2] is the sub-list for method output_type - 2, // [2:2] is the sub-list for method input_type - 2, // [2:2] is the sub-list for extension type_name - 2, // [2:2] is the sub-list for extension extendee - 0, // [0:2] is the sub-list for field type_name + 11, // 0: band.tunnel.v1beta1.TSSRoute.encoder:type_name -> band.feeds.v1beta1.Encoder + 12, // 1: band.tunnel.v1beta1.TunnelPricesPacketData.prices:type_name -> band.feeds.v1beta1.Price + 4, // 2: band.tunnel.v1beta1.IBCHookPacket.packet:type_name -> band.tunnel.v1beta1.TunnelPricesPacketData + 7, // 3: band.tunnel.v1beta1.IBCHookMsg.receive_packet:type_name -> band.tunnel.v1beta1.IBCHookPacket + 8, // 4: band.tunnel.v1beta1.IBCHookWasm.msg:type_name -> band.tunnel.v1beta1.IBCHookMsg + 9, // 5: band.tunnel.v1beta1.IBCHookMemo.wasm:type_name -> band.tunnel.v1beta1.IBCHookWasm + 6, // [6:6] is the sub-list for method output_type + 6, // [6:6] is the sub-list for method input_type + 6, // [6:6] is the sub-list for extension type_name + 6, // [6:6] is the sub-list for extension extendee + 0, // [0:6] is the sub-list for field type_name } func init() { file_band_tunnel_v1beta1_route_proto_init() } @@ -2828,6 +5804,78 @@ func file_band_tunnel_v1beta1_route_proto_init() { return nil } } + file_band_tunnel_v1beta1_route_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*IBCHookRoute); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_band_tunnel_v1beta1_route_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*IBCHookPacketReceipt); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_band_tunnel_v1beta1_route_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*IBCHookPacket); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_band_tunnel_v1beta1_route_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*IBCHookMsg); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_band_tunnel_v1beta1_route_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*IBCHookWasm); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_band_tunnel_v1beta1_route_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*IBCHookMemo); 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{ @@ -2835,7 +5883,7 @@ func file_band_tunnel_v1beta1_route_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_band_tunnel_v1beta1_route_proto_rawDesc, NumEnums: 0, - NumMessages: 5, + NumMessages: 11, NumExtensions: 0, NumServices: 0, }, diff --git a/app/keepers/keepers.go b/app/keepers/keepers.go index a7b8d02cf..87cf4aaf3 100644 --- a/app/keepers/keepers.go +++ b/app/keepers/keepers.go @@ -493,6 +493,7 @@ func NewAppKeeper( appKeepers.IBCFeeKeeper, appKeepers.IBCKeeper.PortKeeper, appKeepers.ScopedTunnelKeeper, + appKeepers.TransferKeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) diff --git a/app/modules.go b/app/modules.go index 8e7409127..547f2d833 100644 --- a/app/modules.go +++ b/app/modules.go @@ -83,7 +83,7 @@ var maccPerms = map[string][]string{ ibcfeetypes.ModuleName: nil, bandtsstypes.ModuleName: nil, restaketypes.ModuleName: nil, - tunneltypes.ModuleName: nil, + tunneltypes.ModuleName: {authtypes.Minter}, } func appModules( diff --git a/proto/band/tunnel/v1beta1/route.proto b/proto/band/tunnel/v1beta1/route.proto index 7c2b7717e..38ca0afce 100644 --- a/proto/band/tunnel/v1beta1/route.proto +++ b/proto/band/tunnel/v1beta1/route.proto @@ -60,3 +60,47 @@ message TunnelPricesPacketData { // created_at is the timestamp when the packet is created int64 created_at = 4; } + +// IBCHookRoute is the type for an IBC hook route +message IBCHookRoute { + option (cosmos_proto.implements_interface) = "RouteI"; + + // channel_id is the IBC channel ID + string channel_id = 1 [(gogoproto.customname) = "ChannelID"]; + // destination_contract_address is the destination contract address + string destination_contract_address = 2; +} + +// IBCHookPacketReceipt represents a receipt for a IBC hook packet and implements the PacketReceiptI interface. +message IBCHookPacketReceipt { + option (cosmos_proto.implements_interface) = "PacketContentI"; + + // sequence is representing the sequence of the IBC packet. + uint64 sequence = 1; +} + +// IBCHookPacket represents the IBC packet payload for the IBC hook packet. +message IBCHookPacket { + // packet is the packet data + TunnelPricesPacketData packet = 1; +} + +// IBCHookMsg represents the message structure of the IBC hook message. +message IBCHookMsg { + // receive_packet is the function name on the destination contract + IBCHookPacket receive_packet = 1; +} + +// IBCHookWasm represents the WASM contract and its associated message. +message IBCHookWasm { + // contract is destination contract address + string contract = 1; + // msg is the IBC hook message + IBCHookMsg msg = 2; +} + +// IBCHookMemo is the type for an IBC hook memo +message IBCHookMemo { + // wasm is the wasm memo struct for IBC hook + IBCHookWasm wasm = 1; +} diff --git a/scripts/tunnel/create_ibc_hook_tunnel.sh b/scripts/tunnel/create_ibc_hook_tunnel.sh new file mode 100644 index 000000000..f3a130b38 --- /dev/null +++ b/scripts/tunnel/create_ibc_hook_tunnel.sh @@ -0,0 +1 @@ +bandd tx tunnel create-tunnel ibc-hook channel-0 osmo1hsj6zc68xh4ydpt57mkynye7frhx5ndzdqhkcl88k4duyfgzqc9qf8gxdx 1000000000uband 60 ./scripts/tunnel/signal_deviations.json --from requester --keyring-backend test --gas-prices 0.0025uband -y --chain-id bandchain diff --git a/x/tunnel/client/cli/tx.go b/x/tunnel/client/cli/tx.go index 7f7842511..2eed71999 100644 --- a/x/tunnel/client/cli/tx.go +++ b/x/tunnel/client/cli/tx.go @@ -51,6 +51,7 @@ func GetTxCmdCreateTunnel() *cobra.Command { txCmd.AddCommand( GetTxCmdCreateTSSTunnel(), GetTxCmdCreateIBCTunnel(), + GetTxCmdCreateIBCHookTunnel(), ) return txCmd @@ -156,6 +157,55 @@ func GetTxCmdCreateIBCTunnel() *cobra.Command { return cmd } +func GetTxCmdCreateIBCHookTunnel() *cobra.Command { + cmd := &cobra.Command{ + Use: "ibc-hook [channel-id] [destination-contract-address] [initial-deposit] [interval] [signalInfos-json-file]", + Short: "Create a new IBC hook tunnel", + Args: cobra.ExactArgs(5), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + channelID := args[0] + destinationContractAddress := args[1] + + initialDeposit, err := sdk.ParseCoinsNormalized(args[2]) + if err != nil { + return err + } + + interval, err := strconv.ParseUint(args[3], 10, 64) + if err != nil { + return err + } + + signalInfos, err := parseSignalDeviations(args[4]) + if err != nil { + return err + } + + msg, err := types.NewMsgCreateIBCHookTunnel( + signalInfos.ToSignalDeviations(), + interval, + channelID, + destinationContractAddress, + initialDeposit, + clientCtx.GetFromAddress().String(), + ) + if err != nil { + return err + } + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + return cmd +} + func GetTxCmdUpdateRoute() *cobra.Command { txCmd := &cobra.Command{ Use: "update-route", @@ -167,6 +217,7 @@ func GetTxCmdUpdateRoute() *cobra.Command { // add create tunnel subcommands txCmd.AddCommand( GetTxCmdUpdateIBCRoute(), + GetTxCmdUpdateIBCHookRoute(), ) return txCmd @@ -206,6 +257,44 @@ func GetTxCmdUpdateIBCRoute() *cobra.Command { return cmd } +func GetTxCmdUpdateIBCHookRoute() *cobra.Command { + cmd := &cobra.Command{ + Use: "ibc-hook [tunnel-id] [channel-id] [destination-contract-address]", + Short: "Update IBC route of a IBC tunnel", + Args: cobra.ExactArgs(3), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + id, err := strconv.ParseUint(args[0], 10, 64) + if err != nil { + return err + } + + channelID := args[1] + destContractAddr := args[2] + + msg, err := types.NewMsgUpdateIBCHookRoute( + id, + channelID, + destContractAddr, + clientCtx.GetFromAddress().String(), + ) + if err != nil { + return err + } + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + + return cmd +} + func GetTxCmdUpdateSignalsAndInterval() *cobra.Command { cmd := &cobra.Command{ Use: "update-signals-and-interval [tunnel-id] [interval] [signalDeviations-json-file] ", diff --git a/x/tunnel/keeper/keeper.go b/x/tunnel/keeper/keeper.go index bec23a527..14086304c 100644 --- a/x/tunnel/keeper/keeper.go +++ b/x/tunnel/keeper/keeper.go @@ -16,14 +16,15 @@ type Keeper struct { cdc codec.BinaryCodec storeKey storetypes.StoreKey - authKeeper types.AccountKeeper - bankKeeper types.BankKeeper - feedsKeeper types.FeedsKeeper - bandtssKeeper types.BandtssKeeper - channelKeeper types.ChannelKeeper - ics4Wrapper types.ICS4Wrapper - portKeeper types.PortKeeper - scopedKeeper types.ScopedKeeper + authKeeper types.AccountKeeper + bankKeeper types.BankKeeper + feedsKeeper types.FeedsKeeper + bandtssKeeper types.BandtssKeeper + channelKeeper types.ChannelKeeper + ics4Wrapper types.ICS4Wrapper + portKeeper types.PortKeeper + scopedKeeper types.ScopedKeeper + transferKeeper types.TransferKeeper authority string } @@ -40,6 +41,7 @@ func NewKeeper( ics4Wrapper types.ICS4Wrapper, portKeeper types.PortKeeper, scopedKeeper types.ScopedKeeper, + transferKeeper types.TransferKeeper, authority string, ) Keeper { // ensure tunnel module account is set @@ -53,17 +55,18 @@ func NewKeeper( } return Keeper{ - cdc: cdc, - storeKey: key, - authKeeper: authKeeper, - bankKeeper: bankKeeper, - feedsKeeper: feedsKeeper, - bandtssKeeper: bandtssKeeper, - channelKeeper: channelKeeper, - ics4Wrapper: ics4Wrapper, - portKeeper: portKeeper, - scopedKeeper: scopedKeeper, - authority: authority, + cdc: cdc, + storeKey: key, + authKeeper: authKeeper, + bankKeeper: bankKeeper, + feedsKeeper: feedsKeeper, + bandtssKeeper: bandtssKeeper, + channelKeeper: channelKeeper, + ics4Wrapper: ics4Wrapper, + portKeeper: portKeeper, + scopedKeeper: scopedKeeper, + transferKeeper: transferKeeper, + authority: authority, } } diff --git a/x/tunnel/keeper/keeper_packet.go b/x/tunnel/keeper/keeper_packet.go index d515ad43f..b56cad0e4 100644 --- a/x/tunnel/keeper/keeper_packet.go +++ b/x/tunnel/keeper/keeper_packet.go @@ -208,6 +208,8 @@ func (k Keeper) SendPacket(ctx sdk.Context, packet types.Packet) (err error) { ) case *types.IBCRoute: receipt, err = k.SendIBCPacket(ctx, r, packet, tunnel.Interval) + case *types.IBCHookRoute: + receipt, err = k.SendIBCHookPacket(ctx, r, packet, sdk.MustAccAddressFromBech32(tunnel.FeePayer), tunnel.Interval) default: return types.ErrInvalidRoute.Wrapf("no route found for tunnel ID: %d", tunnel.ID) } diff --git a/x/tunnel/keeper/keeper_packet_ibc_hook.go b/x/tunnel/keeper/keeper_packet_ibc_hook.go new file mode 100644 index 000000000..935f93da1 --- /dev/null +++ b/x/tunnel/keeper/keeper_packet_ibc_hook.go @@ -0,0 +1,78 @@ +package keeper + +import ( + "time" + + ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" + clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" + + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/bandprotocol/chain/v3/x/tunnel/types" +) + +// SendIBCHookPacket sends a packet to the destination chain using IBC Hook +func (k Keeper) SendIBCHookPacket( + ctx sdk.Context, + route *types.IBCHookRoute, + packet types.Packet, + feePayer sdk.AccAddress, + interval uint64, +) (types.PacketReceiptI, error) { + // create memo string for ibc transfer + pricePacket := types.NewTunnelPricesPacketData(packet.TunnelID, packet.Sequence, packet.Prices, packet.CreatedAt) + memoStr := types.NewIBCHookMemo(route.DestinationContractAddress, pricePacket).JSONString() + + // mint coin to the fee payer + err := k.MintIBCHookCoinToAccount(ctx, packet.TunnelID, feePayer, types.HookTransferAmount) + if err != nil { + return nil, err + } + + // create ibc transfer message with the memo string + msg := ibctransfertypes.NewMsgTransfer( + ibctransfertypes.PortID, + route.ChannelID, + sdk.NewInt64Coin(types.FormatHookDenomIdentifier(packet.TunnelID), int64(types.HookTransferAmount)), + feePayer.String(), + route.DestinationContractAddress, + clienttypes.ZeroHeight(), + uint64(ctx.BlockTime().UnixNano())+interval*uint64(time.Second)*2, + memoStr, + ) + + // send packet + res, err := k.transferKeeper.Transfer(ctx, msg) + if err != nil { + return nil, err + } + + return types.NewIBCHookPacketReceipt(res.Sequence), nil +} + +// MintIBCHookCoinToAccount mints hook coin to the account +func (k Keeper) MintIBCHookCoinToAccount( + ctx sdk.Context, + tunnelID uint64, + account sdk.AccAddress, + amount uint64, +) error { + // create hook coins + hookCoins := sdk.NewCoins( + sdk.NewInt64Coin(types.FormatHookDenomIdentifier(tunnelID), int64(amount)), + ) + + // mint coins to the module account + err := k.bankKeeper.MintCoins(ctx, types.ModuleName, hookCoins) + if err != nil { + return err + } + + // send coins to the account + return k.bankKeeper.SendCoinsFromModuleToAccount( + ctx, + types.ModuleName, + account, + hookCoins, + ) +} diff --git a/x/tunnel/keeper/keeper_packet_ibc_hook_test.go b/x/tunnel/keeper/keeper_packet_ibc_hook_test.go new file mode 100644 index 000000000..8149ebfbb --- /dev/null +++ b/x/tunnel/keeper/keeper_packet_ibc_hook_test.go @@ -0,0 +1,77 @@ +package keeper_test + +import ( + "go.uber.org/mock/gomock" + + ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" + + sdk "github.com/cosmos/cosmos-sdk/types" + + feedstypes "github.com/bandprotocol/chain/v3/x/feeds/types" + "github.com/bandprotocol/chain/v3/x/tunnel/types" +) + +func (s *KeeperTestSuite) TestSendIBCHookPacket() { + ctx, k := s.ctx, s.keeper + + tunnelID := uint64(1) + route := &types.IBCHookRoute{ + ChannelID: "channel-0", + DestinationContractAddress: "wasm1vjq0k3fj47s8wns4a7zw5c4lsjd8l6r2kzzlpk", + } + packet := types.Packet{ + TunnelID: tunnelID, + Sequence: 1, + Prices: []feedstypes.Price{}, + CreatedAt: 1730358471, + } + interval := uint64(60) + feePayer := sdk.AccAddress([]byte("feePayer")) + hookCoins := sdk.NewCoins( + sdk.NewInt64Coin(types.FormatHookDenomIdentifier(tunnelID), int64(types.HookTransferAmount)), + ) + + expectedPacketReceipt := types.IBCHookPacketReceipt{ + Sequence: 1, + } + + s.transferKeeper.EXPECT().Transfer(ctx, gomock.Any()).Return(&ibctransfertypes.MsgTransferResponse{ + Sequence: 1, + }, nil) + s.bankKeeper.EXPECT().MintCoins(ctx, types.ModuleName, hookCoins).Return(nil) + s.bankKeeper.EXPECT(). + SendCoinsFromModuleToAccount(ctx, types.ModuleName, feePayer, hookCoins). + Return(nil) + + content, err := k.SendIBCHookPacket( + ctx, + route, + packet, + feePayer, + interval, + ) + s.Require().NoError(err) + + receipt, ok := content.(*types.IBCHookPacketReceipt) + s.Require().True(ok) + s.Require().Equal(expectedPacketReceipt, *receipt) +} + +func (s *KeeperTestSuite) TestMintIBCHookCoinToAccount() { + ctx, k := s.ctx, s.keeper + + tunnelID := uint64(1) + account := sdk.AccAddress([]byte("test_account")) + hookCoins := sdk.NewCoins( + sdk.NewInt64Coin(types.FormatHookDenomIdentifier(tunnelID), int64(types.HookTransferAmount)), + ) + + s.bankKeeper.EXPECT().MintCoins(ctx, types.ModuleName, hookCoins).Return(nil) + s.bankKeeper.EXPECT(). + SendCoinsFromModuleToAccount(ctx, types.ModuleName, account, hookCoins). + Return(nil) + + // Mint coins to the account + err := k.MintIBCHookCoinToAccount(ctx, tunnelID, account, types.HookTransferAmount) + s.Require().NoError(err) +} diff --git a/x/tunnel/keeper/keeper_test.go b/x/tunnel/keeper/keeper_test.go index fc6e2bbab..039bf338b 100644 --- a/x/tunnel/keeper/keeper_test.go +++ b/x/tunnel/keeper/keeper_test.go @@ -38,14 +38,15 @@ type KeeperTestSuite struct { msgServer types.MsgServer storeKey storetypes.StoreKey - accountKeeper *testutil.MockAccountKeeper - bankKeeper *testutil.MockBankKeeper - feedsKeeper *testutil.MockFeedsKeeper - bandtssKeeper *testutil.MockBandtssKeeper - icsWrapper *testutil.MockICS4Wrapper - portKeeper *testutil.MockPortKeeper - channelKeeper *testutil.MockChannelKeeper - scopedKeeper *testutil.MockScopedKeeper + accountKeeper *testutil.MockAccountKeeper + bankKeeper *testutil.MockBankKeeper + feedsKeeper *testutil.MockFeedsKeeper + bandtssKeeper *testutil.MockBandtssKeeper + channelKeeper *testutil.MockChannelKeeper + icsWrapper *testutil.MockICS4Wrapper + portKeeper *testutil.MockPortKeeper + scopedKeeper *testutil.MockScopedKeeper + transferKeeper *testutil.MockTransferKeeper ctx sdk.Context authority sdk.AccAddress @@ -69,6 +70,7 @@ func (s *KeeperTestSuite) reset() { icsWrapper := testutil.NewMockICS4Wrapper(ctrl) portKeeper := testutil.NewMockPortKeeper(ctrl) scopedKeeper := testutil.NewMockScopedKeeper(ctrl) + transferKeeper := testutil.NewMockTransferKeeper(ctrl) authority := authtypes.NewModuleAddress(govtypes.ModuleName) @@ -86,6 +88,7 @@ func (s *KeeperTestSuite) reset() { icsWrapper, portKeeper, scopedKeeper, + transferKeeper, authority.String(), ) s.queryServer = keeper.NewQueryServer(s.keeper) @@ -98,6 +101,7 @@ func (s *KeeperTestSuite) reset() { s.icsWrapper = icsWrapper s.portKeeper = portKeeper s.scopedKeeper = scopedKeeper + s.transferKeeper = transferKeeper s.ctx = testCtx.Ctx.WithBlockHeader(tmproto.Header{Time: time.Now().UTC()}) s.authority = authority diff --git a/x/tunnel/keeper/msg_server.go b/x/tunnel/keeper/msg_server.go index a93a19f3a..ce1a553dd 100644 --- a/x/tunnel/keeper/msg_server.go +++ b/x/tunnel/keeper/msg_server.go @@ -4,6 +4,8 @@ import ( "context" "fmt" + ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" + sdkerrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" @@ -52,12 +54,21 @@ func (k msgServer) CreateTunnel( return nil, err } - // Check channel id in ibc route should be empty - ibcRoute, isIBCRoute := route.(*types.IBCRoute) - if isIBCRoute { - if ibcRoute.ChannelID != "" { + // isIBCRoute is true if the route is IBCRoute + var isIBCRoute bool + + // validate the route based on the route type + switch r := route.(type) { + case *types.IBCRoute: + if r.ChannelID != "" { return nil, types.ErrInvalidRoute.Wrap("channel id should be set after create tunnel") } + isIBCRoute = true + case *types.IBCHookRoute: + _, found := k.channelKeeper.GetChannel(ctx, ibctransfertypes.PortID, r.ChannelID) + if !found { + return nil, types.ErrInvalidChannelID + } } // add a new tunnel @@ -72,7 +83,7 @@ func (k msgServer) CreateTunnel( return nil, err } - // Bind ibc port for the new tunnel + // bind ibc port for the tunnel if the route is IBCRoute if isIBCRoute { _, err = k.ensureIBCPort(ctx, tunnel.ID) if err != nil { @@ -80,7 +91,7 @@ func (k msgServer) CreateTunnel( } } - // Deposit the initial deposit to the tunnel + // deposit the initial deposit to the tunnel if !msg.InitialDeposit.IsZero() { if err := k.Keeper.DepositToTunnel(ctx, tunnel.ID, creator, msg.InitialDeposit); err != nil { return nil, err @@ -124,6 +135,12 @@ func (k msgServer) UpdateRoute( return nil, types.ErrInvalidChannelID } tunnel.Route = msg.Route + case *types.IBCHookRoute: + _, found := k.channelKeeper.GetChannel(ctx, ibctransfertypes.PortID, r.ChannelID) + if !found { + return nil, types.ErrInvalidChannelID + } + tunnel.Route = msg.Route default: return nil, types.ErrInvalidRoute.Wrap("cannot update route on this route type") diff --git a/x/tunnel/testutil/expected_keepers_mocks.go b/x/tunnel/testutil/expected_keepers_mocks.go index 4d9b090bf..be5048c03 100644 --- a/x/tunnel/testutil/expected_keepers_mocks.go +++ b/x/tunnel/testutil/expected_keepers_mocks.go @@ -18,8 +18,9 @@ import ( types1 "github.com/bandprotocol/chain/v3/x/tss/types" types2 "github.com/cosmos/cosmos-sdk/types" types3 "github.com/cosmos/ibc-go/modules/capability/types" - types4 "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" - types5 "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" + types4 "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" + types5 "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" + types6 "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" gomock "go.uber.org/mock/gomock" ) @@ -165,6 +166,20 @@ func (mr *MockBankKeeperMockRecorder) GetAllBalances(ctx, addr any) *gomock.Call return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAllBalances", reflect.TypeOf((*MockBankKeeper)(nil).GetAllBalances), ctx, addr) } +// MintCoins mocks base method. +func (m *MockBankKeeper) MintCoins(ctx context.Context, moduleName string, amounts types2.Coins) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "MintCoins", ctx, moduleName, amounts) + ret0, _ := ret[0].(error) + return ret0 +} + +// MintCoins indicates an expected call of MintCoins. +func (mr *MockBankKeeperMockRecorder) MintCoins(ctx, moduleName, amounts any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "MintCoins", reflect.TypeOf((*MockBankKeeper)(nil).MintCoins), ctx, moduleName, amounts) +} + // SendCoins mocks base method. func (m *MockBankKeeper) SendCoins(ctx context.Context, fromAddr, toAddr types2.AccAddress, amt types2.Coins) error { m.ctrl.T.Helper() @@ -232,7 +247,7 @@ func (m *MockICS4Wrapper) EXPECT() *MockICS4WrapperMockRecorder { } // SendPacket mocks base method. -func (m *MockICS4Wrapper) SendPacket(ctx types2.Context, chanCap *types3.Capability, sourcePort, sourceChannel string, timeoutHeight types4.Height, timeoutTimestamp uint64, data []byte) (uint64, error) { +func (m *MockICS4Wrapper) SendPacket(ctx types2.Context, chanCap *types3.Capability, sourcePort, sourceChannel string, timeoutHeight types5.Height, timeoutTimestamp uint64, data []byte) (uint64, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "SendPacket", ctx, chanCap, sourcePort, sourceChannel, timeoutHeight, timeoutTimestamp, data) ret0, _ := ret[0].(uint64) @@ -271,10 +286,10 @@ func (m *MockChannelKeeper) EXPECT() *MockChannelKeeperMockRecorder { } // GetChannel mocks base method. -func (m *MockChannelKeeper) GetChannel(ctx types2.Context, srcPort, srcChan string) (types5.Channel, bool) { +func (m *MockChannelKeeper) GetChannel(ctx types2.Context, srcPort, srcChan string) (types6.Channel, bool) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetChannel", ctx, srcPort, srcChan) - ret0, _ := ret[0].(types5.Channel) + ret0, _ := ret[0].(types6.Channel) ret1, _ := ret[1].(bool) return ret0, ret1 } @@ -390,6 +405,44 @@ func (mr *MockScopedKeeperMockRecorder) GetCapability(ctx, name any) *gomock.Cal return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetCapability", reflect.TypeOf((*MockScopedKeeper)(nil).GetCapability), ctx, name) } +// MockTransferKeeper is a mock of TransferKeeper interface. +type MockTransferKeeper struct { + ctrl *gomock.Controller + recorder *MockTransferKeeperMockRecorder +} + +// MockTransferKeeperMockRecorder is the mock recorder for MockTransferKeeper. +type MockTransferKeeperMockRecorder struct { + mock *MockTransferKeeper +} + +// NewMockTransferKeeper creates a new mock instance. +func NewMockTransferKeeper(ctrl *gomock.Controller) *MockTransferKeeper { + mock := &MockTransferKeeper{ctrl: ctrl} + mock.recorder = &MockTransferKeeperMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockTransferKeeper) EXPECT() *MockTransferKeeperMockRecorder { + return m.recorder +} + +// Transfer mocks base method. +func (m *MockTransferKeeper) Transfer(goCtx context.Context, msg *types4.MsgTransfer) (*types4.MsgTransferResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Transfer", goCtx, msg) + ret0, _ := ret[0].(*types4.MsgTransferResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Transfer indicates an expected call of Transfer. +func (mr *MockTransferKeeperMockRecorder) Transfer(goCtx, msg any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Transfer", reflect.TypeOf((*MockTransferKeeper)(nil).Transfer), goCtx, msg) +} + // MockFeedsKeeper is a mock of FeedsKeeper interface. type MockFeedsKeeper struct { ctrl *gomock.Controller diff --git a/x/tunnel/types/codec.go b/x/tunnel/types/codec.go index 8010014a1..d1b63cda5 100644 --- a/x/tunnel/types/codec.go +++ b/x/tunnel/types/codec.go @@ -32,10 +32,12 @@ func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { cdc.RegisterInterface((*RouteI)(nil), nil) cdc.RegisterConcrete(&TSSRoute{}, "tunnel/TSSRoute", nil) cdc.RegisterConcrete(&IBCRoute{}, "tunnel/IBCRoute", nil) + cdc.RegisterConcrete(&IBCHookRoute{}, "tunnel/IBCHookRoute", nil) cdc.RegisterInterface((*PacketReceiptI)(nil), nil) cdc.RegisterConcrete(&TSSPacketReceipt{}, "tunnel/TSSPacketReceipt", nil) cdc.RegisterConcrete(&IBCPacketReceipt{}, "tunnel/IBCPacketReceipt", nil) + cdc.RegisterConcrete(&IBCHookPacketReceipt{}, "tunnel/IBCHookPacketReceipt", nil) cdc.RegisterConcrete(Params{}, "tunnel/Params", nil) } @@ -61,6 +63,7 @@ func RegisterInterfaces(registry codectypes.InterfaceRegistry) { (*RouteI)(nil), &TSSRoute{}, &IBCRoute{}, + &IBCHookRoute{}, ) registry.RegisterInterface( @@ -68,6 +71,7 @@ func RegisterInterfaces(registry codectypes.InterfaceRegistry) { (*PacketReceiptI)(nil), &TSSPacketReceipt{}, &IBCPacketReceipt{}, + &IBCHookPacketReceipt{}, ) msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) diff --git a/x/tunnel/types/expected_keepers.go b/x/tunnel/types/expected_keepers.go index 407068237..9362daec3 100644 --- a/x/tunnel/types/expected_keepers.go +++ b/x/tunnel/types/expected_keepers.go @@ -4,6 +4,7 @@ import ( "context" capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" + ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" ibcclienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" @@ -40,6 +41,7 @@ type BankKeeper interface { recipientModule string, amt sdk.Coins, ) error + MintCoins(ctx context.Context, moduleName string, amounts sdk.Coins) error } type ICS4Wrapper interface { @@ -69,6 +71,11 @@ type ScopedKeeper interface { ClaimCapability(ctx sdk.Context, cap *capabilitytypes.Capability, name string) error } +// TransferKeeper defines the expected IBC transfer keeper +type TransferKeeper interface { + Transfer(goCtx context.Context, msg *ibctransfertypes.MsgTransfer) (*ibctransfertypes.MsgTransferResponse, error) +} + type FeedsKeeper interface { GetAllPrices(ctx sdk.Context) (prices []feedstypes.Price) GetPrices(ctx sdk.Context, signalIDs []string) (prices []feedstypes.Price) diff --git a/x/tunnel/types/memo_ibc_hook.go b/x/tunnel/types/memo_ibc_hook.go new file mode 100644 index 000000000..4fc6f5847 --- /dev/null +++ b/x/tunnel/types/memo_ibc_hook.go @@ -0,0 +1,27 @@ +package types + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// NewIBCHookMemo creates a new IBCHookMemo instance. +func NewIBCHookMemo( + contract string, + packet TunnelPricesPacketData, +) *IBCHookMemo { + return &IBCHookMemo{ + Wasm: &IBCHookWasm{ + Contract: contract, + Msg: &IBCHookMsg{ + ReceivePacket: &IBCHookPacket{ + Packet: &packet, + }, + }, + }, + } +} + +// JSONString returns the JSON string representation of the IBCHookMemo +func (r IBCHookMemo) JSONString() string { + return string(sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&r))) +} diff --git a/x/tunnel/types/memo_ibc_hook_test.go b/x/tunnel/types/memo_ibc_hook_test.go new file mode 100644 index 000000000..ce86a2c01 --- /dev/null +++ b/x/tunnel/types/memo_ibc_hook_test.go @@ -0,0 +1,33 @@ +package types_test + +import ( + "testing" + + "github.com/stretchr/testify/require" + + feedstypes "github.com/bandprotocol/chain/v3/x/feeds/types" + "github.com/bandprotocol/chain/v3/x/tunnel/types" +) + +func TestStringIBCHookMemo(t *testing.T) { + packet := types.NewTunnelPricesPacketData( + 1, + 2, + []feedstypes.Price{ + {Status: feedstypes.PRICE_STATUS_AVAILABLE, SignalID: "signal1", Price: 200, Timestamp: 1740131933}, + {Status: feedstypes.PRICE_STATUS_AVAILABLE, SignalID: "signal2", Price: 300, Timestamp: 1740131933}, + }, + 1610000000, + ) + + memo := types.NewIBCHookMemo( + "wasm1vjq0k3fj47s8wns4a7zw5c4lsjd8l6r2kzzlpk", + packet, + ) + memoStr := memo.JSONString() + require.Equal( + t, + `{"wasm":{"contract":"wasm1vjq0k3fj47s8wns4a7zw5c4lsjd8l6r2kzzlpk","msg":{"receive_packet":{"packet":{"created_at":"1610000000","prices":[{"price":"200","signal_id":"signal1","status":"PRICE_STATUS_AVAILABLE","timestamp":"1740131933"},{"price":"300","signal_id":"signal2","status":"PRICE_STATUS_AVAILABLE","timestamp":"1740131933"}],"sequence":"2","tunnel_id":"1"}}}}}`, + memoStr, + ) +} diff --git a/x/tunnel/types/msgs.go b/x/tunnel/types/msgs.go index df656b1bb..86e6fe323 100644 --- a/x/tunnel/types/msgs.go +++ b/x/tunnel/types/msgs.go @@ -53,12 +53,7 @@ func NewMsgCreateTSSTunnel( creator string, ) (*MsgCreateTunnel, error) { r := NewTSSRoute(destinationChainID, destinationContractAddress, encoder) - m, err := NewMsgCreateTunnel(signalDeviations, interval, &r, initialDeposit, creator) - if err != nil { - return nil, err - } - - return m, nil + return NewMsgCreateTunnel(signalDeviations, interval, &r, initialDeposit, creator) } // NewMsgCreateIBCTunnel creates a new MsgCreateTunnel instance with IBC route type. @@ -69,12 +64,20 @@ func NewMsgCreateIBCTunnel( creator string, ) (*MsgCreateTunnel, error) { r := NewIBCRoute("") - m, err := NewMsgCreateTunnel(signalDeviations, interval, r, deposit, creator) - if err != nil { - return nil, err - } + return NewMsgCreateTunnel(signalDeviations, interval, r, deposit, creator) +} - return m, nil +// NewMsgCreateIBCHookTunnel creates a new MsgCreateTunnel instance for IBC hook tunnel. +func NewMsgCreateIBCHookTunnel( + signalDeviations []SignalDeviation, + interval uint64, + channelID string, + destinationContractAddress string, + initialDeposit sdk.Coins, + creator string, +) (*MsgCreateTunnel, error) { + r := NewIBCHookRoute(channelID, destinationContractAddress) + return NewMsgCreateTunnel(signalDeviations, interval, r, initialDeposit, creator) } // GetRouteValue returns the route of the tunnel. @@ -159,6 +162,16 @@ func NewMsgUpdateIBCRoute( return NewMsgUpdateRoute(tunnelID, NewIBCRoute(channelID), creator) } +// NewMsgUpdateIBCHookRoute creates a new MsgUpdateRoute instance. +func NewMsgUpdateIBCHookRoute( + tunnelID uint64, + channelID string, + destinationContractAddress string, + creator string, +) (*MsgUpdateRoute, error) { + return NewMsgUpdateRoute(tunnelID, NewIBCHookRoute(channelID, destinationContractAddress), creator) +} + // GetRouteValue returns the route of the message. func (m MsgUpdateRoute) GetRouteValue() (RouteI, error) { r, ok := m.Route.GetCachedValue().(RouteI) diff --git a/x/tunnel/types/route.pb.go b/x/tunnel/types/route.pb.go index a2723cda3..b8289ba5a 100644 --- a/x/tunnel/types/route.pb.go +++ b/x/tunnel/types/route.pb.go @@ -301,52 +301,362 @@ func (m *TunnelPricesPacketData) GetCreatedAt() int64 { return 0 } +// IBCHookRoute is the type for an IBC hook route +type IBCHookRoute struct { + // channel_id is the IBC channel ID + ChannelID string `protobuf:"bytes,1,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"` + // destination_contract_address is the destination contract address + DestinationContractAddress string `protobuf:"bytes,2,opt,name=destination_contract_address,json=destinationContractAddress,proto3" json:"destination_contract_address,omitempty"` +} + +func (m *IBCHookRoute) Reset() { *m = IBCHookRoute{} } +func (m *IBCHookRoute) String() string { return proto.CompactTextString(m) } +func (*IBCHookRoute) ProtoMessage() {} +func (*IBCHookRoute) Descriptor() ([]byte, []int) { + return fileDescriptor_543238289d94b7a6, []int{5} +} +func (m *IBCHookRoute) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *IBCHookRoute) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_IBCHookRoute.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 *IBCHookRoute) XXX_Merge(src proto.Message) { + xxx_messageInfo_IBCHookRoute.Merge(m, src) +} +func (m *IBCHookRoute) XXX_Size() int { + return m.Size() +} +func (m *IBCHookRoute) XXX_DiscardUnknown() { + xxx_messageInfo_IBCHookRoute.DiscardUnknown(m) +} + +var xxx_messageInfo_IBCHookRoute proto.InternalMessageInfo + +func (m *IBCHookRoute) GetChannelID() string { + if m != nil { + return m.ChannelID + } + return "" +} + +func (m *IBCHookRoute) GetDestinationContractAddress() string { + if m != nil { + return m.DestinationContractAddress + } + return "" +} + +// IBCHookPacketReceipt represents a receipt for a IBC hook packet and implements the PacketReceiptI interface. +type IBCHookPacketReceipt struct { + // sequence is representing the sequence of the IBC packet. + Sequence uint64 `protobuf:"varint,1,opt,name=sequence,proto3" json:"sequence,omitempty"` +} + +func (m *IBCHookPacketReceipt) Reset() { *m = IBCHookPacketReceipt{} } +func (m *IBCHookPacketReceipt) String() string { return proto.CompactTextString(m) } +func (*IBCHookPacketReceipt) ProtoMessage() {} +func (*IBCHookPacketReceipt) Descriptor() ([]byte, []int) { + return fileDescriptor_543238289d94b7a6, []int{6} +} +func (m *IBCHookPacketReceipt) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *IBCHookPacketReceipt) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_IBCHookPacketReceipt.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 *IBCHookPacketReceipt) XXX_Merge(src proto.Message) { + xxx_messageInfo_IBCHookPacketReceipt.Merge(m, src) +} +func (m *IBCHookPacketReceipt) XXX_Size() int { + return m.Size() +} +func (m *IBCHookPacketReceipt) XXX_DiscardUnknown() { + xxx_messageInfo_IBCHookPacketReceipt.DiscardUnknown(m) +} + +var xxx_messageInfo_IBCHookPacketReceipt proto.InternalMessageInfo + +func (m *IBCHookPacketReceipt) GetSequence() uint64 { + if m != nil { + return m.Sequence + } + return 0 +} + +// IBCHookPacket represents the IBC packet payload for the IBC hook packet. +type IBCHookPacket struct { + // packet is the packet data + Packet *TunnelPricesPacketData `protobuf:"bytes,1,opt,name=packet,proto3" json:"packet,omitempty"` +} + +func (m *IBCHookPacket) Reset() { *m = IBCHookPacket{} } +func (m *IBCHookPacket) String() string { return proto.CompactTextString(m) } +func (*IBCHookPacket) ProtoMessage() {} +func (*IBCHookPacket) Descriptor() ([]byte, []int) { + return fileDescriptor_543238289d94b7a6, []int{7} +} +func (m *IBCHookPacket) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *IBCHookPacket) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_IBCHookPacket.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 *IBCHookPacket) XXX_Merge(src proto.Message) { + xxx_messageInfo_IBCHookPacket.Merge(m, src) +} +func (m *IBCHookPacket) XXX_Size() int { + return m.Size() +} +func (m *IBCHookPacket) XXX_DiscardUnknown() { + xxx_messageInfo_IBCHookPacket.DiscardUnknown(m) +} + +var xxx_messageInfo_IBCHookPacket proto.InternalMessageInfo + +func (m *IBCHookPacket) GetPacket() *TunnelPricesPacketData { + if m != nil { + return m.Packet + } + return nil +} + +// IBCHookMsg represents the message structure of the IBC hook message. +type IBCHookMsg struct { + // receive_packet is the function name on the destination contract + ReceivePacket *IBCHookPacket `protobuf:"bytes,1,opt,name=receive_packet,json=receivePacket,proto3" json:"receive_packet,omitempty"` +} + +func (m *IBCHookMsg) Reset() { *m = IBCHookMsg{} } +func (m *IBCHookMsg) String() string { return proto.CompactTextString(m) } +func (*IBCHookMsg) ProtoMessage() {} +func (*IBCHookMsg) Descriptor() ([]byte, []int) { + return fileDescriptor_543238289d94b7a6, []int{8} +} +func (m *IBCHookMsg) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *IBCHookMsg) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_IBCHookMsg.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 *IBCHookMsg) XXX_Merge(src proto.Message) { + xxx_messageInfo_IBCHookMsg.Merge(m, src) +} +func (m *IBCHookMsg) XXX_Size() int { + return m.Size() +} +func (m *IBCHookMsg) XXX_DiscardUnknown() { + xxx_messageInfo_IBCHookMsg.DiscardUnknown(m) +} + +var xxx_messageInfo_IBCHookMsg proto.InternalMessageInfo + +func (m *IBCHookMsg) GetReceivePacket() *IBCHookPacket { + if m != nil { + return m.ReceivePacket + } + return nil +} + +// IBCHookWasm represents the WASM contract and its associated message. +type IBCHookWasm struct { + // contract is destination contract address + Contract string `protobuf:"bytes,1,opt,name=contract,proto3" json:"contract,omitempty"` + // msg is the IBC hook message + Msg *IBCHookMsg `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg,omitempty"` +} + +func (m *IBCHookWasm) Reset() { *m = IBCHookWasm{} } +func (m *IBCHookWasm) String() string { return proto.CompactTextString(m) } +func (*IBCHookWasm) ProtoMessage() {} +func (*IBCHookWasm) Descriptor() ([]byte, []int) { + return fileDescriptor_543238289d94b7a6, []int{9} +} +func (m *IBCHookWasm) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *IBCHookWasm) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_IBCHookWasm.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 *IBCHookWasm) XXX_Merge(src proto.Message) { + xxx_messageInfo_IBCHookWasm.Merge(m, src) +} +func (m *IBCHookWasm) XXX_Size() int { + return m.Size() +} +func (m *IBCHookWasm) XXX_DiscardUnknown() { + xxx_messageInfo_IBCHookWasm.DiscardUnknown(m) +} + +var xxx_messageInfo_IBCHookWasm proto.InternalMessageInfo + +func (m *IBCHookWasm) GetContract() string { + if m != nil { + return m.Contract + } + return "" +} + +func (m *IBCHookWasm) GetMsg() *IBCHookMsg { + if m != nil { + return m.Msg + } + return nil +} + +// IBCHookMemo is the type for an IBC hook memo +type IBCHookMemo struct { + // wasm is the wasm memo struct for IBC hook + Wasm *IBCHookWasm `protobuf:"bytes,1,opt,name=wasm,proto3" json:"wasm,omitempty"` +} + +func (m *IBCHookMemo) Reset() { *m = IBCHookMemo{} } +func (m *IBCHookMemo) String() string { return proto.CompactTextString(m) } +func (*IBCHookMemo) ProtoMessage() {} +func (*IBCHookMemo) Descriptor() ([]byte, []int) { + return fileDescriptor_543238289d94b7a6, []int{10} +} +func (m *IBCHookMemo) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *IBCHookMemo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_IBCHookMemo.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 *IBCHookMemo) XXX_Merge(src proto.Message) { + xxx_messageInfo_IBCHookMemo.Merge(m, src) +} +func (m *IBCHookMemo) XXX_Size() int { + return m.Size() +} +func (m *IBCHookMemo) XXX_DiscardUnknown() { + xxx_messageInfo_IBCHookMemo.DiscardUnknown(m) +} + +var xxx_messageInfo_IBCHookMemo proto.InternalMessageInfo + +func (m *IBCHookMemo) GetWasm() *IBCHookWasm { + if m != nil { + return m.Wasm + } + return nil +} + func init() { proto.RegisterType((*TSSRoute)(nil), "band.tunnel.v1beta1.TSSRoute") proto.RegisterType((*TSSPacketReceipt)(nil), "band.tunnel.v1beta1.TSSPacketReceipt") proto.RegisterType((*IBCRoute)(nil), "band.tunnel.v1beta1.IBCRoute") proto.RegisterType((*IBCPacketReceipt)(nil), "band.tunnel.v1beta1.IBCPacketReceipt") proto.RegisterType((*TunnelPricesPacketData)(nil), "band.tunnel.v1beta1.TunnelPricesPacketData") + proto.RegisterType((*IBCHookRoute)(nil), "band.tunnel.v1beta1.IBCHookRoute") + proto.RegisterType((*IBCHookPacketReceipt)(nil), "band.tunnel.v1beta1.IBCHookPacketReceipt") + proto.RegisterType((*IBCHookPacket)(nil), "band.tunnel.v1beta1.IBCHookPacket") + proto.RegisterType((*IBCHookMsg)(nil), "band.tunnel.v1beta1.IBCHookMsg") + proto.RegisterType((*IBCHookWasm)(nil), "band.tunnel.v1beta1.IBCHookWasm") + proto.RegisterType((*IBCHookMemo)(nil), "band.tunnel.v1beta1.IBCHookMemo") } func init() { proto.RegisterFile("band/tunnel/v1beta1/route.proto", fileDescriptor_543238289d94b7a6) } var fileDescriptor_543238289d94b7a6 = []byte{ - // 542 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0xc1, 0x6e, 0xd3, 0x30, - 0x18, 0xc7, 0xeb, 0xb5, 0x2a, 0xad, 0x81, 0x69, 0x32, 0xd3, 0xd4, 0x15, 0x48, 0xaa, 0x9e, 0x8a, - 0xc4, 0x12, 0x6d, 0x13, 0x42, 0xea, 0x89, 0xa5, 0x41, 0x22, 0x42, 0x48, 0x53, 0xda, 0x13, 0x97, - 0xca, 0xb5, 0x4d, 0x1b, 0xd8, 0xec, 0x12, 0xbb, 0x13, 0xbc, 0x05, 0xe2, 0x29, 0x78, 0x80, 0x49, - 0xbc, 0xc2, 0xb4, 0xd3, 0x8e, 0x70, 0x89, 0x50, 0xfa, 0x16, 0x9c, 0x50, 0x6c, 0xaf, 0x25, 0xa8, - 0x07, 0x6e, 0xf5, 0xff, 0xfb, 0xe5, 0xfb, 0x7f, 0xff, 0xcf, 0x2e, 0x74, 0x27, 0x98, 0x53, 0x5f, - 0x2d, 0x38, 0x67, 0x67, 0xfe, 0xc5, 0xe1, 0x84, 0x29, 0x7c, 0xe8, 0xa7, 0x62, 0xa1, 0x98, 0x37, - 0x4f, 0x85, 0x12, 0xe8, 0x41, 0x01, 0x78, 0x06, 0xf0, 0x2c, 0xd0, 0xde, 0x27, 0x42, 0x9e, 0x0b, - 0x39, 0xd6, 0x88, 0x6f, 0x0e, 0x86, 0x6f, 0xef, 0x4e, 0xc5, 0x54, 0x18, 0xbd, 0xf8, 0x65, 0xd5, - 0x8e, 0xb6, 0x79, 0xc7, 0x18, 0x95, 0x2b, 0x17, 0xc6, 0x89, 0xa0, 0x2c, 0xb5, 0x84, 0xb3, 0x81, - 0xd0, 0x27, 0x53, 0xef, 0xfe, 0x04, 0xb0, 0x31, 0x1a, 0x0e, 0xe3, 0x62, 0x34, 0xf4, 0x0a, 0xee, - 0x52, 0x26, 0x55, 0xc2, 0xb1, 0x4a, 0x04, 0x1f, 0x93, 0x19, 0x4e, 0xf8, 0x38, 0xa1, 0x2d, 0xd0, - 0x01, 0xbd, 0x66, 0xb0, 0x97, 0x67, 0x2e, 0x0a, 0xd7, 0xf5, 0x41, 0x51, 0x8e, 0xc2, 0x18, 0xd1, - 0x7f, 0x35, 0x8a, 0x5e, 0xc0, 0x47, 0xa5, 0x4e, 0x82, 0xab, 0x14, 0x13, 0x35, 0xc6, 0x94, 0xa6, - 0x4c, 0xca, 0xd6, 0x56, 0xd1, 0x31, 0x6e, 0xff, 0xfd, 0xa5, 0x45, 0x4e, 0x0c, 0x81, 0x9e, 0xc1, - 0x3b, 0x36, 0x49, 0xab, 0xda, 0x01, 0xbd, 0xed, 0xa3, 0x87, 0x9e, 0x5e, 0x99, 0x19, 0xde, 0x46, - 0xf1, 0x5e, 0x1a, 0x24, 0xbe, 0x65, 0xfb, 0xf0, 0xfa, 0xf2, 0xa0, 0xae, 0xd3, 0x44, 0xdd, 0xaf, - 0x00, 0xee, 0x8c, 0x86, 0xc3, 0x53, 0x4c, 0x3e, 0x30, 0x15, 0x33, 0xc2, 0x92, 0xb9, 0x42, 0xef, - 0x21, 0x94, 0xc9, 0x94, 0x27, 0x7c, 0x7a, 0x9b, 0xac, 0x16, 0xbc, 0xce, 0x33, 0xb7, 0x39, 0x34, - 0x6a, 0x14, 0xfe, 0xce, 0xdc, 0xfe, 0x34, 0x51, 0xb3, 0xc5, 0xc4, 0x23, 0xe2, 0xdc, 0x2f, 0x5c, - 0xf5, 0xae, 0x88, 0x38, 0xf3, 0xf5, 0x4a, 0xfc, 0x8b, 0x63, 0xff, 0x93, 0xd6, 0x95, 0x94, 0xbe, - 0xfa, 0x3c, 0x67, 0xd2, 0x5b, 0x7d, 0x1d, 0x37, 0x6d, 0xfb, 0x88, 0xf6, 0xd1, 0xf5, 0xe5, 0xc1, - 0x76, 0xc9, 0x3e, 0xea, 0x86, 0xb0, 0x11, 0x05, 0x03, 0xb3, 0xef, 0xa7, 0x10, 0x92, 0x19, 0x2e, - 0x9e, 0xc0, 0x7a, 0xcb, 0xf7, 0x8b, 0x59, 0x06, 0x46, 0x2d, 0xba, 0x59, 0x20, 0xa2, 0xa5, 0x68, - 0x01, 0xdc, 0x89, 0x82, 0x41, 0x39, 0x59, 0x1b, 0x36, 0x24, 0xfb, 0xb8, 0x60, 0x9c, 0x30, 0x93, - 0x2b, 0x5e, 0x9d, 0x37, 0x4e, 0xf2, 0x1d, 0xc0, 0xbd, 0x91, 0x7e, 0x80, 0xa7, 0x69, 0x42, 0x98, - 0x34, 0xe5, 0x10, 0x2b, 0x8c, 0x9e, 0xc0, 0xa6, 0x79, 0x9a, 0xeb, 0x1d, 0xdd, 0xcb, 0x33, 0xb7, - 0x61, 0xf0, 0x28, 0x8c, 0x1b, 0xa6, 0x1c, 0xd1, 0x92, 0xeb, 0x56, 0xd9, 0x15, 0x3d, 0x87, 0xf5, - 0xb9, 0x6e, 0xdd, 0xaa, 0x76, 0xaa, 0xbd, 0xbb, 0x47, 0xfb, 0x9b, 0xae, 0x50, 0x9b, 0x07, 0xb5, - 0xab, 0xcc, 0xad, 0xc4, 0x16, 0x47, 0x8f, 0x21, 0x24, 0x29, 0xc3, 0x8a, 0xd1, 0x31, 0x56, 0xad, - 0x5a, 0x07, 0xf4, 0xaa, 0x71, 0xd3, 0x2a, 0x27, 0x2a, 0x78, 0xf3, 0x2d, 0x77, 0xc0, 0x55, 0xee, - 0x80, 0x9b, 0xdc, 0x01, 0xbf, 0x72, 0x07, 0x7c, 0x59, 0x3a, 0x95, 0x9b, 0xa5, 0x53, 0xf9, 0xb1, - 0x74, 0x2a, 0x6f, 0xfd, 0xff, 0xb8, 0x3c, 0xfb, 0xcf, 0xd4, 0x77, 0x37, 0xa9, 0x6b, 0xe2, 0xf8, - 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xce, 0xc1, 0x97, 0x14, 0xb5, 0x03, 0x00, 0x00, + // 689 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x54, 0xcd, 0x6a, 0xdb, 0x4a, + 0x14, 0xb6, 0x62, 0xe3, 0x6b, 0x1f, 0x27, 0x21, 0xcc, 0x0d, 0xc1, 0xf1, 0xbd, 0x57, 0x36, 0x5a, + 0xf9, 0xd2, 0x46, 0x22, 0x4e, 0x4b, 0x21, 0xab, 0x46, 0x76, 0x4b, 0x44, 0x31, 0x04, 0xd9, 0x10, + 0x28, 0x05, 0x33, 0x96, 0xa6, 0x8a, 0x9a, 0x58, 0xe3, 0x6a, 0xc6, 0x69, 0xfb, 0x0a, 0x5d, 0x95, + 0x3e, 0x45, 0x1f, 0x20, 0xd0, 0x57, 0x08, 0x59, 0x65, 0xd9, 0x6e, 0x4c, 0x71, 0xde, 0xa2, 0xab, + 0x32, 0x3f, 0x71, 0xaa, 0x62, 0x42, 0x49, 0x77, 0x3a, 0xe7, 0x7c, 0xe7, 0x3b, 0xe7, 0xfb, 0x66, + 0x34, 0x50, 0x1f, 0xe2, 0x24, 0x74, 0xf8, 0x24, 0x49, 0xc8, 0x89, 0x73, 0xba, 0x3d, 0x24, 0x1c, + 0x6f, 0x3b, 0x29, 0x9d, 0x70, 0x62, 0x8f, 0x53, 0xca, 0x29, 0xfa, 0x5b, 0x00, 0x6c, 0x05, 0xb0, + 0x35, 0xa0, 0xb6, 0x19, 0x50, 0x36, 0xa2, 0x6c, 0x20, 0x21, 0x8e, 0x0a, 0x14, 0xbe, 0xb6, 0x1e, + 0xd1, 0x88, 0xaa, 0xbc, 0xf8, 0xd2, 0xd9, 0x86, 0x1c, 0xf3, 0x92, 0x90, 0x90, 0xcd, 0xa7, 0x90, + 0x24, 0xa0, 0x21, 0x49, 0x35, 0xc2, 0x5c, 0x80, 0x90, 0x91, 0xaa, 0x5b, 0x5f, 0x0d, 0x28, 0xf5, + 0x7b, 0x3d, 0x5f, 0xac, 0x86, 0xf6, 0x61, 0x3d, 0x24, 0x8c, 0xc7, 0x09, 0xe6, 0x31, 0x4d, 0x06, + 0xc1, 0x11, 0x8e, 0x93, 0x41, 0x1c, 0x56, 0x8d, 0x86, 0xd1, 0x2c, 0xbb, 0x1b, 0xb3, 0x69, 0x1d, + 0x75, 0x6e, 0xea, 0x6d, 0x51, 0xf6, 0x3a, 0x3e, 0x0a, 0x7f, 0xcd, 0x85, 0xe8, 0x31, 0xfc, 0x9b, + 0x61, 0xa2, 0x09, 0x4f, 0x71, 0xc0, 0x07, 0x38, 0x0c, 0x53, 0xc2, 0x58, 0x75, 0x49, 0x30, 0xfa, + 0xb5, 0x9f, 0x3b, 0x35, 0x64, 0x4f, 0x21, 0xd0, 0x43, 0xf8, 0x4b, 0x2b, 0xa9, 0xe6, 0x1b, 0x46, + 0x73, 0xb5, 0xf5, 0x8f, 0x2d, 0x2d, 0x53, 0xcb, 0x6b, 0x29, 0xf6, 0x13, 0x05, 0xf1, 0xaf, 0xb1, + 0xbb, 0x70, 0x71, 0xb6, 0x55, 0x94, 0x6a, 0x3c, 0xeb, 0xa3, 0x01, 0x6b, 0xfd, 0x5e, 0xef, 0x00, + 0x07, 0xc7, 0x84, 0xfb, 0x24, 0x20, 0xf1, 0x98, 0xa3, 0x57, 0x00, 0x2c, 0x8e, 0x92, 0x38, 0x89, + 0xae, 0x95, 0x15, 0xdc, 0x67, 0xb3, 0x69, 0xbd, 0xdc, 0x53, 0x59, 0xaf, 0xf3, 0x7d, 0x5a, 0xdf, + 0x8d, 0x62, 0x7e, 0x34, 0x19, 0xda, 0x01, 0x1d, 0x39, 0x62, 0xaa, 0xf4, 0x2a, 0xa0, 0x27, 0x8e, + 0xb4, 0xc4, 0x39, 0xdd, 0x71, 0xde, 0xca, 0x3c, 0x67, 0xcc, 0xe1, 0xef, 0xc6, 0x84, 0xd9, 0xf3, + 0x6e, 0xbf, 0xac, 0xe9, 0xbd, 0x70, 0x17, 0x5d, 0x9c, 0x6d, 0xad, 0x66, 0xc6, 0x7b, 0x56, 0x07, + 0x4a, 0x9e, 0xdb, 0x56, 0x7e, 0xdf, 0x07, 0x08, 0x8e, 0xb0, 0xb8, 0x02, 0x37, 0x2e, 0xaf, 0x88, + 0x5d, 0xda, 0x2a, 0x2b, 0xd8, 0x34, 0xc0, 0x0b, 0x33, 0xd2, 0x5c, 0x58, 0xf3, 0xdc, 0x76, 0x56, + 0x59, 0x0d, 0x4a, 0x8c, 0xbc, 0x9e, 0x90, 0x24, 0x20, 0x4a, 0x97, 0x3f, 0x8f, 0x17, 0x6e, 0xf2, + 0xd9, 0x80, 0x8d, 0xbe, 0xbc, 0x80, 0x07, 0x69, 0x1c, 0x10, 0xa6, 0xca, 0x1d, 0xcc, 0x31, 0xfa, + 0x1f, 0xca, 0xea, 0x6a, 0xde, 0x78, 0xb4, 0x3c, 0x9b, 0xd6, 0x4b, 0x0a, 0xee, 0x75, 0xfc, 0x92, + 0x2a, 0x7b, 0x61, 0x66, 0xea, 0x52, 0x76, 0x2a, 0x7a, 0x04, 0xc5, 0xb1, 0xa4, 0xae, 0xe6, 0x1b, + 0xf9, 0x66, 0xa5, 0xb5, 0xb9, 0xe8, 0x08, 0xe5, 0x70, 0xb7, 0x70, 0x3e, 0xad, 0xe7, 0x7c, 0x0d, + 0x47, 0xff, 0x01, 0x04, 0x29, 0xc1, 0x9c, 0x84, 0x03, 0xcc, 0xab, 0x85, 0x86, 0xd1, 0xcc, 0xfb, + 0x65, 0x9d, 0xd9, 0xe3, 0xd6, 0x7b, 0x03, 0x96, 0x3d, 0xb7, 0xbd, 0x4f, 0xe9, 0xf1, 0x1d, 0x8c, + 0xfc, 0xf3, 0xcb, 0x99, 0x39, 0x8a, 0xa7, 0xb0, 0xae, 0x77, 0xb9, 0xd3, 0x71, 0x08, 0x6a, 0x92, + 0x70, 0xcf, 0xea, 0xc3, 0x4a, 0x86, 0x07, 0xb5, 0xa1, 0x38, 0x96, 0x5f, 0xb2, 0xbd, 0xd2, 0xba, + 0x67, 0x2f, 0x78, 0x33, 0xec, 0xc5, 0x27, 0xe8, 0xeb, 0x56, 0xeb, 0x10, 0x40, 0xb3, 0x76, 0x59, + 0x84, 0x3c, 0x58, 0x4d, 0xc5, 0x7a, 0xa7, 0x64, 0x90, 0xa1, 0xb6, 0x16, 0x52, 0x67, 0x65, 0xad, + 0xe8, 0x4e, 0x15, 0x5a, 0x2f, 0xa0, 0xa2, 0xeb, 0x87, 0x98, 0x8d, 0x84, 0xda, 0x6b, 0x1f, 0x95, + 0xff, 0xfe, 0x3c, 0x46, 0xdb, 0x90, 0x1f, 0xb1, 0x48, 0xda, 0x5a, 0x69, 0xd5, 0x6f, 0x1b, 0xd5, + 0x65, 0x91, 0x2f, 0xb0, 0x56, 0x7b, 0xce, 0xde, 0x25, 0x23, 0x8a, 0x1e, 0x40, 0xe1, 0x0d, 0x66, + 0x23, 0xbd, 0x6d, 0xe3, 0x36, 0x0a, 0xb1, 0x8d, 0x2f, 0xd1, 0x6e, 0xf7, 0xd3, 0xcc, 0x34, 0xce, + 0x67, 0xa6, 0x71, 0x39, 0x33, 0x8d, 0x6f, 0x33, 0xd3, 0xf8, 0x70, 0x65, 0xe6, 0x2e, 0xaf, 0xcc, + 0xdc, 0x97, 0x2b, 0x33, 0xf7, 0xdc, 0xf9, 0x8d, 0x7f, 0x5c, 0x3f, 0xe0, 0xf2, 0x17, 0x1f, 0x16, + 0x25, 0x62, 0xe7, 0x47, 0x00, 0x00, 0x00, 0xff, 0xff, 0xc6, 0x4e, 0x2c, 0xfe, 0xdc, 0x05, 0x00, + 0x00, } func (this *TSSRoute) Equal(that interface{}) bool { @@ -489,56 +799,206 @@ func (this *TunnelPricesPacketData) Equal(that interface{}) bool { } return true } -func (m *TSSRoute) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err +func (this *IBCHookRoute) Equal(that interface{}) bool { + if that == nil { + return this == nil } - return dAtA[:n], nil -} - -func (m *TSSRoute) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} -func (m *TSSRoute) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Encoder != 0 { - i = encodeVarintRoute(dAtA, i, uint64(m.Encoder)) - i-- - dAtA[i] = 0x18 + that1, ok := that.(*IBCHookRoute) + if !ok { + that2, ok := that.(IBCHookRoute) + if ok { + that1 = &that2 + } else { + return false + } } - if len(m.DestinationContractAddress) > 0 { - i -= len(m.DestinationContractAddress) - copy(dAtA[i:], m.DestinationContractAddress) - i = encodeVarintRoute(dAtA, i, uint64(len(m.DestinationContractAddress))) - i-- - dAtA[i] = 0x12 + if that1 == nil { + return this == nil + } else if this == nil { + return false } - if len(m.DestinationChainID) > 0 { - i -= len(m.DestinationChainID) - copy(dAtA[i:], m.DestinationChainID) - i = encodeVarintRoute(dAtA, i, uint64(len(m.DestinationChainID))) - i-- - dAtA[i] = 0xa + if this.ChannelID != that1.ChannelID { + return false } - return len(dAtA) - i, nil + if this.DestinationContractAddress != that1.DestinationContractAddress { + return false + } + return true } +func (this *IBCHookPacketReceipt) Equal(that interface{}) bool { + if that == nil { + return this == nil + } -func (m *TSSPacketReceipt) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err + that1, ok := that.(*IBCHookPacketReceipt) + if !ok { + that2, ok := that.(IBCHookPacketReceipt) + if ok { + that1 = &that2 + } else { + return false + } } - return dAtA[:n], nil + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Sequence != that1.Sequence { + return false + } + return true +} +func (this *IBCHookPacket) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*IBCHookPacket) + if !ok { + that2, ok := that.(IBCHookPacket) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.Packet.Equal(that1.Packet) { + return false + } + return true +} +func (this *IBCHookMsg) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*IBCHookMsg) + if !ok { + that2, ok := that.(IBCHookMsg) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.ReceivePacket.Equal(that1.ReceivePacket) { + return false + } + return true +} +func (this *IBCHookWasm) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*IBCHookWasm) + if !ok { + that2, ok := that.(IBCHookWasm) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Contract != that1.Contract { + return false + } + if !this.Msg.Equal(that1.Msg) { + return false + } + return true +} +func (this *IBCHookMemo) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*IBCHookMemo) + if !ok { + that2, ok := that.(IBCHookMemo) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.Wasm.Equal(that1.Wasm) { + return false + } + return true +} +func (m *TSSRoute) 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 *TSSRoute) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TSSRoute) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Encoder != 0 { + i = encodeVarintRoute(dAtA, i, uint64(m.Encoder)) + i-- + dAtA[i] = 0x18 + } + if len(m.DestinationContractAddress) > 0 { + i -= len(m.DestinationContractAddress) + copy(dAtA[i:], m.DestinationContractAddress) + i = encodeVarintRoute(dAtA, i, uint64(len(m.DestinationContractAddress))) + i-- + dAtA[i] = 0x12 + } + if len(m.DestinationChainID) > 0 { + i -= len(m.DestinationChainID) + copy(dAtA[i:], m.DestinationChainID) + i = encodeVarintRoute(dAtA, i, uint64(len(m.DestinationChainID))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *TSSPacketReceipt) 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 *TSSPacketReceipt) MarshalTo(dAtA []byte) (int, error) { @@ -669,77 +1129,289 @@ func (m *TunnelPricesPacketData) MarshalToSizedBuffer(dAtA []byte) (int, error) return len(dAtA) - i, nil } -func encodeVarintRoute(dAtA []byte, offset int, v uint64) int { - offset -= sovRoute(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ +func (m *IBCHookRoute) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - dAtA[offset] = uint8(v) - return base + return dAtA[:n], nil } -func (m *TSSRoute) Size() (n int) { - if m == nil { - return 0 - } + +func (m *IBCHookRoute) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *IBCHookRoute) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - l = len(m.DestinationChainID) - if l > 0 { - n += 1 + l + sovRoute(uint64(l)) - } - l = len(m.DestinationContractAddress) - if l > 0 { - n += 1 + l + sovRoute(uint64(l)) + if len(m.DestinationContractAddress) > 0 { + i -= len(m.DestinationContractAddress) + copy(dAtA[i:], m.DestinationContractAddress) + i = encodeVarintRoute(dAtA, i, uint64(len(m.DestinationContractAddress))) + i-- + dAtA[i] = 0x12 } - if m.Encoder != 0 { - n += 1 + sovRoute(uint64(m.Encoder)) + if len(m.ChannelID) > 0 { + i -= len(m.ChannelID) + copy(dAtA[i:], m.ChannelID) + i = encodeVarintRoute(dAtA, i, uint64(len(m.ChannelID))) + i-- + dAtA[i] = 0xa } - return n + return len(dAtA) - i, nil } -func (m *TSSPacketReceipt) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.SigningID != 0 { - n += 1 + sovRoute(uint64(m.SigningID)) +func (m *IBCHookPacketReceipt) 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 n + return dAtA[:n], nil } -func (m *IBCRoute) Size() (n int) { - if m == nil { - return 0 - } +func (m *IBCHookPacketReceipt) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *IBCHookPacketReceipt) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - l = len(m.ChannelID) - if l > 0 { - n += 1 + l + sovRoute(uint64(l)) + if m.Sequence != 0 { + i = encodeVarintRoute(dAtA, i, uint64(m.Sequence)) + i-- + dAtA[i] = 0x8 } - return n + return len(dAtA) - i, nil } -func (m *IBCPacketReceipt) Size() (n int) { - if m == nil { - return 0 +func (m *IBCHookPacket) 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 *IBCHookPacket) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *IBCHookPacket) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - if m.Sequence != 0 { - n += 1 + sovRoute(uint64(m.Sequence)) + if m.Packet != nil { + { + size, err := m.Packet.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRoute(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa } - return n + return len(dAtA) - i, nil } -func (m *TunnelPricesPacketData) Size() (n int) { - if m == nil { - return 0 +func (m *IBCHookMsg) 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 *IBCHookMsg) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *IBCHookMsg) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.ReceivePacket != nil { + { + size, err := m.ReceivePacket.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRoute(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *IBCHookWasm) 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 *IBCHookWasm) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *IBCHookWasm) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Msg != nil { + { + size, err := m.Msg.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRoute(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Contract) > 0 { + i -= len(m.Contract) + copy(dAtA[i:], m.Contract) + i = encodeVarintRoute(dAtA, i, uint64(len(m.Contract))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *IBCHookMemo) 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 *IBCHookMemo) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *IBCHookMemo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Wasm != nil { + { + size, err := m.Wasm.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRoute(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintRoute(dAtA []byte, offset int, v uint64) int { + offset -= sovRoute(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *TSSRoute) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DestinationChainID) + if l > 0 { + n += 1 + l + sovRoute(uint64(l)) + } + l = len(m.DestinationContractAddress) + if l > 0 { + n += 1 + l + sovRoute(uint64(l)) + } + if m.Encoder != 0 { + n += 1 + sovRoute(uint64(m.Encoder)) + } + return n +} + +func (m *TSSPacketReceipt) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.SigningID != 0 { + n += 1 + sovRoute(uint64(m.SigningID)) + } + return n +} + +func (m *IBCRoute) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ChannelID) + if l > 0 { + n += 1 + l + sovRoute(uint64(l)) + } + return n +} + +func (m *IBCPacketReceipt) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Sequence != 0 { + n += 1 + sovRoute(uint64(m.Sequence)) + } + return n +} + +func (m *TunnelPricesPacketData) Size() (n int) { + if m == nil { + return 0 } var l int _ = l @@ -755,19 +1427,598 @@ func (m *TunnelPricesPacketData) Size() (n int) { n += 1 + l + sovRoute(uint64(l)) } } - if m.CreatedAt != 0 { - n += 1 + sovRoute(uint64(m.CreatedAt)) - } - return n -} + if m.CreatedAt != 0 { + n += 1 + sovRoute(uint64(m.CreatedAt)) + } + return n +} + +func (m *IBCHookRoute) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ChannelID) + if l > 0 { + n += 1 + l + sovRoute(uint64(l)) + } + l = len(m.DestinationContractAddress) + if l > 0 { + n += 1 + l + sovRoute(uint64(l)) + } + return n +} + +func (m *IBCHookPacketReceipt) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Sequence != 0 { + n += 1 + sovRoute(uint64(m.Sequence)) + } + return n +} + +func (m *IBCHookPacket) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Packet != nil { + l = m.Packet.Size() + n += 1 + l + sovRoute(uint64(l)) + } + return n +} + +func (m *IBCHookMsg) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ReceivePacket != nil { + l = m.ReceivePacket.Size() + n += 1 + l + sovRoute(uint64(l)) + } + return n +} + +func (m *IBCHookWasm) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Contract) + if l > 0 { + n += 1 + l + sovRoute(uint64(l)) + } + if m.Msg != nil { + l = m.Msg.Size() + n += 1 + l + sovRoute(uint64(l)) + } + return n +} + +func (m *IBCHookMemo) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Wasm != nil { + l = m.Wasm.Size() + n += 1 + l + sovRoute(uint64(l)) + } + return n +} + +func sovRoute(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozRoute(x uint64) (n int) { + return sovRoute(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *TSSRoute) 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 ErrIntOverflowRoute + } + 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: TSSRoute: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TSSRoute: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DestinationChainID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + 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 ErrInvalidLengthRoute + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRoute + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DestinationChainID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DestinationContractAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + 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 ErrInvalidLengthRoute + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRoute + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DestinationContractAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Encoder", wireType) + } + m.Encoder = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Encoder |= types.Encoder(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipRoute(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthRoute + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TSSPacketReceipt) 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 ErrIntOverflowRoute + } + 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: TSSPacketReceipt: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TSSPacketReceipt: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field SigningID", wireType) + } + m.SigningID = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.SigningID |= github_com_bandprotocol_chain_v3_x_bandtss_types.SigningID(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipRoute(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthRoute + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *IBCRoute) 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 ErrIntOverflowRoute + } + 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: IBCRoute: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: IBCRoute: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ChannelID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + 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 ErrInvalidLengthRoute + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRoute + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ChannelID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRoute(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthRoute + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *IBCPacketReceipt) 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 ErrIntOverflowRoute + } + 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: IBCPacketReceipt: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: IBCPacketReceipt: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Sequence", wireType) + } + m.Sequence = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Sequence |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipRoute(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthRoute + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TunnelPricesPacketData) 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 ErrIntOverflowRoute + } + 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: TunnelPricesPacketData: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TunnelPricesPacketData: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TunnelID", wireType) + } + m.TunnelID = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TunnelID |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Sequence", wireType) + } + m.Sequence = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Sequence |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Prices", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRoute + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Prices = append(m.Prices, types.Price{}) + if err := m.Prices[len(m.Prices)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CreatedAt", wireType) + } + m.CreatedAt = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CreatedAt |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipRoute(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthRoute + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } -func sovRoute(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozRoute(x uint64) (n int) { - return sovRoute(uint64((x << 1) ^ uint64((int64(x) >> 63)))) + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil } -func (m *TSSRoute) Unmarshal(dAtA []byte) error { +func (m *IBCHookRoute) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -790,15 +2041,15 @@ func (m *TSSRoute) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: TSSRoute: wiretype end group for non-group") + return fmt.Errorf("proto: IBCHookRoute: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: TSSRoute: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: IBCHookRoute: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DestinationChainID", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ChannelID", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -826,7 +2077,7 @@ func (m *TSSRoute) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.DestinationChainID = string(dAtA[iNdEx:postIndex]) + m.ChannelID = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { @@ -860,25 +2111,6 @@ func (m *TSSRoute) Unmarshal(dAtA []byte) error { } m.DestinationContractAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Encoder", wireType) - } - m.Encoder = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRoute - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Encoder |= types.Encoder(b&0x7F) << shift - if b < 0x80 { - break - } - } default: iNdEx = preIndex skippy, err := skipRoute(dAtA[iNdEx:]) @@ -900,7 +2132,7 @@ func (m *TSSRoute) Unmarshal(dAtA []byte) error { } return nil } -func (m *TSSPacketReceipt) Unmarshal(dAtA []byte) error { +func (m *IBCHookPacketReceipt) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -923,17 +2155,17 @@ func (m *TSSPacketReceipt) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: TSSPacketReceipt: wiretype end group for non-group") + return fmt.Errorf("proto: IBCHookPacketReceipt: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: TSSPacketReceipt: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: IBCHookPacketReceipt: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field SigningID", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Sequence", wireType) } - m.SigningID = 0 + m.Sequence = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowRoute @@ -943,7 +2175,7 @@ func (m *TSSPacketReceipt) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.SigningID |= github_com_bandprotocol_chain_v3_x_bandtss_types.SigningID(b&0x7F) << shift + m.Sequence |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -969,7 +2201,7 @@ func (m *TSSPacketReceipt) Unmarshal(dAtA []byte) error { } return nil } -func (m *IBCRoute) Unmarshal(dAtA []byte) error { +func (m *IBCHookPacket) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -992,17 +2224,17 @@ func (m *IBCRoute) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: IBCRoute: wiretype end group for non-group") + return fmt.Errorf("proto: IBCHookPacket: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: IBCRoute: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: IBCHookPacket: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ChannelID", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Packet", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowRoute @@ -1012,23 +2244,27 @@ func (m *IBCRoute) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthRoute } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthRoute } if postIndex > l { return io.ErrUnexpectedEOF } - m.ChannelID = string(dAtA[iNdEx:postIndex]) + if m.Packet == nil { + m.Packet = &TunnelPricesPacketData{} + } + if err := m.Packet.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex default: iNdEx = preIndex @@ -1051,7 +2287,7 @@ func (m *IBCRoute) Unmarshal(dAtA []byte) error { } return nil } -func (m *IBCPacketReceipt) Unmarshal(dAtA []byte) error { +func (m *IBCHookMsg) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1074,17 +2310,17 @@ func (m *IBCPacketReceipt) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: IBCPacketReceipt: wiretype end group for non-group") + return fmt.Errorf("proto: IBCHookMsg: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: IBCPacketReceipt: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: IBCHookMsg: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Sequence", wireType) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ReceivePacket", wireType) } - m.Sequence = 0 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowRoute @@ -1094,11 +2330,28 @@ func (m *IBCPacketReceipt) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Sequence |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } + if msglen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRoute + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.ReceivePacket == nil { + m.ReceivePacket = &IBCHookPacket{} + } + if err := m.ReceivePacket.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipRoute(dAtA[iNdEx:]) @@ -1120,7 +2373,7 @@ func (m *IBCPacketReceipt) Unmarshal(dAtA []byte) error { } return nil } -func (m *TunnelPricesPacketData) Unmarshal(dAtA []byte) error { +func (m *IBCHookWasm) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1143,17 +2396,17 @@ func (m *TunnelPricesPacketData) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: TunnelPricesPacketData: wiretype end group for non-group") + return fmt.Errorf("proto: IBCHookWasm: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: TunnelPricesPacketData: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: IBCHookWasm: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TunnelID", wireType) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Contract", wireType) } - m.TunnelID = 0 + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowRoute @@ -1163,33 +2416,27 @@ func (m *TunnelPricesPacketData) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.TunnelID |= uint64(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Sequence", wireType) + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRoute } - m.Sequence = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRoute - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Sequence |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRoute } - case 3: + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Contract = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Prices", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Msg", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -1216,16 +2463,68 @@ func (m *TunnelPricesPacketData) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Prices = append(m.Prices, types.Price{}) - if err := m.Prices[len(m.Prices)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if m.Msg == nil { + m.Msg = &IBCHookMsg{} + } + if err := m.Msg.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field CreatedAt", wireType) + default: + iNdEx = preIndex + skippy, err := skipRoute(dAtA[iNdEx:]) + if err != nil { + return err } - m.CreatedAt = 0 + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthRoute + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *IBCHookMemo) 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 ErrIntOverflowRoute + } + 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: IBCHookMemo: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: IBCHookMemo: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Wasm", wireType) + } + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowRoute @@ -1235,11 +2534,28 @@ func (m *TunnelPricesPacketData) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.CreatedAt |= int64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } + if msglen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRoute + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Wasm == nil { + m.Wasm = &IBCHookWasm{} + } + if err := m.Wasm.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipRoute(dAtA[iNdEx:]) diff --git a/x/tunnel/types/route_ibc_hook.go b/x/tunnel/types/route_ibc_hook.go new file mode 100644 index 000000000..5bacfeae6 --- /dev/null +++ b/x/tunnel/types/route_ibc_hook.go @@ -0,0 +1,52 @@ +package types + +import ( + "fmt" + + channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" +) + +var ( + // HookDenomPrefix defines the prefix for the IBC hook denom + HookDenomPrefix = "tunnel-" + // HookTransferAmount defines the amount to transfer for the IBC hook + HookTransferAmount = uint64(1) +) + +// IBCRoute defines the IBC route for the tunnel module +var _ RouteI = &IBCHookRoute{} + +// NewIBCHookRoute creates a new IBCHookRoute instance. It is used to create the IBC hook route data +func NewIBCHookRoute(channelID, destinationContractAddress string) *IBCHookRoute { + return &IBCHookRoute{ + ChannelID: channelID, + DestinationContractAddress: destinationContractAddress, + } +} + +// Route defines the IBC route for the tunnel module +func (r *IBCHookRoute) ValidateBasic() error { + // Validate the ChannelID format + if !channeltypes.IsChannelIDFormat(r.ChannelID) { + return fmt.Errorf("channel identifier is not in the format: `channel-{N}`") + } + + // Validate the DestinationContractAddress cannot be empty + if r.DestinationContractAddress == "" { + return fmt.Errorf("destination contract address cannot be empty") + } + + return nil +} + +// NewIBCHookPacketReceipt creates a new IBCHookPacketReceipt instance. It is used to create the IBC hook packet receipt data +func NewIBCHookPacketReceipt(sequence uint64) *IBCHookPacketReceipt { + return &IBCHookPacketReceipt{ + Sequence: sequence, + } +} + +// FormatHookDenomIdentifier returns the hook denom identifier based on the tunnel ID +func FormatHookDenomIdentifier(tunnelID uint64) string { + return fmt.Sprintf("%s%d", HookDenomPrefix, tunnelID) +} diff --git a/x/tunnel/types/route_ibc_hook_test.go b/x/tunnel/types/route_ibc_hook_test.go new file mode 100644 index 000000000..d740aa0f1 --- /dev/null +++ b/x/tunnel/types/route_ibc_hook_test.go @@ -0,0 +1,64 @@ +package types_test + +import ( + "testing" + + "github.com/stretchr/testify/require" + + "github.com/bandprotocol/chain/v3/x/tunnel/types" +) + +func TestIBCHookRoute_ValidateBasic(t *testing.T) { + tests := []struct { + name string + route types.IBCHookRoute + expErr bool + errMsg string + }{ + { + name: "invalid channel ID", + route: types.IBCHookRoute{ + ChannelID: "invalid-channel", + }, + expErr: true, + errMsg: "channel identifier is not in the format: `channel-{N}`", + }, + { + name: "empty channel ID", + route: types.IBCHookRoute{ + ChannelID: "", + }, + expErr: true, + errMsg: "channel identifier is not in the format: `channel-{N}`", + }, + { + name: "empty destination contract address", + route: types.IBCHookRoute{ + ChannelID: "channel-1", + DestinationContractAddress: "", + }, + expErr: true, + errMsg: "destination contract address cannot be empty", + }, + { + name: "all good", + route: types.IBCHookRoute{ + ChannelID: "channel-1", + DestinationContractAddress: "mock17evppqj3qsx7c2z9vhpd3m3r0p9a7ghs6ht4vvtzn4v2xx6vxhhsuqvf0w", + }, + expErr: false, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + err := tt.route.ValidateBasic() + if tt.expErr { + require.Error(t, err) + require.Equal(t, tt.errMsg, err.Error()) + } else { + require.NoError(t, err) + } + }) + } +}