diff --git a/api/cosmos/evm/crypto/v1/ethsecp256k1/keys.pulsar.go b/api/cosmos/evm/crypto/v1/ethsecp256k1/keys.pulsar.go deleted file mode 100644 index 0d0b7e628..000000000 --- a/api/cosmos/evm/crypto/v1/ethsecp256k1/keys.pulsar.go +++ /dev/null @@ -1,1058 +0,0 @@ -// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. -package ethsecp256k1 - -import ( - fmt "fmt" - runtime "github.com/cosmos/cosmos-proto/runtime" - _ "github.com/cosmos/gogoproto/gogoproto" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoiface "google.golang.org/protobuf/runtime/protoiface" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - io "io" - reflect "reflect" - sync "sync" -) - -var ( - md_PubKey protoreflect.MessageDescriptor - fd_PubKey_key protoreflect.FieldDescriptor -) - -func init() { - file_cosmos_evm_crypto_v1_ethsecp256k1_keys_proto_init() - md_PubKey = File_cosmos_evm_crypto_v1_ethsecp256k1_keys_proto.Messages().ByName("PubKey") - fd_PubKey_key = md_PubKey.Fields().ByName("key") -} - -var _ protoreflect.Message = (*fastReflection_PubKey)(nil) - -type fastReflection_PubKey PubKey - -func (x *PubKey) ProtoReflect() protoreflect.Message { - return (*fastReflection_PubKey)(x) -} - -func (x *PubKey) slowProtoReflect() protoreflect.Message { - mi := &file_cosmos_evm_crypto_v1_ethsecp256k1_keys_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_PubKey_messageType fastReflection_PubKey_messageType -var _ protoreflect.MessageType = fastReflection_PubKey_messageType{} - -type fastReflection_PubKey_messageType struct{} - -func (x fastReflection_PubKey_messageType) Zero() protoreflect.Message { - return (*fastReflection_PubKey)(nil) -} -func (x fastReflection_PubKey_messageType) New() protoreflect.Message { - return new(fastReflection_PubKey) -} -func (x fastReflection_PubKey_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_PubKey -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_PubKey) Descriptor() protoreflect.MessageDescriptor { - return md_PubKey -} - -// 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_PubKey) Type() protoreflect.MessageType { - return _fastReflection_PubKey_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_PubKey) New() protoreflect.Message { - return new(fastReflection_PubKey) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_PubKey) Interface() protoreflect.ProtoMessage { - return (*PubKey)(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_PubKey) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if len(x.Key) != 0 { - value := protoreflect.ValueOfBytes(x.Key) - if !f(fd_PubKey_key, 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_PubKey) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "cosmos.evm.crypto.v1.ethsecp256k1.PubKey.key": - return len(x.Key) != 0 - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.crypto.v1.ethsecp256k1.PubKey")) - } - panic(fmt.Errorf("message cosmos.evm.crypto.v1.ethsecp256k1.PubKey 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_PubKey) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "cosmos.evm.crypto.v1.ethsecp256k1.PubKey.key": - x.Key = nil - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.crypto.v1.ethsecp256k1.PubKey")) - } - panic(fmt.Errorf("message cosmos.evm.crypto.v1.ethsecp256k1.PubKey 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_PubKey) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "cosmos.evm.crypto.v1.ethsecp256k1.PubKey.key": - value := x.Key - return protoreflect.ValueOfBytes(value) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.crypto.v1.ethsecp256k1.PubKey")) - } - panic(fmt.Errorf("message cosmos.evm.crypto.v1.ethsecp256k1.PubKey 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_PubKey) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "cosmos.evm.crypto.v1.ethsecp256k1.PubKey.key": - x.Key = value.Bytes() - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.crypto.v1.ethsecp256k1.PubKey")) - } - panic(fmt.Errorf("message cosmos.evm.crypto.v1.ethsecp256k1.PubKey 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_PubKey) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "cosmos.evm.crypto.v1.ethsecp256k1.PubKey.key": - panic(fmt.Errorf("field key of message cosmos.evm.crypto.v1.ethsecp256k1.PubKey is not mutable")) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.crypto.v1.ethsecp256k1.PubKey")) - } - panic(fmt.Errorf("message cosmos.evm.crypto.v1.ethsecp256k1.PubKey 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_PubKey) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "cosmos.evm.crypto.v1.ethsecp256k1.PubKey.key": - return protoreflect.ValueOfBytes(nil) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.crypto.v1.ethsecp256k1.PubKey")) - } - panic(fmt.Errorf("message cosmos.evm.crypto.v1.ethsecp256k1.PubKey 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_PubKey) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in cosmos.evm.crypto.v1.ethsecp256k1.PubKey", 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_PubKey) 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_PubKey) 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_PubKey) 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_PubKey) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*PubKey) - 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.Key) - 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().(*PubKey) - 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.Key) > 0 { - i -= len(x.Key) - copy(dAtA[i:], x.Key) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Key))) - 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().(*PubKey) - 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: PubKey: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: PubKey: 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 Key", wireType) - } - var byteLen 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++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + byteLen - 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.Key = append(x.Key[:0], dAtA[iNdEx:postIndex]...) - if x.Key == nil { - x.Key = []byte{} - } - 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_PrivKey protoreflect.MessageDescriptor - fd_PrivKey_key protoreflect.FieldDescriptor -) - -func init() { - file_cosmos_evm_crypto_v1_ethsecp256k1_keys_proto_init() - md_PrivKey = File_cosmos_evm_crypto_v1_ethsecp256k1_keys_proto.Messages().ByName("PrivKey") - fd_PrivKey_key = md_PrivKey.Fields().ByName("key") -} - -var _ protoreflect.Message = (*fastReflection_PrivKey)(nil) - -type fastReflection_PrivKey PrivKey - -func (x *PrivKey) ProtoReflect() protoreflect.Message { - return (*fastReflection_PrivKey)(x) -} - -func (x *PrivKey) slowProtoReflect() protoreflect.Message { - mi := &file_cosmos_evm_crypto_v1_ethsecp256k1_keys_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_PrivKey_messageType fastReflection_PrivKey_messageType -var _ protoreflect.MessageType = fastReflection_PrivKey_messageType{} - -type fastReflection_PrivKey_messageType struct{} - -func (x fastReflection_PrivKey_messageType) Zero() protoreflect.Message { - return (*fastReflection_PrivKey)(nil) -} -func (x fastReflection_PrivKey_messageType) New() protoreflect.Message { - return new(fastReflection_PrivKey) -} -func (x fastReflection_PrivKey_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_PrivKey -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_PrivKey) Descriptor() protoreflect.MessageDescriptor { - return md_PrivKey -} - -// 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_PrivKey) Type() protoreflect.MessageType { - return _fastReflection_PrivKey_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_PrivKey) New() protoreflect.Message { - return new(fastReflection_PrivKey) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_PrivKey) Interface() protoreflect.ProtoMessage { - return (*PrivKey)(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_PrivKey) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if len(x.Key) != 0 { - value := protoreflect.ValueOfBytes(x.Key) - if !f(fd_PrivKey_key, 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_PrivKey) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "cosmos.evm.crypto.v1.ethsecp256k1.PrivKey.key": - return len(x.Key) != 0 - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.crypto.v1.ethsecp256k1.PrivKey")) - } - panic(fmt.Errorf("message cosmos.evm.crypto.v1.ethsecp256k1.PrivKey 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_PrivKey) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "cosmos.evm.crypto.v1.ethsecp256k1.PrivKey.key": - x.Key = nil - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.crypto.v1.ethsecp256k1.PrivKey")) - } - panic(fmt.Errorf("message cosmos.evm.crypto.v1.ethsecp256k1.PrivKey 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_PrivKey) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "cosmos.evm.crypto.v1.ethsecp256k1.PrivKey.key": - value := x.Key - return protoreflect.ValueOfBytes(value) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.crypto.v1.ethsecp256k1.PrivKey")) - } - panic(fmt.Errorf("message cosmos.evm.crypto.v1.ethsecp256k1.PrivKey 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_PrivKey) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "cosmos.evm.crypto.v1.ethsecp256k1.PrivKey.key": - x.Key = value.Bytes() - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.crypto.v1.ethsecp256k1.PrivKey")) - } - panic(fmt.Errorf("message cosmos.evm.crypto.v1.ethsecp256k1.PrivKey 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_PrivKey) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "cosmos.evm.crypto.v1.ethsecp256k1.PrivKey.key": - panic(fmt.Errorf("field key of message cosmos.evm.crypto.v1.ethsecp256k1.PrivKey is not mutable")) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.crypto.v1.ethsecp256k1.PrivKey")) - } - panic(fmt.Errorf("message cosmos.evm.crypto.v1.ethsecp256k1.PrivKey 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_PrivKey) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "cosmos.evm.crypto.v1.ethsecp256k1.PrivKey.key": - return protoreflect.ValueOfBytes(nil) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.crypto.v1.ethsecp256k1.PrivKey")) - } - panic(fmt.Errorf("message cosmos.evm.crypto.v1.ethsecp256k1.PrivKey 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_PrivKey) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in cosmos.evm.crypto.v1.ethsecp256k1.PrivKey", 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_PrivKey) 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_PrivKey) 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_PrivKey) 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_PrivKey) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*PrivKey) - 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.Key) - 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().(*PrivKey) - 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.Key) > 0 { - i -= len(x.Key) - copy(dAtA[i:], x.Key) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Key))) - 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().(*PrivKey) - 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: PrivKey: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: PrivKey: 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 Key", wireType) - } - var byteLen 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++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + byteLen - 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.Key = append(x.Key[:0], dAtA[iNdEx:postIndex]...) - if x.Key == nil { - x.Key = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.27.0 -// protoc (unknown) -// source: cosmos/evm/crypto/v1/ethsecp256k1/keys.proto - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// PubKey defines a type alias for an ecdsa.PublicKey that implements -// CometBFT's PubKey interface. It represents the 33-byte compressed public -// key format. -type PubKey struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // key is the public key in byte form - Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` -} - -func (x *PubKey) Reset() { - *x = PubKey{} - if protoimpl.UnsafeEnabled { - mi := &file_cosmos_evm_crypto_v1_ethsecp256k1_keys_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PubKey) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PubKey) ProtoMessage() {} - -// Deprecated: Use PubKey.ProtoReflect.Descriptor instead. -func (*PubKey) Descriptor() ([]byte, []int) { - return file_cosmos_evm_crypto_v1_ethsecp256k1_keys_proto_rawDescGZIP(), []int{0} -} - -func (x *PubKey) GetKey() []byte { - if x != nil { - return x.Key - } - return nil -} - -// PrivKey defines a type alias for an ecdsa.PrivateKey that implements -// CometBFT's PrivateKey interface. -type PrivKey struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // key is the private key in byte form - Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` -} - -func (x *PrivKey) Reset() { - *x = PrivKey{} - if protoimpl.UnsafeEnabled { - mi := &file_cosmos_evm_crypto_v1_ethsecp256k1_keys_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PrivKey) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PrivKey) ProtoMessage() {} - -// Deprecated: Use PrivKey.ProtoReflect.Descriptor instead. -func (*PrivKey) Descriptor() ([]byte, []int) { - return file_cosmos_evm_crypto_v1_ethsecp256k1_keys_proto_rawDescGZIP(), []int{1} -} - -func (x *PrivKey) GetKey() []byte { - if x != nil { - return x.Key - } - return nil -} - -var File_cosmos_evm_crypto_v1_ethsecp256k1_keys_proto protoreflect.FileDescriptor - -var file_cosmos_evm_crypto_v1_ethsecp256k1_keys_proto_rawDesc = []byte{ - 0x0a, 0x2c, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x65, 0x76, 0x6d, 0x2f, 0x63, 0x72, 0x79, - 0x70, 0x74, 0x6f, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x74, 0x68, 0x73, 0x65, 0x63, 0x70, 0x32, 0x35, - 0x36, 0x6b, 0x31, 0x2f, 0x6b, 0x65, 0x79, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x21, - 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x65, 0x76, 0x6d, 0x2e, 0x63, 0x72, 0x79, 0x70, 0x74, - 0x6f, 0x2e, 0x76, 0x31, 0x2e, 0x65, 0x74, 0x68, 0x73, 0x65, 0x63, 0x70, 0x32, 0x35, 0x36, 0x6b, - 0x31, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, - 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x20, 0x0a, 0x06, 0x50, 0x75, 0x62, 0x4b, 0x65, - 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x03, - 0x6b, 0x65, 0x79, 0x3a, 0x04, 0x98, 0xa0, 0x1f, 0x00, 0x22, 0x1b, 0x0a, 0x07, 0x50, 0x72, 0x69, - 0x76, 0x4b, 0x65, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0c, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x42, 0x90, 0x02, 0x0a, 0x25, 0x63, 0x6f, 0x6d, 0x2e, 0x63, - 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x65, 0x76, 0x6d, 0x2e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x6f, - 0x2e, 0x76, 0x31, 0x2e, 0x65, 0x74, 0x68, 0x73, 0x65, 0x63, 0x70, 0x32, 0x35, 0x36, 0x6b, 0x31, - 0x42, 0x09, 0x4b, 0x65, 0x79, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x32, 0x63, - 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, - 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x65, 0x76, 0x6d, 0x2f, 0x63, 0x72, 0x79, 0x70, 0x74, - 0x6f, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x74, 0x68, 0x73, 0x65, 0x63, 0x70, 0x32, 0x35, 0x36, 0x6b, - 0x31, 0xa2, 0x02, 0x05, 0x43, 0x45, 0x43, 0x56, 0x45, 0xaa, 0x02, 0x21, 0x43, 0x6f, 0x73, 0x6d, - 0x6f, 0x73, 0x2e, 0x45, 0x76, 0x6d, 0x2e, 0x43, 0x72, 0x79, 0x70, 0x74, 0x6f, 0x2e, 0x56, 0x31, - 0x2e, 0x45, 0x74, 0x68, 0x73, 0x65, 0x63, 0x70, 0x32, 0x35, 0x36, 0x6b, 0x31, 0xca, 0x02, 0x21, - 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x45, 0x76, 0x6d, 0x5c, 0x43, 0x72, 0x79, 0x70, 0x74, - 0x6f, 0x5c, 0x56, 0x31, 0x5c, 0x45, 0x74, 0x68, 0x73, 0x65, 0x63, 0x70, 0x32, 0x35, 0x36, 0x6b, - 0x31, 0xe2, 0x02, 0x2d, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x45, 0x76, 0x6d, 0x5c, 0x43, - 0x72, 0x79, 0x70, 0x74, 0x6f, 0x5c, 0x56, 0x31, 0x5c, 0x45, 0x74, 0x68, 0x73, 0x65, 0x63, 0x70, - 0x32, 0x35, 0x36, 0x6b, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, - 0x61, 0xea, 0x02, 0x25, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x45, 0x76, 0x6d, 0x3a, - 0x3a, 0x43, 0x72, 0x79, 0x70, 0x74, 0x6f, 0x3a, 0x3a, 0x56, 0x31, 0x3a, 0x3a, 0x45, 0x74, 0x68, - 0x73, 0x65, 0x63, 0x70, 0x32, 0x35, 0x36, 0x6b, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, -} - -var ( - file_cosmos_evm_crypto_v1_ethsecp256k1_keys_proto_rawDescOnce sync.Once - file_cosmos_evm_crypto_v1_ethsecp256k1_keys_proto_rawDescData = file_cosmos_evm_crypto_v1_ethsecp256k1_keys_proto_rawDesc -) - -func file_cosmos_evm_crypto_v1_ethsecp256k1_keys_proto_rawDescGZIP() []byte { - file_cosmos_evm_crypto_v1_ethsecp256k1_keys_proto_rawDescOnce.Do(func() { - file_cosmos_evm_crypto_v1_ethsecp256k1_keys_proto_rawDescData = protoimpl.X.CompressGZIP(file_cosmos_evm_crypto_v1_ethsecp256k1_keys_proto_rawDescData) - }) - return file_cosmos_evm_crypto_v1_ethsecp256k1_keys_proto_rawDescData -} - -var file_cosmos_evm_crypto_v1_ethsecp256k1_keys_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_cosmos_evm_crypto_v1_ethsecp256k1_keys_proto_goTypes = []interface{}{ - (*PubKey)(nil), // 0: cosmos.evm.crypto.v1.ethsecp256k1.PubKey - (*PrivKey)(nil), // 1: cosmos.evm.crypto.v1.ethsecp256k1.PrivKey -} -var file_cosmos_evm_crypto_v1_ethsecp256k1_keys_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_cosmos_evm_crypto_v1_ethsecp256k1_keys_proto_init() } -func file_cosmos_evm_crypto_v1_ethsecp256k1_keys_proto_init() { - if File_cosmos_evm_crypto_v1_ethsecp256k1_keys_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_cosmos_evm_crypto_v1_ethsecp256k1_keys_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PubKey); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cosmos_evm_crypto_v1_ethsecp256k1_keys_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PrivKey); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_cosmos_evm_crypto_v1_ethsecp256k1_keys_proto_rawDesc, - NumEnums: 0, - NumMessages: 2, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_cosmos_evm_crypto_v1_ethsecp256k1_keys_proto_goTypes, - DependencyIndexes: file_cosmos_evm_crypto_v1_ethsecp256k1_keys_proto_depIdxs, - MessageInfos: file_cosmos_evm_crypto_v1_ethsecp256k1_keys_proto_msgTypes, - }.Build() - File_cosmos_evm_crypto_v1_ethsecp256k1_keys_proto = out.File - file_cosmos_evm_crypto_v1_ethsecp256k1_keys_proto_rawDesc = nil - file_cosmos_evm_crypto_v1_ethsecp256k1_keys_proto_goTypes = nil - file_cosmos_evm_crypto_v1_ethsecp256k1_keys_proto_depIdxs = nil -} diff --git a/api/cosmos/evm/erc20/v1/erc20.pulsar.go b/api/cosmos/evm/erc20/v1/erc20.pulsar.go index d582bb6c1..346793fef 100644 --- a/api/cosmos/evm/erc20/v1/erc20.pulsar.go +++ b/api/cosmos/evm/erc20/v1/erc20.pulsar.go @@ -20,6 +20,7 @@ var ( fd_TokenPair_denom protoreflect.FieldDescriptor fd_TokenPair_enabled protoreflect.FieldDescriptor fd_TokenPair_contract_owner protoreflect.FieldDescriptor + fd_TokenPair_owner_address protoreflect.FieldDescriptor ) func init() { @@ -29,6 +30,7 @@ func init() { fd_TokenPair_denom = md_TokenPair.Fields().ByName("denom") fd_TokenPair_enabled = md_TokenPair.Fields().ByName("enabled") fd_TokenPair_contract_owner = md_TokenPair.Fields().ByName("contract_owner") + fd_TokenPair_owner_address = md_TokenPair.Fields().ByName("owner_address") } var _ protoreflect.Message = (*fastReflection_TokenPair)(nil) @@ -120,6 +122,12 @@ func (x *fastReflection_TokenPair) Range(f func(protoreflect.FieldDescriptor, pr return } } + if x.OwnerAddress != "" { + value := protoreflect.ValueOfString(x.OwnerAddress) + if !f(fd_TokenPair_owner_address, value) { + return + } + } } // Has reports whether a field is populated. @@ -143,6 +151,8 @@ func (x *fastReflection_TokenPair) Has(fd protoreflect.FieldDescriptor) bool { return x.Enabled != false case "cosmos.evm.erc20.v1.TokenPair.contract_owner": return x.ContractOwner != 0 + case "cosmos.evm.erc20.v1.TokenPair.owner_address": + return x.OwnerAddress != "" default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.erc20.v1.TokenPair")) @@ -167,6 +177,8 @@ func (x *fastReflection_TokenPair) Clear(fd protoreflect.FieldDescriptor) { x.Enabled = false case "cosmos.evm.erc20.v1.TokenPair.contract_owner": x.ContractOwner = 0 + case "cosmos.evm.erc20.v1.TokenPair.owner_address": + x.OwnerAddress = "" default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.erc20.v1.TokenPair")) @@ -195,6 +207,9 @@ func (x *fastReflection_TokenPair) Get(descriptor protoreflect.FieldDescriptor) case "cosmos.evm.erc20.v1.TokenPair.contract_owner": value := x.ContractOwner return protoreflect.ValueOfEnum((protoreflect.EnumNumber)(value)) + case "cosmos.evm.erc20.v1.TokenPair.owner_address": + value := x.OwnerAddress + return protoreflect.ValueOfString(value) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.erc20.v1.TokenPair")) @@ -223,6 +238,8 @@ func (x *fastReflection_TokenPair) Set(fd protoreflect.FieldDescriptor, value pr x.Enabled = value.Bool() case "cosmos.evm.erc20.v1.TokenPair.contract_owner": x.ContractOwner = (Owner)(value.Enum()) + case "cosmos.evm.erc20.v1.TokenPair.owner_address": + x.OwnerAddress = value.Interface().(string) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.erc20.v1.TokenPair")) @@ -251,6 +268,8 @@ func (x *fastReflection_TokenPair) Mutable(fd protoreflect.FieldDescriptor) prot panic(fmt.Errorf("field enabled of message cosmos.evm.erc20.v1.TokenPair is not mutable")) case "cosmos.evm.erc20.v1.TokenPair.contract_owner": panic(fmt.Errorf("field contract_owner of message cosmos.evm.erc20.v1.TokenPair is not mutable")) + case "cosmos.evm.erc20.v1.TokenPair.owner_address": + panic(fmt.Errorf("field owner_address of message cosmos.evm.erc20.v1.TokenPair is not mutable")) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.erc20.v1.TokenPair")) @@ -272,6 +291,8 @@ func (x *fastReflection_TokenPair) NewField(fd protoreflect.FieldDescriptor) pro return protoreflect.ValueOfBool(false) case "cosmos.evm.erc20.v1.TokenPair.contract_owner": return protoreflect.ValueOfEnum(0) + case "cosmos.evm.erc20.v1.TokenPair.owner_address": + return protoreflect.ValueOfString("") default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.erc20.v1.TokenPair")) @@ -355,6 +376,10 @@ func (x *fastReflection_TokenPair) ProtoMethods() *protoiface.Methods { if x.ContractOwner != 0 { n += 1 + runtime.Sov(uint64(x.ContractOwner)) } + l = len(x.OwnerAddress) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } if x.unknownFields != nil { n += len(x.unknownFields) } @@ -384,6 +409,13 @@ func (x *fastReflection_TokenPair) ProtoMethods() *protoiface.Methods { i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } + if len(x.OwnerAddress) > 0 { + i -= len(x.OwnerAddress) + copy(dAtA[i:], x.OwnerAddress) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.OwnerAddress))) + i-- + dAtA[i] = 0x2a + } if x.ContractOwner != 0 { i = runtime.EncodeVarint(dAtA, i, uint64(x.ContractOwner)) i-- @@ -565,6 +597,38 @@ func (x *fastReflection_TokenPair) ProtoMethods() *protoiface.Methods { break } } + case 5: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field OwnerAddress", 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.OwnerAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := runtime.Skip(dAtA[iNdEx:]) @@ -3566,6 +3630,9 @@ type TokenPair struct { // contract_owner is the an ENUM specifying the type of ERC20 owner (0 // invalid, 1 ModuleAccount, 2 external address) ContractOwner Owner `protobuf:"varint,4,opt,name=contract_owner,json=contractOwner,proto3,enum=cosmos.evm.erc20.v1.Owner" json:"contract_owner,omitempty"` + // owner_address is the address of the current owner of the token + // Only set if contract_owner is OWNER_MODULE + OwnerAddress string `protobuf:"bytes,5,opt,name=owner_address,json=ownerAddress,proto3" json:"owner_address,omitempty"` } func (x *TokenPair) Reset() { @@ -3616,6 +3683,13 @@ func (x *TokenPair) GetContractOwner() Owner { return Owner_OWNER_UNSPECIFIED } +func (x *TokenPair) GetOwnerAddress() string { + if x != nil { + return x.OwnerAddress + } + return "" +} + // Allowance is a token allowance only for erc20 precompile type Allowance struct { state protoimpl.MessageState @@ -3905,7 +3979,7 @@ var file_cosmos_evm_erc20_v1_erc20_proto_rawDesc = []byte{ 0x63, 0x32, 0x30, 0x2e, 0x76, 0x31, 0x1a, 0x1e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, 0x61, 0x6e, 0x6b, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x62, 0x61, 0x6e, 0x6b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xa9, 0x01, 0x0a, + 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xce, 0x01, 0x0a, 0x09, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x50, 0x61, 0x69, 0x72, 0x12, 0x23, 0x0a, 0x0d, 0x65, 0x72, 0x63, 0x32, 0x30, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x65, 0x72, 0x63, 0x32, 0x30, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, @@ -3916,64 +3990,67 @@ var file_cosmos_evm_erc20_v1_erc20_proto_rawDesc = []byte{ 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1a, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x65, 0x76, 0x6d, 0x2e, 0x65, 0x72, 0x63, 0x32, 0x30, 0x2e, 0x76, 0x31, 0x2e, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x52, 0x0d, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x4f, 0x77, 0x6e, - 0x65, 0x72, 0x3a, 0x04, 0xe8, 0xa0, 0x1f, 0x01, 0x22, 0x9b, 0x01, 0x0a, 0x09, 0x41, 0x6c, 0x6c, - 0x6f, 0x77, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x65, 0x72, 0x63, 0x32, 0x30, 0x5f, - 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x65, - 0x72, 0x63, 0x32, 0x30, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x6f, - 0x77, 0x6e, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6f, 0x77, 0x6e, 0x65, - 0x72, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x07, 0x73, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x12, 0x33, 0x0a, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x42, 0x1d, 0xc8, 0xde, 0x1f, 0x00, - 0xda, 0xde, 0x1f, 0x15, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, - 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x49, 0x6e, 0x74, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x3a, 0x04, 0xe8, 0xa0, 0x1f, 0x00, 0x22, 0x95, 0x01, 0x0a, 0x14, 0x52, 0x65, 0x67, 0x69, 0x73, - 0x74, 0x65, 0x72, 0x43, 0x6f, 0x69, 0x6e, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x12, - 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, - 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, - 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, - 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3f, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, - 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, + 0x65, 0x72, 0x12, 0x23, 0x0a, 0x0d, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x6f, 0x77, 0x6e, 0x65, 0x72, + 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x3a, 0x04, 0xe8, 0xa0, 0x1f, 0x01, 0x22, 0x9b, 0x01, + 0x0a, 0x09, 0x41, 0x6c, 0x6c, 0x6f, 0x77, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x65, + 0x72, 0x63, 0x32, 0x30, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0c, 0x65, 0x72, 0x63, 0x32, 0x30, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0x12, 0x14, 0x0a, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x70, 0x65, 0x6e, 0x64, 0x65, + 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x72, + 0x12, 0x33, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x42, + 0x1d, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x15, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, + 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x49, 0x6e, 0x74, 0x52, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x04, 0xe8, 0xa0, 0x1f, 0x00, 0x22, 0x95, 0x01, 0x0a, 0x14, + 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x69, 0x6e, 0x50, 0x72, 0x6f, 0x70, + 0x6f, 0x73, 0x61, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, + 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3f, 0x0a, 0x08, + 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, + 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x6e, 0x6b, 0x2e, 0x76, 0x31, 0x62, + 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x42, 0x04, 0xc8, + 0xde, 0x1f, 0x00, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x3a, 0x04, 0xe8, + 0xa0, 0x1f, 0x00, 0x22, 0x53, 0x0a, 0x10, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x4d, + 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x3f, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, + 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x6e, 0x6b, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x08, - 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x3a, 0x04, 0xe8, 0xa0, 0x1f, 0x00, 0x22, 0x53, - 0x0a, 0x10, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, - 0x74, 0x61, 0x12, 0x3f, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, - 0x6e, 0x6b, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, - 0x61, 0x74, 0x61, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, - 0x61, 0x74, 0x61, 0x22, 0x7d, 0x0a, 0x15, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x45, - 0x52, 0x43, 0x32, 0x30, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x12, 0x14, 0x0a, 0x05, - 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, - 0x6c, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, - 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, - 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x26, 0x0a, 0x0e, 0x65, 0x72, 0x63, 0x32, 0x30, 0x61, 0x64, 0x64, - 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0e, 0x65, 0x72, - 0x63, 0x32, 0x30, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x3a, 0x04, 0xe8, 0xa0, - 0x1f, 0x00, 0x22, 0x73, 0x0a, 0x1d, 0x54, 0x6f, 0x67, 0x67, 0x6c, 0x65, 0x54, 0x6f, 0x6b, 0x65, - 0x6e, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x70, 0x6f, - 0x73, 0x61, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, - 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, - 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x74, - 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, - 0x6e, 0x3a, 0x04, 0xe8, 0xa0, 0x1f, 0x01, 0x2a, 0x4a, 0x0a, 0x05, 0x4f, 0x77, 0x6e, 0x65, 0x72, - 0x12, 0x15, 0x0a, 0x11, 0x4f, 0x57, 0x4e, 0x45, 0x52, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, - 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x10, 0x0a, 0x0c, 0x4f, 0x57, 0x4e, 0x45, 0x52, - 0x5f, 0x4d, 0x4f, 0x44, 0x55, 0x4c, 0x45, 0x10, 0x01, 0x12, 0x12, 0x0a, 0x0e, 0x4f, 0x57, 0x4e, - 0x45, 0x52, 0x5f, 0x45, 0x58, 0x54, 0x45, 0x52, 0x4e, 0x41, 0x4c, 0x10, 0x02, 0x1a, 0x04, 0x88, - 0xa3, 0x1e, 0x00, 0x42, 0xc2, 0x01, 0x0a, 0x17, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, - 0x6f, 0x73, 0x2e, 0x65, 0x76, 0x6d, 0x2e, 0x65, 0x72, 0x63, 0x32, 0x30, 0x2e, 0x76, 0x31, 0x42, - 0x0a, 0x45, 0x72, 0x63, 0x32, 0x30, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2c, 0x63, - 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, - 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x65, 0x76, 0x6d, 0x2f, 0x65, 0x72, 0x63, 0x32, 0x30, - 0x2f, 0x76, 0x31, 0x3b, 0x65, 0x72, 0x63, 0x32, 0x30, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x45, - 0x45, 0xaa, 0x02, 0x13, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x45, 0x76, 0x6d, 0x2e, 0x45, - 0x72, 0x63, 0x32, 0x30, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x13, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x5c, 0x45, 0x76, 0x6d, 0x5c, 0x45, 0x72, 0x63, 0x32, 0x30, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x1f, - 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x45, 0x76, 0x6d, 0x5c, 0x45, 0x72, 0x63, 0x32, 0x30, - 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, - 0x02, 0x16, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x45, 0x76, 0x6d, 0x3a, 0x3a, 0x45, - 0x72, 0x63, 0x32, 0x30, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x22, 0x7d, 0x0a, 0x15, 0x52, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x65, 0x72, 0x45, 0x52, 0x43, 0x32, 0x30, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, + 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, + 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, + 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x26, 0x0a, 0x0e, 0x65, 0x72, 0x63, + 0x32, 0x30, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, + 0x09, 0x52, 0x0e, 0x65, 0x72, 0x63, 0x32, 0x30, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, + 0x73, 0x3a, 0x04, 0xe8, 0xa0, 0x1f, 0x00, 0x22, 0x73, 0x0a, 0x1d, 0x54, 0x6f, 0x67, 0x67, 0x6c, + 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, + 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x20, + 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x3a, 0x04, 0xe8, 0xa0, 0x1f, 0x01, 0x2a, 0x4a, 0x0a, 0x05, + 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x12, 0x15, 0x0a, 0x11, 0x4f, 0x57, 0x4e, 0x45, 0x52, 0x5f, 0x55, + 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x10, 0x0a, 0x0c, + 0x4f, 0x57, 0x4e, 0x45, 0x52, 0x5f, 0x4d, 0x4f, 0x44, 0x55, 0x4c, 0x45, 0x10, 0x01, 0x12, 0x12, + 0x0a, 0x0e, 0x4f, 0x57, 0x4e, 0x45, 0x52, 0x5f, 0x45, 0x58, 0x54, 0x45, 0x52, 0x4e, 0x41, 0x4c, + 0x10, 0x02, 0x1a, 0x04, 0x88, 0xa3, 0x1e, 0x00, 0x42, 0xc2, 0x01, 0x0a, 0x17, 0x63, 0x6f, 0x6d, + 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x65, 0x76, 0x6d, 0x2e, 0x65, 0x72, 0x63, 0x32, + 0x30, 0x2e, 0x76, 0x31, 0x42, 0x0a, 0x45, 0x72, 0x63, 0x32, 0x30, 0x50, 0x72, 0x6f, 0x74, 0x6f, + 0x50, 0x01, 0x5a, 0x2c, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, + 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x65, 0x76, 0x6d, 0x2f, + 0x65, 0x72, 0x63, 0x32, 0x30, 0x2f, 0x76, 0x31, 0x3b, 0x65, 0x72, 0x63, 0x32, 0x30, 0x76, 0x31, + 0xa2, 0x02, 0x03, 0x43, 0x45, 0x45, 0xaa, 0x02, 0x13, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, + 0x45, 0x76, 0x6d, 0x2e, 0x45, 0x72, 0x63, 0x32, 0x30, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x13, 0x43, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x45, 0x76, 0x6d, 0x5c, 0x45, 0x72, 0x63, 0x32, 0x30, 0x5c, + 0x56, 0x31, 0xe2, 0x02, 0x1f, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x45, 0x76, 0x6d, 0x5c, + 0x45, 0x72, 0x63, 0x32, 0x30, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, + 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x16, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x45, + 0x76, 0x6d, 0x3a, 0x3a, 0x45, 0x72, 0x63, 0x32, 0x30, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/api/cosmos/evm/erc20/v1/query.pulsar.go b/api/cosmos/evm/erc20/v1/query.pulsar.go index 857714876..34f9c4688 100644 --- a/api/cosmos/evm/erc20/v1/query.pulsar.go +++ b/api/cosmos/evm/erc20/v1/query.pulsar.go @@ -2670,6 +2670,846 @@ func (x *fastReflection_QueryParamsResponse) ProtoMethods() *protoiface.Methods } } +var ( + md_QueryOwnerAddressRequest protoreflect.MessageDescriptor + fd_QueryOwnerAddressRequest_contract_address protoreflect.FieldDescriptor +) + +func init() { + file_cosmos_evm_erc20_v1_query_proto_init() + md_QueryOwnerAddressRequest = File_cosmos_evm_erc20_v1_query_proto.Messages().ByName("QueryOwnerAddressRequest") + fd_QueryOwnerAddressRequest_contract_address = md_QueryOwnerAddressRequest.Fields().ByName("contract_address") +} + +var _ protoreflect.Message = (*fastReflection_QueryOwnerAddressRequest)(nil) + +type fastReflection_QueryOwnerAddressRequest QueryOwnerAddressRequest + +func (x *QueryOwnerAddressRequest) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryOwnerAddressRequest)(x) +} + +func (x *QueryOwnerAddressRequest) slowProtoReflect() protoreflect.Message { + mi := &file_cosmos_evm_erc20_v1_query_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_QueryOwnerAddressRequest_messageType fastReflection_QueryOwnerAddressRequest_messageType +var _ protoreflect.MessageType = fastReflection_QueryOwnerAddressRequest_messageType{} + +type fastReflection_QueryOwnerAddressRequest_messageType struct{} + +func (x fastReflection_QueryOwnerAddressRequest_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryOwnerAddressRequest)(nil) +} +func (x fastReflection_QueryOwnerAddressRequest_messageType) New() protoreflect.Message { + return new(fastReflection_QueryOwnerAddressRequest) +} +func (x fastReflection_QueryOwnerAddressRequest_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryOwnerAddressRequest +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_QueryOwnerAddressRequest) Descriptor() protoreflect.MessageDescriptor { + return md_QueryOwnerAddressRequest +} + +// 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_QueryOwnerAddressRequest) Type() protoreflect.MessageType { + return _fastReflection_QueryOwnerAddressRequest_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_QueryOwnerAddressRequest) New() protoreflect.Message { + return new(fastReflection_QueryOwnerAddressRequest) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_QueryOwnerAddressRequest) Interface() protoreflect.ProtoMessage { + return (*QueryOwnerAddressRequest)(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_QueryOwnerAddressRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.ContractAddress != "" { + value := protoreflect.ValueOfString(x.ContractAddress) + if !f(fd_QueryOwnerAddressRequest_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_QueryOwnerAddressRequest) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "cosmos.evm.erc20.v1.QueryOwnerAddressRequest.contract_address": + return x.ContractAddress != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.erc20.v1.QueryOwnerAddressRequest")) + } + panic(fmt.Errorf("message cosmos.evm.erc20.v1.QueryOwnerAddressRequest 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_QueryOwnerAddressRequest) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "cosmos.evm.erc20.v1.QueryOwnerAddressRequest.contract_address": + x.ContractAddress = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.erc20.v1.QueryOwnerAddressRequest")) + } + panic(fmt.Errorf("message cosmos.evm.erc20.v1.QueryOwnerAddressRequest 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_QueryOwnerAddressRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "cosmos.evm.erc20.v1.QueryOwnerAddressRequest.contract_address": + value := x.ContractAddress + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.erc20.v1.QueryOwnerAddressRequest")) + } + panic(fmt.Errorf("message cosmos.evm.erc20.v1.QueryOwnerAddressRequest 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_QueryOwnerAddressRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "cosmos.evm.erc20.v1.QueryOwnerAddressRequest.contract_address": + x.ContractAddress = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.erc20.v1.QueryOwnerAddressRequest")) + } + panic(fmt.Errorf("message cosmos.evm.erc20.v1.QueryOwnerAddressRequest 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_QueryOwnerAddressRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.evm.erc20.v1.QueryOwnerAddressRequest.contract_address": + panic(fmt.Errorf("field contract_address of message cosmos.evm.erc20.v1.QueryOwnerAddressRequest is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.erc20.v1.QueryOwnerAddressRequest")) + } + panic(fmt.Errorf("message cosmos.evm.erc20.v1.QueryOwnerAddressRequest 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_QueryOwnerAddressRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.evm.erc20.v1.QueryOwnerAddressRequest.contract_address": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.erc20.v1.QueryOwnerAddressRequest")) + } + panic(fmt.Errorf("message cosmos.evm.erc20.v1.QueryOwnerAddressRequest 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_QueryOwnerAddressRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in cosmos.evm.erc20.v1.QueryOwnerAddressRequest", 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_QueryOwnerAddressRequest) 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_QueryOwnerAddressRequest) 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_QueryOwnerAddressRequest) 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_QueryOwnerAddressRequest) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*QueryOwnerAddressRequest) + 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.ContractAddress) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*QueryOwnerAddressRequest) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.ContractAddress) > 0 { + i -= len(x.ContractAddress) + copy(dAtA[i:], x.ContractAddress) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.ContractAddress))) + i-- + dAtA[i] = 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().(*QueryOwnerAddressRequest) + 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: QueryOwnerAddressRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryOwnerAddressRequest: 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 ContractAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.ContractAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_QueryOwnerAddressResponse protoreflect.MessageDescriptor + fd_QueryOwnerAddressResponse_owner_address protoreflect.FieldDescriptor +) + +func init() { + file_cosmos_evm_erc20_v1_query_proto_init() + md_QueryOwnerAddressResponse = File_cosmos_evm_erc20_v1_query_proto.Messages().ByName("QueryOwnerAddressResponse") + fd_QueryOwnerAddressResponse_owner_address = md_QueryOwnerAddressResponse.Fields().ByName("owner_address") +} + +var _ protoreflect.Message = (*fastReflection_QueryOwnerAddressResponse)(nil) + +type fastReflection_QueryOwnerAddressResponse QueryOwnerAddressResponse + +func (x *QueryOwnerAddressResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryOwnerAddressResponse)(x) +} + +func (x *QueryOwnerAddressResponse) slowProtoReflect() protoreflect.Message { + mi := &file_cosmos_evm_erc20_v1_query_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_QueryOwnerAddressResponse_messageType fastReflection_QueryOwnerAddressResponse_messageType +var _ protoreflect.MessageType = fastReflection_QueryOwnerAddressResponse_messageType{} + +type fastReflection_QueryOwnerAddressResponse_messageType struct{} + +func (x fastReflection_QueryOwnerAddressResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryOwnerAddressResponse)(nil) +} +func (x fastReflection_QueryOwnerAddressResponse_messageType) New() protoreflect.Message { + return new(fastReflection_QueryOwnerAddressResponse) +} +func (x fastReflection_QueryOwnerAddressResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryOwnerAddressResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_QueryOwnerAddressResponse) Descriptor() protoreflect.MessageDescriptor { + return md_QueryOwnerAddressResponse +} + +// 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_QueryOwnerAddressResponse) Type() protoreflect.MessageType { + return _fastReflection_QueryOwnerAddressResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_QueryOwnerAddressResponse) New() protoreflect.Message { + return new(fastReflection_QueryOwnerAddressResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_QueryOwnerAddressResponse) Interface() protoreflect.ProtoMessage { + return (*QueryOwnerAddressResponse)(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_QueryOwnerAddressResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.OwnerAddress != "" { + value := protoreflect.ValueOfString(x.OwnerAddress) + if !f(fd_QueryOwnerAddressResponse_owner_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_QueryOwnerAddressResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "cosmos.evm.erc20.v1.QueryOwnerAddressResponse.owner_address": + return x.OwnerAddress != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.erc20.v1.QueryOwnerAddressResponse")) + } + panic(fmt.Errorf("message cosmos.evm.erc20.v1.QueryOwnerAddressResponse 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_QueryOwnerAddressResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "cosmos.evm.erc20.v1.QueryOwnerAddressResponse.owner_address": + x.OwnerAddress = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.erc20.v1.QueryOwnerAddressResponse")) + } + panic(fmt.Errorf("message cosmos.evm.erc20.v1.QueryOwnerAddressResponse 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_QueryOwnerAddressResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "cosmos.evm.erc20.v1.QueryOwnerAddressResponse.owner_address": + value := x.OwnerAddress + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.erc20.v1.QueryOwnerAddressResponse")) + } + panic(fmt.Errorf("message cosmos.evm.erc20.v1.QueryOwnerAddressResponse 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_QueryOwnerAddressResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "cosmos.evm.erc20.v1.QueryOwnerAddressResponse.owner_address": + x.OwnerAddress = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.erc20.v1.QueryOwnerAddressResponse")) + } + panic(fmt.Errorf("message cosmos.evm.erc20.v1.QueryOwnerAddressResponse 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_QueryOwnerAddressResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.evm.erc20.v1.QueryOwnerAddressResponse.owner_address": + panic(fmt.Errorf("field owner_address of message cosmos.evm.erc20.v1.QueryOwnerAddressResponse is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.erc20.v1.QueryOwnerAddressResponse")) + } + panic(fmt.Errorf("message cosmos.evm.erc20.v1.QueryOwnerAddressResponse 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_QueryOwnerAddressResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.evm.erc20.v1.QueryOwnerAddressResponse.owner_address": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.erc20.v1.QueryOwnerAddressResponse")) + } + panic(fmt.Errorf("message cosmos.evm.erc20.v1.QueryOwnerAddressResponse 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_QueryOwnerAddressResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in cosmos.evm.erc20.v1.QueryOwnerAddressResponse", 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_QueryOwnerAddressResponse) 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_QueryOwnerAddressResponse) 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_QueryOwnerAddressResponse) 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_QueryOwnerAddressResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*QueryOwnerAddressResponse) + 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.OwnerAddress) + 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().(*QueryOwnerAddressResponse) + 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.OwnerAddress) > 0 { + i -= len(x.OwnerAddress) + copy(dAtA[i:], x.OwnerAddress) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.OwnerAddress))) + 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().(*QueryOwnerAddressResponse) + 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: QueryOwnerAddressResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryOwnerAddressResponse: 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 OwnerAddress", 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.OwnerAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.0 @@ -2910,6 +3750,76 @@ func (x *QueryParamsResponse) GetParams() *Params { return nil } +type QueryOwnerAddressRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ContractAddress string `protobuf:"bytes,1,opt,name=contract_address,json=contractAddress,proto3" json:"contract_address,omitempty"` +} + +func (x *QueryOwnerAddressRequest) Reset() { + *x = QueryOwnerAddressRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_evm_erc20_v1_query_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryOwnerAddressRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryOwnerAddressRequest) ProtoMessage() {} + +// Deprecated: Use QueryOwnerAddressRequest.ProtoReflect.Descriptor instead. +func (*QueryOwnerAddressRequest) Descriptor() ([]byte, []int) { + return file_cosmos_evm_erc20_v1_query_proto_rawDescGZIP(), []int{6} +} + +func (x *QueryOwnerAddressRequest) GetContractAddress() string { + if x != nil { + return x.ContractAddress + } + return "" +} + +type QueryOwnerAddressResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + OwnerAddress string `protobuf:"bytes,1,opt,name=owner_address,json=ownerAddress,proto3" json:"owner_address,omitempty"` +} + +func (x *QueryOwnerAddressResponse) Reset() { + *x = QueryOwnerAddressResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_evm_erc20_v1_query_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryOwnerAddressResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryOwnerAddressResponse) ProtoMessage() {} + +// Deprecated: Use QueryOwnerAddressResponse.ProtoReflect.Descriptor instead. +func (*QueryOwnerAddressResponse) Descriptor() ([]byte, []int) { + return file_cosmos_evm_erc20_v1_query_proto_rawDescGZIP(), []int{7} +} + +func (x *QueryOwnerAddressResponse) GetOwnerAddress() string { + if x != nil { + return x.OwnerAddress + } + return "" +} + var File_cosmos_evm_erc20_v1_query_proto protoreflect.FileDescriptor var file_cosmos_evm_erc20_v1_query_proto_rawDesc = []byte{ @@ -2961,47 +3871,66 @@ var file_cosmos_evm_erc20_v1_query_proto_rawDesc = []byte{ 0x32, 0x1b, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x65, 0x76, 0x6d, 0x2e, 0x65, 0x72, 0x63, 0x32, 0x30, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, - 0x32, 0xb7, 0x03, 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x91, 0x01, 0x0a, 0x0a, 0x54, - 0x6f, 0x6b, 0x65, 0x6e, 0x50, 0x61, 0x69, 0x72, 0x73, 0x12, 0x2b, 0x2e, 0x63, 0x6f, 0x73, 0x6d, - 0x6f, 0x73, 0x2e, 0x65, 0x76, 0x6d, 0x2e, 0x65, 0x72, 0x63, 0x32, 0x30, 0x2e, 0x76, 0x31, 0x2e, - 0x51, 0x75, 0x65, 0x72, 0x79, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x50, 0x61, 0x69, 0x72, 0x73, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2c, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, - 0x65, 0x76, 0x6d, 0x2e, 0x65, 0x72, 0x63, 0x32, 0x30, 0x2e, 0x76, 0x31, 0x2e, 0x51, 0x75, 0x65, - 0x72, 0x79, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x50, 0x61, 0x69, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x28, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x22, 0x12, 0x20, 0x2f, 0x63, - 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x65, 0x76, 0x6d, 0x2f, 0x65, 0x72, 0x63, 0x32, 0x30, 0x2f, - 0x76, 0x31, 0x2f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x70, 0x61, 0x69, 0x72, 0x73, 0x12, 0x96, - 0x01, 0x0a, 0x09, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x50, 0x61, 0x69, 0x72, 0x12, 0x2a, 0x2e, 0x63, - 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x65, 0x76, 0x6d, 0x2e, 0x65, 0x72, 0x63, 0x32, 0x30, 0x2e, - 0x76, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x50, 0x61, 0x69, - 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2b, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, - 0x73, 0x2e, 0x65, 0x76, 0x6d, 0x2e, 0x65, 0x72, 0x63, 0x32, 0x30, 0x2e, 0x76, 0x31, 0x2e, 0x51, - 0x75, 0x65, 0x72, 0x79, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x50, 0x61, 0x69, 0x72, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x30, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2a, 0x12, 0x28, 0x2f, - 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x65, 0x76, 0x6d, 0x2f, 0x65, 0x72, 0x63, 0x32, 0x30, - 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x70, 0x61, 0x69, 0x72, 0x73, 0x2f, - 0x7b, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x7d, 0x12, 0x80, 0x01, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, - 0x6d, 0x73, 0x12, 0x27, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x65, 0x76, 0x6d, 0x2e, - 0x65, 0x72, 0x63, 0x32, 0x30, 0x2e, 0x76, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, - 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x28, 0x2e, 0x63, 0x6f, + 0x22, 0x45, 0x0a, 0x18, 0x51, 0x75, 0x65, 0x72, 0x79, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x41, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x29, 0x0a, 0x10, + 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, + 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x40, 0x0a, 0x19, 0x51, 0x75, 0x65, 0x72, 0x79, + 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x5f, 0x61, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x6f, 0x77, 0x6e, + 0x65, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x32, 0xe1, 0x04, 0x0a, 0x05, 0x51, 0x75, + 0x65, 0x72, 0x79, 0x12, 0x91, 0x01, 0x0a, 0x0a, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x50, 0x61, 0x69, + 0x72, 0x73, 0x12, 0x2b, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x65, 0x76, 0x6d, 0x2e, + 0x65, 0x72, 0x63, 0x32, 0x30, 0x2e, 0x76, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x54, 0x6f, + 0x6b, 0x65, 0x6e, 0x50, 0x61, 0x69, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x2c, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x65, 0x76, 0x6d, 0x2e, 0x65, 0x72, 0x63, + 0x32, 0x30, 0x2e, 0x76, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x54, 0x6f, 0x6b, 0x65, 0x6e, + 0x50, 0x61, 0x69, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x28, 0x82, + 0xd3, 0xe4, 0x93, 0x02, 0x22, 0x12, 0x20, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x65, + 0x76, 0x6d, 0x2f, 0x65, 0x72, 0x63, 0x32, 0x30, 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x6f, 0x6b, 0x65, + 0x6e, 0x5f, 0x70, 0x61, 0x69, 0x72, 0x73, 0x12, 0x96, 0x01, 0x0a, 0x09, 0x54, 0x6f, 0x6b, 0x65, + 0x6e, 0x50, 0x61, 0x69, 0x72, 0x12, 0x2a, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x65, + 0x76, 0x6d, 0x2e, 0x65, 0x72, 0x63, 0x32, 0x30, 0x2e, 0x76, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, + 0x79, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x50, 0x61, 0x69, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x2b, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x65, 0x76, 0x6d, 0x2e, 0x65, + 0x72, 0x63, 0x32, 0x30, 0x2e, 0x76, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x54, 0x6f, 0x6b, + 0x65, 0x6e, 0x50, 0x61, 0x69, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x30, + 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2a, 0x12, 0x28, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, + 0x65, 0x76, 0x6d, 0x2f, 0x65, 0x72, 0x63, 0x32, 0x30, 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x6f, 0x6b, + 0x65, 0x6e, 0x5f, 0x70, 0x61, 0x69, 0x72, 0x73, 0x2f, 0x7b, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x7d, + 0x12, 0x80, 0x01, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x27, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x65, 0x76, 0x6d, 0x2e, 0x65, 0x72, 0x63, 0x32, 0x30, 0x2e, 0x76, - 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x23, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1d, 0x12, 0x1b, 0x2f, - 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x65, 0x76, 0x6d, 0x2f, 0x65, 0x72, 0x63, 0x32, 0x30, - 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0xc2, 0x01, 0x0a, 0x17, 0x63, - 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x65, 0x76, 0x6d, 0x2e, 0x65, 0x72, - 0x63, 0x32, 0x30, 0x2e, 0x76, 0x31, 0x42, 0x0a, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x72, 0x6f, - 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2c, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, - 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x65, 0x76, - 0x6d, 0x2f, 0x65, 0x72, 0x63, 0x32, 0x30, 0x2f, 0x76, 0x31, 0x3b, 0x65, 0x72, 0x63, 0x32, 0x30, - 0x76, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x45, 0x45, 0xaa, 0x02, 0x13, 0x43, 0x6f, 0x73, 0x6d, 0x6f, - 0x73, 0x2e, 0x45, 0x76, 0x6d, 0x2e, 0x45, 0x72, 0x63, 0x32, 0x30, 0x2e, 0x56, 0x31, 0xca, 0x02, - 0x13, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x45, 0x76, 0x6d, 0x5c, 0x45, 0x72, 0x63, 0x32, - 0x30, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x1f, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x45, 0x76, - 0x6d, 0x5c, 0x45, 0x72, 0x63, 0x32, 0x30, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, - 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x16, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, - 0x3a, 0x45, 0x76, 0x6d, 0x3a, 0x3a, 0x45, 0x72, 0x63, 0x32, 0x30, 0x3a, 0x3a, 0x56, 0x31, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x28, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x65, 0x76, + 0x6d, 0x2e, 0x65, 0x72, 0x63, 0x32, 0x30, 0x2e, 0x76, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, + 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x23, + 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1d, 0x12, 0x1b, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, + 0x65, 0x76, 0x6d, 0x2f, 0x65, 0x72, 0x63, 0x32, 0x30, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x61, 0x72, + 0x61, 0x6d, 0x73, 0x12, 0xa7, 0x01, 0x0a, 0x0c, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x41, 0x64, 0x64, + 0x72, 0x65, 0x73, 0x73, 0x12, 0x2d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x65, 0x76, + 0x6d, 0x2e, 0x65, 0x72, 0x63, 0x32, 0x30, 0x2e, 0x76, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, + 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x2e, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x65, 0x76, 0x6d, + 0x2e, 0x65, 0x72, 0x63, 0x32, 0x30, 0x2e, 0x76, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x4f, + 0x77, 0x6e, 0x65, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x38, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x32, 0x12, 0x30, 0x2f, 0x65, 0x76, + 0x6d, 0x6f, 0x73, 0x2f, 0x65, 0x72, 0x63, 0x32, 0x30, 0x2f, 0x76, 0x31, 0x2f, 0x6f, 0x77, 0x6e, + 0x65, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x2f, 0x7b, 0x63, 0x6f, 0x6e, 0x74, + 0x72, 0x61, 0x63, 0x74, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x7d, 0x42, 0xc2, 0x01, + 0x0a, 0x17, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x65, 0x76, 0x6d, + 0x2e, 0x65, 0x72, 0x63, 0x32, 0x30, 0x2e, 0x76, 0x31, 0x42, 0x0a, 0x51, 0x75, 0x65, 0x72, 0x79, + 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2c, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, + 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x2f, 0x65, 0x76, 0x6d, 0x2f, 0x65, 0x72, 0x63, 0x32, 0x30, 0x2f, 0x76, 0x31, 0x3b, 0x65, 0x72, + 0x63, 0x32, 0x30, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x45, 0x45, 0xaa, 0x02, 0x13, 0x43, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x45, 0x76, 0x6d, 0x2e, 0x45, 0x72, 0x63, 0x32, 0x30, 0x2e, 0x56, + 0x31, 0xca, 0x02, 0x13, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x45, 0x76, 0x6d, 0x5c, 0x45, + 0x72, 0x63, 0x32, 0x30, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x1f, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x5c, 0x45, 0x76, 0x6d, 0x5c, 0x45, 0x72, 0x63, 0x32, 0x30, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, + 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x16, 0x43, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x3a, 0x3a, 0x45, 0x76, 0x6d, 0x3a, 0x3a, 0x45, 0x72, 0x63, 0x32, 0x30, 0x3a, 0x3a, + 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -3016,36 +3945,40 @@ func file_cosmos_evm_erc20_v1_query_proto_rawDescGZIP() []byte { return file_cosmos_evm_erc20_v1_query_proto_rawDescData } -var file_cosmos_evm_erc20_v1_query_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_cosmos_evm_erc20_v1_query_proto_msgTypes = make([]protoimpl.MessageInfo, 8) var file_cosmos_evm_erc20_v1_query_proto_goTypes = []interface{}{ - (*QueryTokenPairsRequest)(nil), // 0: cosmos.evm.erc20.v1.QueryTokenPairsRequest - (*QueryTokenPairsResponse)(nil), // 1: cosmos.evm.erc20.v1.QueryTokenPairsResponse - (*QueryTokenPairRequest)(nil), // 2: cosmos.evm.erc20.v1.QueryTokenPairRequest - (*QueryTokenPairResponse)(nil), // 3: cosmos.evm.erc20.v1.QueryTokenPairResponse - (*QueryParamsRequest)(nil), // 4: cosmos.evm.erc20.v1.QueryParamsRequest - (*QueryParamsResponse)(nil), // 5: cosmos.evm.erc20.v1.QueryParamsResponse - (*v1beta1.PageRequest)(nil), // 6: cosmos.base.query.v1beta1.PageRequest - (*TokenPair)(nil), // 7: cosmos.evm.erc20.v1.TokenPair - (*v1beta1.PageResponse)(nil), // 8: cosmos.base.query.v1beta1.PageResponse - (*Params)(nil), // 9: cosmos.evm.erc20.v1.Params + (*QueryTokenPairsRequest)(nil), // 0: cosmos.evm.erc20.v1.QueryTokenPairsRequest + (*QueryTokenPairsResponse)(nil), // 1: cosmos.evm.erc20.v1.QueryTokenPairsResponse + (*QueryTokenPairRequest)(nil), // 2: cosmos.evm.erc20.v1.QueryTokenPairRequest + (*QueryTokenPairResponse)(nil), // 3: cosmos.evm.erc20.v1.QueryTokenPairResponse + (*QueryParamsRequest)(nil), // 4: cosmos.evm.erc20.v1.QueryParamsRequest + (*QueryParamsResponse)(nil), // 5: cosmos.evm.erc20.v1.QueryParamsResponse + (*QueryOwnerAddressRequest)(nil), // 6: cosmos.evm.erc20.v1.QueryOwnerAddressRequest + (*QueryOwnerAddressResponse)(nil), // 7: cosmos.evm.erc20.v1.QueryOwnerAddressResponse + (*v1beta1.PageRequest)(nil), // 8: cosmos.base.query.v1beta1.PageRequest + (*TokenPair)(nil), // 9: cosmos.evm.erc20.v1.TokenPair + (*v1beta1.PageResponse)(nil), // 10: cosmos.base.query.v1beta1.PageResponse + (*Params)(nil), // 11: cosmos.evm.erc20.v1.Params } var file_cosmos_evm_erc20_v1_query_proto_depIdxs = []int32{ - 6, // 0: cosmos.evm.erc20.v1.QueryTokenPairsRequest.pagination:type_name -> cosmos.base.query.v1beta1.PageRequest - 7, // 1: cosmos.evm.erc20.v1.QueryTokenPairsResponse.token_pairs:type_name -> cosmos.evm.erc20.v1.TokenPair - 8, // 2: cosmos.evm.erc20.v1.QueryTokenPairsResponse.pagination:type_name -> cosmos.base.query.v1beta1.PageResponse - 7, // 3: cosmos.evm.erc20.v1.QueryTokenPairResponse.token_pair:type_name -> cosmos.evm.erc20.v1.TokenPair - 9, // 4: cosmos.evm.erc20.v1.QueryParamsResponse.params:type_name -> cosmos.evm.erc20.v1.Params - 0, // 5: cosmos.evm.erc20.v1.Query.TokenPairs:input_type -> cosmos.evm.erc20.v1.QueryTokenPairsRequest - 2, // 6: cosmos.evm.erc20.v1.Query.TokenPair:input_type -> cosmos.evm.erc20.v1.QueryTokenPairRequest - 4, // 7: cosmos.evm.erc20.v1.Query.Params:input_type -> cosmos.evm.erc20.v1.QueryParamsRequest - 1, // 8: cosmos.evm.erc20.v1.Query.TokenPairs:output_type -> cosmos.evm.erc20.v1.QueryTokenPairsResponse - 3, // 9: cosmos.evm.erc20.v1.Query.TokenPair:output_type -> cosmos.evm.erc20.v1.QueryTokenPairResponse - 5, // 10: cosmos.evm.erc20.v1.Query.Params:output_type -> cosmos.evm.erc20.v1.QueryParamsResponse - 8, // [8:11] is the sub-list for method output_type - 5, // [5:8] is the sub-list for method input_type - 5, // [5:5] is the sub-list for extension type_name - 5, // [5:5] is the sub-list for extension extendee - 0, // [0:5] is the sub-list for field type_name + 8, // 0: cosmos.evm.erc20.v1.QueryTokenPairsRequest.pagination:type_name -> cosmos.base.query.v1beta1.PageRequest + 9, // 1: cosmos.evm.erc20.v1.QueryTokenPairsResponse.token_pairs:type_name -> cosmos.evm.erc20.v1.TokenPair + 10, // 2: cosmos.evm.erc20.v1.QueryTokenPairsResponse.pagination:type_name -> cosmos.base.query.v1beta1.PageResponse + 9, // 3: cosmos.evm.erc20.v1.QueryTokenPairResponse.token_pair:type_name -> cosmos.evm.erc20.v1.TokenPair + 11, // 4: cosmos.evm.erc20.v1.QueryParamsResponse.params:type_name -> cosmos.evm.erc20.v1.Params + 0, // 5: cosmos.evm.erc20.v1.Query.TokenPairs:input_type -> cosmos.evm.erc20.v1.QueryTokenPairsRequest + 2, // 6: cosmos.evm.erc20.v1.Query.TokenPair:input_type -> cosmos.evm.erc20.v1.QueryTokenPairRequest + 4, // 7: cosmos.evm.erc20.v1.Query.Params:input_type -> cosmos.evm.erc20.v1.QueryParamsRequest + 6, // 8: cosmos.evm.erc20.v1.Query.OwnerAddress:input_type -> cosmos.evm.erc20.v1.QueryOwnerAddressRequest + 1, // 9: cosmos.evm.erc20.v1.Query.TokenPairs:output_type -> cosmos.evm.erc20.v1.QueryTokenPairsResponse + 3, // 10: cosmos.evm.erc20.v1.Query.TokenPair:output_type -> cosmos.evm.erc20.v1.QueryTokenPairResponse + 5, // 11: cosmos.evm.erc20.v1.Query.Params:output_type -> cosmos.evm.erc20.v1.QueryParamsResponse + 7, // 12: cosmos.evm.erc20.v1.Query.OwnerAddress:output_type -> cosmos.evm.erc20.v1.QueryOwnerAddressResponse + 9, // [9:13] is the sub-list for method output_type + 5, // [5:9] is the sub-list for method input_type + 5, // [5:5] is the sub-list for extension type_name + 5, // [5:5] is the sub-list for extension extendee + 0, // [0:5] is the sub-list for field type_name } func init() { file_cosmos_evm_erc20_v1_query_proto_init() } @@ -3128,6 +4061,30 @@ func file_cosmos_evm_erc20_v1_query_proto_init() { return nil } } + file_cosmos_evm_erc20_v1_query_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QueryOwnerAddressRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_cosmos_evm_erc20_v1_query_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QueryOwnerAddressResponse); 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{ @@ -3135,7 +4092,7 @@ func file_cosmos_evm_erc20_v1_query_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_cosmos_evm_erc20_v1_query_proto_rawDesc, NumEnums: 0, - NumMessages: 6, + NumMessages: 8, NumExtensions: 0, NumServices: 1, }, diff --git a/api/cosmos/evm/erc20/v1/query_grpc.pb.go b/api/cosmos/evm/erc20/v1/query_grpc.pb.go index 14fa6fbd2..83fef8b6b 100644 --- a/api/cosmos/evm/erc20/v1/query_grpc.pb.go +++ b/api/cosmos/evm/erc20/v1/query_grpc.pb.go @@ -19,9 +19,10 @@ import ( const _ = grpc.SupportPackageIsVersion7 const ( - Query_TokenPairs_FullMethodName = "/cosmos.evm.erc20.v1.Query/TokenPairs" - Query_TokenPair_FullMethodName = "/cosmos.evm.erc20.v1.Query/TokenPair" - Query_Params_FullMethodName = "/cosmos.evm.erc20.v1.Query/Params" + Query_TokenPairs_FullMethodName = "/cosmos.evm.erc20.v1.Query/TokenPairs" + Query_TokenPair_FullMethodName = "/cosmos.evm.erc20.v1.Query/TokenPair" + Query_Params_FullMethodName = "/cosmos.evm.erc20.v1.Query/Params" + Query_OwnerAddress_FullMethodName = "/cosmos.evm.erc20.v1.Query/OwnerAddress" ) // QueryClient is the client API for Query service. @@ -34,6 +35,8 @@ type QueryClient interface { TokenPair(ctx context.Context, in *QueryTokenPairRequest, opts ...grpc.CallOption) (*QueryTokenPairResponse, error) // Params retrieves the erc20 module params Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) + // OwnerAddress retrieves the owner address for a given ERC20 contract address + OwnerAddress(ctx context.Context, in *QueryOwnerAddressRequest, opts ...grpc.CallOption) (*QueryOwnerAddressResponse, error) } type queryClient struct { @@ -71,6 +74,15 @@ func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts . return out, nil } +func (c *queryClient) OwnerAddress(ctx context.Context, in *QueryOwnerAddressRequest, opts ...grpc.CallOption) (*QueryOwnerAddressResponse, error) { + out := new(QueryOwnerAddressResponse) + err := c.cc.Invoke(ctx, Query_OwnerAddress_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // QueryServer is the server API for Query service. // All implementations must embed UnimplementedQueryServer // for forward compatibility @@ -81,6 +93,8 @@ type QueryServer interface { TokenPair(context.Context, *QueryTokenPairRequest) (*QueryTokenPairResponse, error) // Params retrieves the erc20 module params Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) + // OwnerAddress retrieves the owner address for a given ERC20 contract address + OwnerAddress(context.Context, *QueryOwnerAddressRequest) (*QueryOwnerAddressResponse, error) mustEmbedUnimplementedQueryServer() } @@ -97,6 +111,9 @@ func (UnimplementedQueryServer) TokenPair(context.Context, *QueryTokenPairReques func (UnimplementedQueryServer) Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") } +func (UnimplementedQueryServer) OwnerAddress(context.Context, *QueryOwnerAddressRequest) (*QueryOwnerAddressResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method OwnerAddress not implemented") +} func (UnimplementedQueryServer) mustEmbedUnimplementedQueryServer() {} // UnsafeQueryServer may be embedded to opt out of forward compatibility for this service. @@ -164,6 +181,24 @@ func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interf return interceptor(ctx, in, info, handler) } +func _Query_OwnerAddress_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryOwnerAddressRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).OwnerAddress(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Query_OwnerAddress_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).OwnerAddress(ctx, req.(*QueryOwnerAddressRequest)) + } + return interceptor(ctx, in, info, handler) +} + // Query_ServiceDesc is the grpc.ServiceDesc for Query service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -183,6 +218,10 @@ var Query_ServiceDesc = grpc.ServiceDesc{ MethodName: "Params", Handler: _Query_Params_Handler, }, + { + MethodName: "OwnerAddress", + Handler: _Query_OwnerAddress_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "cosmos/evm/erc20/v1/query.proto", diff --git a/api/cosmos/evm/erc20/v1/tx.pulsar.go b/api/cosmos/evm/erc20/v1/tx.pulsar.go index 0487e8734..651f3123f 100644 --- a/api/cosmos/evm/erc20/v1/tx.pulsar.go +++ b/api/cosmos/evm/erc20/v1/tx.pulsar.go @@ -4500,6 +4500,2782 @@ func (x *fastReflection_MsgToggleConversionResponse) ProtoMethods() *protoiface. } } +var ( + md_MsgTransferOwnership protoreflect.MessageDescriptor + fd_MsgTransferOwnership_authority protoreflect.FieldDescriptor + fd_MsgTransferOwnership_token protoreflect.FieldDescriptor + fd_MsgTransferOwnership_new_owner protoreflect.FieldDescriptor +) + +func init() { + file_cosmos_evm_erc20_v1_tx_proto_init() + md_MsgTransferOwnership = File_cosmos_evm_erc20_v1_tx_proto.Messages().ByName("MsgTransferOwnership") + fd_MsgTransferOwnership_authority = md_MsgTransferOwnership.Fields().ByName("authority") + fd_MsgTransferOwnership_token = md_MsgTransferOwnership.Fields().ByName("token") + fd_MsgTransferOwnership_new_owner = md_MsgTransferOwnership.Fields().ByName("new_owner") +} + +var _ protoreflect.Message = (*fastReflection_MsgTransferOwnership)(nil) + +type fastReflection_MsgTransferOwnership MsgTransferOwnership + +func (x *MsgTransferOwnership) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgTransferOwnership)(x) +} + +func (x *MsgTransferOwnership) slowProtoReflect() protoreflect.Message { + mi := &file_cosmos_evm_erc20_v1_tx_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgTransferOwnership_messageType fastReflection_MsgTransferOwnership_messageType +var _ protoreflect.MessageType = fastReflection_MsgTransferOwnership_messageType{} + +type fastReflection_MsgTransferOwnership_messageType struct{} + +func (x fastReflection_MsgTransferOwnership_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgTransferOwnership)(nil) +} +func (x fastReflection_MsgTransferOwnership_messageType) New() protoreflect.Message { + return new(fastReflection_MsgTransferOwnership) +} +func (x fastReflection_MsgTransferOwnership_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgTransferOwnership +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgTransferOwnership) Descriptor() protoreflect.MessageDescriptor { + return md_MsgTransferOwnership +} + +// 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_MsgTransferOwnership) Type() protoreflect.MessageType { + return _fastReflection_MsgTransferOwnership_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgTransferOwnership) New() protoreflect.Message { + return new(fastReflection_MsgTransferOwnership) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgTransferOwnership) Interface() protoreflect.ProtoMessage { + return (*MsgTransferOwnership)(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_MsgTransferOwnership) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Authority != "" { + value := protoreflect.ValueOfString(x.Authority) + if !f(fd_MsgTransferOwnership_authority, value) { + return + } + } + if x.Token != "" { + value := protoreflect.ValueOfString(x.Token) + if !f(fd_MsgTransferOwnership_token, value) { + return + } + } + if x.NewOwner != "" { + value := protoreflect.ValueOfString(x.NewOwner) + if !f(fd_MsgTransferOwnership_new_owner, 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_MsgTransferOwnership) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "cosmos.evm.erc20.v1.MsgTransferOwnership.authority": + return x.Authority != "" + case "cosmos.evm.erc20.v1.MsgTransferOwnership.token": + return x.Token != "" + case "cosmos.evm.erc20.v1.MsgTransferOwnership.new_owner": + return x.NewOwner != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.erc20.v1.MsgTransferOwnership")) + } + panic(fmt.Errorf("message cosmos.evm.erc20.v1.MsgTransferOwnership 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_MsgTransferOwnership) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "cosmos.evm.erc20.v1.MsgTransferOwnership.authority": + x.Authority = "" + case "cosmos.evm.erc20.v1.MsgTransferOwnership.token": + x.Token = "" + case "cosmos.evm.erc20.v1.MsgTransferOwnership.new_owner": + x.NewOwner = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.erc20.v1.MsgTransferOwnership")) + } + panic(fmt.Errorf("message cosmos.evm.erc20.v1.MsgTransferOwnership 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_MsgTransferOwnership) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "cosmos.evm.erc20.v1.MsgTransferOwnership.authority": + value := x.Authority + return protoreflect.ValueOfString(value) + case "cosmos.evm.erc20.v1.MsgTransferOwnership.token": + value := x.Token + return protoreflect.ValueOfString(value) + case "cosmos.evm.erc20.v1.MsgTransferOwnership.new_owner": + value := x.NewOwner + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.erc20.v1.MsgTransferOwnership")) + } + panic(fmt.Errorf("message cosmos.evm.erc20.v1.MsgTransferOwnership 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_MsgTransferOwnership) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "cosmos.evm.erc20.v1.MsgTransferOwnership.authority": + x.Authority = value.Interface().(string) + case "cosmos.evm.erc20.v1.MsgTransferOwnership.token": + x.Token = value.Interface().(string) + case "cosmos.evm.erc20.v1.MsgTransferOwnership.new_owner": + x.NewOwner = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.erc20.v1.MsgTransferOwnership")) + } + panic(fmt.Errorf("message cosmos.evm.erc20.v1.MsgTransferOwnership 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_MsgTransferOwnership) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.evm.erc20.v1.MsgTransferOwnership.authority": + panic(fmt.Errorf("field authority of message cosmos.evm.erc20.v1.MsgTransferOwnership is not mutable")) + case "cosmos.evm.erc20.v1.MsgTransferOwnership.token": + panic(fmt.Errorf("field token of message cosmos.evm.erc20.v1.MsgTransferOwnership is not mutable")) + case "cosmos.evm.erc20.v1.MsgTransferOwnership.new_owner": + panic(fmt.Errorf("field new_owner of message cosmos.evm.erc20.v1.MsgTransferOwnership is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.erc20.v1.MsgTransferOwnership")) + } + panic(fmt.Errorf("message cosmos.evm.erc20.v1.MsgTransferOwnership 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_MsgTransferOwnership) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.evm.erc20.v1.MsgTransferOwnership.authority": + return protoreflect.ValueOfString("") + case "cosmos.evm.erc20.v1.MsgTransferOwnership.token": + return protoreflect.ValueOfString("") + case "cosmos.evm.erc20.v1.MsgTransferOwnership.new_owner": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.erc20.v1.MsgTransferOwnership")) + } + panic(fmt.Errorf("message cosmos.evm.erc20.v1.MsgTransferOwnership 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_MsgTransferOwnership) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in cosmos.evm.erc20.v1.MsgTransferOwnership", 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_MsgTransferOwnership) 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_MsgTransferOwnership) 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_MsgTransferOwnership) 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_MsgTransferOwnership) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgTransferOwnership) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.Authority) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.Token) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.NewOwner) + 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().(*MsgTransferOwnership) + 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.NewOwner) > 0 { + i -= len(x.NewOwner) + copy(dAtA[i:], x.NewOwner) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.NewOwner))) + i-- + dAtA[i] = 0x1a + } + if len(x.Token) > 0 { + i -= len(x.Token) + copy(dAtA[i:], x.Token) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Token))) + i-- + dAtA[i] = 0x12 + } + if len(x.Authority) > 0 { + i -= len(x.Authority) + copy(dAtA[i:], x.Authority) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Authority))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgTransferOwnership) + 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: MsgTransferOwnership: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgTransferOwnership: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Token", 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.Token = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field NewOwner", 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.NewOwner = 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_MsgTransferOwnershipResponse protoreflect.MessageDescriptor +) + +func init() { + file_cosmos_evm_erc20_v1_tx_proto_init() + md_MsgTransferOwnershipResponse = File_cosmos_evm_erc20_v1_tx_proto.Messages().ByName("MsgTransferOwnershipResponse") +} + +var _ protoreflect.Message = (*fastReflection_MsgTransferOwnershipResponse)(nil) + +type fastReflection_MsgTransferOwnershipResponse MsgTransferOwnershipResponse + +func (x *MsgTransferOwnershipResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgTransferOwnershipResponse)(x) +} + +func (x *MsgTransferOwnershipResponse) slowProtoReflect() protoreflect.Message { + mi := &file_cosmos_evm_erc20_v1_tx_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgTransferOwnershipResponse_messageType fastReflection_MsgTransferOwnershipResponse_messageType +var _ protoreflect.MessageType = fastReflection_MsgTransferOwnershipResponse_messageType{} + +type fastReflection_MsgTransferOwnershipResponse_messageType struct{} + +func (x fastReflection_MsgTransferOwnershipResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgTransferOwnershipResponse)(nil) +} +func (x fastReflection_MsgTransferOwnershipResponse_messageType) New() protoreflect.Message { + return new(fastReflection_MsgTransferOwnershipResponse) +} +func (x fastReflection_MsgTransferOwnershipResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgTransferOwnershipResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgTransferOwnershipResponse) Descriptor() protoreflect.MessageDescriptor { + return md_MsgTransferOwnershipResponse +} + +// 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_MsgTransferOwnershipResponse) Type() protoreflect.MessageType { + return _fastReflection_MsgTransferOwnershipResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgTransferOwnershipResponse) New() protoreflect.Message { + return new(fastReflection_MsgTransferOwnershipResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgTransferOwnershipResponse) Interface() protoreflect.ProtoMessage { + return (*MsgTransferOwnershipResponse)(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_MsgTransferOwnershipResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgTransferOwnershipResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.erc20.v1.MsgTransferOwnershipResponse")) + } + panic(fmt.Errorf("message cosmos.evm.erc20.v1.MsgTransferOwnershipResponse 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_MsgTransferOwnershipResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.erc20.v1.MsgTransferOwnershipResponse")) + } + panic(fmt.Errorf("message cosmos.evm.erc20.v1.MsgTransferOwnershipResponse 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_MsgTransferOwnershipResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.erc20.v1.MsgTransferOwnershipResponse")) + } + panic(fmt.Errorf("message cosmos.evm.erc20.v1.MsgTransferOwnershipResponse 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_MsgTransferOwnershipResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.erc20.v1.MsgTransferOwnershipResponse")) + } + panic(fmt.Errorf("message cosmos.evm.erc20.v1.MsgTransferOwnershipResponse 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_MsgTransferOwnershipResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.erc20.v1.MsgTransferOwnershipResponse")) + } + panic(fmt.Errorf("message cosmos.evm.erc20.v1.MsgTransferOwnershipResponse 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_MsgTransferOwnershipResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.erc20.v1.MsgTransferOwnershipResponse")) + } + panic(fmt.Errorf("message cosmos.evm.erc20.v1.MsgTransferOwnershipResponse 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_MsgTransferOwnershipResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in cosmos.evm.erc20.v1.MsgTransferOwnershipResponse", 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_MsgTransferOwnershipResponse) 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_MsgTransferOwnershipResponse) 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_MsgTransferOwnershipResponse) 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_MsgTransferOwnershipResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgTransferOwnershipResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgTransferOwnershipResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgTransferOwnershipResponse) + 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: MsgTransferOwnershipResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgTransferOwnershipResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_MsgMint protoreflect.MessageDescriptor + fd_MsgMint_contract_address protoreflect.FieldDescriptor + fd_MsgMint_amount protoreflect.FieldDescriptor + fd_MsgMint_to protoreflect.FieldDescriptor + fd_MsgMint_sender protoreflect.FieldDescriptor +) + +func init() { + file_cosmos_evm_erc20_v1_tx_proto_init() + md_MsgMint = File_cosmos_evm_erc20_v1_tx_proto.Messages().ByName("MsgMint") + fd_MsgMint_contract_address = md_MsgMint.Fields().ByName("contract_address") + fd_MsgMint_amount = md_MsgMint.Fields().ByName("amount") + fd_MsgMint_to = md_MsgMint.Fields().ByName("to") + fd_MsgMint_sender = md_MsgMint.Fields().ByName("sender") +} + +var _ protoreflect.Message = (*fastReflection_MsgMint)(nil) + +type fastReflection_MsgMint MsgMint + +func (x *MsgMint) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgMint)(x) +} + +func (x *MsgMint) slowProtoReflect() protoreflect.Message { + mi := &file_cosmos_evm_erc20_v1_tx_proto_msgTypes[12] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgMint_messageType fastReflection_MsgMint_messageType +var _ protoreflect.MessageType = fastReflection_MsgMint_messageType{} + +type fastReflection_MsgMint_messageType struct{} + +func (x fastReflection_MsgMint_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgMint)(nil) +} +func (x fastReflection_MsgMint_messageType) New() protoreflect.Message { + return new(fastReflection_MsgMint) +} +func (x fastReflection_MsgMint_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgMint +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgMint) Descriptor() protoreflect.MessageDescriptor { + return md_MsgMint +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgMint) Type() protoreflect.MessageType { + return _fastReflection_MsgMint_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgMint) New() protoreflect.Message { + return new(fastReflection_MsgMint) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgMint) Interface() protoreflect.ProtoMessage { + return (*MsgMint)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgMint) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.ContractAddress != "" { + value := protoreflect.ValueOfString(x.ContractAddress) + if !f(fd_MsgMint_contract_address, value) { + return + } + } + if x.Amount != "" { + value := protoreflect.ValueOfString(x.Amount) + if !f(fd_MsgMint_amount, value) { + return + } + } + if x.To != "" { + value := protoreflect.ValueOfString(x.To) + if !f(fd_MsgMint_to, value) { + return + } + } + if x.Sender != "" { + value := protoreflect.ValueOfString(x.Sender) + if !f(fd_MsgMint_sender, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgMint) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "cosmos.evm.erc20.v1.MsgMint.contract_address": + return x.ContractAddress != "" + case "cosmos.evm.erc20.v1.MsgMint.amount": + return x.Amount != "" + case "cosmos.evm.erc20.v1.MsgMint.to": + return x.To != "" + case "cosmos.evm.erc20.v1.MsgMint.sender": + return x.Sender != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.erc20.v1.MsgMint")) + } + panic(fmt.Errorf("message cosmos.evm.erc20.v1.MsgMint does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgMint) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "cosmos.evm.erc20.v1.MsgMint.contract_address": + x.ContractAddress = "" + case "cosmos.evm.erc20.v1.MsgMint.amount": + x.Amount = "" + case "cosmos.evm.erc20.v1.MsgMint.to": + x.To = "" + case "cosmos.evm.erc20.v1.MsgMint.sender": + x.Sender = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.erc20.v1.MsgMint")) + } + panic(fmt.Errorf("message cosmos.evm.erc20.v1.MsgMint does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgMint) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "cosmos.evm.erc20.v1.MsgMint.contract_address": + value := x.ContractAddress + return protoreflect.ValueOfString(value) + case "cosmos.evm.erc20.v1.MsgMint.amount": + value := x.Amount + return protoreflect.ValueOfString(value) + case "cosmos.evm.erc20.v1.MsgMint.to": + value := x.To + return protoreflect.ValueOfString(value) + case "cosmos.evm.erc20.v1.MsgMint.sender": + value := x.Sender + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.erc20.v1.MsgMint")) + } + panic(fmt.Errorf("message cosmos.evm.erc20.v1.MsgMint does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgMint) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "cosmos.evm.erc20.v1.MsgMint.contract_address": + x.ContractAddress = value.Interface().(string) + case "cosmos.evm.erc20.v1.MsgMint.amount": + x.Amount = value.Interface().(string) + case "cosmos.evm.erc20.v1.MsgMint.to": + x.To = value.Interface().(string) + case "cosmos.evm.erc20.v1.MsgMint.sender": + x.Sender = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.erc20.v1.MsgMint")) + } + panic(fmt.Errorf("message cosmos.evm.erc20.v1.MsgMint does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgMint) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.evm.erc20.v1.MsgMint.contract_address": + panic(fmt.Errorf("field contract_address of message cosmos.evm.erc20.v1.MsgMint is not mutable")) + case "cosmos.evm.erc20.v1.MsgMint.amount": + panic(fmt.Errorf("field amount of message cosmos.evm.erc20.v1.MsgMint is not mutable")) + case "cosmos.evm.erc20.v1.MsgMint.to": + panic(fmt.Errorf("field to of message cosmos.evm.erc20.v1.MsgMint is not mutable")) + case "cosmos.evm.erc20.v1.MsgMint.sender": + panic(fmt.Errorf("field sender of message cosmos.evm.erc20.v1.MsgMint is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.erc20.v1.MsgMint")) + } + panic(fmt.Errorf("message cosmos.evm.erc20.v1.MsgMint does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgMint) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.evm.erc20.v1.MsgMint.contract_address": + return protoreflect.ValueOfString("") + case "cosmos.evm.erc20.v1.MsgMint.amount": + return protoreflect.ValueOfString("") + case "cosmos.evm.erc20.v1.MsgMint.to": + return protoreflect.ValueOfString("") + case "cosmos.evm.erc20.v1.MsgMint.sender": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.erc20.v1.MsgMint")) + } + panic(fmt.Errorf("message cosmos.evm.erc20.v1.MsgMint does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgMint) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in cosmos.evm.erc20.v1.MsgMint", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgMint) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgMint) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgMint) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgMint) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgMint) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.ContractAddress) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.Amount) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.To) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.Sender) + 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().(*MsgMint) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.Sender) > 0 { + i -= len(x.Sender) + copy(dAtA[i:], x.Sender) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Sender))) + i-- + dAtA[i] = 0x22 + } + if len(x.To) > 0 { + i -= len(x.To) + copy(dAtA[i:], x.To) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.To))) + i-- + dAtA[i] = 0x1a + } + if len(x.Amount) > 0 { + i -= len(x.Amount) + copy(dAtA[i:], x.Amount) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Amount))) + i-- + dAtA[i] = 0x12 + } + if len(x.ContractAddress) > 0 { + i -= len(x.ContractAddress) + copy(dAtA[i:], x.ContractAddress) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.ContractAddress))) + i-- + dAtA[i] = 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().(*MsgMint) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgMint: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgMint: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ContractAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.ContractAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var 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.Amount = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field To", 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.To = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_MsgMintResponse protoreflect.MessageDescriptor +) + +func init() { + file_cosmos_evm_erc20_v1_tx_proto_init() + md_MsgMintResponse = File_cosmos_evm_erc20_v1_tx_proto.Messages().ByName("MsgMintResponse") +} + +var _ protoreflect.Message = (*fastReflection_MsgMintResponse)(nil) + +type fastReflection_MsgMintResponse MsgMintResponse + +func (x *MsgMintResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgMintResponse)(x) +} + +func (x *MsgMintResponse) slowProtoReflect() protoreflect.Message { + mi := &file_cosmos_evm_erc20_v1_tx_proto_msgTypes[13] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgMintResponse_messageType fastReflection_MsgMintResponse_messageType +var _ protoreflect.MessageType = fastReflection_MsgMintResponse_messageType{} + +type fastReflection_MsgMintResponse_messageType struct{} + +func (x fastReflection_MsgMintResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgMintResponse)(nil) +} +func (x fastReflection_MsgMintResponse_messageType) New() protoreflect.Message { + return new(fastReflection_MsgMintResponse) +} +func (x fastReflection_MsgMintResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgMintResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgMintResponse) Descriptor() protoreflect.MessageDescriptor { + return md_MsgMintResponse +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgMintResponse) Type() protoreflect.MessageType { + return _fastReflection_MsgMintResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgMintResponse) New() protoreflect.Message { + return new(fastReflection_MsgMintResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgMintResponse) Interface() protoreflect.ProtoMessage { + return (*MsgMintResponse)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgMintResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgMintResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.erc20.v1.MsgMintResponse")) + } + panic(fmt.Errorf("message cosmos.evm.erc20.v1.MsgMintResponse does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgMintResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.erc20.v1.MsgMintResponse")) + } + panic(fmt.Errorf("message cosmos.evm.erc20.v1.MsgMintResponse does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgMintResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.erc20.v1.MsgMintResponse")) + } + panic(fmt.Errorf("message cosmos.evm.erc20.v1.MsgMintResponse does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgMintResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.erc20.v1.MsgMintResponse")) + } + panic(fmt.Errorf("message cosmos.evm.erc20.v1.MsgMintResponse does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgMintResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.erc20.v1.MsgMintResponse")) + } + panic(fmt.Errorf("message cosmos.evm.erc20.v1.MsgMintResponse does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgMintResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.erc20.v1.MsgMintResponse")) + } + panic(fmt.Errorf("message cosmos.evm.erc20.v1.MsgMintResponse does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgMintResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in cosmos.evm.erc20.v1.MsgMintResponse", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgMintResponse) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgMintResponse) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgMintResponse) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgMintResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgMintResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgMintResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgMintResponse) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgMintResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgMintResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_MsgBurn protoreflect.MessageDescriptor + fd_MsgBurn_contract_address protoreflect.FieldDescriptor + fd_MsgBurn_amount protoreflect.FieldDescriptor + fd_MsgBurn_sender protoreflect.FieldDescriptor +) + +func init() { + file_cosmos_evm_erc20_v1_tx_proto_init() + md_MsgBurn = File_cosmos_evm_erc20_v1_tx_proto.Messages().ByName("MsgBurn") + fd_MsgBurn_contract_address = md_MsgBurn.Fields().ByName("contract_address") + fd_MsgBurn_amount = md_MsgBurn.Fields().ByName("amount") + fd_MsgBurn_sender = md_MsgBurn.Fields().ByName("sender") +} + +var _ protoreflect.Message = (*fastReflection_MsgBurn)(nil) + +type fastReflection_MsgBurn MsgBurn + +func (x *MsgBurn) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgBurn)(x) +} + +func (x *MsgBurn) slowProtoReflect() protoreflect.Message { + mi := &file_cosmos_evm_erc20_v1_tx_proto_msgTypes[14] + 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_MsgBurn_messageType fastReflection_MsgBurn_messageType +var _ protoreflect.MessageType = fastReflection_MsgBurn_messageType{} + +type fastReflection_MsgBurn_messageType struct{} + +func (x fastReflection_MsgBurn_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgBurn)(nil) +} +func (x fastReflection_MsgBurn_messageType) New() protoreflect.Message { + return new(fastReflection_MsgBurn) +} +func (x fastReflection_MsgBurn_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgBurn +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgBurn) Descriptor() protoreflect.MessageDescriptor { + return md_MsgBurn +} + +// 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_MsgBurn) Type() protoreflect.MessageType { + return _fastReflection_MsgBurn_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgBurn) New() protoreflect.Message { + return new(fastReflection_MsgBurn) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgBurn) Interface() protoreflect.ProtoMessage { + return (*MsgBurn)(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_MsgBurn) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.ContractAddress != "" { + value := protoreflect.ValueOfString(x.ContractAddress) + if !f(fd_MsgBurn_contract_address, value) { + return + } + } + if x.Amount != "" { + value := protoreflect.ValueOfString(x.Amount) + if !f(fd_MsgBurn_amount, value) { + return + } + } + if x.Sender != "" { + value := protoreflect.ValueOfString(x.Sender) + if !f(fd_MsgBurn_sender, 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_MsgBurn) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "cosmos.evm.erc20.v1.MsgBurn.contract_address": + return x.ContractAddress != "" + case "cosmos.evm.erc20.v1.MsgBurn.amount": + return x.Amount != "" + case "cosmos.evm.erc20.v1.MsgBurn.sender": + return x.Sender != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.erc20.v1.MsgBurn")) + } + panic(fmt.Errorf("message cosmos.evm.erc20.v1.MsgBurn 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_MsgBurn) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "cosmos.evm.erc20.v1.MsgBurn.contract_address": + x.ContractAddress = "" + case "cosmos.evm.erc20.v1.MsgBurn.amount": + x.Amount = "" + case "cosmos.evm.erc20.v1.MsgBurn.sender": + x.Sender = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.erc20.v1.MsgBurn")) + } + panic(fmt.Errorf("message cosmos.evm.erc20.v1.MsgBurn 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_MsgBurn) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "cosmos.evm.erc20.v1.MsgBurn.contract_address": + value := x.ContractAddress + return protoreflect.ValueOfString(value) + case "cosmos.evm.erc20.v1.MsgBurn.amount": + value := x.Amount + return protoreflect.ValueOfString(value) + case "cosmos.evm.erc20.v1.MsgBurn.sender": + value := x.Sender + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.erc20.v1.MsgBurn")) + } + panic(fmt.Errorf("message cosmos.evm.erc20.v1.MsgBurn 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_MsgBurn) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "cosmos.evm.erc20.v1.MsgBurn.contract_address": + x.ContractAddress = value.Interface().(string) + case "cosmos.evm.erc20.v1.MsgBurn.amount": + x.Amount = value.Interface().(string) + case "cosmos.evm.erc20.v1.MsgBurn.sender": + x.Sender = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.erc20.v1.MsgBurn")) + } + panic(fmt.Errorf("message cosmos.evm.erc20.v1.MsgBurn 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_MsgBurn) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.evm.erc20.v1.MsgBurn.contract_address": + panic(fmt.Errorf("field contract_address of message cosmos.evm.erc20.v1.MsgBurn is not mutable")) + case "cosmos.evm.erc20.v1.MsgBurn.amount": + panic(fmt.Errorf("field amount of message cosmos.evm.erc20.v1.MsgBurn is not mutable")) + case "cosmos.evm.erc20.v1.MsgBurn.sender": + panic(fmt.Errorf("field sender of message cosmos.evm.erc20.v1.MsgBurn is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.erc20.v1.MsgBurn")) + } + panic(fmt.Errorf("message cosmos.evm.erc20.v1.MsgBurn 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_MsgBurn) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.evm.erc20.v1.MsgBurn.contract_address": + return protoreflect.ValueOfString("") + case "cosmos.evm.erc20.v1.MsgBurn.amount": + return protoreflect.ValueOfString("") + case "cosmos.evm.erc20.v1.MsgBurn.sender": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.erc20.v1.MsgBurn")) + } + panic(fmt.Errorf("message cosmos.evm.erc20.v1.MsgBurn 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_MsgBurn) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in cosmos.evm.erc20.v1.MsgBurn", 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_MsgBurn) 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_MsgBurn) 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_MsgBurn) 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_MsgBurn) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgBurn) + 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.ContractAddress) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.Amount) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.Sender) + 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().(*MsgBurn) + 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.Sender) > 0 { + i -= len(x.Sender) + copy(dAtA[i:], x.Sender) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Sender))) + i-- + dAtA[i] = 0x1a + } + if len(x.Amount) > 0 { + i -= len(x.Amount) + copy(dAtA[i:], x.Amount) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Amount))) + i-- + dAtA[i] = 0x12 + } + if len(x.ContractAddress) > 0 { + i -= len(x.ContractAddress) + copy(dAtA[i:], x.ContractAddress) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.ContractAddress))) + i-- + dAtA[i] = 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().(*MsgBurn) + 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: MsgBurn: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgBurn: 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 ContractAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.ContractAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var 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.Amount = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + 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_MsgBurnResponse protoreflect.MessageDescriptor +) + +func init() { + file_cosmos_evm_erc20_v1_tx_proto_init() + md_MsgBurnResponse = File_cosmos_evm_erc20_v1_tx_proto.Messages().ByName("MsgBurnResponse") +} + +var _ protoreflect.Message = (*fastReflection_MsgBurnResponse)(nil) + +type fastReflection_MsgBurnResponse MsgBurnResponse + +func (x *MsgBurnResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgBurnResponse)(x) +} + +func (x *MsgBurnResponse) slowProtoReflect() protoreflect.Message { + mi := &file_cosmos_evm_erc20_v1_tx_proto_msgTypes[15] + 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_MsgBurnResponse_messageType fastReflection_MsgBurnResponse_messageType +var _ protoreflect.MessageType = fastReflection_MsgBurnResponse_messageType{} + +type fastReflection_MsgBurnResponse_messageType struct{} + +func (x fastReflection_MsgBurnResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgBurnResponse)(nil) +} +func (x fastReflection_MsgBurnResponse_messageType) New() protoreflect.Message { + return new(fastReflection_MsgBurnResponse) +} +func (x fastReflection_MsgBurnResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgBurnResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgBurnResponse) Descriptor() protoreflect.MessageDescriptor { + return md_MsgBurnResponse +} + +// 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_MsgBurnResponse) Type() protoreflect.MessageType { + return _fastReflection_MsgBurnResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgBurnResponse) New() protoreflect.Message { + return new(fastReflection_MsgBurnResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgBurnResponse) Interface() protoreflect.ProtoMessage { + return (*MsgBurnResponse)(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_MsgBurnResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgBurnResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.erc20.v1.MsgBurnResponse")) + } + panic(fmt.Errorf("message cosmos.evm.erc20.v1.MsgBurnResponse 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_MsgBurnResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.erc20.v1.MsgBurnResponse")) + } + panic(fmt.Errorf("message cosmos.evm.erc20.v1.MsgBurnResponse 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_MsgBurnResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.erc20.v1.MsgBurnResponse")) + } + panic(fmt.Errorf("message cosmos.evm.erc20.v1.MsgBurnResponse 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_MsgBurnResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.erc20.v1.MsgBurnResponse")) + } + panic(fmt.Errorf("message cosmos.evm.erc20.v1.MsgBurnResponse 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_MsgBurnResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.erc20.v1.MsgBurnResponse")) + } + panic(fmt.Errorf("message cosmos.evm.erc20.v1.MsgBurnResponse 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_MsgBurnResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evm.erc20.v1.MsgBurnResponse")) + } + panic(fmt.Errorf("message cosmos.evm.erc20.v1.MsgBurnResponse 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_MsgBurnResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in cosmos.evm.erc20.v1.MsgBurnResponse", 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_MsgBurnResponse) 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_MsgBurnResponse) 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_MsgBurnResponse) 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_MsgBurnResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgBurnResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgBurnResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgBurnResponse) + 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: MsgBurnResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgBurnResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.0 @@ -4918,6 +7694,262 @@ func (*MsgToggleConversionResponse) Descriptor() ([]byte, []int) { return file_cosmos_evm_erc20_v1_tx_proto_rawDescGZIP(), []int{9} } +// MsgTransferOwnership defines a Msg to transfer the ownership of the ERC20 +// token pair to the new owner +type MsgTransferOwnership struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // token identifier can be either the hex contract address of the ERC20 or the + // Cosmos base denomination + Token string `protobuf:"bytes,2,opt,name=token,proto3" json:"token,omitempty"` + // new_owner is the hex address of the new owner + NewOwner string `protobuf:"bytes,3,opt,name=new_owner,json=newOwner,proto3" json:"new_owner,omitempty"` +} + +func (x *MsgTransferOwnership) Reset() { + *x = MsgTransferOwnership{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_evm_erc20_v1_tx_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgTransferOwnership) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgTransferOwnership) ProtoMessage() {} + +// Deprecated: Use MsgTransferOwnership.ProtoReflect.Descriptor instead. +func (*MsgTransferOwnership) Descriptor() ([]byte, []int) { + return file_cosmos_evm_erc20_v1_tx_proto_rawDescGZIP(), []int{10} +} + +func (x *MsgTransferOwnership) GetAuthority() string { + if x != nil { + return x.Authority + } + return "" +} + +func (x *MsgTransferOwnership) GetToken() string { + if x != nil { + return x.Token + } + return "" +} + +func (x *MsgTransferOwnership) GetNewOwner() string { + if x != nil { + return x.NewOwner + } + return "" +} + +// MsgTransferOwnershipResponse returns no fields +type MsgTransferOwnershipResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *MsgTransferOwnershipResponse) Reset() { + *x = MsgTransferOwnershipResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_evm_erc20_v1_tx_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgTransferOwnershipResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgTransferOwnershipResponse) ProtoMessage() {} + +// Deprecated: Use MsgTransferOwnershipResponse.ProtoReflect.Descriptor instead. +func (*MsgTransferOwnershipResponse) Descriptor() ([]byte, []int) { + return file_cosmos_evm_erc20_v1_tx_proto_rawDescGZIP(), []int{11} +} + +// MsgMint defines a Msg to mint ERC20 tokens +type MsgMint struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // contract_address of an ERC20 token contract, that is registered in a token + // pair + ContractAddress string `protobuf:"bytes,1,opt,name=contract_address,json=contractAddress,proto3" json:"contract_address,omitempty"` + // amount of ERC20 tokens to mint + Amount string `protobuf:"bytes,2,opt,name=amount,proto3" json:"amount,omitempty"` + // to is the address to mint the tokens to + To string `protobuf:"bytes,3,opt,name=to,proto3" json:"to,omitempty"` + // sender is the address of the sender + Sender string `protobuf:"bytes,4,opt,name=sender,proto3" json:"sender,omitempty"` +} + +func (x *MsgMint) Reset() { + *x = MsgMint{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_evm_erc20_v1_tx_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgMint) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgMint) ProtoMessage() {} + +// Deprecated: Use MsgMint.ProtoReflect.Descriptor instead. +func (*MsgMint) Descriptor() ([]byte, []int) { + return file_cosmos_evm_erc20_v1_tx_proto_rawDescGZIP(), []int{12} +} + +func (x *MsgMint) GetContractAddress() string { + if x != nil { + return x.ContractAddress + } + return "" +} + +func (x *MsgMint) GetAmount() string { + if x != nil { + return x.Amount + } + return "" +} + +func (x *MsgMint) GetTo() string { + if x != nil { + return x.To + } + return "" +} + +func (x *MsgMint) GetSender() string { + if x != nil { + return x.Sender + } + return "" +} + +type MsgMintResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *MsgMintResponse) Reset() { + *x = MsgMintResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_evm_erc20_v1_tx_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgMintResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgMintResponse) ProtoMessage() {} + +// Deprecated: Use MsgMintResponse.ProtoReflect.Descriptor instead. +func (*MsgMintResponse) Descriptor() ([]byte, []int) { + return file_cosmos_evm_erc20_v1_tx_proto_rawDescGZIP(), []int{13} +} + +// MsgBurn defines a Msg to burn ERC20 tokens +type MsgBurn struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // contract_address of an ERC20 token contract, that is registered in a token + // pair + ContractAddress string `protobuf:"bytes,1,opt,name=contract_address,json=contractAddress,proto3" json:"contract_address,omitempty"` + // amount of ERC20 tokens to burn + Amount string `protobuf:"bytes,2,opt,name=amount,proto3" json:"amount,omitempty"` + // sender is the address of the sender + Sender string `protobuf:"bytes,3,opt,name=sender,proto3" json:"sender,omitempty"` +} + +func (x *MsgBurn) Reset() { + *x = MsgBurn{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_evm_erc20_v1_tx_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgBurn) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgBurn) ProtoMessage() {} + +// Deprecated: Use MsgBurn.ProtoReflect.Descriptor instead. +func (*MsgBurn) Descriptor() ([]byte, []int) { + return file_cosmos_evm_erc20_v1_tx_proto_rawDescGZIP(), []int{14} +} + +func (x *MsgBurn) GetContractAddress() string { + if x != nil { + return x.ContractAddress + } + return "" +} + +func (x *MsgBurn) GetAmount() string { + if x != nil { + return x.Amount + } + return "" +} + +func (x *MsgBurn) GetSender() string { + if x != nil { + return x.Sender + } + return "" +} + +type MsgBurnResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *MsgBurnResponse) Reset() { + *x = MsgBurnResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_evm_erc20_v1_tx_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgBurnResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgBurnResponse) ProtoMessage() {} + +// Deprecated: Use MsgBurnResponse.ProtoReflect.Descriptor instead. +func (*MsgBurnResponse) Descriptor() ([]byte, []int) { + return file_cosmos_evm_erc20_v1_tx_proto_rawDescGZIP(), []int{15} +} + var File_cosmos_evm_erc20_v1_tx_proto protoreflect.FileDescriptor var file_cosmos_evm_erc20_v1_tx_proto_rawDesc = []byte{ @@ -5005,7 +8037,40 @@ var file_cosmos_evm_erc20_v1_tx_proto_rawDesc = []byte{ 0x4d, 0x73, 0x67, 0x54, 0x6f, 0x67, 0x67, 0x6c, 0x65, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x1d, 0x0a, 0x1b, 0x4d, 0x73, 0x67, 0x54, 0x6f, 0x67, 0x67, 0x6c, 0x65, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x32, 0xeb, 0x04, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x91, 0x01, 0x0a, 0x0c, 0x43, + 0x73, 0x65, 0x22, 0x91, 0x01, 0x0a, 0x14, 0x4d, 0x73, 0x67, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, + 0x65, 0x72, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x73, 0x68, 0x69, 0x70, 0x12, 0x36, 0x0a, 0x09, 0x61, + 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, + 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, + 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, + 0x69, 0x74, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x1b, 0x0a, 0x09, 0x6e, 0x65, 0x77, + 0x5f, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6e, 0x65, + 0x77, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x3a, 0x0e, 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x61, 0x75, 0x74, + 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x22, 0x1e, 0x0a, 0x1c, 0x4d, 0x73, 0x67, 0x54, 0x72, 0x61, + 0x6e, 0x73, 0x66, 0x65, 0x72, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x73, 0x68, 0x69, 0x70, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xa0, 0x01, 0x0a, 0x07, 0x4d, 0x73, 0x67, 0x4d, 0x69, + 0x6e, 0x74, 0x12, 0x29, 0x0a, 0x10, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x5f, 0x61, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x63, 0x6f, + 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x35, 0x0a, + 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x1d, 0xc8, + 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x15, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, + 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x49, 0x6e, 0x74, 0x52, 0x06, 0x61, 0x6d, + 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x74, 0x6f, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x02, 0x74, 0x6f, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x3a, 0x0b, 0x82, 0xe7, + 0xb0, 0x2a, 0x06, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x22, 0x11, 0x0a, 0x0f, 0x4d, 0x73, 0x67, + 0x4d, 0x69, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x90, 0x01, 0x0a, + 0x07, 0x4d, 0x73, 0x67, 0x42, 0x75, 0x72, 0x6e, 0x12, 0x29, 0x0a, 0x10, 0x63, 0x6f, 0x6e, 0x74, + 0x72, 0x61, 0x63, 0x74, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x41, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0x12, 0x35, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x42, 0x1d, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x15, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x49, + 0x6e, 0x74, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x65, + 0x6e, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x65, 0x6e, 0x64, + 0x65, 0x72, 0x3a, 0x0b, 0x82, 0xe7, 0xb0, 0x2a, 0x06, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x22, + 0x11, 0x0a, 0x0f, 0x4d, 0x73, 0x67, 0x42, 0x75, 0x72, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x32, 0xca, 0x07, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x91, 0x01, 0x0a, 0x0c, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x74, 0x45, 0x52, 0x43, 0x32, 0x30, 0x12, 0x24, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x65, 0x76, 0x6d, 0x2e, 0x65, 0x72, 0x63, 0x32, 0x30, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x74, 0x45, 0x52, 0x43, 0x32, @@ -5043,20 +8108,42 @@ var file_cosmos_evm_erc20_v1_tx_proto_rawDesc = []byte{ 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x1a, 0x30, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x65, 0x76, 0x6d, 0x2e, 0x65, 0x72, 0x63, 0x32, 0x30, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x54, 0x6f, 0x67, 0x67, 0x6c, 0x65, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, - 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, - 0x42, 0xbf, 0x01, 0x0a, 0x17, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, - 0x65, 0x76, 0x6d, 0x2e, 0x65, 0x72, 0x63, 0x32, 0x30, 0x2e, 0x76, 0x31, 0x42, 0x07, 0x54, 0x78, - 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2c, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, - 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x2f, 0x65, 0x76, 0x6d, 0x2f, 0x65, 0x72, 0x63, 0x32, 0x30, 0x2f, 0x76, 0x31, 0x3b, 0x65, 0x72, - 0x63, 0x32, 0x30, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x45, 0x45, 0xaa, 0x02, 0x13, 0x43, 0x6f, - 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x45, 0x76, 0x6d, 0x2e, 0x45, 0x72, 0x63, 0x32, 0x30, 0x2e, 0x56, - 0x31, 0xca, 0x02, 0x13, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x45, 0x76, 0x6d, 0x5c, 0x45, - 0x72, 0x63, 0x32, 0x30, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x1f, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x5c, 0x45, 0x76, 0x6d, 0x5c, 0x45, 0x72, 0x63, 0x32, 0x30, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, - 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x16, 0x43, 0x6f, 0x73, 0x6d, - 0x6f, 0x73, 0x3a, 0x3a, 0x45, 0x76, 0x6d, 0x3a, 0x3a, 0x45, 0x72, 0x63, 0x32, 0x30, 0x3a, 0x3a, - 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x79, 0x0a, 0x19, 0x54, 0x72, 0x61, + 0x6e, 0x73, 0x66, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x4f, 0x77, 0x6e, + 0x65, 0x72, 0x73, 0x68, 0x69, 0x70, 0x12, 0x29, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, + 0x65, 0x76, 0x6d, 0x2e, 0x65, 0x72, 0x63, 0x32, 0x30, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, + 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x73, 0x68, 0x69, + 0x70, 0x1a, 0x31, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x65, 0x76, 0x6d, 0x2e, 0x65, + 0x72, 0x63, 0x32, 0x30, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x54, 0x72, 0x61, 0x6e, 0x73, + 0x66, 0x65, 0x72, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x73, 0x68, 0x69, 0x70, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x70, 0x0a, 0x04, 0x4d, 0x69, 0x6e, 0x74, 0x12, 0x1c, 0x2e, 0x63, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x65, 0x76, 0x6d, 0x2e, 0x65, 0x72, 0x63, 0x32, 0x30, 0x2e, + 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x4d, 0x69, 0x6e, 0x74, 0x1a, 0x24, 0x2e, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x2e, 0x65, 0x76, 0x6d, 0x2e, 0x65, 0x72, 0x63, 0x32, 0x30, 0x2e, 0x76, 0x31, + 0x2e, 0x4d, 0x73, 0x67, 0x4d, 0x69, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0x24, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1e, 0x22, 0x1c, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x2f, 0x65, 0x76, 0x6d, 0x2f, 0x65, 0x72, 0x63, 0x32, 0x30, 0x2f, 0x76, 0x31, 0x2f, 0x74, + 0x78, 0x2f, 0x6d, 0x69, 0x6e, 0x74, 0x12, 0x70, 0x0a, 0x04, 0x42, 0x75, 0x72, 0x6e, 0x12, 0x1c, + 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x65, 0x76, 0x6d, 0x2e, 0x65, 0x72, 0x63, 0x32, + 0x30, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x42, 0x75, 0x72, 0x6e, 0x1a, 0x24, 0x2e, 0x63, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x65, 0x76, 0x6d, 0x2e, 0x65, 0x72, 0x63, 0x32, 0x30, 0x2e, + 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x42, 0x75, 0x72, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x22, 0x24, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1e, 0x22, 0x1c, 0x2f, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x2f, 0x65, 0x76, 0x6d, 0x2f, 0x65, 0x72, 0x63, 0x32, 0x30, 0x2f, 0x76, 0x31, + 0x2f, 0x74, 0x78, 0x2f, 0x62, 0x75, 0x72, 0x6e, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, + 0xbf, 0x01, 0x0a, 0x17, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x65, + 0x76, 0x6d, 0x2e, 0x65, 0x72, 0x63, 0x32, 0x30, 0x2e, 0x76, 0x31, 0x42, 0x07, 0x54, 0x78, 0x50, + 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2c, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, + 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, + 0x65, 0x76, 0x6d, 0x2f, 0x65, 0x72, 0x63, 0x32, 0x30, 0x2f, 0x76, 0x31, 0x3b, 0x65, 0x72, 0x63, + 0x32, 0x30, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x45, 0x45, 0xaa, 0x02, 0x13, 0x43, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x2e, 0x45, 0x76, 0x6d, 0x2e, 0x45, 0x72, 0x63, 0x32, 0x30, 0x2e, 0x56, 0x31, + 0xca, 0x02, 0x13, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x45, 0x76, 0x6d, 0x5c, 0x45, 0x72, + 0x63, 0x32, 0x30, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x1f, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, + 0x45, 0x76, 0x6d, 0x5c, 0x45, 0x72, 0x63, 0x32, 0x30, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, + 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x16, 0x43, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x3a, 0x3a, 0x45, 0x76, 0x6d, 0x3a, 0x3a, 0x45, 0x72, 0x63, 0x32, 0x30, 0x3a, 0x3a, 0x56, + 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -5071,36 +8158,48 @@ func file_cosmos_evm_erc20_v1_tx_proto_rawDescGZIP() []byte { return file_cosmos_evm_erc20_v1_tx_proto_rawDescData } -var file_cosmos_evm_erc20_v1_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 10) +var file_cosmos_evm_erc20_v1_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 16) var file_cosmos_evm_erc20_v1_tx_proto_goTypes = []interface{}{ - (*MsgConvertERC20)(nil), // 0: cosmos.evm.erc20.v1.MsgConvertERC20 - (*MsgConvertERC20Response)(nil), // 1: cosmos.evm.erc20.v1.MsgConvertERC20Response - (*MsgConvertCoin)(nil), // 2: cosmos.evm.erc20.v1.MsgConvertCoin - (*MsgConvertCoinResponse)(nil), // 3: cosmos.evm.erc20.v1.MsgConvertCoinResponse - (*MsgUpdateParams)(nil), // 4: cosmos.evm.erc20.v1.MsgUpdateParams - (*MsgUpdateParamsResponse)(nil), // 5: cosmos.evm.erc20.v1.MsgUpdateParamsResponse - (*MsgRegisterERC20)(nil), // 6: cosmos.evm.erc20.v1.MsgRegisterERC20 - (*MsgRegisterERC20Response)(nil), // 7: cosmos.evm.erc20.v1.MsgRegisterERC20Response - (*MsgToggleConversion)(nil), // 8: cosmos.evm.erc20.v1.MsgToggleConversion - (*MsgToggleConversionResponse)(nil), // 9: cosmos.evm.erc20.v1.MsgToggleConversionResponse - (*v1beta1.Coin)(nil), // 10: cosmos.base.v1beta1.Coin - (*Params)(nil), // 11: cosmos.evm.erc20.v1.Params + (*MsgConvertERC20)(nil), // 0: cosmos.evm.erc20.v1.MsgConvertERC20 + (*MsgConvertERC20Response)(nil), // 1: cosmos.evm.erc20.v1.MsgConvertERC20Response + (*MsgConvertCoin)(nil), // 2: cosmos.evm.erc20.v1.MsgConvertCoin + (*MsgConvertCoinResponse)(nil), // 3: cosmos.evm.erc20.v1.MsgConvertCoinResponse + (*MsgUpdateParams)(nil), // 4: cosmos.evm.erc20.v1.MsgUpdateParams + (*MsgUpdateParamsResponse)(nil), // 5: cosmos.evm.erc20.v1.MsgUpdateParamsResponse + (*MsgRegisterERC20)(nil), // 6: cosmos.evm.erc20.v1.MsgRegisterERC20 + (*MsgRegisterERC20Response)(nil), // 7: cosmos.evm.erc20.v1.MsgRegisterERC20Response + (*MsgToggleConversion)(nil), // 8: cosmos.evm.erc20.v1.MsgToggleConversion + (*MsgToggleConversionResponse)(nil), // 9: cosmos.evm.erc20.v1.MsgToggleConversionResponse + (*MsgTransferOwnership)(nil), // 10: cosmos.evm.erc20.v1.MsgTransferOwnership + (*MsgTransferOwnershipResponse)(nil), // 11: cosmos.evm.erc20.v1.MsgTransferOwnershipResponse + (*MsgMint)(nil), // 12: cosmos.evm.erc20.v1.MsgMint + (*MsgMintResponse)(nil), // 13: cosmos.evm.erc20.v1.MsgMintResponse + (*MsgBurn)(nil), // 14: cosmos.evm.erc20.v1.MsgBurn + (*MsgBurnResponse)(nil), // 15: cosmos.evm.erc20.v1.MsgBurnResponse + (*v1beta1.Coin)(nil), // 16: cosmos.base.v1beta1.Coin + (*Params)(nil), // 17: cosmos.evm.erc20.v1.Params } var file_cosmos_evm_erc20_v1_tx_proto_depIdxs = []int32{ - 10, // 0: cosmos.evm.erc20.v1.MsgConvertCoin.coin:type_name -> cosmos.base.v1beta1.Coin - 11, // 1: cosmos.evm.erc20.v1.MsgUpdateParams.params:type_name -> cosmos.evm.erc20.v1.Params + 16, // 0: cosmos.evm.erc20.v1.MsgConvertCoin.coin:type_name -> cosmos.base.v1beta1.Coin + 17, // 1: cosmos.evm.erc20.v1.MsgUpdateParams.params:type_name -> cosmos.evm.erc20.v1.Params 0, // 2: cosmos.evm.erc20.v1.Msg.ConvertERC20:input_type -> cosmos.evm.erc20.v1.MsgConvertERC20 2, // 3: cosmos.evm.erc20.v1.Msg.ConvertCoin:input_type -> cosmos.evm.erc20.v1.MsgConvertCoin 4, // 4: cosmos.evm.erc20.v1.Msg.UpdateParams:input_type -> cosmos.evm.erc20.v1.MsgUpdateParams 6, // 5: cosmos.evm.erc20.v1.Msg.RegisterERC20:input_type -> cosmos.evm.erc20.v1.MsgRegisterERC20 8, // 6: cosmos.evm.erc20.v1.Msg.ToggleConversion:input_type -> cosmos.evm.erc20.v1.MsgToggleConversion - 1, // 7: cosmos.evm.erc20.v1.Msg.ConvertERC20:output_type -> cosmos.evm.erc20.v1.MsgConvertERC20Response - 3, // 8: cosmos.evm.erc20.v1.Msg.ConvertCoin:output_type -> cosmos.evm.erc20.v1.MsgConvertCoinResponse - 5, // 9: cosmos.evm.erc20.v1.Msg.UpdateParams:output_type -> cosmos.evm.erc20.v1.MsgUpdateParamsResponse - 7, // 10: cosmos.evm.erc20.v1.Msg.RegisterERC20:output_type -> cosmos.evm.erc20.v1.MsgRegisterERC20Response - 9, // 11: cosmos.evm.erc20.v1.Msg.ToggleConversion:output_type -> cosmos.evm.erc20.v1.MsgToggleConversionResponse - 7, // [7:12] is the sub-list for method output_type - 2, // [2:7] is the sub-list for method input_type + 10, // 7: cosmos.evm.erc20.v1.Msg.TransferContractOwnership:input_type -> cosmos.evm.erc20.v1.MsgTransferOwnership + 12, // 8: cosmos.evm.erc20.v1.Msg.Mint:input_type -> cosmos.evm.erc20.v1.MsgMint + 14, // 9: cosmos.evm.erc20.v1.Msg.Burn:input_type -> cosmos.evm.erc20.v1.MsgBurn + 1, // 10: cosmos.evm.erc20.v1.Msg.ConvertERC20:output_type -> cosmos.evm.erc20.v1.MsgConvertERC20Response + 3, // 11: cosmos.evm.erc20.v1.Msg.ConvertCoin:output_type -> cosmos.evm.erc20.v1.MsgConvertCoinResponse + 5, // 12: cosmos.evm.erc20.v1.Msg.UpdateParams:output_type -> cosmos.evm.erc20.v1.MsgUpdateParamsResponse + 7, // 13: cosmos.evm.erc20.v1.Msg.RegisterERC20:output_type -> cosmos.evm.erc20.v1.MsgRegisterERC20Response + 9, // 14: cosmos.evm.erc20.v1.Msg.ToggleConversion:output_type -> cosmos.evm.erc20.v1.MsgToggleConversionResponse + 11, // 15: cosmos.evm.erc20.v1.Msg.TransferContractOwnership:output_type -> cosmos.evm.erc20.v1.MsgTransferOwnershipResponse + 13, // 16: cosmos.evm.erc20.v1.Msg.Mint:output_type -> cosmos.evm.erc20.v1.MsgMintResponse + 15, // 17: cosmos.evm.erc20.v1.Msg.Burn:output_type -> cosmos.evm.erc20.v1.MsgBurnResponse + 10, // [10:18] is the sub-list for method output_type + 2, // [2:10] 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 @@ -5233,6 +8332,78 @@ func file_cosmos_evm_erc20_v1_tx_proto_init() { return nil } } + file_cosmos_evm_erc20_v1_tx_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgTransferOwnership); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_cosmos_evm_erc20_v1_tx_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgTransferOwnershipResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_cosmos_evm_erc20_v1_tx_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgMint); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_cosmos_evm_erc20_v1_tx_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgMintResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_cosmos_evm_erc20_v1_tx_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgBurn); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_cosmos_evm_erc20_v1_tx_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgBurnResponse); 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{ @@ -5240,7 +8411,7 @@ func file_cosmos_evm_erc20_v1_tx_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_cosmos_evm_erc20_v1_tx_proto_rawDesc, NumEnums: 0, - NumMessages: 10, + NumMessages: 16, NumExtensions: 0, NumServices: 1, }, diff --git a/api/cosmos/evm/erc20/v1/tx_grpc.pb.go b/api/cosmos/evm/erc20/v1/tx_grpc.pb.go index b78f770e6..5244550c5 100644 --- a/api/cosmos/evm/erc20/v1/tx_grpc.pb.go +++ b/api/cosmos/evm/erc20/v1/tx_grpc.pb.go @@ -19,11 +19,14 @@ import ( const _ = grpc.SupportPackageIsVersion7 const ( - Msg_ConvertERC20_FullMethodName = "/cosmos.evm.erc20.v1.Msg/ConvertERC20" - Msg_ConvertCoin_FullMethodName = "/cosmos.evm.erc20.v1.Msg/ConvertCoin" - Msg_UpdateParams_FullMethodName = "/cosmos.evm.erc20.v1.Msg/UpdateParams" - Msg_RegisterERC20_FullMethodName = "/cosmos.evm.erc20.v1.Msg/RegisterERC20" - Msg_ToggleConversion_FullMethodName = "/cosmos.evm.erc20.v1.Msg/ToggleConversion" + Msg_ConvertERC20_FullMethodName = "/cosmos.evm.erc20.v1.Msg/ConvertERC20" + Msg_ConvertCoin_FullMethodName = "/cosmos.evm.erc20.v1.Msg/ConvertCoin" + Msg_UpdateParams_FullMethodName = "/cosmos.evm.erc20.v1.Msg/UpdateParams" + Msg_RegisterERC20_FullMethodName = "/cosmos.evm.erc20.v1.Msg/RegisterERC20" + Msg_ToggleConversion_FullMethodName = "/cosmos.evm.erc20.v1.Msg/ToggleConversion" + Msg_TransferContractOwnership_FullMethodName = "/cosmos.evm.erc20.v1.Msg/TransferContractOwnership" + Msg_Mint_FullMethodName = "/cosmos.evm.erc20.v1.Msg/Mint" + Msg_Burn_FullMethodName = "/cosmos.evm.erc20.v1.Msg/Burn" ) // MsgClient is the client API for Msg service. @@ -48,6 +51,13 @@ type MsgClient interface { // token pair conversion. The authority is hard-coded to the Cosmos SDK x/gov // module account ToggleConversion(ctx context.Context, in *MsgToggleConversion, opts ...grpc.CallOption) (*MsgToggleConversionResponse, error) + // TransferContractOwnership defines a Msg to transfer the ownership of the + // ERC20 token pair to the new owner + TransferContractOwnership(ctx context.Context, in *MsgTransferOwnership, opts ...grpc.CallOption) (*MsgTransferOwnershipResponse, error) + // Mint mints ERC20 tokens + Mint(ctx context.Context, in *MsgMint, opts ...grpc.CallOption) (*MsgMintResponse, error) + // Burn burns ERC20 tokens + Burn(ctx context.Context, in *MsgBurn, opts ...grpc.CallOption) (*MsgBurnResponse, error) } type msgClient struct { @@ -103,6 +113,33 @@ func (c *msgClient) ToggleConversion(ctx context.Context, in *MsgToggleConversio return out, nil } +func (c *msgClient) TransferContractOwnership(ctx context.Context, in *MsgTransferOwnership, opts ...grpc.CallOption) (*MsgTransferOwnershipResponse, error) { + out := new(MsgTransferOwnershipResponse) + err := c.cc.Invoke(ctx, Msg_TransferContractOwnership_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) Mint(ctx context.Context, in *MsgMint, opts ...grpc.CallOption) (*MsgMintResponse, error) { + out := new(MsgMintResponse) + err := c.cc.Invoke(ctx, Msg_Mint_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) Burn(ctx context.Context, in *MsgBurn, opts ...grpc.CallOption) (*MsgBurnResponse, error) { + out := new(MsgBurnResponse) + err := c.cc.Invoke(ctx, Msg_Burn_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. // All implementations must embed UnimplementedMsgServer // for forward compatibility @@ -125,6 +162,13 @@ type MsgServer interface { // token pair conversion. The authority is hard-coded to the Cosmos SDK x/gov // module account ToggleConversion(context.Context, *MsgToggleConversion) (*MsgToggleConversionResponse, error) + // TransferContractOwnership defines a Msg to transfer the ownership of the + // ERC20 token pair to the new owner + TransferContractOwnership(context.Context, *MsgTransferOwnership) (*MsgTransferOwnershipResponse, error) + // Mint mints ERC20 tokens + Mint(context.Context, *MsgMint) (*MsgMintResponse, error) + // Burn burns ERC20 tokens + Burn(context.Context, *MsgBurn) (*MsgBurnResponse, error) mustEmbedUnimplementedMsgServer() } @@ -147,6 +191,15 @@ func (UnimplementedMsgServer) RegisterERC20(context.Context, *MsgRegisterERC20) func (UnimplementedMsgServer) ToggleConversion(context.Context, *MsgToggleConversion) (*MsgToggleConversionResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ToggleConversion not implemented") } +func (UnimplementedMsgServer) TransferContractOwnership(context.Context, *MsgTransferOwnership) (*MsgTransferOwnershipResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method TransferContractOwnership not implemented") +} +func (UnimplementedMsgServer) Mint(context.Context, *MsgMint) (*MsgMintResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Mint not implemented") +} +func (UnimplementedMsgServer) Burn(context.Context, *MsgBurn) (*MsgBurnResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Burn not implemented") +} func (UnimplementedMsgServer) mustEmbedUnimplementedMsgServer() {} // UnsafeMsgServer may be embedded to opt out of forward compatibility for this service. @@ -250,6 +303,60 @@ func _Msg_ToggleConversion_Handler(srv interface{}, ctx context.Context, dec fun return interceptor(ctx, in, info, handler) } +func _Msg_TransferContractOwnership_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgTransferOwnership) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).TransferContractOwnership(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Msg_TransferContractOwnership_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).TransferContractOwnership(ctx, req.(*MsgTransferOwnership)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_Mint_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgMint) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).Mint(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Msg_Mint_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).Mint(ctx, req.(*MsgMint)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_Burn_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgBurn) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).Burn(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Msg_Burn_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).Burn(ctx, req.(*MsgBurn)) + } + return interceptor(ctx, in, info, handler) +} + // Msg_ServiceDesc is the grpc.ServiceDesc for Msg service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -277,6 +384,18 @@ var Msg_ServiceDesc = grpc.ServiceDesc{ MethodName: "ToggleConversion", Handler: _Msg_ToggleConversion_Handler, }, + { + MethodName: "TransferContractOwnership", + Handler: _Msg_TransferContractOwnership_Handler, + }, + { + MethodName: "Mint", + Handler: _Msg_Mint_Handler, + }, + { + MethodName: "Burn", + Handler: _Msg_Burn_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "cosmos/evm/erc20/v1/tx.proto", diff --git a/contracts/solidity/precompiles/erc20/IERC20Burnable.sol b/contracts/solidity/precompiles/erc20/IERC20Burnable.sol new file mode 100644 index 000000000..d139bc039 --- /dev/null +++ b/contracts/solidity/precompiles/erc20/IERC20Burnable.sol @@ -0,0 +1,39 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import "./IERC20.sol"; + +/** + * @dev Extension of {ERC20} that allows token holders to destroy both their own + * tokens and those that they have an allowance for, in a way that can be + * recognized off-chain (via event analysis). + */ +interface IERC20Burnable is IERC20 { + /** + * @dev Destroys `amount` tokens from the caller. + * + * See {ERC20-_burn}. + */ + function burn(uint256 amount) external; + + /** + * @dev Destroys `amount` tokens from `from`. + * + * See {ERC20-_burn} and {ERC20-allowance}. + * + */ + function burn(address from, uint256 amount) external; + + /** + * @dev Destroys a `value` amount of tokens from `account`, deducting from + * the caller's allowance. + * + * See {ERC20-_burn} and {ERC20-allowance}. + * + * Requirements: + * + * - the caller must have allowance for ``accounts``'s tokens of at least + * `value`. + */ + function burnFrom(address account, uint256 value) external; +} diff --git a/contracts/solidity/precompiles/erc20/IERC20Metadata.sol b/contracts/solidity/precompiles/erc20/IERC20Metadata.sol index 982bc39eb..862207cc3 100644 --- a/contracts/solidity/precompiles/erc20/IERC20Metadata.sol +++ b/contracts/solidity/precompiles/erc20/IERC20Metadata.sol @@ -4,13 +4,16 @@ pragma solidity ^0.8.0; import "./IERC20.sol"; +import "./IERC20Mintable.sol"; +import "./IERC20Burnable.sol"; +import "./IOwnable.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ -interface IERC20Metadata is IERC20 { +interface IERC20Metadata is IERC20, IERC20Mintable, IERC20Burnable, IOwnable { /** * @dev Returns the name of the token. */ diff --git a/contracts/solidity/precompiles/erc20/IERC20Mintable.sol b/contracts/solidity/precompiles/erc20/IERC20Mintable.sol new file mode 100644 index 000000000..1a1816ce4 --- /dev/null +++ b/contracts/solidity/precompiles/erc20/IERC20Mintable.sol @@ -0,0 +1,9 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import "./IERC20.sol"; + +interface IERC20Mintable is IERC20 { + + function mint(address account, uint256 amount) external returns (bool); +} diff --git a/contracts/solidity/precompiles/erc20/IOwnable.sol b/contracts/solidity/precompiles/erc20/IOwnable.sol new file mode 100644 index 000000000..0f7aa97ac --- /dev/null +++ b/contracts/solidity/precompiles/erc20/IOwnable.sol @@ -0,0 +1,42 @@ +// SPDX-License-Identifier: MIT +// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol) + +pragma solidity ^0.8.0; + +/** + * @dev Contract module which provides a basic access control mechanism, where + * there is an account (an owner) that can be granted exclusive access to + * specific functions. + * + * The initial owner is set to the address provided by the deployer. This can + * later be changed with {transferOwnership}. + * + * This module is used through inheritance. It will make available the modifier + * `onlyOwner`, which can be applied to your functions to restrict their use to + * the owner. + */ +interface IOwnable { + /** + * @dev The caller account is not authorized to perform an operation. + */ + error OwnableUnauthorizedAccount(address account); + + /** + * @dev The owner is not a valid owner account. (eg. `address(0)`) + */ + error OwnableInvalidOwner(address owner); + + event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); + + /** + * @dev Returns the address of the current owner. + */ + function owner() external view returns (address); + + + /** + * @dev Transfers ownership of the contract to a new account (`newOwner`). + * Can only be called by the current owner. + */ + function transferOwnership(address newOwner) external; +} diff --git a/crypto/ethsecp256k1/keys.pb.go b/crypto/ethsecp256k1/keys.pb.go index 90f1bbd22..9207a7ad3 100644 --- a/crypto/ethsecp256k1/keys.pb.go +++ b/crypto/ethsecp256k1/keys.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: cosmos/evm/crypto/v1/ethsecp256k1/keys.proto +// source: ethermint/crypto/v1/ethsecp256k1/keys.proto package ethsecp256k1 @@ -34,7 +34,7 @@ type PubKey struct { func (m *PubKey) Reset() { *m = PubKey{} } func (*PubKey) ProtoMessage() {} func (*PubKey) Descriptor() ([]byte, []int) { - return fileDescriptor_3033ac433209de5f, []int{0} + return fileDescriptor_0c10cadcf35beb64, []int{0} } func (m *PubKey) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -81,7 +81,7 @@ func (m *PrivKey) Reset() { *m = PrivKey{} } func (m *PrivKey) String() string { return proto.CompactTextString(m) } func (*PrivKey) ProtoMessage() {} func (*PrivKey) Descriptor() ([]byte, []int) { - return fileDescriptor_3033ac433209de5f, []int{1} + return fileDescriptor_0c10cadcf35beb64, []int{1} } func (m *PrivKey) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -118,29 +118,29 @@ func (m *PrivKey) GetKey() []byte { } func init() { - proto.RegisterType((*PubKey)(nil), "cosmos.evm.crypto.v1.ethsecp256k1.PubKey") - proto.RegisterType((*PrivKey)(nil), "cosmos.evm.crypto.v1.ethsecp256k1.PrivKey") + proto.RegisterType((*PubKey)(nil), "ethermint.crypto.v1.ethsecp256k1.PubKey") + proto.RegisterType((*PrivKey)(nil), "ethermint.crypto.v1.ethsecp256k1.PrivKey") } func init() { - proto.RegisterFile("cosmos/evm/crypto/v1/ethsecp256k1/keys.proto", fileDescriptor_3033ac433209de5f) + proto.RegisterFile("ethermint/crypto/v1/ethsecp256k1/keys.proto", fileDescriptor_0c10cadcf35beb64) } -var fileDescriptor_3033ac433209de5f = []byte{ - // 193 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xd2, 0x49, 0xce, 0x2f, 0xce, - 0xcd, 0x2f, 0xd6, 0x4f, 0x2d, 0xcb, 0xd5, 0x4f, 0x2e, 0xaa, 0x2c, 0x28, 0xc9, 0xd7, 0x2f, 0x33, - 0xd4, 0x4f, 0x2d, 0xc9, 0x28, 0x4e, 0x4d, 0x2e, 0x30, 0x32, 0x35, 0xcb, 0x36, 0xd4, 0xcf, 0x4e, - 0xad, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x52, 0x84, 0xa8, 0xd6, 0x4b, 0x2d, 0xcb, - 0xd5, 0x83, 0xa8, 0xd6, 0x2b, 0x33, 0xd4, 0x43, 0x56, 0x2d, 0x25, 0x92, 0x9e, 0x9f, 0x9e, 0x0f, - 0x56, 0xad, 0x0f, 0x62, 0x41, 0x34, 0x2a, 0x29, 0x70, 0xb1, 0x05, 0x94, 0x26, 0x79, 0xa7, 0x56, - 0x0a, 0x09, 0x70, 0x31, 0x67, 0xa7, 0x56, 0x4a, 0x30, 0x2a, 0x30, 0x6a, 0xf0, 0x04, 0x81, 0x98, - 0x56, 0x2c, 0x33, 0x16, 0xc8, 0x33, 0x28, 0x49, 0x73, 0xb1, 0x07, 0x14, 0x65, 0x96, 0x61, 0x55, - 0xe2, 0xe4, 0x7c, 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x0f, 0x1e, 0xc9, 0x31, 0x4e, - 0x78, 0x2c, 0xc7, 0x70, 0xe1, 0xb1, 0x1c, 0xc3, 0x8d, 0xc7, 0x72, 0x0c, 0x51, 0x9a, 0xe9, 0x99, - 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0xfa, 0x98, 0x5e, 0x41, 0x76, 0x59, 0x12, 0x1b, - 0xd8, 0x29, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0x77, 0x7e, 0xb9, 0x2e, 0xf3, 0x00, 0x00, - 0x00, +var fileDescriptor_0c10cadcf35beb64 = []byte{ + // 198 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xd2, 0x4e, 0x2d, 0xc9, 0x48, + 0x2d, 0xca, 0xcd, 0xcc, 0x2b, 0xd1, 0x4f, 0x2e, 0xaa, 0x2c, 0x28, 0xc9, 0xd7, 0x2f, 0x33, 0xd4, + 0x4f, 0x2d, 0xc9, 0x28, 0x4e, 0x4d, 0x2e, 0x30, 0x32, 0x35, 0xcb, 0x36, 0xd4, 0xcf, 0x4e, 0xad, + 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x52, 0x80, 0x2b, 0xd6, 0x83, 0x28, 0xd6, 0x2b, + 0x33, 0xd4, 0x43, 0x56, 0x2c, 0x25, 0x92, 0x9e, 0x9f, 0x9e, 0x0f, 0x56, 0xac, 0x0f, 0x62, 0x41, + 0xf4, 0x29, 0x29, 0x70, 0xb1, 0x05, 0x94, 0x26, 0x79, 0xa7, 0x56, 0x0a, 0x09, 0x70, 0x31, 0x67, + 0xa7, 0x56, 0x4a, 0x30, 0x2a, 0x30, 0x6a, 0xf0, 0x04, 0x81, 0x98, 0x56, 0x2c, 0x33, 0x16, 0xc8, + 0x33, 0x28, 0x49, 0x73, 0xb1, 0x07, 0x14, 0x65, 0x96, 0x61, 0x55, 0xe2, 0xe4, 0x7c, 0xe2, 0x91, + 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x0f, 0x1e, 0xc9, 0x31, 0x4e, 0x78, 0x2c, 0xc7, 0x70, 0xe1, + 0xb1, 0x1c, 0xc3, 0x8d, 0xc7, 0x72, 0x0c, 0x51, 0x9a, 0xe9, 0x99, 0x25, 0x19, 0xa5, 0x49, 0x7a, + 0xc9, 0xf9, 0xb9, 0xfa, 0xc9, 0xf9, 0xc5, 0xb9, 0xf9, 0xc5, 0xfa, 0xa9, 0x65, 0xb9, 0x30, 0x9f, + 0x20, 0xbb, 0x2c, 0x89, 0x0d, 0xec, 0x14, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0x3c, 0xae, + 0xea, 0xae, 0xf1, 0x00, 0x00, 0x00, } func (m *PubKey) Marshal() (dAtA []byte, err error) { diff --git a/local_node.sh b/local_node.sh index 7ccfa247a..726bc9249 100755 --- a/local_node.sh +++ b/local_node.sh @@ -148,7 +148,7 @@ if [[ $overwrite == "y" || $overwrite == "Y" ]]; then # Enable native denomination as a token pair for STRv2 jq '.app_state.erc20.native_precompiles=["0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE"]' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" - jq '.app_state.erc20.token_pairs=[{contract_owner:1,erc20_address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",denom:"atest",enabled:true}]' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" + jq '.app_state.erc20.token_pairs=[{contract_owner:1,erc20_address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",denom:"atest",enabled:true, "owner_address":"cosmos1cml96vmptgw99syqrrz8az79xer2pcgp95srxm"}]' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" # Set gas limit in genesis jq '.consensus.params.block.max_gas="10000000"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" diff --git a/precompiles/erc20/IERC20Burnable.sol b/precompiles/erc20/IERC20Burnable.sol new file mode 100644 index 000000000..d139bc039 --- /dev/null +++ b/precompiles/erc20/IERC20Burnable.sol @@ -0,0 +1,39 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import "./IERC20.sol"; + +/** + * @dev Extension of {ERC20} that allows token holders to destroy both their own + * tokens and those that they have an allowance for, in a way that can be + * recognized off-chain (via event analysis). + */ +interface IERC20Burnable is IERC20 { + /** + * @dev Destroys `amount` tokens from the caller. + * + * See {ERC20-_burn}. + */ + function burn(uint256 amount) external; + + /** + * @dev Destroys `amount` tokens from `from`. + * + * See {ERC20-_burn} and {ERC20-allowance}. + * + */ + function burn(address from, uint256 amount) external; + + /** + * @dev Destroys a `value` amount of tokens from `account`, deducting from + * the caller's allowance. + * + * See {ERC20-_burn} and {ERC20-allowance}. + * + * Requirements: + * + * - the caller must have allowance for ``accounts``'s tokens of at least + * `value`. + */ + function burnFrom(address account, uint256 value) external; +} diff --git a/precompiles/erc20/IERC20Metadata.sol b/precompiles/erc20/IERC20Metadata.sol index 982bc39eb..862207cc3 100644 --- a/precompiles/erc20/IERC20Metadata.sol +++ b/precompiles/erc20/IERC20Metadata.sol @@ -4,13 +4,16 @@ pragma solidity ^0.8.0; import "./IERC20.sol"; +import "./IERC20Mintable.sol"; +import "./IERC20Burnable.sol"; +import "./IOwnable.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ -interface IERC20Metadata is IERC20 { +interface IERC20Metadata is IERC20, IERC20Mintable, IERC20Burnable, IOwnable { /** * @dev Returns the name of the token. */ diff --git a/precompiles/erc20/IERC20Mintable.sol b/precompiles/erc20/IERC20Mintable.sol new file mode 100644 index 000000000..1a1816ce4 --- /dev/null +++ b/precompiles/erc20/IERC20Mintable.sol @@ -0,0 +1,9 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import "./IERC20.sol"; + +interface IERC20Mintable is IERC20 { + + function mint(address account, uint256 amount) external returns (bool); +} diff --git a/precompiles/erc20/IOwnable.sol b/precompiles/erc20/IOwnable.sol new file mode 100644 index 000000000..0f7aa97ac --- /dev/null +++ b/precompiles/erc20/IOwnable.sol @@ -0,0 +1,42 @@ +// SPDX-License-Identifier: MIT +// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol) + +pragma solidity ^0.8.0; + +/** + * @dev Contract module which provides a basic access control mechanism, where + * there is an account (an owner) that can be granted exclusive access to + * specific functions. + * + * The initial owner is set to the address provided by the deployer. This can + * later be changed with {transferOwnership}. + * + * This module is used through inheritance. It will make available the modifier + * `onlyOwner`, which can be applied to your functions to restrict their use to + * the owner. + */ +interface IOwnable { + /** + * @dev The caller account is not authorized to perform an operation. + */ + error OwnableUnauthorizedAccount(address account); + + /** + * @dev The owner is not a valid owner account. (eg. `address(0)`) + */ + error OwnableInvalidOwner(address owner); + + event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); + + /** + * @dev Returns the address of the current owner. + */ + function owner() external view returns (address); + + + /** + * @dev Transfers ownership of the contract to a new account (`newOwner`). + * Can only be called by the current owner. + */ + function transferOwnership(address newOwner) external; +} diff --git a/precompiles/erc20/abi.json b/precompiles/erc20/abi.json index ebb8c03b0..26cf41577 100644 --- a/precompiles/erc20/abi.json +++ b/precompiles/erc20/abi.json @@ -28,6 +28,25 @@ "name": "Approval", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -224,6 +243,99 @@ ], "stateMutability": "nonpayable", "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "mint", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "burn", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "burn", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "burnFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" } ], "bytecode": "0x", diff --git a/precompiles/erc20/erc20.go b/precompiles/erc20/erc20.go index c7d2a401f..3d5952385 100644 --- a/precompiles/erc20/erc20.go +++ b/precompiles/erc20/erc20.go @@ -28,15 +28,17 @@ const ( // The results can be inspected here: // https://github.com/evmos/evmos/blob/malte/erc20-gas-tests/precompiles/erc20/plot_gas_values.ipynb - GasTransfer = 9_000 - GasTransferFrom = 30_500 - GasApprove = 8_100 - GasName = 3_421 - GasSymbol = 3_464 - GasDecimals = 427 - GasTotalSupply = 2_480 - GasBalanceOf = 2_870 - GasAllowance = 3_225 + GasTransfer = 9_000 + GasTransferFrom = 30_500 + GasApprove = 8_100 + GasName = 3_421 + GasSymbol = 3_464 + GasDecimals = 427 + GasTotalSupply = 2_480 + GasBalanceOf = 2_870 + GasAllowance = 3_225 + GasTransferOwnership = 50_000 + GasOwner = 2_870 ) // Embed abi json file to the executable binary. Needed when importing as dependency. @@ -109,6 +111,16 @@ func (p Precompile) RequiredGas(input []byte) uint64 { return GasTransferFrom case ApproveMethod: return GasApprove + case MintMethod: + return GasTransfer + case BurnMethod: + return GasTransfer + case Burn0Method: + return GasTransfer + case BurnFromMethod: + return GasTransfer + case TransferOwnershipMethod: + return GasTransferOwnership // ERC-20 queries case NameMethod: return GasName @@ -122,6 +134,8 @@ func (p Precompile) RequiredGas(input []byte) uint64 { return GasBalanceOf case AllowanceMethod: return GasAllowance + case OwnerMethod: + return GasOwner default: return 0 } @@ -174,7 +188,12 @@ func (Precompile) IsTransaction(method *abi.Method) bool { switch method.Name { case TransferMethod, TransferFromMethod, - ApproveMethod: + ApproveMethod, + MintMethod, + BurnMethod, + Burn0Method, + BurnFromMethod, + TransferOwnershipMethod: return true default: return false @@ -197,6 +216,16 @@ func (p *Precompile) HandleMethod( bz, err = p.TransferFrom(ctx, contract, stateDB, method, args) case ApproveMethod: bz, err = p.Approve(ctx, contract, stateDB, method, args) + case MintMethod: + bz, err = p.Mint(ctx, contract, stateDB, method, args) + case BurnMethod: + bz, err = p.Burn(ctx, contract, stateDB, method, args) + case Burn0Method: + bz, err = p.Burn0(ctx, contract, stateDB, method, args) + case BurnFromMethod: + bz, err = p.BurnFrom(ctx, contract, stateDB, method, args) + case TransferOwnershipMethod: + bz, err = p.TransferOwnership(ctx, contract, stateDB, method, args) // ERC-20 queries case NameMethod: bz, err = p.Name(ctx, contract, stateDB, method, args) @@ -210,6 +239,8 @@ func (p *Precompile) HandleMethod( bz, err = p.BalanceOf(ctx, contract, stateDB, method, args) case AllowanceMethod: bz, err = p.Allowance(ctx, contract, stateDB, method, args) + case OwnerMethod: + bz, err = p.Owner(ctx, contract, stateDB, method, args) default: return nil, fmt.Errorf(cmn.ErrUnknownMethod, method.Name) } diff --git a/precompiles/erc20/errors.go b/precompiles/erc20/errors.go index 77f90d882..377a3a2f3 100644 --- a/precompiles/erc20/errors.go +++ b/precompiles/erc20/errors.go @@ -31,6 +31,11 @@ var ( ErrDecreasedAllowanceBelowZero = errors.New("ERC20: decreased allowance below zero") ErrInsufficientAllowance = errors.New("ERC20: insufficient allowance") ErrTransferAmountExceedsBalance = errors.New("ERC20: transfer amount exceeds balance") + ErrOwnableInvalidOwner = errors.New("ERC20: invalid new owner") + ErrOwnableUnauthorizedAccount = errors.New("ERC20: unauthorized account") + ErrMinterIsNotOwner = errors.New("ERC20: minter is not the owner") + ErrSenderIsNotOwner = errors.New("ERC20: sender is not the owner") + ErrContractOwnerNotFound = errors.New("ERC20: contract owner not found") ) // ConvertErrToERC20Error is a helper function which maps errors raised by the Cosmos SDK stack @@ -49,6 +54,12 @@ func ConvertErrToERC20Error(err error) error { return ErrDecreasedAllowanceBelowZero case strings.Contains(err.Error(), cmn.ErrIntegerOverflow): return vm.ErrExecutionReverted + case strings.Contains(err.Error(), "invalid owner"): + return ErrOwnableInvalidOwner + case strings.Contains(err.Error(), "unauthorized") || strings.Contains(err.Error(), "authorization not found"): + return ErrOwnableUnauthorizedAccount + case strings.Contains(err.Error(), "minter is not the owner"): + return ErrMinterIsNotOwner case errors.Is(err, ibc.ErrNoIBCVoucherDenom) || errors.Is(err, ibc.ErrDenomNotFound) || strings.Contains(err.Error(), "invalid base denomination") || diff --git a/precompiles/erc20/events.go b/precompiles/erc20/events.go index 33949fa80..a4ab52bf7 100644 --- a/precompiles/erc20/events.go +++ b/precompiles/erc20/events.go @@ -19,6 +19,9 @@ const ( // EventTypeApproval defines the event type for the ERC-20 Approval event. EventTypeApproval = "Approval" + + // EventTypeTransferOwnership defines the event type for the ERC-20 transferOwnership transaction. + EventTypeTransferOwnership = "TransferOwnership" ) // EmitTransferEvent creates a new Transfer event emitted on transfer and transferFrom transactions. @@ -92,3 +95,32 @@ func (p Precompile) EmitApprovalEvent(ctx sdk.Context, stateDB vm.StateDB, owner return nil } + +// EmitTransferOwnershipEvent creates a new TransferOwnership event emitted on transferOwnership transactions. +func (p Precompile) EmitTransferOwnershipEvent(ctx sdk.Context, stateDB vm.StateDB, previousOwner, newOwner common.Address) error { + // Prepare the event topics + event := p.Events[EventTypeTransferOwnership] + topics := make([]common.Hash, 3) + + // The first topic is always the signature of the event. + topics[0] = event.ID + + var err error + topics[1], err = cmn.MakeTopic(previousOwner) + if err != nil { + return err + } + + topics[2], err = cmn.MakeTopic(newOwner) + if err != nil { + return err + } + + stateDB.AddLog(ðtypes.Log{ + Address: p.Address(), + Topics: topics, + BlockNumber: uint64(ctx.BlockHeight()), //nolint:gosec // G115 + }) + + return nil +} diff --git a/precompiles/erc20/interfaces.go b/precompiles/erc20/interfaces.go index c4bcb6c68..c3cbb6769 100644 --- a/precompiles/erc20/interfaces.go +++ b/precompiles/erc20/interfaces.go @@ -5,6 +5,8 @@ import ( "github.com/ethereum/go-ethereum/common" + "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" ) @@ -13,4 +15,8 @@ type Erc20Keeper interface { GetAllowance(ctx sdk.Context, erc20 common.Address, owner common.Address, spender common.Address) (*big.Int, error) SetAllowance(ctx sdk.Context, erc20 common.Address, owner common.Address, spender common.Address, value *big.Int) error DeleteAllowance(ctx sdk.Context, erc20 common.Address, owner common.Address, spender common.Address) error + MintCoins(ctx sdk.Context, sender, to sdk.AccAddress, amount math.Int, token string) error + BurnCoins(ctx sdk.Context, sender sdk.AccAddress, amount math.Int, token string) error + GetTokenPairOwnerAddress(ctx sdk.Context, token string) (sdk.AccAddress, error) + TransferOwnership(ctx sdk.Context, sender sdk.AccAddress, newOwner sdk.AccAddress, token string) error } diff --git a/precompiles/erc20/query.go b/precompiles/erc20/query.go index b3461f2c0..5cff14e91 100644 --- a/precompiles/erc20/query.go +++ b/precompiles/erc20/query.go @@ -33,6 +33,9 @@ const ( // AllowanceMethod defines the ABI method name for the Allowance // query. AllowanceMethod = "allowance" + // OwnerMethod defines the ABI method name for the ERC-20 Owner + // query. + OwnerMethod = "owner" ) // Name returns the name of the token. If the token metadata is registered in the @@ -193,6 +196,27 @@ func (p Precompile) Allowance( return method.Outputs.Pack(allowance) } +// Owner returns the address of the current owner of the token. +func (p Precompile) Owner( + ctx sdk.Context, + _ *vm.Contract, + _ vm.StateDB, + method *abi.Method, + args []interface{}, +) ([]byte, error) { + err := ParseOwnerArgs(args) + if err != nil { + return nil, err + } + + ownerAddr, err := p.erc20Keeper.GetTokenPairOwnerAddress(ctx, p.tokenPair.GetERC20Contract().Hex()) + if err != nil { + return nil, ErrContractOwnerNotFound + } + + return method.Outputs.Pack(common.Address(ownerAddr.Bytes())) +} + // getBaseDenomFromIBCVoucher returns the base denomination from the given IBC voucher denomination. func (p Precompile) getBaseDenomFromIBCVoucher(ctx sdk.Context, voucherDenom string) (string, error) { // Infer the denomination name from the coin denomination base voucherDenom diff --git a/precompiles/erc20/tx.go b/precompiles/erc20/tx.go index 54bffdaf9..d94d77f68 100644 --- a/precompiles/erc20/tx.go +++ b/precompiles/erc20/tx.go @@ -24,17 +24,24 @@ const ( // TransferFromMethod defines the ABI method name for the ERC-20 transferFrom // transaction. TransferFromMethod = "transferFrom" + // MintMethod defines the ABI method name for the ERC-20 mint transaction. + MintMethod = "mint" + // BurnMethod defines the ABI method name for the ERC-20 burn transaction. + BurnMethod = "burn" + // Burn0Method defines the ABI method name for burn transaction with 2 arguments (spender, amount). + Burn0Method = "burn0" + // BurnFromMethod defines the ABI method name for the ERC-20 burnFrom transaction. + BurnFromMethod = "burnFrom" + // TransferOwnershipMethod defines the ABI method name for the ERC-20 transferOwnership transaction. + TransferOwnershipMethod = "transferOwnership" // ApproveMethod defines the ABI method name for ERC-20 Approve // transaction. ApproveMethod = "approve" - // DecreaseAllowanceMethod defines the ABI method name for the DecreaseAllowance - // transaction. - DecreaseAllowanceMethod = "decreaseAllowance" - // IncreaseAllowanceMethod defines the ABI method name for the IncreaseAllowance - // transaction. - IncreaseAllowanceMethod = "increaseAllowance" ) +// ZeroAddress represents the zero address +var ZeroAddress = common.Address{} + // Transfer executes a direct transfer from the caller address to the // destination address. func (p *Precompile) Transfer( @@ -155,3 +162,231 @@ func (p *Precompile) transfer( return method.Outputs.Pack(true) } + +// Mint executes a mint of the caller's tokens. +func (p *Precompile) Mint( + ctx sdk.Context, + contract *vm.Contract, + stateDB vm.StateDB, + method *abi.Method, + args []interface{}, +) ([]byte, error) { + to, amount, err := ParseMintArgs(args) + if err != nil { + return nil, err + } + + minterAddr := contract.Caller() + minter := sdk.AccAddress(minterAddr.Bytes()) + toAddr := sdk.AccAddress(to.Bytes()) + + err = p.erc20Keeper.MintCoins(ctx, minter, toAddr, math.NewIntFromBigInt(amount), p.tokenPair.GetERC20Contract().Hex()) + if err != nil { + return nil, ConvertErrToERC20Error(err) + } + + // TODO: Properly handle native balance changes via the balance handler. + // Currently, decimal conversion issues exist with the precisebank module. + // As a temporary workaround, balances are adjusted directly using add/sub operations. + evmDenom := evmtypes.GetEVMCoinDenom() + if p.tokenPair.Denom == evmDenom { + convertedAmount, err := utils.Uint256FromBigInt(evmtypes.ConvertAmountTo18DecimalsBigInt(amount)) + if err != nil { + return nil, err + } + + stateDB.AddBalance(to, convertedAmount, tracing.BalanceChangeUnspecified) + } + + if err = p.EmitTransferEvent(ctx, stateDB, ZeroAddress, to, amount); err != nil { + return nil, err + } + + return method.Outputs.Pack() +} + +// Burn executes a burn of the caller's tokens. +func (p *Precompile) Burn( + ctx sdk.Context, + contract *vm.Contract, + stateDB vm.StateDB, + method *abi.Method, + args []interface{}, +) ([]byte, error) { + amount, err := ParseBurnArgs(args) + if err != nil { + return nil, err + } + + burnerAddr := contract.Caller() + + if err := p.burn(ctx, stateDB, burnerAddr, amount); err != nil { + return nil, err + } + + return method.Outputs.Pack() +} + +// Burn0 executes a burn of the spender's tokens. +func (p *Precompile) Burn0( + ctx sdk.Context, + contract *vm.Contract, + stateDB vm.StateDB, + method *abi.Method, + args []interface{}, +) ([]byte, error) { + spender, amount, err := ParseBurn0Args(args) + if err != nil { + return nil, err + } + + owner, err := sdk.AccAddressFromBech32(p.tokenPair.OwnerAddress) + if err != nil { + return nil, err + } + sender := sdk.AccAddress(contract.Caller().Bytes()) + + if !sender.Equals(owner) { + return nil, ConvertErrToERC20Error(ErrSenderIsNotOwner) + } + + if err := p.burn(ctx, stateDB, spender, amount); err != nil { + return nil, err + } + + return method.Outputs.Pack() +} + +// BurnFrom executes a burn of the caller's tokens. +func (p *Precompile) BurnFrom( + ctx sdk.Context, + contract *vm.Contract, + stateDB vm.StateDB, + method *abi.Method, + args []interface{}, +) ([]byte, error) { + owner, amount, err := ParseBurnFromArgs(args) + if err != nil { + return nil, err + } + + coins := sdk.Coins{{Denom: p.tokenPair.Denom, Amount: math.NewIntFromBigInt(amount)}} + + msg := banktypes.NewMsgSend(owner.Bytes(), ZeroAddress.Bytes(), coins) + + if err = msg.Amount.Validate(); err != nil { + return nil, err + } + spenderAddr := contract.Caller() + + prevAllowance, err := p.erc20Keeper.GetAllowance(ctx, p.Address(), owner, spenderAddr) + if err != nil { + return nil, ConvertErrToERC20Error(err) + } + + newAllowance := new(big.Int).Sub(prevAllowance, amount) + if newAllowance.Sign() < 0 { + return nil, ErrInsufficientAllowance + } + + if newAllowance.Sign() == 0 { + // If the new allowance is 0, we need to delete it from the store. + err = p.erc20Keeper.DeleteAllowance(ctx, p.Address(), owner, spenderAddr) + } else { + // If the new allowance is not 0, we need to set it in the store. + err = p.erc20Keeper.SetAllowance(ctx, p.Address(), owner, spenderAddr, newAllowance) + } + if err != nil { + return nil, ConvertErrToERC20Error(err) + } + + msgSrv := NewMsgServerImpl(p.BankKeeper) + if err = msgSrv.Send(ctx, msg); err != nil { + // This should return an error to avoid the contract from being executed and an event being emitted + return nil, ConvertErrToERC20Error(err) + } + + // TODO: Properly handle native balance changes via the balance handler. + // Currently, decimal conversion issues exist with the precisebank module. + // As a temporary workaround, balances are adjusted directly using add/sub operations. + evmDenom := evmtypes.GetEVMCoinDenom() + if p.tokenPair.Denom == evmDenom { + convertedAmount, err := utils.Uint256FromBigInt(evmtypes.ConvertAmountTo18DecimalsBigInt(amount)) + if err != nil { + return nil, err + } + + stateDB.SubBalance(owner, convertedAmount, tracing.BalanceChangeUnspecified) + } + + if err = p.EmitTransferEvent(ctx, stateDB, owner, ZeroAddress, amount); err != nil { + return nil, err + } + + // NOTE: if it's a direct transfer, we return here but if used through transferFrom, + // we need to emit the approval event with the new allowance. + if err = p.EmitApprovalEvent(ctx, stateDB, owner, spenderAddr, newAllowance); err != nil { + return nil, err + } + + return method.Outputs.Pack() +} + +// TransferOwnership executes a transfer of ownership of the token. +func (p *Precompile) TransferOwnership( + ctx sdk.Context, + contract *vm.Contract, + stateDB vm.StateDB, + method *abi.Method, + args []interface{}, +) ([]byte, error) { + newOwner, err := ParseTransferOwnershipArgs(args) + if err != nil { + return nil, err + } + + sender := sdk.AccAddress(contract.Caller().Bytes()) + + if p.tokenPair.OwnerAddress != sender.String() { + return nil, ConvertErrToERC20Error(ErrSenderIsNotOwner) + } + + err = p.erc20Keeper.TransferOwnership(ctx, sender, newOwner.Bytes(), p.tokenPair.GetERC20Contract().Hex()) + if err != nil { + return nil, ConvertErrToERC20Error(err) + } + + p.tokenPair.OwnerAddress = newOwner.String() + + if err = p.EmitTransferOwnershipEvent(ctx, stateDB, contract.Caller(), newOwner); err != nil { + return nil, err + } + + return method.Outputs.Pack() +} + +// burn is a common function that handles burns for the ERC-20 Burn +// and BurnFrom methods. It executes a bank BurnCoins message. +func (p *Precompile) burn(ctx sdk.Context, stateDB vm.StateDB, burnerAddr common.Address, amount *big.Int) error { + burner := sdk.AccAddress(burnerAddr.Bytes()) + + err := p.erc20Keeper.BurnCoins(ctx, burner, math.NewIntFromBigInt(amount), p.tokenPair.GetERC20Contract().Hex()) + if err != nil { + return ConvertErrToERC20Error(err) + } + + // TODO: Properly handle native balance changes via the balance handler. + // Currently, decimal conversion issues exist with the precisebank module. + // As a temporary workaround, balances are adjusted directly using add/sub operations. + evmDenom := evmtypes.GetEVMCoinDenom() + if p.tokenPair.Denom == evmDenom { + convertedAmount, err := utils.Uint256FromBigInt(evmtypes.ConvertAmountTo18DecimalsBigInt(amount)) + if err != nil { + return err + } + + stateDB.SubBalance(burnerAddr, convertedAmount, tracing.BalanceChangeUnspecified) + } + + return p.EmitTransferEvent(ctx, stateDB, burnerAddr, ZeroAddress, amount) +} diff --git a/precompiles/erc20/types.go b/precompiles/erc20/types.go index 685f6fa62..0549cf2aa 100644 --- a/precompiles/erc20/types.go +++ b/precompiles/erc20/types.go @@ -127,3 +127,98 @@ func ParseBalanceOfArgs(args []interface{}) (common.Address, error) { return account, nil } + +// ParseOwnerArgs parses the arguments from the owner method and returns the owner address. +func ParseOwnerArgs(args []interface{}) error { + if len(args) != 0 { + return fmt.Errorf("invalid number of arguments; expected 0; got: %d", len(args)) + } + + return nil +} + +// ParseMintArgs parses the arguments from the mint method and returns the +// destination address (to) and amount. +func ParseMintArgs(args []interface{}) (to common.Address, amount *big.Int, err error) { + if len(args) != 2 { + return common.Address{}, nil, fmt.Errorf("invalid number of arguments; expected 2; got: %d", len(args)) + } + + to, ok := args[0].(common.Address) + if !ok { + return common.Address{}, nil, fmt.Errorf("invalid to address: %v", args[0]) + } + + amount, ok = args[1].(*big.Int) + if !ok { + return common.Address{}, nil, fmt.Errorf("invalid amount: %v", args[1]) + } + + return to, amount, nil +} + +// ParseBurnArgs parses the arguments from the burn method and returns the amount. +func ParseBurnArgs(args []interface{}) (amount *big.Int, err error) { + if len(args) != 1 { + return nil, fmt.Errorf("invalid number of arguments; expected 1; got: %d", len(args)) + } + + amount, ok := args[0].(*big.Int) + if !ok { + return nil, fmt.Errorf("invalid amount: %v", args[0]) + } + + return amount, nil +} + +func ParseBurn0Args(args []interface{}) (spender common.Address, amount *big.Int, err error) { + if len(args) != 2 { + return common.Address{}, nil, fmt.Errorf("invalid number of arguments; expected 2; got: %d", len(args)) + } + + spender, ok := args[0].(common.Address) + if !ok { + return common.Address{}, nil, fmt.Errorf("invalid spender address: %v", args[0]) + } + + amount, ok = args[1].(*big.Int) + if !ok { + return common.Address{}, nil, fmt.Errorf("invalid amount: %v", args[1]) + } + + return spender, amount, nil +} + +// ParseBurnFromArgs parses the arguments from the burnFrom method and returns the +// from address and amount. +func ParseBurnFromArgs(args []interface{}) (from common.Address, amount *big.Int, err error) { + if len(args) != 2 { + return common.Address{}, nil, fmt.Errorf("invalid number of arguments; expected 2; got: %d", len(args)) + } + + from, ok := args[0].(common.Address) + if !ok { + return common.Address{}, nil, fmt.Errorf("invalid from address: %v", args[0]) + } + + amount, ok = args[1].(*big.Int) + if !ok { + return common.Address{}, nil, fmt.Errorf("invalid amount: %v", args[1]) + } + + return from, amount, nil +} + +// ParseTransferOwnershipArgs parses the arguments from the transferOwnership method and returns the new owner address. +func ParseTransferOwnershipArgs(args []interface{}) (common.Address, error) { + if len(args) != 1 { + return common.Address{}, fmt.Errorf("invalid number of arguments; expected 1; got: %d", len(args)) + } + + newOwner, ok := args[0].(common.Address) + if !ok { + return common.Address{}, fmt.Errorf("invalid new owner address: %v", args[0]) + } + + return newOwner, nil +} diff --git a/precompiles/werc20/abi.json b/precompiles/werc20/abi.json index 3753fd7bc..4c3442215 100644 --- a/precompiles/werc20/abi.json +++ b/precompiles/werc20/abi.json @@ -28,6 +28,25 @@ "name": "Approval", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -273,6 +292,99 @@ ], "stateMutability": "nonpayable", "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "mint", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "burn", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "burn", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "burnFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" }, { "inputs": [ diff --git a/precompiles/werc20/interfaces.go b/precompiles/werc20/interfaces.go index 9ebf87202..8c93525a8 100644 --- a/precompiles/werc20/interfaces.go +++ b/precompiles/werc20/interfaces.go @@ -5,6 +5,8 @@ import ( "github.com/ethereum/go-ethereum/common" + "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" ) @@ -12,4 +14,8 @@ type Erc20Keeper interface { GetAllowance(ctx sdk.Context, erc20 common.Address, owner common.Address, spender common.Address) (*big.Int, error) SetAllowance(ctx sdk.Context, erc20 common.Address, owner common.Address, spender common.Address, value *big.Int) error DeleteAllowance(ctx sdk.Context, erc20 common.Address, owner common.Address, spender common.Address) error + BurnCoins(ctx sdk.Context, sender sdk.AccAddress, amount math.Int, token string) error + GetTokenPairOwnerAddress(ctx sdk.Context, token string) (sdk.AccAddress, error) + TransferOwnership(ctx sdk.Context, sender sdk.AccAddress, newOwner sdk.AccAddress, token string) error + MintCoins(ctx sdk.Context, sender, to sdk.AccAddress, amount math.Int, token string) error } diff --git a/proto/cosmos/evm/erc20/v1/erc20.proto b/proto/cosmos/evm/erc20/v1/erc20.proto index 5ead3be52..c6a3457e5 100644 --- a/proto/cosmos/evm/erc20/v1/erc20.proto +++ b/proto/cosmos/evm/erc20/v1/erc20.proto @@ -30,6 +30,9 @@ message TokenPair { // contract_owner is the an ENUM specifying the type of ERC20 owner (0 // invalid, 1 ModuleAccount, 2 external address) Owner contract_owner = 4; + // owner_address is the address of the current owner of the token + // Only set if contract_owner is OWNER_MODULE + string owner_address = 5; } // Allowance is a token allowance only for erc20 precompile diff --git a/proto/cosmos/evm/erc20/v1/query.proto b/proto/cosmos/evm/erc20/v1/query.proto index b1d2061f4..59ce83c00 100644 --- a/proto/cosmos/evm/erc20/v1/query.proto +++ b/proto/cosmos/evm/erc20/v1/query.proto @@ -27,6 +27,12 @@ service Query { rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { option (google.api.http).get = "/cosmos/evm/erc20/v1/params"; } + // OwnerAddress retrieves the owner address for a given ERC20 contract address + rpc OwnerAddress(QueryOwnerAddressRequest) + returns (QueryOwnerAddressResponse) { + option (google.api.http).get = + "/evmos/erc20/v1/owner_address/{contract_address}"; + } } // QueryTokenPairsRequest is the request type for the Query/TokenPairs RPC @@ -72,3 +78,7 @@ message QueryParamsResponse { Params params = 1 [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; } + +message QueryOwnerAddressRequest { string contract_address = 1; } + +message QueryOwnerAddressResponse { string owner_address = 1; } diff --git a/proto/cosmos/evm/erc20/v1/tx.proto b/proto/cosmos/evm/erc20/v1/tx.proto index b8cdbaf39..19813425a 100644 --- a/proto/cosmos/evm/erc20/v1/tx.proto +++ b/proto/cosmos/evm/erc20/v1/tx.proto @@ -38,6 +38,18 @@ service Msg { // module account rpc ToggleConversion(MsgToggleConversion) returns (MsgToggleConversionResponse); + // TransferContractOwnership defines a Msg to transfer the ownership of the + // ERC20 token pair to the new owner + rpc TransferContractOwnership(MsgTransferOwnership) + returns (MsgTransferOwnershipResponse); + // Mint mints ERC20 tokens + rpc Mint(MsgMint) returns (MsgMintResponse) { + option (google.api.http).post = "/cosmos/evm/erc20/v1/tx/mint"; + }; + // Burn burns ERC20 tokens + rpc Burn(MsgBurn) returns (MsgBurnResponse) { + option (google.api.http).post = "/cosmos/evm/erc20/v1/tx/burn"; + }; } // MsgConvertERC20 defines a Msg to convert a ERC20 token to a native Cosmos @@ -134,3 +146,55 @@ message MsgToggleConversion { // MsgToggleConversionResponse defines the response structure for executing a // ToggleConversion message. message MsgToggleConversionResponse {} + +// MsgTransferOwnership defines a Msg to transfer the ownership of the ERC20 +// token pair to the new owner +message MsgTransferOwnership { + option (cosmos.msg.v1.signer) = "authority"; + + string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + // token identifier can be either the hex contract address of the ERC20 or the + // Cosmos base denomination + string token = 2; + // new_owner is the hex address of the new owner + string new_owner = 3; +} + +// MsgTransferOwnershipResponse returns no fields +message MsgTransferOwnershipResponse {} + +// MsgMint defines a Msg to mint ERC20 tokens +message MsgMint { + option (cosmos.msg.v1.signer) = "sender"; + // contract_address of an ERC20 token contract, that is registered in a token + // pair + string contract_address = 1; + // amount of ERC20 tokens to mint + string amount = 2 [ + (gogoproto.customtype) = "cosmossdk.io/math.Int", + (gogoproto.nullable) = false + ]; + // to is the address to mint the tokens to + string to = 3; + // sender is the address of the sender + string sender = 4; +} + +message MsgMintResponse {} + +// MsgBurn defines a Msg to burn ERC20 tokens +message MsgBurn { + option (cosmos.msg.v1.signer) = "sender"; + // contract_address of an ERC20 token contract, that is registered in a token + // pair + string contract_address = 1; + // amount of ERC20 tokens to burn + string amount = 2 [ + (gogoproto.customtype) = "cosmossdk.io/math.Int", + (gogoproto.nullable) = false + ]; + // sender is the address of the sender + string sender = 3; +} + +message MsgBurnResponse {} diff --git a/proto/cosmos/evm/crypto/v1/ethsecp256k1/keys.proto b/proto/ethermint/crypto/v1/ethsecp256k1/keys.proto similarity index 93% rename from proto/cosmos/evm/crypto/v1/ethsecp256k1/keys.proto rename to proto/ethermint/crypto/v1/ethsecp256k1/keys.proto index 4f1303bc7..4a061fb75 100644 --- a/proto/cosmos/evm/crypto/v1/ethsecp256k1/keys.proto +++ b/proto/ethermint/crypto/v1/ethsecp256k1/keys.proto @@ -1,6 +1,6 @@ syntax = "proto3"; -package cosmos.evm.crypto.v1.ethsecp256k1; +package ethermint.crypto.v1.ethsecp256k1; import "gogoproto/gogo.proto"; diff --git a/tests/integration/precompiles/erc20/test_burn.go b/tests/integration/precompiles/erc20/test_burn.go new file mode 100644 index 000000000..88b193c24 --- /dev/null +++ b/tests/integration/precompiles/erc20/test_burn.go @@ -0,0 +1,94 @@ +package erc20 + +import ( + "math/big" + + utiltx "github.com/cosmos/evm/testutil/tx" + "github.com/cosmos/evm/x/erc20/types" + + "cosmossdk.io/math" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +func (suite *PrecompileTestSuite) TestBurnCoins() { + var ctx sdk.Context + sender := sdk.AccAddress(utiltx.GenerateAddress().Bytes()) + expPair := types.NewTokenPair(utiltx.GenerateAddress(), "coin", types.OWNER_MODULE) + expPair.SetOwnerAddress(sender.String()) + amount := big.NewInt(1000000) + id := expPair.GetID() + + testcases := []struct { + name string + malleate func() + postCheck func() + expErr bool + errContains string + }{ + { + name: "fail - token pair not found", + malleate: func() { + params := types.DefaultParams() + params.EnableErc20 = true + suite.network.App.GetErc20Keeper().SetParams(ctx, params) //nolint:errcheck + }, + postCheck: func() {}, + expErr: true, + errContains: "", + }, + { + "fail - pair is not native coin", + func() { + expPair.ContractOwner = types.OWNER_EXTERNAL + suite.network.App.GetErc20Keeper().SetTokenPair(ctx, expPair) + suite.network.App.GetErc20Keeper().SetDenomMap(ctx, expPair.Denom, id) + suite.network.App.GetErc20Keeper().SetERC20Map(ctx, expPair.GetERC20Contract(), id) + }, + func() {}, + true, + types.ErrNonNativeCoinBurningDisabled.Error(), + }, + { + "pass", + func() { + expPair.ContractOwner = types.OWNER_MODULE + if err := suite.network.App.GetBankKeeper().MintCoins(ctx, types.ModuleName, sdk.Coins{{Denom: expPair.Denom, Amount: math.NewIntFromBigInt(amount)}}); err != nil { + suite.FailNow(err.Error()) + } + if err := suite.network.App.GetBankKeeper().SendCoinsFromModuleToAccount(ctx, types.ModuleName, sender, sdk.Coins{{Denom: expPair.Denom, Amount: math.NewIntFromBigInt(amount)}}); err != nil { + suite.FailNow(err.Error()) + } + expPair.SetOwnerAddress(sender.String()) + suite.network.App.GetErc20Keeper().SetTokenPair(ctx, expPair) + suite.network.App.GetErc20Keeper().SetDenomMap(ctx, expPair.Denom, id) + suite.network.App.GetErc20Keeper().SetERC20Map(ctx, expPair.GetERC20Contract(), id) + }, + func() { + balance := suite.network.App.GetBankKeeper().GetBalance(ctx, sender, expPair.Denom) + suite.Require().Equal(balance.Amount.Int64(), math.NewInt(0).Int64()) + }, + false, + "", + }, + } + + for _, tc := range testcases { + suite.Run(tc.name, func() { + suite.SetupTest() + + ctx = suite.network.GetContext() + + tc.malleate() + + err := suite.network.App.GetErc20Keeper().BurnCoins(ctx, sender, math.NewIntFromBigInt(amount), expPair.Erc20Address) + if tc.expErr { + suite.Require().Error(err, "expected transfer transaction to fail") + suite.Require().Contains(err.Error(), tc.errContains, "expected transfer transaction to fail with specific error") + } else { + suite.Require().NoError(err, "expected transfer transaction succeeded") + tc.postCheck() + } + }) + } +} diff --git a/tests/integration/precompiles/erc20/test_erc20.go b/tests/integration/precompiles/erc20/test_erc20.go index 227ac20a2..63692441e 100644 --- a/tests/integration/precompiles/erc20/test_erc20.go +++ b/tests/integration/precompiles/erc20/test_erc20.go @@ -20,6 +20,10 @@ func (s *PrecompileTestSuite) TestIsTransaction() { s.Require().False(s.precompile.IsTransaction(&method)) method = s.precompile.Methods[erc20.TotalSupplyMethod] s.Require().False(s.precompile.IsTransaction(&method)) + method = s.precompile.Methods[erc20.AllowanceMethod] + s.Require().False(s.precompile.IsTransaction(&method)) + method = s.precompile.Methods[erc20.OwnerMethod] + s.Require().False(s.precompile.IsTransaction(&method)) // Transactions method = s.precompile.Methods[erc20.ApproveMethod] @@ -28,6 +32,16 @@ func (s *PrecompileTestSuite) TestIsTransaction() { s.Require().True(s.precompile.IsTransaction(&method)) method = s.precompile.Methods[erc20.TransferFromMethod] s.Require().True(s.precompile.IsTransaction(&method)) + method = s.precompile.Methods[erc20.MintMethod] + s.Require().True(s.precompile.IsTransaction(&method)) + method = s.precompile.Methods[erc20.BurnMethod] + s.Require().True(s.precompile.IsTransaction(&method)) + method = s.precompile.Methods[erc20.BurnFromMethod] + s.Require().True(s.precompile.IsTransaction(&method)) + method = s.precompile.Methods[erc20.Burn0Method] + s.Require().True(s.precompile.IsTransaction(&method)) + method = s.precompile.Methods[erc20.TransferOwnershipMethod] + s.Require().True(s.precompile.IsTransaction(&method)) } func (s *PrecompileTestSuite) TestRequiredGas() { @@ -119,6 +133,24 @@ func (s *PrecompileTestSuite) TestRequiredGas() { }, expGas: erc20.GasAllowance, }, + { + name: erc20.OwnerMethod, + malleate: func() []byte { + bz, err := s.precompile.Pack(erc20.OwnerMethod) + s.Require().NoError(err, "expected no error packing ABI") + return bz + }, + expGas: erc20.GasBalanceOf, + }, + { + name: erc20.TransferOwnershipMethod, + malleate: func() []byte { + bz, err := s.precompile.Pack(erc20.TransferOwnershipMethod, s.keyring.GetAddr(0)) + s.Require().NoError(err, "expected no error packing ABI") + return bz + }, + expGas: erc20.GasTransferOwnership, + }, { name: "invalid method", malleate: func() []byte { diff --git a/tests/integration/precompiles/erc20/test_mint.go b/tests/integration/precompiles/erc20/test_mint.go new file mode 100644 index 000000000..71a246027 --- /dev/null +++ b/tests/integration/precompiles/erc20/test_mint.go @@ -0,0 +1,265 @@ +package erc20 + +import ( + "fmt" + "math/big" + + utiltx "github.com/cosmos/evm/testutil/tx" + "github.com/cosmos/evm/x/erc20/types" + + "cosmossdk.io/math" + + sdk "github.com/cosmos/cosmos-sdk/types" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" +) + +func (suite *PrecompileTestSuite) TestMintingEnabled() { + var ctx sdk.Context + sender := sdk.AccAddress(utiltx.GenerateAddress().Bytes()) + receiver := sdk.AccAddress(utiltx.GenerateAddress().Bytes()) + expPair := types.NewTokenPair(utiltx.GenerateAddress(), "coin", types.OWNER_MODULE) + id := expPair.GetID() + + testCases := []struct { + name string + malleate func() + expPass bool + }{ + { + "conversion is disabled globally", + func() { + params := types.DefaultParams() + params.EnableErc20 = false + suite.network.App.GetErc20Keeper().SetParams(ctx, params) //nolint:errcheck + }, + false, + }, + { + "token pair not found", + func() {}, + false, + }, + { + "conversion is disabled for the given pair", + func() { + expPair.Enabled = false + suite.network.App.GetErc20Keeper().SetTokenPair(ctx, expPair) + suite.network.App.GetErc20Keeper().SetDenomMap(ctx, expPair.Denom, id) + suite.network.App.GetErc20Keeper().SetERC20Map(ctx, expPair.GetERC20Contract(), id) + }, + false, + }, + { + "token transfers are disabled", + func() { + expPair.Enabled = true + suite.network.App.GetErc20Keeper().SetTokenPair(ctx, expPair) + suite.network.App.GetErc20Keeper().SetDenomMap(ctx, expPair.Denom, id) + suite.network.App.GetErc20Keeper().SetERC20Map(ctx, expPair.GetERC20Contract(), id) + + suite.network.App.GetBankKeeper().SetSendEnabled(ctx, expPair.Denom, false) + }, + false, + }, + { + "token not registered", + func() { + suite.network.App.GetErc20Keeper().SetDenomMap(ctx, expPair.Denom, id) + suite.network.App.GetErc20Keeper().SetERC20Map(ctx, expPair.GetERC20Contract(), id) + }, + false, + }, + { + "receiver address is blocked (module account)", + func() { + suite.network.App.GetErc20Keeper().SetTokenPair(ctx, expPair) + suite.network.App.GetErc20Keeper().SetDenomMap(ctx, expPair.Denom, id) + suite.network.App.GetErc20Keeper().SetERC20Map(ctx, expPair.GetERC20Contract(), id) + + acc := suite.network.App.GetAccountKeeper().GetModuleAccount(ctx, types.ModuleName) + receiver = acc.GetAddress() + }, + false, + }, + { + "ok", + func() { + suite.network.App.GetErc20Keeper().SetTokenPair(ctx, expPair) + suite.network.App.GetErc20Keeper().SetDenomMap(ctx, expPair.Denom, id) + suite.network.App.GetErc20Keeper().SetERC20Map(ctx, expPair.GetERC20Contract(), id) + + receiver = sdk.AccAddress(utiltx.GenerateAddress().Bytes()) + }, + true, + }, + } + + for _, tc := range testCases { + suite.Run(fmt.Sprintf("Case %s", tc.name), func() { + suite.SetupTest() // reset + ctx = suite.network.GetContext() + + tc.malleate() + + pair, err := suite.network.App.GetErc20Keeper().MintingEnabled(ctx, sender, receiver, expPair.Erc20Address) + if tc.expPass { + suite.Require().NoError(err) + suite.Require().Equal(expPair, pair) + } else { + suite.Require().Error(err) + } + }) + } +} + +func (suite *PrecompileTestSuite) TestMintCoins() { + var ctx sdk.Context + sender := sdk.AccAddress(utiltx.GenerateAddress().Bytes()) + to := sdk.AccAddress(utiltx.GenerateAddress().Bytes()) + expPair := types.NewTokenPair(utiltx.GenerateAddress(), "coin", types.OWNER_MODULE) + expPair.SetOwnerAddress(sender.String()) + amount := big.NewInt(1000000) + id := expPair.GetID() + + testcases := []struct { + name string + malleate func() + postCheck func() + expErr bool + errContains string + }{ + { + "fail - conversion is disabled globally", + func() { + params := types.DefaultParams() + params.EnableErc20 = false + suite.network.App.GetErc20Keeper().SetParams(ctx, params) //nolint:errcheck + }, + func() {}, + true, + "", + }, + { + "fail - token pair not found", + func() {}, + func() {}, + true, + "", + }, + { + "fail - conversion is disabled for the given pair", + func() { + expPair.Enabled = false + suite.network.App.GetErc20Keeper().SetTokenPair(ctx, expPair) + suite.network.App.GetErc20Keeper().SetDenomMap(ctx, expPair.Denom, id) + suite.network.App.GetErc20Keeper().SetERC20Map(ctx, expPair.GetERC20Contract(), id) + }, + func() {}, + true, + "", + }, + { + "fail - token transfers are disabled", + func() { + expPair.Enabled = true + suite.network.App.GetErc20Keeper().SetTokenPair(ctx, expPair) + suite.network.App.GetErc20Keeper().SetDenomMap(ctx, expPair.Denom, id) + suite.network.App.GetErc20Keeper().SetERC20Map(ctx, expPair.GetERC20Contract(), id) + + params := banktypes.DefaultParams() + params.SendEnabled = []*banktypes.SendEnabled{ + {Denom: expPair.Denom, Enabled: false}, + } + err := suite.network.App.GetBankKeeper().SetParams(ctx, params) + suite.Require().NoError(err) + }, + func() {}, + true, + "", + }, + { + "fail - token not registered", + func() { + suite.network.App.GetErc20Keeper().SetDenomMap(ctx, expPair.Denom, id) + suite.network.App.GetErc20Keeper().SetERC20Map(ctx, expPair.GetERC20Contract(), id) + }, + func() {}, + true, + "", + }, + { + "fail - receiver address is blocked (module account)", + func() { + suite.network.App.GetErc20Keeper().SetTokenPair(ctx, expPair) + suite.network.App.GetErc20Keeper().SetDenomMap(ctx, expPair.Denom, id) + suite.network.App.GetErc20Keeper().SetERC20Map(ctx, expPair.GetERC20Contract(), id) + + acc := suite.network.App.GetAccountKeeper().GetModuleAccount(ctx, types.ModuleName) + to = acc.GetAddress() + }, + func() {}, + true, + "", + }, + { + "fail - pair is not native coin", + func() { + expPair.ContractOwner = types.OWNER_EXTERNAL + suite.network.App.GetErc20Keeper().SetTokenPair(ctx, expPair) + suite.network.App.GetErc20Keeper().SetDenomMap(ctx, expPair.Denom, id) + suite.network.App.GetErc20Keeper().SetERC20Map(ctx, expPair.GetERC20Contract(), id) + + to = sdk.AccAddress(utiltx.GenerateAddress().Bytes()) + }, + func() {}, + true, + types.ErrNonNativeCoinMintingDisabled.Error(), + }, + { + "fail - minter is not the owner", + func() { + expPair.ContractOwner = types.OWNER_MODULE + expPair.SetOwnerAddress(sdk.AccAddress(utiltx.GenerateAddress().Bytes()).String()) + suite.network.App.GetErc20Keeper().SetTokenPair(ctx, expPair) + suite.network.App.GetErc20Keeper().SetDenomMap(ctx, expPair.Denom, id) + suite.network.App.GetErc20Keeper().SetERC20Map(ctx, expPair.GetERC20Contract(), id) + }, + func() {}, + true, + types.ErrMinterIsNotOwner.Error(), + }, + { + "pass", + func() { + expPair.SetOwnerAddress(sender.String()) + suite.network.App.GetErc20Keeper().SetTokenPair(ctx, expPair) + suite.network.App.GetErc20Keeper().SetDenomMap(ctx, expPair.Denom, id) + suite.network.App.GetErc20Keeper().SetERC20Map(ctx, expPair.GetERC20Contract(), id) + + to = sdk.AccAddress(utiltx.GenerateAddress().Bytes()) + }, + func() {}, + false, + "", + }, + } + + for _, tc := range testcases { + suite.Run(tc.name, func() { + suite.SetupTest() + + ctx = suite.network.GetContext() + + tc.malleate() + + err := suite.network.App.GetErc20Keeper().MintCoins(ctx, sender, to, math.NewIntFromBigInt(amount), expPair.Erc20Address) + if tc.expErr { + suite.Require().Error(err, "expected transfer transaction to fail") + suite.Require().Contains(err.Error(), tc.errContains, "expected transfer transaction to fail with specific error") + } else { + suite.Require().NoError(err, "expected transfer transaction succeeded") + tc.postCheck() + } + }) + } +} diff --git a/tests/integration/precompiles/erc20/test_params.go b/tests/integration/precompiles/erc20/test_params.go new file mode 100644 index 000000000..e40f60ec3 --- /dev/null +++ b/tests/integration/precompiles/erc20/test_params.go @@ -0,0 +1,38 @@ +package erc20 + +import ( + "github.com/cosmos/evm/x/erc20/types" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +func (suite *PrecompileTestSuite) TestParams() { + var ctx sdk.Context + + testCases := []struct { + name string + paramsFun func() interface{} + getFun func() interface{} + expected bool + }{ + { + "success - Checks if the default params are set correctly", + func() interface{} { + return types.DefaultParams() + }, + func() interface{} { + return suite.network.App.GetErc20Keeper().GetParams(ctx) + }, + true, + }, + } + + for _, tc := range testCases { + suite.Run(tc.name, func() { + suite.SetupTest() + ctx = suite.network.GetContext() + + suite.Require().Equal(tc.paramsFun(), tc.getFun()) + }) + } +} diff --git a/tests/integration/precompiles/erc20/test_token_pairs.go b/tests/integration/precompiles/erc20/test_token_pairs.go new file mode 100644 index 000000000..ad1565515 --- /dev/null +++ b/tests/integration/precompiles/erc20/test_token_pairs.go @@ -0,0 +1,492 @@ +package erc20 + +import ( + "fmt" + + "github.com/ethereum/go-ethereum/common" + + testconstants "github.com/cosmos/evm/testutil/constants" + utiltx "github.com/cosmos/evm/testutil/tx" + "github.com/cosmos/evm/x/erc20/types" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +func (suite *PrecompileTestSuite) TestGetTokenPairs() { + var ( + ctx sdk.Context + expRes []types.TokenPair + ) + + testCases := []struct { + name string + malleate func() + }{ + { + "no pair registered", func() { + // Account for the token pair created during SetupTest() + expRes = testconstants.ExampleTokenPairs + // Get the token pair created during setup + tokenPairID := suite.network.App.GetErc20Keeper().GetDenomMap(suite.network.GetContext(), suite.tokenDenom) + if tokenPairID != nil { + tokenPair, found := suite.network.App.GetErc20Keeper().GetTokenPair(suite.network.GetContext(), tokenPairID) + if found { + expRes = append(expRes, tokenPair) + } + } + }, + }, + { + "1 pair registered", + func() { + pair := types.NewTokenPair(utiltx.GenerateAddress(), "coin", types.OWNER_MODULE) + suite.network.App.GetErc20Keeper().SetTokenPair(ctx, pair) + expRes = testconstants.ExampleTokenPairs + // Get the token pair created during setup + tokenPairID := suite.network.App.GetErc20Keeper().GetDenomMap(suite.network.GetContext(), suite.tokenDenom) + if tokenPairID != nil { + tokenPair, found := suite.network.App.GetErc20Keeper().GetTokenPair(suite.network.GetContext(), tokenPairID) + if found { + expRes = append(expRes, tokenPair) + } + } + expRes = append(expRes, pair) + }, + }, + { + "2 pairs registered", + func() { + pair := types.NewTokenPair(utiltx.GenerateAddress(), "coin", types.OWNER_MODULE) + pair2 := types.NewTokenPair(utiltx.GenerateAddress(), "coin2", types.OWNER_MODULE) + suite.network.App.GetErc20Keeper().SetTokenPair(ctx, pair) + suite.network.App.GetErc20Keeper().SetTokenPair(ctx, pair2) + expRes = testconstants.ExampleTokenPairs + // Get the token pair created during setup + tokenPairID := suite.network.App.GetErc20Keeper().GetDenomMap(suite.network.GetContext(), suite.tokenDenom) + if tokenPairID != nil { + tokenPair, found := suite.network.App.GetErc20Keeper().GetTokenPair(suite.network.GetContext(), tokenPairID) + if found { + expRes = append(expRes, tokenPair) + } + } + expRes = append(expRes, []types.TokenPair{pair, pair2}...) + }, + }, + } + for _, tc := range testCases { + suite.Run(fmt.Sprintf("Case %s", tc.name), func() { + suite.SetupTest() // reset + ctx = suite.network.GetContext() + + tc.malleate() + res := suite.network.App.GetErc20Keeper().GetTokenPairs(ctx) + + suite.Require().ElementsMatch(expRes, res, tc.name) + }) + } +} + +func (suite *PrecompileTestSuite) TestGetTokenPairID() { + baseDenom, err := sdk.GetBaseDenom() + suite.Require().NoError(err, "failed to get base denom") + + pair := types.NewTokenPair(utiltx.GenerateAddress(), baseDenom, types.OWNER_MODULE) + + testCases := []struct { + name string + token string + expID []byte + }{ + {"nil token", "", nil}, + {"valid hex token", utiltx.GenerateAddress().Hex(), []byte{}}, + {"valid hex token", utiltx.GenerateAddress().String(), []byte{}}, + } + for _, tc := range testCases { + suite.SetupTest() + ctx := suite.network.GetContext() + + suite.network.App.GetErc20Keeper().SetTokenPair(ctx, pair) + + id := suite.network.App.GetErc20Keeper().GetTokenPairID(ctx, tc.token) + if id != nil { + suite.Require().Equal(tc.expID, id, tc.name) + } else { + suite.Require().Nil(id) + } + } +} + +func (suite *PrecompileTestSuite) TestGetTokenPair() { + baseDenom, err := sdk.GetBaseDenom() + suite.Require().NoError(err, "failed to get base denom") + + pair := types.NewTokenPair(utiltx.GenerateAddress(), baseDenom, types.OWNER_MODULE) + + testCases := []struct { + name string + id []byte + ok bool + }{ + {"nil id", nil, false}, + {"valid id", pair.GetID(), true}, + {"pair not found", []byte{}, false}, + } + for _, tc := range testCases { + suite.SetupTest() + ctx := suite.network.GetContext() + + suite.network.App.GetErc20Keeper().SetTokenPair(ctx, pair) + p, found := suite.network.App.GetErc20Keeper().GetTokenPair(ctx, tc.id) + if tc.ok { + suite.Require().True(found, tc.name) + suite.Require().Equal(pair, p, tc.name) + } else { + suite.Require().False(found, tc.name) + } + } +} + +func (suite *PrecompileTestSuite) TestDeleteTokenPair() { + tokenDenom := "random" + + var ctx sdk.Context + pair := types.NewTokenPair(utiltx.GenerateAddress(), tokenDenom, types.OWNER_MODULE) + id := pair.GetID() + + testCases := []struct { + name string + id []byte + malleate func() + ok bool + }{ + {"nil id", nil, func() {}, false}, + {"pair not found", []byte{}, func() {}, false}, + {"valid id", id, func() {}, true}, + { + "delete tokenpair", + id, + func() { + suite.network.App.GetErc20Keeper().DeleteTokenPair(ctx, pair) + }, + false, + }, + } + for _, tc := range testCases { + suite.SetupTest() + ctx = suite.network.GetContext() + err := suite.network.App.GetErc20Keeper().SetToken(ctx, pair) + suite.Require().NoError(err) + + tc.malleate() + p, found := suite.network.App.GetErc20Keeper().GetTokenPair(ctx, tc.id) + if tc.ok { + suite.Require().True(found, tc.name) + suite.Require().Equal(pair, p, tc.name) + } else { + suite.Require().False(found, tc.name) + } + } +} + +func (suite *PrecompileTestSuite) TestIsTokenPairRegistered() { + baseDenom, err := sdk.GetBaseDenom() + suite.Require().NoError(err, "failed to get base denom") + + var ctx sdk.Context + pair := types.NewTokenPair(utiltx.GenerateAddress(), baseDenom, types.OWNER_MODULE) + + testCases := []struct { + name string + id []byte + ok bool + }{ + {"valid id", pair.GetID(), true}, + {"pair not found", []byte{}, false}, + } + for _, tc := range testCases { + suite.SetupTest() + ctx = suite.network.GetContext() + + suite.network.App.GetErc20Keeper().SetTokenPair(ctx, pair) + found := suite.network.App.GetErc20Keeper().IsTokenPairRegistered(ctx, tc.id) + if tc.ok { + suite.Require().True(found, tc.name) + } else { + suite.Require().False(found, tc.name) + } + } +} + +func (suite *PrecompileTestSuite) TestIsERC20Registered() { + var ctx sdk.Context + addr := utiltx.GenerateAddress() + pair := types.NewTokenPair(addr, "coin", types.OWNER_MODULE) + + testCases := []struct { + name string + erc20 common.Address + malleate func() + ok bool + }{ + {"nil erc20 address", common.Address{}, func() {}, false}, + {"valid erc20 address", pair.GetERC20Contract(), func() {}, true}, + { + "deleted erc20 map", + pair.GetERC20Contract(), + func() { + suite.network.App.GetErc20Keeper().DeleteTokenPair(ctx, pair) + }, + false, + }, + } + for _, tc := range testCases { + suite.SetupTest() + ctx = suite.network.GetContext() + + err := suite.network.App.GetErc20Keeper().SetToken(ctx, pair) + suite.Require().NoError(err) + + tc.malleate() + + found := suite.network.App.GetErc20Keeper().IsERC20Registered(ctx, tc.erc20) + + if tc.ok { + suite.Require().True(found, tc.name) + } else { + suite.Require().False(found, tc.name) + } + } +} + +func (suite *PrecompileTestSuite) TestIsDenomRegistered() { + var ctx sdk.Context + addr := utiltx.GenerateAddress() + pair := types.NewTokenPair(addr, "coin", types.OWNER_MODULE) + + testCases := []struct { + name string + denom string + malleate func() + ok bool + }{ + {"empty denom", "", func() {}, false}, + {"valid denom", pair.GetDenom(), func() {}, true}, + { + "deleted denom map", + pair.GetDenom(), + func() { + suite.network.App.GetErc20Keeper().DeleteTokenPair(ctx, pair) + }, + false, + }, + } + for _, tc := range testCases { + suite.SetupTest() + ctx = suite.network.GetContext() + + err := suite.network.App.GetErc20Keeper().SetToken(ctx, pair) + suite.Require().NoError(err) + + tc.malleate() + + found := suite.network.App.GetErc20Keeper().IsDenomRegistered(ctx, tc.denom) + + if tc.ok { + suite.Require().True(found, tc.name) + } else { + suite.Require().False(found, tc.name) + } + } +} + +func (suite *PrecompileTestSuite) TestGetTokenDenom() { + var ctx sdk.Context + tokenAddress := utiltx.GenerateAddress() + tokenDenom := "token" + + testCases := []struct { + name string + tokenDenom string + malleate func() + expError bool + errContains string + }{ + { + "denom found", + tokenDenom, + func() { + pair := types.NewTokenPair(tokenAddress, tokenDenom, types.OWNER_MODULE) + suite.network.App.GetErc20Keeper().SetTokenPair(ctx, pair) + suite.network.App.GetErc20Keeper().SetERC20Map(ctx, tokenAddress, pair.GetID()) + }, + true, + "", + }, + { + "denom not found", + tokenDenom, + func() { + address := utiltx.GenerateAddress() + pair := types.NewTokenPair(address, tokenDenom, types.OWNER_MODULE) + suite.network.App.GetErc20Keeper().SetTokenPair(ctx, pair) + suite.network.App.GetErc20Keeper().SetERC20Map(ctx, address, pair.GetID()) + }, + false, + fmt.Sprintf("token '%s' not registered", tokenAddress), + }, + } + for _, tc := range testCases { + suite.Run(fmt.Sprintf("Case %s", tc.name), func() { + suite.SetupTest() + ctx = suite.network.GetContext() + + tc.malleate() + res, err := suite.network.App.GetErc20Keeper().GetTokenDenom(ctx, tokenAddress) + + if tc.expError { + suite.Require().NoError(err) + suite.Require().Equal(res, tokenDenom) + } else { + suite.Require().Error(err, "expected an error while getting the token denom") + suite.Require().ErrorContains(err, tc.errContains) + } + }) + } +} + +func (suite *PrecompileTestSuite) TestSetToken() { + testCases := []struct { + name string + pair1 types.TokenPair + pair2 types.TokenPair + expError bool + }{ + {"same denom", types.NewTokenPair(common.HexToAddress("0x1"), "denom1", types.OWNER_MODULE), types.NewTokenPair(common.HexToAddress("0x2"), "denom1", types.OWNER_MODULE), true}, + {"same erc20", types.NewTokenPair(common.HexToAddress("0x1"), "denom1", types.OWNER_MODULE), types.NewTokenPair(common.HexToAddress("0x1"), "denom2", types.OWNER_MODULE), true}, + {"same pair", types.NewTokenPair(common.HexToAddress("0x1"), "denom1", types.OWNER_MODULE), types.NewTokenPair(common.HexToAddress("0x1"), "denom1", types.OWNER_MODULE), true}, + {"two different pairs", types.NewTokenPair(common.HexToAddress("0x1"), "denom1", types.OWNER_MODULE), types.NewTokenPair(common.HexToAddress("0x2"), "denom2", types.OWNER_MODULE), false}, + } + for _, tc := range testCases { + suite.SetupTest() + ctx := suite.network.GetContext() + + err := suite.network.App.GetErc20Keeper().SetToken(ctx, tc.pair1) + suite.Require().NoError(err) + err = suite.network.App.GetErc20Keeper().SetToken(ctx, tc.pair2) + if tc.expError { + suite.Require().Error(err) + } else { + suite.Require().NoError(err) + } + } +} + +func (suite *PrecompileTestSuite) TestGetTokenPairOwnerAddress() { + var ctx sdk.Context + + tokenAddress := utiltx.GenerateAddress() + ownerAddress := utiltx.GenerateAddress() + testCases := []struct { + name string + ownerAddress sdk.AccAddress + malleate func() + expError bool + errContains string + }{ + { + "owner address found", + sdk.AccAddress(ownerAddress.Bytes()), + func() { + pair := types.NewTokenPair(tokenAddress, "coin", types.OWNER_MODULE) + pair.SetOwnerAddress(sdk.AccAddress(ownerAddress.Bytes()).String()) + suite.network.App.GetErc20Keeper().SetTokenPair(ctx, pair) + suite.network.App.GetErc20Keeper().SetERC20Map(ctx, tokenAddress, pair.GetID()) + }, + true, + "", + }, + { + "owner address not found", + sdk.AccAddress(utiltx.GenerateAddress().Bytes()), + func() { + address := utiltx.GenerateAddress() + pair := types.NewTokenPair(address, "coin", types.OWNER_MODULE) + pair.SetOwnerAddress(sdk.AccAddress(address.Bytes()).String()) + suite.network.App.GetErc20Keeper().SetTokenPair(ctx, pair) + suite.network.App.GetErc20Keeper().SetERC20Map(ctx, address, pair.GetID()) + }, + false, + fmt.Sprintf("token '%s' not registered", tokenAddress), + }, + } + for _, tc := range testCases { + suite.Run(fmt.Sprintf("Case %s", tc.name), func() { + suite.SetupTest() // reset + + ctx = suite.network.GetContext() + + tc.malleate() + res, err := suite.network.App.GetErc20Keeper().GetTokenPairOwnerAddress(ctx, tokenAddress.Hex()) + + if tc.expError { + suite.Require().NoError(err) + suite.Require().Equal(res.String(), tc.ownerAddress.String()) + } else { + suite.Require().Error(err, "expected an error while getting the token denom") + suite.Require().ErrorContains(err, tc.errContains) + } + }) + } +} + +func (suite *PrecompileTestSuite) TestSetTokenPairOwnerAddress() { + var ctx sdk.Context + tokenAddress := utiltx.GenerateAddress() + newOwnerAddress := utiltx.GenerateAddress() + + testCases := []struct { + name string + newOwnerAddress sdk.AccAddress + malleate func() types.TokenPair + postCheck func(*types.TokenPair, string) error + expError bool + errContains string + }{ + { + "owner address set", + sdk.AccAddress(newOwnerAddress.Bytes()), + func() types.TokenPair { + pair := types.NewTokenPair(tokenAddress, "coin", types.OWNER_MODULE) + pair.SetOwnerAddress(sdk.AccAddress(utiltx.GenerateAddress().Bytes()).String()) + suite.network.App.GetErc20Keeper().SetTokenPair(ctx, pair) + suite.network.App.GetErc20Keeper().SetERC20Map(ctx, tokenAddress, pair.GetID()) + return pair + }, + func(tp *types.TokenPair, expectedNewOwner string) error { + pair, found := suite.network.App.GetErc20Keeper().GetTokenPair(ctx, tp.GetID()) + if !found { + return fmt.Errorf("token pair not found") + } + + if pair.OwnerAddress != expectedNewOwner { + return fmt.Errorf("owner address mismatch: expected %s, got %s", expectedNewOwner, pair.OwnerAddress) + } + return nil + }, + true, + "", + }, + } + for _, tc := range testCases { + suite.Run(fmt.Sprintf("Case %s", tc.name), func() { + suite.SetupTest() // reset + + ctx = suite.network.GetContext() + + pair := tc.malleate() + suite.network.App.GetErc20Keeper().SetTokenPairOwnerAddress(ctx, pair, tc.newOwnerAddress.String()) + + suite.Require().Nil(tc.postCheck(&pair, tc.newOwnerAddress.String())) + }) + } +} diff --git a/tests/integration/precompiles/erc20/test_tx.go b/tests/integration/precompiles/erc20/test_tx.go index e50f3425a..0555baffc 100644 --- a/tests/integration/precompiles/erc20/test_tx.go +++ b/tests/integration/precompiles/erc20/test_tx.go @@ -3,6 +3,7 @@ package erc20 import ( "math/big" + "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/vm" "github.com/holiman/uint256" @@ -10,6 +11,8 @@ import ( "github.com/cosmos/evm/precompiles/common/mocks" "github.com/cosmos/evm/precompiles/erc20" "github.com/cosmos/evm/precompiles/testutil" + "github.com/cosmos/evm/testutil/keyring" + utiltx "github.com/cosmos/evm/testutil/tx" erc20types "github.com/cosmos/evm/x/erc20/types" "github.com/cosmos/evm/x/vm/statedb" vmtypes "github.com/cosmos/evm/x/vm/types" @@ -367,3 +370,532 @@ func (s *PrecompileTestSuite) TestSend() { }) } } + +func (s *PrecompileTestSuite) TestMint() { + method := s.precompile.Methods[erc20.MintMethod] + sender := s.keyring.GetKey(0) + spender := s.keyring.GetKey(1) + + testcases := []struct { + name string + malleate func() ([]interface{}, erc20types.TokenPair) + postCheck func() + expErr bool + errContains string + }{ + { + "fail - negative amount", + func() ([]interface{}, erc20types.TokenPair) { + tokenPair := erc20types.NewTokenPair(utiltx.GenerateAddress(), s.tokenDenom, erc20types.OWNER_MODULE) + tokenPair.SetOwnerAddress(sender.AccAddr.String()) + s.network.App.GetErc20Keeper().SetTokenPair(s.network.GetContext(), tokenPair) + s.network.App.GetErc20Keeper().SetDenomMap(s.network.GetContext(), tokenPair.Denom, tokenPair.GetID()) + s.network.App.GetErc20Keeper().SetERC20Map(s.network.GetContext(), tokenPair.GetERC20Contract(), tokenPair.GetID()) + return []interface{}{toAddr, big.NewInt(-1)}, tokenPair + }, + func() {}, + true, + "-1xmpl: invalid coins", + }, + { + "fail - invalid to address", + func() ([]interface{}, erc20types.TokenPair) { + tokenPair := erc20types.NewTokenPair(utiltx.GenerateAddress(), s.tokenDenom, erc20types.OWNER_MODULE) + tokenPair.SetOwnerAddress(sender.AccAddr.String()) + s.network.App.GetErc20Keeper().SetTokenPair(s.network.GetContext(), tokenPair) + s.network.App.GetErc20Keeper().SetDenomMap(s.network.GetContext(), tokenPair.Denom, tokenPair.GetID()) + s.network.App.GetErc20Keeper().SetERC20Map(s.network.GetContext(), tokenPair.GetERC20Contract(), tokenPair.GetID()) + return []interface{}{"", big.NewInt(100)}, tokenPair + }, + func() {}, + true, + "invalid to address", + }, + { + "fail - invalid amount", + func() ([]interface{}, erc20types.TokenPair) { + tokenPair := erc20types.NewTokenPair(utiltx.GenerateAddress(), s.tokenDenom, erc20types.OWNER_MODULE) + tokenPair.SetOwnerAddress(sender.AccAddr.String()) + s.network.App.GetErc20Keeper().SetTokenPair(s.network.GetContext(), tokenPair) + s.network.App.GetErc20Keeper().SetDenomMap(s.network.GetContext(), tokenPair.Denom, tokenPair.GetID()) + s.network.App.GetErc20Keeper().SetERC20Map(s.network.GetContext(), tokenPair.GetERC20Contract(), tokenPair.GetID()) + return []interface{}{toAddr, ""}, tokenPair + }, + func() {}, + true, + "invalid amount", + }, + { + "fail - minter is not the owner", + func() ([]interface{}, erc20types.TokenPair) { + tokenPair := erc20types.NewTokenPair(utiltx.GenerateAddress(), s.tokenDenom, erc20types.OWNER_MODULE) + tokenPair.SetOwnerAddress(sdk.AccAddress(utiltx.GenerateAddress().Bytes()).String()) + s.network.App.GetErc20Keeper().SetTokenPair(s.network.GetContext(), tokenPair) + s.network.App.GetErc20Keeper().SetDenomMap(s.network.GetContext(), tokenPair.Denom, tokenPair.GetID()) + s.network.App.GetErc20Keeper().SetERC20Map(s.network.GetContext(), tokenPair.GetERC20Contract(), tokenPair.GetID()) + return []interface{}{spender.Addr, big.NewInt(100)}, tokenPair + }, + func() {}, + true, + erc20types.ErrMinterIsNotOwner.Error(), + }, + { + "pass", + func() ([]interface{}, erc20types.TokenPair) { + tokenPair := erc20types.NewTokenPair(utiltx.GenerateAddress(), s.tokenDenom, erc20types.OWNER_MODULE) + tokenPair.SetOwnerAddress(sender.AccAddr.String()) + s.network.App.GetErc20Keeper().SetTokenPair(s.network.GetContext(), tokenPair) + s.network.App.GetErc20Keeper().SetDenomMap(s.network.GetContext(), tokenPair.Denom, tokenPair.GetID()) + s.network.App.GetErc20Keeper().SetERC20Map(s.network.GetContext(), tokenPair.GetERC20Contract(), tokenPair.GetID()) + + coins := sdk.Coins{{Denom: tokenDenom, Amount: math.NewInt(100)}} + err := s.network.App.GetBankKeeper().MintCoins(s.network.GetContext(), erc20types.ModuleName, coins) + s.Require().NoError(err, "failed to mint coins") + err = s.network.App.GetBankKeeper().SendCoinsFromModuleToAccount(s.network.GetContext(), erc20types.ModuleName, sdk.AccAddress(toAddr.Bytes()), coins) + s.Require().NoError(err, "failed to send coins from module to account") + return []interface{}{spender.Addr, big.NewInt(100)}, tokenPair + }, + func() { + toAddrBalance := s.network.App.GetBankKeeper().GetBalance(s.network.GetContext(), toAddr.Bytes(), tokenDenom) + s.Require().Equal(big.NewInt(100), toAddrBalance.Amount.BigInt(), "expected toAddr to have 100 XMPL") + }, + false, + "", + }, + } + + for _, tc := range testcases { + s.Run(tc.name, func() { + s.SetupTest() + stateDB := s.network.GetStateDB() + + args, tokenPair := tc.malleate() + + precompile, err := setupERC20PrecompileForTokenPair(*s.network, tokenPair) + s.Require().NoError(err, "failed to set up %q erc20 precompile", tokenPair.Denom) + + var contract *vm.Contract + contract, ctx := testutil.NewPrecompileContract(s.T(), s.network.GetContext(), sender.Addr, precompile.Address(), 0) + + // Mint some coins to the module account and then send to the from address + err = s.network.App.GetBankKeeper().MintCoins(s.network.GetContext(), erc20types.ModuleName, XMPLCoin) + s.Require().NoError(err, "failed to mint coins") + err = s.network.App.GetBankKeeper().SendCoinsFromModuleToAccount(s.network.GetContext(), erc20types.ModuleName, sender.AccAddr, XMPLCoin) + s.Require().NoError(err, "failed to send coins from module to account") + + _, err = precompile.Mint(ctx, contract, stateDB, &method, args) + if tc.expErr { + s.Require().Error(err, "expected transfer transaction to fail") + s.Require().Contains(err.Error(), tc.errContains, "expected transfer transaction to fail with specific error") + } else { + s.Require().NoError(err, "expected transfer transaction succeeded") + tc.postCheck() + } + }) + } +} + +func (s *PrecompileTestSuite) TestBurn() { + method := s.precompile.Methods[erc20.BurnMethod] + amount := int64(100) + + testcases := []struct { + name string + contractDeployer keyring.Key + prefundedAccount keyring.Key + malleate func() (keyring.Key, keyring.Key, []interface{}) + postCheck func() + expErr bool + errContains string + }{ + { + "fail - invalid args", + s.keyring.GetKey(0), + s.keyring.GetKey(0), + func() (keyring.Key, keyring.Key, []interface{}) { + return s.keyring.GetKey(0), s.keyring.GetKey(0), []interface{}{} + }, + func() {}, + true, + "invalid number of arguments", + }, + { + "pass - burn from caller", + s.keyring.GetKey(0), + s.keyring.GetKey(0), + func() (keyring.Key, keyring.Key, []interface{}) { + return s.keyring.GetKey(0), s.keyring.GetKey(0), []interface{}{ + big.NewInt(amount), + } + }, + func() {}, + false, + "", + }, + { + "pass - burn tokens", + s.keyring.GetKey(0), + s.keyring.GetKey(1), + func() (keyring.Key, keyring.Key, []interface{}) { + s.setupSendAuthz( + s.keyring.GetAccAddr(1), + s.keyring.GetPrivKey(0), + sdk.NewCoins(sdk.NewInt64Coin(s.tokenDenom, amount)), + ) + return s.keyring.GetKey(0), s.keyring.GetKey(1), []interface{}{ + big.NewInt(amount), + } + }, + func() {}, + false, + "", + }, + } + + for _, tc := range testcases { + s.Run(tc.name, func() { + s.SetupTest() + + contractDeployer, prefundedAccount, args := tc.malleate() + + stateDB := s.network.GetStateDB() + + tokenPair := erc20types.NewTokenPair(utiltx.GenerateAddress(), s.tokenDenom, erc20types.OWNER_MODULE) + tokenPair.SetOwnerAddress(contractDeployer.AccAddr.String()) + s.network.App.GetErc20Keeper().SetTokenPair(s.network.GetContext(), tokenPair) + s.network.App.GetErc20Keeper().SetDenomMap(s.network.GetContext(), tokenPair.Denom, tokenPair.GetID()) + s.network.App.GetErc20Keeper().SetERC20Map(s.network.GetContext(), tokenPair.GetERC20Contract(), tokenPair.GetID()) + + precompile, err := setupERC20PrecompileForTokenPair(*s.network, tokenPair) + s.Require().NoError(err, "failed to set up %q erc20 precompile", tokenPair.Denom) + + var contract *vm.Contract + // For the "pass - burn from address" test, we need to use the prefunded account as the caller + // since that's the account that has the tokens to burn + callerAddr := contractDeployer.Addr + if !tc.expErr { + callerAddr = prefundedAccount.Addr + } + contract, ctx := testutil.NewPrecompileContract(s.T(), s.network.GetContext(), callerAddr, precompile.Address(), 0) + + // Mint some coins to the module account and then send to the from address + err = s.network.App.GetBankKeeper().MintCoins(s.network.GetContext(), erc20types.ModuleName, XMPLCoin) + s.Require().NoError(err, "failed to mint coins") + err = s.network.App.GetBankKeeper().SendCoinsFromModuleToAccount(s.network.GetContext(), erc20types.ModuleName, prefundedAccount.AccAddr, XMPLCoin) + s.Require().NoError(err, "failed to send coins from module to account") + + _, err = precompile.Burn(ctx, contract, stateDB, &method, args) + if tc.expErr { + s.Require().Error(err, "expected burn transaction to fail") + s.Require().Contains(err.Error(), tc.errContains, "expected burn transaction to fail with specific error") + } else { + s.Require().NoError(err, "expected transfer transaction succeeded") + tc.postCheck() + } + }) + } +} + +func (s *PrecompileTestSuite) TestBurn0() { + method := s.precompile.Methods[erc20.Burn0Method] + amount := int64(100) + + testcases := []struct { + name string + malleate func() (keyring.Key, keyring.Key, keyring.Key, []interface{}) + postCheck func() + expErr bool + errContains string + }{ + { + "should fail - empty args", + func() (keyring.Key, keyring.Key, keyring.Key, []interface{}) { + return s.keyring.GetKey(0), s.keyring.GetKey(1), s.keyring.GetKey(0), nil + }, + func() {}, + true, + "invalid number of arguments", + }, + { + "should fail - invalid spender address", + func() (keyring.Key, keyring.Key, keyring.Key, []interface{}) { + return s.keyring.GetKey(0), s.keyring.GetKey(1), s.keyring.GetKey(0), []interface{}{ + "invalid", + big.NewInt(amount), + } + }, + func() {}, + true, + "invalid spender address", + }, + { + "should fail - invalid amount", + func() (keyring.Key, keyring.Key, keyring.Key, []interface{}) { + return s.keyring.GetKey(0), s.keyring.GetKey(1), s.keyring.GetKey(0), []interface{}{ + s.keyring.GetAddr(0), + "invalid", + } + }, + func() {}, + true, + "invalid amount", + }, + { + "should fail - sender is not the owner", + func() (keyring.Key, keyring.Key, keyring.Key, []interface{}) { + return s.keyring.GetKey(1), s.keyring.GetKey(0), s.keyring.GetKey(0), []interface{}{ + s.keyring.GetAddr(0), + big.NewInt(1000), + } + }, + func() {}, + true, + "sender is not the owner", + }, + { + "should pass - valid burn0", + func() (keyring.Key, keyring.Key, keyring.Key, []interface{}) { + return s.keyring.GetKey(0), s.keyring.GetKey(1), s.keyring.GetKey(0), []interface{}{ + s.keyring.GetAddr(1), + big.NewInt(amount), + } + }, + func() {}, + false, + "", + }, + } + + for _, tc := range testcases { + s.Run(tc.name, func() { + s.SetupTest() + + contractDeployer, prefundedAccount, owner, args := tc.malleate() + + stateDB := s.network.GetStateDB() + + tokenPair := erc20types.NewTokenPair(utiltx.GenerateAddress(), s.tokenDenom, erc20types.OWNER_MODULE) + tokenPair.SetOwnerAddress(owner.AccAddr.String()) + s.network.App.GetErc20Keeper().SetTokenPair(s.network.GetContext(), tokenPair) + s.network.App.GetErc20Keeper().SetDenomMap(s.network.GetContext(), tokenPair.Denom, tokenPair.GetID()) + s.network.App.GetErc20Keeper().SetERC20Map(s.network.GetContext(), tokenPair.GetERC20Contract(), tokenPair.GetID()) + + precompile, err := setupERC20PrecompileForTokenPair(*s.network, tokenPair) + s.Require().NoError(err, "failed to set up %q erc20 precompile", tokenPair.Denom) + + var contract *vm.Contract + contract, ctx := testutil.NewPrecompileContract(s.T(), s.network.GetContext(), contractDeployer.Addr, precompile.Address(), 0) + + // Mint some coins to the module account and then send to the from address + err = s.network.App.GetBankKeeper().MintCoins(s.network.GetContext(), erc20types.ModuleName, XMPLCoin) + s.Require().NoError(err, "failed to mint coins") + err = s.network.App.GetBankKeeper().SendCoinsFromModuleToAccount(s.network.GetContext(), erc20types.ModuleName, prefundedAccount.AccAddr, XMPLCoin) + s.Require().NoError(err, "failed to send coins from module to account") + + _, err = precompile.Burn0(ctx, contract, stateDB, &method, args) + if tc.expErr { + s.Require().Error(err, "expected burn0 transaction to fail") + s.Require().Contains(err.Error(), tc.errContains, "expected burn0 transaction to fail with specific error") + } else { + s.Require().NoError(err, "expected burn0 transaction succeeded") + tc.postCheck() + } + }) + } +} + +func (s *PrecompileTestSuite) TestBurnFrom() { + method := s.precompile.Methods[erc20.BurnFromMethod] + amount := int64(100) + + testcases := []struct { + name string + malleate func() []interface{} + postCheck func() + expErr bool + errContains string + }{ + { + "should fail - empty args", + func() []interface{} { + return nil + }, + func() {}, + true, + "invalid number of arguments", + }, + { + "should fail - invalid address", + func() []interface{} { + return []interface{}{ + "invalid", + big.NewInt(amount), + } + }, + func() {}, + true, + "invalid from address", + }, + { + "should fail - invalid amount", + func() []interface{} { + return []interface{}{ + s.keyring.GetAddr(0), + "invalid", + } + }, + func() {}, + true, + "invalid amount", + }, + { + "should fail - allowance is 0", + func() []interface{} { + return []interface{}{ + s.keyring.GetAddr(0), + big.NewInt(100), + } + }, + func() {}, + true, + "", + }, + { + "should fail - allowance is less than amount", + func() []interface{} { + s.setupSendAuthz( + s.keyring.GetAccAddr(1), + s.keyring.GetPrivKey(0), + sdk.NewCoins(sdk.NewInt64Coin(s.tokenDenom, 1)), + ) + + return []interface{}{ + s.keyring.GetAddr(0), + big.NewInt(amount), + } + }, + func() {}, + true, + "", + }, + { + "should pass", + func() []interface{} { + return []interface{}{ + s.keyring.GetAddr(1), + big.NewInt(amount), + } + }, + func() {}, + false, + "", + }, + } + + for _, tc := range testcases { + s.Run(tc.name, func() { + s.SetupTest() + stateDB := s.network.GetStateDB() + + tokenPair := erc20types.NewTokenPair(utiltx.GenerateAddress(), s.tokenDenom, erc20types.OWNER_MODULE) + tokenPair.SetOwnerAddress(s.keyring.GetAddr(0).String()) + s.network.App.GetErc20Keeper().SetTokenPair(s.network.GetContext(), tokenPair) + s.network.App.GetErc20Keeper().SetDenomMap(s.network.GetContext(), tokenPair.Denom, tokenPair.GetID()) + s.network.App.GetErc20Keeper().SetERC20Map(s.network.GetContext(), tokenPair.GetERC20Contract(), tokenPair.GetID()) + + precompile, err := setupERC20PrecompileForTokenPair(*s.network, tokenPair) + s.Require().NoError(err, "failed to set up %q erc20 precompile", tokenPair.Denom) + + // Set allowance for the "should pass" test case + if !tc.expErr { + err = s.network.App.GetErc20Keeper().SetAllowance(s.network.GetContext(), precompile.Address(), s.keyring.GetAddr(1), s.keyring.GetAddr(0), big.NewInt(200)) + s.Require().NoError(err, "failed to set allowance") + } + + var contract *vm.Contract + contract, ctx := testutil.NewPrecompileContract(s.T(), s.network.GetContext(), s.keyring.GetAddr(0), precompile.Address(), 0) + + // Mint some coins to the module account and then send to the from address + err = s.network.App.GetBankKeeper().MintCoins(s.network.GetContext(), erc20types.ModuleName, XMPLCoin) + s.Require().NoError(err, "failed to mint coins") + err = s.network.App.GetBankKeeper().SendCoinsFromModuleToAccount(s.network.GetContext(), erc20types.ModuleName, s.keyring.GetAccAddr(1), XMPLCoin) + s.Require().NoError(err, "failed to send coins from module to account") + + _, err = precompile.BurnFrom(ctx, contract, stateDB, &method, tc.malleate()) + if tc.expErr { + s.Require().Error(err, "expected burn transaction to fail") + s.Require().Contains(err.Error(), tc.errContains, "expected burn transaction to fail with specific error") + } else { + s.Require().NoError(err, "expected transfer transaction succeeded") + tc.postCheck() + } + }) + } +} + +func (s *PrecompileTestSuite) TestTransferOwnership() { + method := s.precompile.Methods[erc20.TransferOwnershipMethod] + from := s.keyring.GetKey(0) + newOwner := common.Address(utiltx.GenerateAddress().Bytes()) + + testcases := []struct { + name string + malleate func() []interface{} + postCheck func() + expErr bool + errContains string + }{ + { + name: "fail - invalid number of arguments", + malleate: func() []interface{} { + return []interface{}{} + }, + expErr: true, + errContains: "invalid number of arguments; expected 1; got: 0", + }, + { + name: "fail - invalid address", + malleate: func() []interface{} { + return []interface{}{"invalid"} + }, + expErr: true, + errContains: "invalid new owner address", + }, + { + name: "pass", + malleate: func() []interface{} { + return []interface{}{newOwner} + }, + postCheck: func() {}, + }, + } + + for _, tc := range testcases { + s.Run(tc.name, func() { + s.SetupTest() + stateDB := s.network.GetStateDB() + + tokenPair := erc20types.NewTokenPair(utiltx.GenerateAddress(), s.tokenDenom, erc20types.OWNER_MODULE) + tokenPair.SetOwnerAddress(from.AccAddr.String()) + s.network.App.GetErc20Keeper().SetTokenPair(s.network.GetContext(), tokenPair) + s.network.App.GetErc20Keeper().SetDenomMap(s.network.GetContext(), tokenPair.Denom, tokenPair.GetID()) + s.network.App.GetErc20Keeper().SetERC20Map(s.network.GetContext(), tokenPair.GetERC20Contract(), tokenPair.GetID()) + + precompile, err := setupERC20PrecompileForTokenPair(*s.network, tokenPair) + s.Require().NoError(err, "failed to set up %q erc20 precompile", tokenPair.Denom) + + var contract *vm.Contract + + contract, ctx := testutil.NewPrecompileContract(s.T(), s.network.GetContext(), from.Addr, precompile.Address(), 0) + + _, err = precompile.TransferOwnership(ctx, contract, stateDB, &method, tc.malleate()) + if tc.expErr { + s.Require().Error(err) + s.Require().Contains(err.Error(), tc.errContains) + } else { + s.Require().NoError(err) + tc.postCheck() + } + }) + } +} diff --git a/tests/integration/precompiles/erc20/test_types.go b/tests/integration/precompiles/erc20/test_types.go index 46cbfecd5..4a6e668a7 100644 --- a/tests/integration/precompiles/erc20/test_types.go +++ b/tests/integration/precompiles/erc20/test_types.go @@ -300,3 +300,37 @@ func (s *PrecompileTestSuite) TestParseBalanceOfArgs() { }) } } + +func (s *PrecompileTestSuite) TestParseOwnerArgs() { + testcases := []struct { + name string + args []interface{} + expPass bool + errContains string + }{ + { + name: "pass - correct arguments", + args: []interface{}{}, + expPass: true, + }, + { + name: "fail - invalid number of arguments", + args: []interface{}{ + 1, 2, 3, + }, + errContains: "invalid number of arguments", + }, + } + + for _, tc := range testcases { + s.Run(tc.name, func() { + err := erc20.ParseOwnerArgs(tc.args) + if tc.expPass { + s.Require().NoError(err, "unexpected error parsing the owner arguments") + } else { + s.Require().Error(err, "expected an error parsing the owner arguments") + s.Require().ErrorContains(err, tc.errContains, "expected different error message") + } + }) + } +} diff --git a/tests/integration/precompiles/erc20/test_utils.go b/tests/integration/precompiles/erc20/test_utils.go index 06d6b3884..92aedb46b 100644 --- a/tests/integration/precompiles/erc20/test_utils.go +++ b/tests/integration/precompiles/erc20/test_utils.go @@ -5,6 +5,7 @@ import ( "fmt" "math/big" "slices" + "time" "github.com/ethereum/go-ethereum/accounts/abi" "github.com/ethereum/go-ethereum/common" @@ -16,6 +17,7 @@ import ( "github.com/cosmos/evm/crypto/ethsecp256k1" "github.com/cosmos/evm/precompiles/erc20" "github.com/cosmos/evm/precompiles/testutil" + commonfactory "github.com/cosmos/evm/testutil/integration/base/factory" "github.com/cosmos/evm/testutil/integration/evm/network" utiltx "github.com/cosmos/evm/testutil/tx" testutiltypes "github.com/cosmos/evm/testutil/types" @@ -28,6 +30,8 @@ import ( cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/authz" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" ) // CallType indicates which type of contract call is made during the integration tests. @@ -459,3 +463,50 @@ func GenerateAddress() common.Address { addr, _ := NewAddrKey() return addr } + +func (s *PrecompileTestSuite) setupSendAuthz( + grantee sdk.AccAddress, granterPriv cryptotypes.PrivKey, amount sdk.Coins, +) { + err := setupSendAuthz( + s.network, + s.factory, + grantee, + granterPriv, + amount, + ) + s.Require().NoError(err, "failed to set up send authorization") +} + +func setupSendAuthz( + network network.Network, + factory commonfactory.BaseTxFactory, + grantee sdk.AccAddress, + granterPriv cryptotypes.PrivKey, + amount sdk.Coins, +) error { + granter := sdk.AccAddress(granterPriv.PubKey().Address()) + expiration := network.GetContext().BlockHeader().Time.Add(time.Hour) + sendAuthz := banktypes.NewSendAuthorization( + amount, + []sdk.AccAddress{}, + ) + + msgGrant, err := authz.NewMsgGrant( + granter, + grantee, + sendAuthz, + &expiration, + ) + if err != nil { + return errorsmod.Wrap(err, "failed to create MsgGrant") + } + + // Create an authorization + txArgs := commonfactory.CosmosTxArgs{Msgs: []sdk.Msg{msgGrant}} + _, err = factory.ExecuteCosmosTx(granterPriv, txArgs) + if err != nil { + return errorsmod.Wrap(err, "failed to execute MsgGrant") + } + + return nil +} diff --git a/tests/solidity/init-node.sh b/tests/solidity/init-node.sh index 249b6a532..7a7343b74 100755 --- a/tests/solidity/init-node.sh +++ b/tests/solidity/init-node.sh @@ -80,6 +80,10 @@ jq '.app_state["mint"]["params"]["mint_denom"]="atest"' "$GENESIS" >"$TMP_GENESI # Enable precompiles in EVM params jq '.app_state["evm"]["params"]["active_static_precompiles"]=["0x0000000000000000000000000000000000000100","0x0000000000000000000000000000000000000400","0x0000000000000000000000000000000000000800","0x0000000000000000000000000000000000000801","0x0000000000000000000000000000000000000802","0x0000000000000000000000000000000000000803","0x0000000000000000000000000000000000000804"]' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" +# Enable native denomination as a token pair for STRv2 +jq '.app_state.erc20.native_precompiles=["0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE"]' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" +jq '.app_state.erc20.token_pairs=[{contract_owner:1,erc20_address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",denom:"acoin",enabled:true, "owner_address":"cosmos10jmp6sgh4cc6zt3e8gw05wavvejgr5pwsjskvv"}]' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" + # Change proposal periods to pass within a reasonable time for local testing sed -i.bak 's/"max_deposit_period": "172800s"/"max_deposit_period": "30s"/g' "$GENESIS" sed -i.bak 's/"voting_period": "172800s"/"voting_period": "30s"/g' "$GENESIS" diff --git a/tests/solidity/suites/precompiles/test/3_erc20/erc20.js b/tests/solidity/suites/precompiles/test/3_erc20/erc20.js index daedebc2b..e1a52a2fc 100644 --- a/tests/solidity/suites/precompiles/test/3_erc20/erc20.js +++ b/tests/solidity/suites/precompiles/test/3_erc20/erc20.js @@ -3,20 +3,36 @@ const hre = require('hardhat') const { findEvent, waitWithTimeout, RETRY_DELAY_FUNC} = require('../common') describe('ERC20 Precompile', function () { - let erc20, owner, spender, recipient + let erc20, erc20BurnContract, erc20Burn0Contract, owner, spender, recipient const GAS_LIMIT = 1_000_000 // skip gas estimation for simplicity + const ERC20_PRECOMPILE_ADDRESS = '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE' + + const ERC20_BURN_ABI = [ + 'function mint(address to, uint256 amount) external returns (bool)', + 'function burn(uint256 amount) external', + ] + + // Get the ERC20 precompile contract instance + const ERC20_BURN0_ABI = [ + 'function mint(address to, uint256 amount) external returns (bool)', + 'function burn(address from, uint256 amount) external', + ] + before(async function () { [owner, spender, recipient] = await hre.ethers.getSigners() erc20 = await hre.ethers.getContractAt( 'IERC20Metadata', '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE' ) + + erc20BurnContract = new hre.ethers.Contract(ERC20_PRECOMPILE_ADDRESS, ERC20_BURN_ABI, owner) + erc20Burn0Contract = new hre.ethers.Contract(ERC20_PRECOMPILE_ADDRESS, ERC20_BURN0_ABI, owner) }) it('should return the name', async function () { const name = await erc20.name() - expect(name).to.contain('Test Token') + expect(name).to.contain('Token') }) it('should return the symbol', async function () { @@ -44,6 +60,12 @@ describe('ERC20 Precompile', function () { expect(allowance).to.equal(0n) }) + + it('should return the contract owner address', async function () { + const ownerAddr = await erc20.owner() + expect(ownerAddr).to.equal(owner.address) + }) + it('should transfer tokens', async function () { const amount = hre.ethers.parseEther('1') const prev = await erc20.balanceOf(spender.address) @@ -66,10 +88,10 @@ describe('ERC20 Precompile', function () { // owner gives spender permission to move amount const approvalTx = await erc20. - connect(owner) + connect(owner) .approve(spender.address, amount, {gasLimit: GAS_LIMIT}) const approvalReceipt = await waitWithTimeout(approvalTx, 20000, RETRY_DELAY_FUNC) - console.log(`Approval transaction hash: ${approvalTx.hash}`) + const approvalEvent = findEvent(approvalReceipt.logs, erc20.interface, 'Approval') expect(approvalEvent, 'Approval event must be emitted').to.exist @@ -80,15 +102,12 @@ describe('ERC20 Precompile', function () { // record pre-transfer balances and allowance const prevBalance = await erc20.balanceOf(recipient.address) const prevAllowance = await erc20.allowance(owner.address, spender.address) - console.log(`Pre-transfer balance of recipient: ${prevBalance}`) - console.log(`Pre-transfer allowance of spender: ${prevAllowance}`) // spender pulls from owner → recipient const tx = await erc20 .connect(spender) .transferFrom(owner.address, recipient.address, amount, {gasLimit: GAS_LIMIT}) const receipt = await waitWithTimeout(tx, 20000, RETRY_DELAY_FUNC) - console.log(`Transfer transaction hash: ${tx.hash}`) const transferEvent = findEvent(receipt.logs, erc20.interface, 'Transfer') expect(transferEvent, 'Transfer event must be emitted').to.exist @@ -106,4 +125,234 @@ describe('ERC20 Precompile', function () { // allowance should have decreased by `amount` expect(afterAllowance).to.equal(prevAllowance - amount) }) + + + describe('mint', function () { + it('should revert if the caller is not the contract owner', async function () { + const mintAmount = hre.ethers.parseEther('100') + + // Connect as spender (non-owner) and mint - this should revert + const spenderContract = erc20.connect(spender) + + // Mint tokens as non-owner spender to recipient - should revert + await expect(spenderContract.mint(recipient.address, mintAmount)) + .to.be.reverted + }) + + it('should mint tokens to the recipient if the caller is the contract owner', async function () { + const mintAmount = hre.ethers.parseEther('100') + + // Connect as owner and mint + const contractOwner = erc20.connect(owner) + + // Get initial balance + const initialBalance = await erc20.balanceOf(recipient.address) + + // Mint tokens as owner + const tx = await contractOwner.mint(recipient.address, mintAmount) + const receipt = await waitWithTimeout(tx, 20000, RETRY_DELAY_FUNC) + + expect(tx).to.not.be.reverted + + // Check Transfer event was emitted + const transferEvent = findEvent(receipt.logs, erc20.interface, 'Transfer') + expect(transferEvent, 'Transfer event must be emitted').to.exist + expect(transferEvent.args.from).to.equal('0x0000000000000000000000000000000000000000') // Zero address for minting + expect(transferEvent.args.to).to.equal(recipient.address) + expect(transferEvent.args.value).to.equal(mintAmount) + + // Check new balance + const newBalance = await erc20.balanceOf(recipient.address) + expect(newBalance).to.equal(initialBalance + mintAmount) + }) + }) + + describe('burn', function () { + it('should burn tokens from the caller', async function () { + const mintAmount = hre.ethers.parseEther('100') + const burnAmount = hre.ethers.parseEther('50') + + // First mint some tokens to owner (use owner for this test to avoid conflicts) + const mintTx = await erc20BurnContract.mint(spender.address, mintAmount) + const mintReceipt = await waitWithTimeout(mintTx, 20000, RETRY_DELAY_FUNC) + + const spenderContract = new hre.ethers.Contract(ERC20_PRECOMPILE_ADDRESS, ERC20_BURN_ABI, spender) + // Get initial balance + const initialBalance = await erc20.balanceOf(spender.address) + + // Owner burns their own tokens + const burnTx = await spenderContract.burn(burnAmount) + const burnReceipt = await waitWithTimeout(burnTx, 20000, RETRY_DELAY_FUNC) + + // Check Transfer event was emitted + const transferEvent = findEvent(burnReceipt.logs, erc20.interface, 'Transfer') + expect(transferEvent, 'Transfer event must be emitted').to.exist + expect(transferEvent.args.from).to.equal(spender.address) + expect(transferEvent.args.to).to.equal('0x0000000000000000000000000000000000000000') // Zero address for burning + expect(transferEvent.args.value).to.equal(burnAmount) + }) + }) + + describe('burn0', function () { + it('should revert if the caller is not the contract owner', async function () { + const burnAmount = hre.ethers.parseEther('10') + + // Connect as spender (non-owner) and attempt to burn from recipient - this should revert + const contractAsSpender = new hre.ethers.Contract(ERC20_PRECOMPILE_ADDRESS, ERC20_BURN0_ABI, spender) + + // Attempt to burn tokens from recipient as non-owner spender - should revert + await expect(contractAsSpender.burn(recipient.address, burnAmount)) + .to.be.reverted + }) + + it('should allow owner to burn tokens from any address', async function () { + const mintAmount = hre.ethers.parseEther('100') + const burnAmount = hre.ethers.parseEther('30') + + // First mint some tokens to spender + const mintTx = await erc20Burn0Contract.mint(spender.address, mintAmount) + const mintReceipt = await waitWithTimeout(mintTx, 20000, RETRY_DELAY_FUNC) + + // Get initial balance of spender + const initialBalance = await erc20.balanceOf(spender.address) + + // Owner burns tokens from spender's account + const burnTx = await erc20Burn0Contract.burn(spender.address, burnAmount) + const burnReceipt = await waitWithTimeout(burnTx, 20000, RETRY_DELAY_FUNC) + + expect(burnTx).to.not.be.reverted + + // Check Transfer event was emitted + const transferEvent = findEvent(burnReceipt.logs, erc20.interface, 'Transfer') + expect(transferEvent, 'Transfer event must be emitted').to.exist + expect(transferEvent.args.from).to.equal(spender.address) + expect(transferEvent.args.to).to.equal('0x0000000000000000000000000000000000000000') // Zero address for burning + expect(transferEvent.args.value).to.equal(burnAmount) + + // Check new balance + const newBalance = await erc20.balanceOf(spender.address) + expect(newBalance).to.equal(initialBalance - burnAmount) + }) + + it('should revert when trying to burn more than available balance', async function () { + // Get current balance of spender + const currentBalance = await erc20.balanceOf(spender.address) + const burnAmount = currentBalance + hre.ethers.parseEther('1') // Try to burn more than available + + // Owner attempts to burn more tokens than spender has - should revert + await expect(erc20Burn0Contract.burn(spender.address, burnAmount)) + .to.be.reverted + }) + }) + + describe('burnFrom', function () { + it('should allow any caller to burn from account with allowance', async function () { + const mintAmount = hre.ethers.parseEther('100') + const burnAmount = hre.ethers.parseEther('50') + + // First mint some tokens to spender + const mintTx = await erc20.connect(owner).mint(spender.address, mintAmount) + const mintReceipt = await waitWithTimeout(mintTx, 20000, RETRY_DELAY_FUNC) + + // Spender approves recipient to spend tokens + const contractAsSpender = erc20.connect(spender) + const approveTx = await contractAsSpender.approve(recipient.address, burnAmount) + const approveReceipt = await waitWithTimeout(approveTx, 20000, RETRY_DELAY_FUNC) + + // Get initial balance and allowance + const initialBalance = await erc20.balanceOf(spender.address) + const initialAllowance = await erc20.allowance(spender.address, recipient.address) + + // Connect as recipient (non-owner) and burnFrom - this should succeed with allowance + const contractAsRecipient = erc20.connect(recipient) + + const burnFromTx = await contractAsRecipient.burnFrom(spender.address, burnAmount) + const burnFromReceipt = await waitWithTimeout(burnFromTx, 20000, RETRY_DELAY_FUNC) + + // Check Transfer event was emitted + const transferEvent = findEvent(burnFromReceipt.logs, erc20.interface, 'Transfer') + expect(transferEvent, 'Transfer event must be emitted').to.exist + expect(transferEvent.args.from).to.equal(spender.address) + expect(transferEvent.args.to).to.equal('0x0000000000000000000000000000000000000000') // Zero address for burning + expect(transferEvent.args.value).to.equal(burnAmount) + + // Check new balance + const newBalance = await erc20.balanceOf(spender.address) + expect(newBalance).to.equal(initialBalance - burnAmount) + + // Check allowance was reduced + const newAllowance = await erc20.allowance(spender.address, recipient.address) + expect(newAllowance).to.equal(0) + }) + + it('should burn tokens from the specified account with allowance', async function () { + const mintAmount = hre.ethers.parseEther('200') // Use different amount to avoid conflicts + const burnAmount = hre.ethers.parseEther('75') // Use different amount to avoid conflicts + + // First mint some tokens to recipient (use recipient for this test) + const mintTx = await erc20.connect(owner).mint(recipient.address, mintAmount) + const mintReceipt = await waitWithTimeout(mintTx, 20000, RETRY_DELAY_FUNC) + + // Recipient approves spender to spend tokens (different direction than first burnFrom test) + const contractAsRecipient = erc20.connect(recipient) + const approveTx = await contractAsRecipient.approve(spender.address, burnAmount) + const approveReceipt = await waitWithTimeout(approveTx, 20000, RETRY_DELAY_FUNC) + + // Get initial balance and allowance + const initialBalance = await erc20.balanceOf(recipient.address) + const initialAllowance = await erc20.allowance(recipient.address, spender.address) + + // Spender burns tokens from recipient's account + const contractAsSpender = erc20.connect(spender) + const burnFromTx = await contractAsSpender.burnFrom(recipient.address, burnAmount) + const burnFromReceipt = await waitWithTimeout(burnFromTx, 20000, RETRY_DELAY_FUNC) + + // Check Transfer event was emitted + const transferEvent = findEvent(burnFromReceipt.logs, erc20.interface, 'Transfer') + expect(transferEvent, 'Transfer event must be emitted').to.exist + expect(transferEvent.args.from).to.equal(recipient.address) + expect(transferEvent.args.to).to.equal('0x0000000000000000000000000000000000000000') // Zero address for burning + expect(transferEvent.args.value).to.equal(burnAmount) + + // Check new balance + const newBalance = await erc20.balanceOf(recipient.address) + expect(newBalance).to.equal(initialBalance - burnAmount) + + // Check allowance was reduced + const newAllowance = await erc20.allowance(recipient.address, spender.address) + expect(newAllowance).to.equal(0) + }) + }) + + describe('transferOwnership', function () { + it('should revert if the caller is not the contract owner', async function () { + // Connect as spender (non-owner) and attempt to transfer ownership - this should revert + const contractAsSpender = erc20.connect(spender) + + // Attempt to transfer ownership as non-owner spender to recipient - should revert + await expect(contractAsSpender.transferOwnership(recipient.address)) + .to.be.reverted + }) + + it('should transfer ownership when called by the current owner', async function () { + // Get initial owner + const initialOwner = await erc20.owner() + expect(initialOwner).to.equal(owner.address) + + // Connect as owner and transfer ownership + const contractAsOwner = erc20.connect(owner) + + // Transfer ownership to spender + const tx = await contractAsOwner.transferOwnership(spender.address) + const receipt = await waitWithTimeout(tx, 20000, RETRY_DELAY_FUNC) + + expect(tx).to.not.be.reverted + + // Check ownership has changed + const newOwner = await erc20.owner() + expect(newOwner).to.equal(spender.address) + }) + }) + + }) diff --git a/x/erc20/client/cli/query.go b/x/erc20/client/cli/query.go index 0aef05f50..8fc4c9630 100644 --- a/x/erc20/client/cli/query.go +++ b/x/erc20/client/cli/query.go @@ -2,7 +2,9 @@ package cli import ( "context" + "fmt" + "github.com/ethereum/go-ethereum/common" "github.com/spf13/cobra" "github.com/cosmos/evm/x/erc20/types" @@ -25,6 +27,7 @@ func GetQueryCmd() *cobra.Command { GetTokenPairsCmd(), GetTokenPairCmd(), GetParamsCmd(), + GetOwnerAddressCmd(), ) return cmd } @@ -127,3 +130,37 @@ func GetParamsCmd() *cobra.Command { flags.AddQueryFlagsToCmd(cmd) return cmd } + +func GetOwnerAddressCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "owner-address CONTRACT_ADDRESS", + Short: "Gets the owner address for a given ERC20 contract address", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + if !common.IsHexAddress(args[0]) { + return fmt.Errorf("invalid contract address") + } + + queryClient := types.NewQueryClient(clientCtx) + + req := &types.QueryOwnerAddressRequest{ + ContractAddress: args[0], + } + + res, err := queryClient.OwnerAddress(context.Background(), req) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + return cmd +} diff --git a/x/erc20/client/cli/tx.go b/x/erc20/client/cli/tx.go index 647630ddd..e6e74abfa 100644 --- a/x/erc20/client/cli/tx.go +++ b/x/erc20/client/cli/tx.go @@ -31,6 +31,8 @@ func NewTxCmd() *cobra.Command { NewConvertCoinCmd(), NewConvertERC20Cmd(), NewMsgRegisterERC20Cmd(), + NewMintCmd(), + NewBurnCmd(), ) return txCmd } @@ -158,3 +160,85 @@ func NewMsgRegisterERC20Cmd() *cobra.Command { flags.AddTxFlagsToCmd(cmd) return cmd } + +// NewMintCmd implements the command to mint an ERC20 token +func NewMintCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "mint CONTRACT_ADDRESS TO AMOUNT", + Args: cobra.ExactArgs(3), + Short: "Mint an ERC20 token", + Long: "Mint an ERC20 token", + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + contract := args[0] + if err := cosmosevmtypes.ValidateAddress(contract); err != nil { + return fmt.Errorf("invalid ERC20 contract address %w", err) + } + + to, err := sdk.AccAddressFromBech32(args[1]) + if err != nil { + return err + } + + amount, ok := math.NewIntFromString(args[2]) + if !ok { + return fmt.Errorf("invalid amount %s", args[2]) + } + + from := clientCtx.GetFromAddress() + + msg := &types.MsgMint{ + ContractAddress: contract, + Amount: amount, + Sender: from.String(), + To: to.String(), + } + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + return cmd +} + +// NewBurnCmd implements the command to burn an ERC20 token +func NewBurnCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "burn CONTRACT_ADDRESS AMOUNT", + Args: cobra.ExactArgs(2), + Short: "Burn an ERC20 token", + Long: "Burn an ERC20 token", + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + contract := args[0] + if err := cosmosevmtypes.ValidateAddress(contract); err != nil { + return fmt.Errorf("invalid ERC20 contract address %w", err) + } + + amount, ok := math.NewIntFromString(args[1]) + if !ok { + return fmt.Errorf("invalid amount %s", args[1]) + } + + msg := &types.MsgBurn{ + ContractAddress: contract, + Amount: amount, + Sender: clientCtx.GetFromAddress().String(), + } + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + return cmd +} diff --git a/x/erc20/keeper/burn.go b/x/erc20/keeper/burn.go new file mode 100644 index 000000000..f4a954b68 --- /dev/null +++ b/x/erc20/keeper/burn.go @@ -0,0 +1,45 @@ +package keeper + +import ( + "github.com/cosmos/evm/x/erc20/types" + + errorsmod "cosmossdk.io/errors" + "cosmossdk.io/math" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// BurnCoins burns the provided amount of coins from the given address. +func (k Keeper) BurnCoins(ctx sdk.Context, sender sdk.AccAddress, amount math.Int, token string) error { + pair, found := k.GetTokenPair(ctx, k.GetTokenPairID(ctx, token)) + if !found { + return errorsmod.Wrapf(types.ErrTokenPairNotFound, "token '%s' not registered", token) + } + + if !pair.IsNativeCoin() { + return errorsmod.Wrap(types.ErrNonNativeCoinBurningDisabled, token) + } + + coins := sdk.Coins{{Denom: pair.Denom, Amount: amount}} + + err := k.bankKeeper.SendCoinsFromAccountToModule(ctx, sender, types.ModuleName, coins) + if err != nil { + return err + } + + err = k.bankKeeper.BurnCoins(ctx, types.ModuleName, coins) + if err != nil { + return err + } + + ctx.EventManager().EmitEvent( + sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyAction, types.TypeMsgBurn), + sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName), + sdk.NewAttribute(sdk.AttributeKeySender, sender.String()), + sdk.NewAttribute(sdk.AttributeKeyAmount, amount.String()), + ), + ) + return nil +} diff --git a/x/erc20/keeper/grpc_query.go b/x/erc20/keeper/grpc_query.go index 8932de2ba..63dea545a 100644 --- a/x/erc20/keeper/grpc_query.go +++ b/x/erc20/keeper/grpc_query.go @@ -84,3 +84,10 @@ func (k Keeper) Params(c context.Context, _ *types.QueryParamsRequest) (*types.Q params := k.GetParams(ctx) return &types.QueryParamsResponse{Params: params}, nil } + +// OwnerAddress returns the owner address for a given ERC20 contract address +func (k Keeper) OwnerAddress(c context.Context, req *types.QueryOwnerAddressRequest) (*types.QueryOwnerAddressResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + owner := k.GetOwnerAddress(ctx, req.ContractAddress) + return &types.QueryOwnerAddressResponse{OwnerAddress: owner}, nil +} diff --git a/x/erc20/keeper/mint.go b/x/erc20/keeper/mint.go index dba3792fc..62edf275e 100644 --- a/x/erc20/keeper/mint.go +++ b/x/erc20/keeper/mint.go @@ -4,6 +4,7 @@ import ( "github.com/cosmos/evm/x/erc20/types" errorsmod "cosmossdk.io/errors" + "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" errortypes "github.com/cosmos/cosmos-sdk/types/errors" @@ -65,3 +66,46 @@ func (k Keeper) MintingEnabled( return pair, nil } + +// MintCoins mints the provided amount of coins to the given address. +func (k Keeper) MintCoins(ctx sdk.Context, sender, to sdk.AccAddress, amount math.Int, token string) error { + pair, err := k.MintingEnabled(ctx, sender, to, token) + if err != nil { + return err + } + + if !pair.IsNativeCoin() { + return errorsmod.Wrap(types.ErrNonNativeCoinMintingDisabled, token) + } + + contractOwnerAddr, err := sdk.AccAddressFromBech32(pair.OwnerAddress) + if err != nil { + return errorsmod.Wrapf(err, "invalid owner address") + } + if !sender.Equals(contractOwnerAddr) { + return types.ErrMinterIsNotOwner + } + + coins := sdk.Coins{{Denom: pair.Denom, Amount: amount}} + err = k.bankKeeper.MintCoins(ctx, types.ModuleName, coins) + if err != nil { + return err + } + + err = k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, to, coins) + if err != nil { + return err + } + + ctx.EventManager().EmitEvent( + sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyAction, types.TypeMsgMint), + sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName), + sdk.NewAttribute(sdk.AttributeKeySender, sender.String()), + sdk.NewAttribute(sdk.AttributeKeyAmount, amount.String()), + ), + ) + + return nil +} diff --git a/x/erc20/keeper/msg_server.go b/x/erc20/keeper/msg_server.go index d6e7e8a9e..476638e59 100644 --- a/x/erc20/keeper/msg_server.go +++ b/x/erc20/keeper/msg_server.go @@ -321,6 +321,66 @@ func (k *Keeper) UpdateParams(goCtx context.Context, req *types.MsgUpdateParams) return &types.MsgUpdateParamsResponse{}, nil } +// TransferOwnership implements the MsgServer interface for the ERC20 module. +func (k Keeper) TransferContractOwnership(goCtx context.Context, msg *types.MsgTransferOwnership) (*types.MsgTransferOwnershipResponse, error) { + if err := k.validateAuthority(msg.Authority); err != nil { + return nil, err + } + + ctx := sdk.UnwrapSDKContext(goCtx) + + newOwner, err := sdk.AccAddressFromBech32(msg.NewOwner) + if err != nil { + return nil, err + } + + err = k.TransferOwnershipProposal(ctx, newOwner, msg.Token) + if err != nil { + return nil, err + } + + return &types.MsgTransferOwnershipResponse{}, nil +} + +// Mint implements the MsgServer interface for the ERC20 module. It mints ERC20 tokens to a given address. +func (k Keeper) Mint(goCtx context.Context, msg *types.MsgMint) (*types.MsgMintResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + sender, err := sdk.AccAddressFromBech32(msg.Sender) + if err != nil { + return nil, err + } + + receiver, err := sdk.AccAddressFromBech32(msg.To) + if err != nil { + return nil, err + } + + err = k.MintCoins(ctx, sender, receiver, math.NewIntFromBigInt(msg.Amount.BigInt()), msg.ContractAddress) + if err != nil { + return nil, err + } + + return &types.MsgMintResponse{}, nil +} + +// Burn implements the MsgServer interface for the ERC20 module. It burns ERC20 tokens from a given address. +func (k Keeper) Burn(goCtx context.Context, msg *types.MsgBurn) (*types.MsgBurnResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + sender, err := sdk.AccAddressFromBech32(msg.Sender) + if err != nil { + return nil, err + } + + err = k.BurnCoins(ctx, sender, math.NewIntFromBigInt(msg.Amount.BigInt()), msg.ContractAddress) + if err != nil { + return nil, err + } + + return &types.MsgBurnResponse{}, nil +} + // RegisterERC20 implements the gRPC MsgServer interface. Any account can permissionlessly // register a native ERC20 contract to map to a Cosmos Coin. func (k *Keeper) RegisterERC20(goCtx context.Context, req *types.MsgRegisterERC20) (*types.MsgRegisterERC20Response, error) { diff --git a/x/erc20/keeper/token_pairs.go b/x/erc20/keeper/token_pairs.go index a0e060c4d..cc67a7111 100644 --- a/x/erc20/keeper/token_pairs.go +++ b/x/erc20/keeper/token_pairs.go @@ -217,3 +217,25 @@ func (k Keeper) GetTokenDenom(ctx sdk.Context, tokenAddress common.Address) (str return tokenPair.Denom, nil } + +// GetTokenOwnerAddress returns the OwnerAddress of the token +func (k Keeper) GetTokenPairOwnerAddress(ctx sdk.Context, token string) (sdk.AccAddress, error) { + tokenPairID := k.GetERC20Map(ctx, common.HexToAddress(token)) + if len(tokenPairID) == 0 { + return nil, errorsmod.Wrapf(types.ErrTokenPairNotFound, "token '%s' not registered", token) + } + + tokenPair, found := k.GetTokenPair(ctx, tokenPairID) + if !found { + return nil, errorsmod.Wrapf(types.ErrTokenPairNotFound, "token '%s' not registered", token) + } + + return sdk.AccAddressFromBech32(tokenPair.OwnerAddress) +} + +// SetTokenPairOwnerAddress sets the owner address for the token pair +func (k Keeper) SetTokenPairOwnerAddress(ctx sdk.Context, pair types.TokenPair, newOwner string) { + pair.SetOwnerAddress(newOwner) + + k.SetTokenPair(ctx, pair) +} diff --git a/x/erc20/keeper/transfer_ownership.go b/x/erc20/keeper/transfer_ownership.go new file mode 100644 index 000000000..d5b7115f4 --- /dev/null +++ b/x/erc20/keeper/transfer_ownership.go @@ -0,0 +1,67 @@ +package keeper + +import ( + "github.com/cosmos/evm/x/erc20/types" + + errorsmod "cosmossdk.io/errors" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// TransferOwnershipProposal transfers ownership of the token to the new owner through a proposal +func (k Keeper) TransferOwnershipProposal(ctx sdk.Context, newOwner sdk.AccAddress, token string) error { + pair, found := k.GetTokenPair(ctx, k.GetTokenPairID(ctx, token)) + if !found { + return errorsmod.Wrapf(types.ErrTokenPairNotFound, "token '%s' not registered", token) + } + + return k.transferOwnership(ctx, newOwner, pair) +} + +// TransferOwnership transfers ownership of the token to the new owner. +func (k Keeper) TransferOwnership(ctx sdk.Context, sender, newOwner sdk.AccAddress, token string) error { + pair, found := k.GetTokenPair(ctx, k.GetTokenPairID(ctx, token)) + if !found { + return errorsmod.Wrapf(types.ErrTokenPairNotFound, "token '%s' not registered", token) + } + + ownerAddr, err := sdk.AccAddressFromBech32(pair.OwnerAddress) + if err != nil { + return errorsmod.Wrapf(err, "invalid owner address") + } + + if !sender.Equals(ownerAddr) { + return errorsmod.Wrap(types.ErrMinterIsNotOwner, "sender is not the owner of the token") + } + + return k.transferOwnership(ctx, newOwner, pair) +} + +// transferOwnership transfers ownership of the token to the new owner +func (k Keeper) transferOwnership(ctx sdk.Context, newOwner sdk.AccAddress, token types.TokenPair) error { + if !token.IsNativeCoin() { + return errorsmod.Wrap(types.ErrNonNativeTransferOwnershipDisabled, token.Erc20Address) + } + + k.SetTokenPairOwnerAddress(ctx, token, newOwner.String()) + + ctx.EventManager().EmitEvent( + sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyAction, types.TypeMsgTransferOwnership), + sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName), + sdk.NewAttribute(types.AttributeKeyNewOwner, newOwner.String()), + ), + ) + + return nil +} + +func (k Keeper) GetOwnerAddress(ctx sdk.Context, contractAddress string) string { + pair, found := k.GetTokenPair(ctx, k.GetTokenPairID(ctx, contractAddress)) + if !found { + return "" + } + + return pair.OwnerAddress +} diff --git a/x/erc20/types/erc20.pb.go b/x/erc20/types/erc20.pb.go index 5089cc87b..f2933dcbe 100644 --- a/x/erc20/types/erc20.pb.go +++ b/x/erc20/types/erc20.pb.go @@ -69,6 +69,9 @@ type TokenPair struct { // contract_owner is the an ENUM specifying the type of ERC20 owner (0 // invalid, 1 ModuleAccount, 2 external address) ContractOwner Owner `protobuf:"varint,4,opt,name=contract_owner,json=contractOwner,proto3,enum=cosmos.evm.erc20.v1.Owner" json:"contract_owner,omitempty"` + // owner_address is the address of the current owner of the token + // Only set if contract_owner is OWNER_MODULE + OwnerAddress string `protobuf:"bytes,5,opt,name=owner_address,json=ownerAddress,proto3" json:"owner_address,omitempty"` } func (m *TokenPair) Reset() { *m = TokenPair{} } @@ -132,6 +135,13 @@ func (m *TokenPair) GetContractOwner() Owner { return OWNER_UNSPECIFIED } +func (m *TokenPair) GetOwnerAddress() string { + if m != nil { + return m.OwnerAddress + } + return "" +} + // Allowance is a token allowance only for erc20 precompile type Allowance struct { // erc20_address is the hex address of ERC20 contract @@ -463,43 +473,44 @@ func init() { func init() { proto.RegisterFile("cosmos/evm/erc20/v1/erc20.proto", fileDescriptor_1164958b5b106e92) } var fileDescriptor_1164958b5b106e92 = []byte{ - // 574 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x94, 0xb1, 0x6b, 0xdb, 0x4e, - 0x14, 0xc7, 0x75, 0x89, 0xf3, 0xfb, 0x45, 0x97, 0xc4, 0xb8, 0xd7, 0x04, 0x84, 0xc1, 0xb2, 0x71, - 0xa0, 0x98, 0x0e, 0x52, 0xec, 0x6c, 0x85, 0x52, 0x6c, 0x47, 0x05, 0x97, 0xc4, 0x36, 0x8a, 0x43, - 0x4b, 0x17, 0x73, 0x96, 0x0e, 0x45, 0x58, 0xba, 0x33, 0xba, 0x8b, 0xd2, 0x0e, 0xdd, 0x3b, 0x76, - 0xe9, 0xd4, 0xa5, 0xd0, 0xa9, 0xff, 0x49, 0xc6, 0x8c, 0xa5, 0x43, 0x28, 0xf6, 0xd2, 0x3f, 0xa3, - 0xe8, 0x4e, 0x2a, 0x69, 0xe9, 0x50, 0x9a, 0xed, 0xbe, 0x5f, 0xbf, 0xf7, 0xfc, 0x79, 0xf7, 0x9e, - 0x0e, 0xd6, 0x3d, 0xc6, 0x63, 0xc6, 0x6d, 0x92, 0xc6, 0x36, 0x49, 0xbc, 0xce, 0x81, 0x9d, 0xb6, - 0xd5, 0xc1, 0x5a, 0x24, 0x4c, 0x30, 0x74, 0x5f, 0x05, 0x58, 0x24, 0x8d, 0x2d, 0xe5, 0xa7, 0xed, - 0xaa, 0x99, 0x67, 0xcd, 0x30, 0x9d, 0xdb, 0x69, 0x7b, 0x46, 0x04, 0x6e, 0x4b, 0xa1, 0x92, 0xaa, - 0xbb, 0x01, 0x0b, 0x98, 0x3c, 0xda, 0xd9, 0x49, 0xb9, 0xcd, 0xcf, 0x00, 0xea, 0x13, 0x36, 0x27, - 0x74, 0x8c, 0xc3, 0x04, 0xed, 0xc3, 0x1d, 0x59, 0x6f, 0x8a, 0x7d, 0x3f, 0x21, 0x9c, 0x1b, 0xa0, - 0x01, 0x5a, 0xba, 0xbb, 0x2d, 0xcd, 0xae, 0xf2, 0xd0, 0x2e, 0xdc, 0xf0, 0x09, 0x65, 0xb1, 0xb1, - 0x26, 0x7f, 0x54, 0x02, 0x19, 0xf0, 0x7f, 0x42, 0xf1, 0x2c, 0x22, 0xbe, 0xb1, 0xde, 0x00, 0xad, - 0x4d, 0xb7, 0x90, 0xa8, 0x0b, 0xcb, 0x1e, 0xa3, 0x22, 0xc1, 0x9e, 0x98, 0xb2, 0x4b, 0x4a, 0x12, - 0xa3, 0xd4, 0x00, 0xad, 0x72, 0xa7, 0x6a, 0xfd, 0xa1, 0x0d, 0x6b, 0x94, 0x45, 0xb8, 0x3b, 0x45, - 0x86, 0x94, 0x8f, 0x4a, 0xdf, 0x3f, 0xd6, 0x41, 0xf3, 0x03, 0x80, 0x7a, 0x37, 0x8a, 0xd8, 0x25, - 0xa6, 0x1e, 0xf9, 0x6b, 0x56, 0xf5, 0x97, 0x39, 0xab, 0x14, 0x19, 0x2b, 0x5f, 0x10, 0xea, 0x93, - 0x44, 0xb2, 0xea, 0x6e, 0x21, 0xd1, 0x21, 0xdc, 0x48, 0x71, 0x74, 0x41, 0x24, 0xa2, 0xde, 0xab, - 0x5d, 0xdd, 0xd4, 0xb5, 0xaf, 0x37, 0xf5, 0x3d, 0x45, 0xca, 0xfd, 0xb9, 0x15, 0x32, 0x3b, 0xc6, - 0xe2, 0xdc, 0x1a, 0x50, 0xe1, 0xaa, 0x58, 0x49, 0xa7, 0x35, 0xdf, 0x03, 0xb8, 0xeb, 0x92, 0x20, - 0xe4, 0x82, 0x24, 0x7d, 0x16, 0xd2, 0x71, 0xc2, 0x16, 0x8c, 0xe3, 0x28, 0x63, 0x10, 0xa1, 0x88, - 0x48, 0x0e, 0xa8, 0x04, 0x6a, 0xc0, 0x2d, 0x9f, 0x70, 0x2f, 0x09, 0x17, 0x22, 0x64, 0x34, 0xe7, - 0xbb, 0x6d, 0xa1, 0x27, 0x70, 0x33, 0x26, 0x02, 0xfb, 0x58, 0x60, 0x63, 0xbd, 0xb1, 0xde, 0xda, - 0xea, 0xd4, 0x8a, 0x1b, 0x93, 0x63, 0xcd, 0x67, 0x6c, 0x9d, 0xe4, 0x41, 0xbd, 0x52, 0x46, 0xeb, - 0xfe, 0x4c, 0xca, 0xb9, 0x4e, 0x61, 0xa5, 0x40, 0x29, 0x22, 0x7f, 0x29, 0x0d, 0xfe, 0xa1, 0x74, - 0xf3, 0x0d, 0xdc, 0x2b, 0x7a, 0x75, 0xdc, 0x7e, 0xe7, 0xe0, 0xce, 0xcd, 0x3e, 0x80, 0x65, 0x39, - 0xb8, 0x7c, 0x98, 0x84, 0xcb, 0x96, 0x75, 0xf7, 0x37, 0x37, 0xef, 0x89, 0xc3, 0xda, 0x84, 0x05, - 0x41, 0x44, 0xe4, 0xea, 0xf6, 0x19, 0x4d, 0x49, 0xc2, 0x43, 0x76, 0xf7, 0x3b, 0xcf, 0xf2, 0xb2, - 0x92, 0xf9, 0x5e, 0x28, 0xa1, 0xd6, 0xef, 0xe1, 0x33, 0xb8, 0x21, 0xb7, 0x11, 0xed, 0xc1, 0x7b, - 0xa3, 0xe7, 0x43, 0xc7, 0x9d, 0x9e, 0x0d, 0x4f, 0xc7, 0x4e, 0x7f, 0xf0, 0x74, 0xe0, 0x1c, 0x55, - 0x34, 0x54, 0x81, 0xdb, 0xca, 0x3e, 0x19, 0x1d, 0x9d, 0x1d, 0x3b, 0x15, 0x80, 0x10, 0x2c, 0x2b, - 0xc7, 0x79, 0x31, 0x71, 0xdc, 0x61, 0xf7, 0xb8, 0xb2, 0x56, 0x2d, 0xbd, 0xfd, 0x64, 0x6a, 0xbd, - 0xc7, 0x57, 0x4b, 0x13, 0x5c, 0x2f, 0x4d, 0xf0, 0x6d, 0x69, 0x82, 0x77, 0x2b, 0x53, 0xbb, 0x5e, - 0x99, 0xda, 0x97, 0x95, 0xa9, 0xbd, 0xdc, 0x0f, 0x42, 0x71, 0x7e, 0x31, 0xb3, 0x3c, 0x16, 0xdb, - 0xb7, 0xde, 0x81, 0x57, 0xf9, 0x4b, 0x20, 0x5e, 0x2f, 0x08, 0x9f, 0xfd, 0x27, 0x3f, 0xde, 0xc3, - 0x1f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x8c, 0xc4, 0x5f, 0x9c, 0x2a, 0x04, 0x00, 0x00, + // 582 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x54, 0x31, 0x6b, 0xdb, 0x40, + 0x18, 0xd5, 0x25, 0x76, 0x1b, 0x5d, 0x12, 0xe3, 0xaa, 0x09, 0x08, 0x43, 0x64, 0xe3, 0x40, 0x31, + 0x1d, 0xa4, 0xd8, 0xd9, 0x0a, 0xa5, 0x38, 0x8e, 0x0a, 0x2e, 0x89, 0x6d, 0x14, 0x87, 0x96, 0x2e, + 0xe6, 0x2c, 0x1d, 0x8a, 0xb0, 0x74, 0x67, 0x74, 0x17, 0xa5, 0x1d, 0xba, 0x77, 0xec, 0xd2, 0xa9, + 0x4b, 0xa1, 0x7f, 0x26, 0x53, 0xc9, 0x58, 0x3a, 0x84, 0x62, 0x2f, 0xfd, 0x19, 0x45, 0x77, 0xa7, + 0x90, 0x96, 0x0e, 0xa5, 0xd9, 0xee, 0x3d, 0x7d, 0xef, 0xe3, 0xbd, 0xfb, 0x3e, 0x1d, 0xac, 0xfb, + 0x94, 0x25, 0x94, 0x39, 0x38, 0x4b, 0x1c, 0x9c, 0xfa, 0x9d, 0x3d, 0x27, 0x6b, 0xcb, 0x83, 0x3d, + 0x4f, 0x29, 0xa7, 0xc6, 0x43, 0x59, 0x60, 0xe3, 0x2c, 0xb1, 0x25, 0x9f, 0xb5, 0x6b, 0x96, 0x52, + 0x4d, 0x11, 0x99, 0x39, 0x59, 0x7b, 0x8a, 0x39, 0x6a, 0x0b, 0x20, 0x45, 0xb5, 0xad, 0x90, 0x86, + 0x54, 0x1c, 0x9d, 0xfc, 0x24, 0xd9, 0xe6, 0x57, 0x00, 0xf5, 0x31, 0x9d, 0x61, 0x32, 0x42, 0x51, + 0x6a, 0xec, 0xc2, 0x4d, 0xd1, 0x6f, 0x82, 0x82, 0x20, 0xc5, 0x8c, 0x99, 0xa0, 0x01, 0x5a, 0xba, + 0xb7, 0x21, 0xc8, 0xae, 0xe4, 0x8c, 0x2d, 0x58, 0x0e, 0x30, 0xa1, 0x89, 0xb9, 0x22, 0x3e, 0x4a, + 0x60, 0x98, 0xf0, 0x3e, 0x26, 0x68, 0x1a, 0xe3, 0xc0, 0x5c, 0x6d, 0x80, 0xd6, 0x9a, 0x57, 0x40, + 0xa3, 0x0b, 0x2b, 0x3e, 0x25, 0x3c, 0x45, 0x3e, 0x9f, 0xd0, 0x0b, 0x82, 0x53, 0xb3, 0xd4, 0x00, + 0xad, 0x4a, 0xa7, 0x66, 0xff, 0x25, 0x86, 0x3d, 0xcc, 0x2b, 0xbc, 0xcd, 0x42, 0x21, 0x60, 0xee, + 0x4b, 0x28, 0x6f, 0x7c, 0x95, 0xa5, 0x2f, 0x41, 0x2a, 0x5f, 0x4f, 0x4a, 0x3f, 0x3f, 0xd7, 0x41, + 0xf3, 0x13, 0x80, 0x7a, 0x37, 0x8e, 0xe9, 0x05, 0x22, 0x3e, 0xfe, 0xe7, 0x40, 0xd2, 0x97, 0x0a, + 0x24, 0x40, 0x1e, 0x88, 0xcd, 0x31, 0x09, 0x70, 0x2a, 0x02, 0xe9, 0x5e, 0x01, 0x8d, 0x7d, 0x58, + 0xce, 0x50, 0x7c, 0x8e, 0x45, 0x0e, 0xfd, 0x60, 0xe7, 0xf2, 0xba, 0xae, 0x7d, 0xbf, 0xae, 0x6f, + 0xcb, 0x38, 0x2c, 0x98, 0xd9, 0x11, 0x75, 0x12, 0xc4, 0xcf, 0xec, 0x3e, 0xe1, 0x9e, 0xac, 0x15, + 0xee, 0xb4, 0xe6, 0x47, 0x00, 0xb7, 0x3c, 0x1c, 0x46, 0x8c, 0xe3, 0xb4, 0x47, 0x23, 0x32, 0x4a, + 0xe9, 0x9c, 0x32, 0x14, 0xe7, 0x1e, 0x78, 0xc4, 0x63, 0xac, 0x0c, 0x4a, 0x60, 0x34, 0xe0, 0x7a, + 0x80, 0x99, 0x9f, 0x46, 0x73, 0x1e, 0x51, 0xa2, 0xfc, 0xdd, 0xa6, 0x8c, 0x67, 0x70, 0x2d, 0xc1, + 0x1c, 0x05, 0x88, 0x23, 0x73, 0xb5, 0xb1, 0xda, 0x5a, 0xef, 0xec, 0x14, 0xd7, 0x2a, 0x66, 0xaf, + 0x16, 0xc1, 0x3e, 0x56, 0x45, 0x07, 0xa5, 0xdc, 0xad, 0x77, 0x23, 0x52, 0xbe, 0x4e, 0x60, 0xb5, + 0xb0, 0x52, 0x54, 0xfe, 0xd6, 0x1a, 0xfc, 0x47, 0xeb, 0xe6, 0x3b, 0xb8, 0x5d, 0x64, 0x75, 0xbd, + 0x5e, 0x67, 0xef, 0xce, 0x61, 0x1f, 0xc1, 0x8a, 0x18, 0x9c, 0x1a, 0x26, 0x66, 0x22, 0xb2, 0xee, + 0xfd, 0xc1, 0xaa, 0x4c, 0x0c, 0xee, 0x8c, 0x69, 0x18, 0xc6, 0x58, 0xec, 0x77, 0x8f, 0x92, 0x0c, + 0xa7, 0x2c, 0xa2, 0x77, 0xbf, 0xf3, 0x5c, 0x97, 0xb7, 0x54, 0x7b, 0x21, 0x81, 0x5c, 0xbf, 0xc7, + 0x2f, 0x60, 0x59, 0xae, 0xec, 0x36, 0x7c, 0x30, 0x7c, 0x39, 0x70, 0xbd, 0xc9, 0xe9, 0xe0, 0x64, + 0xe4, 0xf6, 0xfa, 0xcf, 0xfb, 0xee, 0x61, 0x55, 0x33, 0xaa, 0x70, 0x43, 0xd2, 0xc7, 0xc3, 0xc3, + 0xd3, 0x23, 0xb7, 0x0a, 0x0c, 0x03, 0x56, 0x24, 0xe3, 0xbe, 0x1a, 0xbb, 0xde, 0xa0, 0x7b, 0x54, + 0x5d, 0xa9, 0x95, 0xde, 0x7f, 0xb1, 0xb4, 0x83, 0xa7, 0x97, 0x0b, 0x0b, 0x5c, 0x2d, 0x2c, 0xf0, + 0x63, 0x61, 0x81, 0x0f, 0x4b, 0x4b, 0xbb, 0x5a, 0x5a, 0xda, 0xb7, 0xa5, 0xa5, 0xbd, 0xde, 0x0d, + 0x23, 0x7e, 0x76, 0x3e, 0xb5, 0x7d, 0x9a, 0x38, 0xb7, 0x1e, 0x8b, 0x37, 0xea, 0xb9, 0xe0, 0x6f, + 0xe7, 0x98, 0x4d, 0xef, 0x89, 0x3f, 0x7c, 0xff, 0x57, 0x00, 0x00, 0x00, 0xff, 0xff, 0xbe, 0x52, + 0x13, 0x1b, 0x4f, 0x04, 0x00, 0x00, } func (this *TokenPair) Equal(that interface{}) bool { @@ -533,6 +544,9 @@ func (this *TokenPair) Equal(that interface{}) bool { if this.ContractOwner != that1.ContractOwner { return false } + if this.OwnerAddress != that1.OwnerAddress { + return false + } return true } func (this *ToggleTokenConversionProposal) Equal(that interface{}) bool { @@ -585,6 +599,13 @@ func (m *TokenPair) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.OwnerAddress) > 0 { + i -= len(m.OwnerAddress) + copy(dAtA[i:], m.OwnerAddress) + i = encodeVarintErc20(dAtA, i, uint64(len(m.OwnerAddress))) + i-- + dAtA[i] = 0x2a + } if m.ContractOwner != 0 { i = encodeVarintErc20(dAtA, i, uint64(m.ContractOwner)) i-- @@ -880,6 +901,10 @@ func (m *TokenPair) Size() (n int) { if m.ContractOwner != 0 { n += 1 + sovErc20(uint64(m.ContractOwner)) } + l = len(m.OwnerAddress) + if l > 0 { + n += 1 + l + sovErc20(uint64(l)) + } return n } @@ -1126,6 +1151,38 @@ func (m *TokenPair) Unmarshal(dAtA []byte) error { break } } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OwnerAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowErc20 + } + 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 ErrInvalidLengthErc20 + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthErc20 + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OwnerAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipErc20(dAtA[iNdEx:]) diff --git a/x/erc20/types/errors.go b/x/erc20/types/errors.go index 99ad293f2..7012d12c1 100644 --- a/x/erc20/types/errors.go +++ b/x/erc20/types/errors.go @@ -6,23 +6,28 @@ import ( // errors var ( - ErrERC20Disabled = errorsmod.Register(ModuleName, 2, "erc20 module is disabled") - ErrInternalTokenPair = errorsmod.Register(ModuleName, 3, "internal ethereum token mapping error") - ErrTokenPairNotFound = errorsmod.Register(ModuleName, 4, "token pair not found") - ErrTokenPairAlreadyExists = errorsmod.Register(ModuleName, 5, "token pair already exists") - ErrUndefinedOwner = errorsmod.Register(ModuleName, 6, "undefined owner of contract pair") - ErrBalanceInvariance = errorsmod.Register(ModuleName, 7, "post transfer balance invariant failed") - ErrUnexpectedEvent = errorsmod.Register(ModuleName, 8, "unexpected event") - ErrABIPack = errorsmod.Register(ModuleName, 9, "contract ABI pack failed") - ErrABIUnpack = errorsmod.Register(ModuleName, 10, "contract ABI unpack failed") - ErrEVMDenom = errorsmod.Register(ModuleName, 11, "EVM denomination registration") - ErrEVMCall = errorsmod.Register(ModuleName, 12, "EVM call unexpected error") - ErrERC20TokenPairDisabled = errorsmod.Register(ModuleName, 13, "erc20 token pair is disabled") - ErrInvalidIBC = errorsmod.Register(ModuleName, 14, "invalid IBC transaction") - ErrTokenPairOwnedByModule = errorsmod.Register(ModuleName, 15, "token pair owned by module") - ErrNativeConversionDisabled = errorsmod.Register(ModuleName, 16, "native coins manual conversion is disabled") - ErrAllowanceNotFound = errorsmod.Register(ModuleName, 17, "allowance not found") - ErrInvalidAllowance = errorsmod.Register(ModuleName, 18, "invalid allowance") - ErrNegativeToken = errorsmod.Register(ModuleName, 19, "token amount is negative") - ErrExpectedEvent = errorsmod.Register(ModuleName, 20, "expected event") + ErrERC20Disabled = errorsmod.Register(ModuleName, 2, "erc20 module is disabled") + ErrInternalTokenPair = errorsmod.Register(ModuleName, 3, "internal ethereum token mapping error") + ErrTokenPairNotFound = errorsmod.Register(ModuleName, 4, "token pair not found") + ErrTokenPairAlreadyExists = errorsmod.Register(ModuleName, 5, "token pair already exists") + ErrUndefinedOwner = errorsmod.Register(ModuleName, 6, "undefined owner of contract pair") + ErrBalanceInvariance = errorsmod.Register(ModuleName, 7, "post transfer balance invariant failed") + ErrUnexpectedEvent = errorsmod.Register(ModuleName, 8, "unexpected event") + ErrABIPack = errorsmod.Register(ModuleName, 9, "contract ABI pack failed") + ErrABIUnpack = errorsmod.Register(ModuleName, 10, "contract ABI unpack failed") + ErrEVMDenom = errorsmod.Register(ModuleName, 11, "EVM denomination registration") + ErrEVMCall = errorsmod.Register(ModuleName, 12, "EVM call unexpected error") + ErrERC20TokenPairDisabled = errorsmod.Register(ModuleName, 13, "erc20 token pair is disabled") + ErrInvalidIBC = errorsmod.Register(ModuleName, 14, "invalid IBC transaction") + ErrTokenPairOwnedByModule = errorsmod.Register(ModuleName, 15, "token pair owned by module") + ErrNativeConversionDisabled = errorsmod.Register(ModuleName, 16, "native coins manual conversion is disabled") + ErrAllowanceNotFound = errorsmod.Register(ModuleName, 17, "allowance not found") + ErrInvalidAllowance = errorsmod.Register(ModuleName, 18, "invalid allowance") + ErrNegativeToken = errorsmod.Register(ModuleName, 19, "token amount is negative") + ErrExpectedEvent = errorsmod.Register(ModuleName, 20, "expected event") + ErrMinterIsNotOwner = errorsmod.Register(ModuleName, 21, "minter is not the owner") + ErrSenderIsNotOwner = errorsmod.Register(ModuleName, 22, "sender is not the owner") + ErrNonNativeCoinMintingDisabled = errorsmod.Register(ModuleName, 23, "minting non-native coins is disabled") + ErrNonNativeCoinBurningDisabled = errorsmod.Register(ModuleName, 24, "burning non-native coins is disabled") + ErrNonNativeTransferOwnershipDisabled = errorsmod.Register(ModuleName, 25, "transferring ownership of non-native coins is disabled") ) diff --git a/x/erc20/types/msg.go b/x/erc20/types/msg.go index 8c4213b13..8d2f4695a 100644 --- a/x/erc20/types/msg.go +++ b/x/erc20/types/msg.go @@ -19,16 +19,28 @@ var ( _ sdk.Msg = &MsgUpdateParams{} _ sdk.Msg = &MsgRegisterERC20{} _ sdk.Msg = &MsgToggleConversion{} + _ sdk.Msg = &MsgMint{} + _ sdk.Msg = &MsgBurn{} + _ sdk.Msg = &MsgTransferOwnership{} _ sdk.HasValidateBasic = &MsgConvertERC20{} _ sdk.HasValidateBasic = &MsgConvertCoin{} _ sdk.HasValidateBasic = &MsgUpdateParams{} _ sdk.HasValidateBasic = &MsgRegisterERC20{} _ sdk.HasValidateBasic = &MsgToggleConversion{} + _ sdk.HasValidateBasic = &MsgMint{} + _ sdk.HasValidateBasic = &MsgBurn{} + _ sdk.HasValidateBasic = &MsgTransferOwnership{} ) const ( TypeMsgConvertERC20 = "convert_ERC20" TypeMsgConvertCoin = "convert_coin" + + TypeMsgMint = "mint" + TypeMsgBurn = "burn" + TypeMsgTransferOwnership = "transfer_ownership" + + AttributeKeyNewOwner = "new_owner" ) var MsgConvertERC20CustomGetSigner = txsigning.CustomGetSigner{ @@ -149,3 +161,75 @@ func (msg MsgConvertCoin) ValidateBasic() error { func (msg MsgConvertCoin) GetSignBytes() []byte { return sdk.MustSortJSON(AminoCdc.MustMarshalJSON(&msg)) } + +// ValidateBasic does a sanity check of the provided data +func (m *MsgTransferOwnership) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(m.Authority); err != nil { + return errorsmod.Wrap(err, "invalid authority address") + } + + if !common.IsHexAddress(m.Token) { + return errorsmod.Wrapf(errortypes.ErrInvalidAddress, "invalid ERC20 contract address %s", m.Token) + } + + if _, err := sdk.AccAddressFromBech32(m.NewOwner); err != nil { + return errorsmod.Wrap(err, "invalid new owner address") + } + + return nil +} + +// GetSignBytes implements the LegacyMsg interface. +func (m MsgTransferOwnership) GetSignBytes() []byte { + return sdk.MustSortJSON(AminoCdc.MustMarshalJSON(&m)) +} + +// ValidateBasic does a sanity check of the provided data +func (m MsgMint) ValidateBasic() error { + if !common.IsHexAddress(m.ContractAddress) { + return errorsmod.Wrapf(errortypes.ErrInvalidAddress, "invalid contract hex address '%s'", m.ContractAddress) + } + + if !m.Amount.IsPositive() { + return errorsmod.Wrapf(errortypes.ErrInvalidCoins, "cannot mint a non-positive amount") + } + + if _, err := sdk.AccAddressFromBech32(m.Sender); err != nil { + return errorsmod.Wrap(err, "invalid sender address") + } + + if _, err := sdk.AccAddressFromBech32(m.To); err != nil { + return errorsmod.Wrap(err, "invalid receiver address") + } + + return nil +} + +// Route returns the message route for a MsgMint +func (m MsgMint) Route() string { return RouterKey } + +// Type returns the message type for a MsgMint +func (m MsgMint) Type() string { return TypeMsgMint } + +// ValidateBasic does a sanity check of the provided data +func (m MsgBurn) ValidateBasic() error { + if !common.IsHexAddress(m.ContractAddress) { + return errorsmod.Wrapf(errortypes.ErrInvalidAddress, "invalid contract hex address '%s'", m.ContractAddress) + } + + if !m.Amount.IsPositive() { + return errorsmod.Wrapf(errortypes.ErrInvalidCoins, "cannot burn a non-positive amount") + } + + if _, err := sdk.AccAddressFromBech32(m.Sender); err != nil { + return errorsmod.Wrap(err, "invalid sender address") + } + + return nil +} + +// Route returns the message route for a MsgBurn +func (m MsgBurn) Route() string { return RouterKey } + +// Type returns the message type for a MsgBurn +func (m MsgBurn) Type() string { return TypeMsgBurn } diff --git a/x/erc20/types/msg_test.go b/x/erc20/types/msg_test.go index 28b9c4ad9..0c65c524b 100644 --- a/x/erc20/types/msg_test.go +++ b/x/erc20/types/msg_test.go @@ -279,3 +279,172 @@ func (suite *MsgsTestSuite) TestMsgUpdateValidateBasic() { }) } } + +func (suite *MsgsTestSuite) TestMsgMintValidateBasic() { + testcases := []struct { + name string + msgMint *types.MsgMint + expPass bool + }{ + { + "fail - invalid contract address", + &types.MsgMint{ + ContractAddress: "invalid", + }, + false, + }, + { + "fail - non-positive amount", + &types.MsgMint{ + ContractAddress: utiltx.GenerateAddress().String(), + Amount: math.NewInt(-1), + }, + false, + }, + { + "fail - invalid sender address", + &types.MsgMint{ + ContractAddress: utiltx.GenerateAddress().String(), + Amount: math.NewInt(100), + Sender: "invalid", + }, + false, + }, + { + "fail - invalid receiver address", + &types.MsgMint{ + ContractAddress: utiltx.GenerateAddress().String(), + Amount: math.NewInt(100), + Sender: sdk.AccAddress(utiltx.GenerateAddress().Bytes()).String(), + To: "invalid", + }, + false, + }, + { + "pass - valid msg", + &types.MsgMint{ + ContractAddress: utiltx.GenerateAddress().String(), + Amount: math.NewInt(100), + Sender: sdk.AccAddress(utiltx.GenerateAddress().Bytes()).String(), + To: sdk.AccAddress(utiltx.GenerateAddress().Bytes()).String(), + }, + true, + }, + } + + for _, tc := range testcases { + suite.Run(tc.name, func() { + err := tc.msgMint.ValidateBasic() + if tc.expPass { + suite.NoError(err) + } else { + suite.Error(err) + } + }) + } +} + +func (suite *MsgsTestSuite) TestMsgBurnValidateBasic() { + testcases := []struct { + name string + msgBurn *types.MsgBurn + expPass bool + }{ + { + "fail - invalid contract address", + &types.MsgBurn{ + ContractAddress: "invalid", + }, + false, + }, + { + "fail - non-positive amount", + &types.MsgBurn{ + ContractAddress: utiltx.GenerateAddress().String(), + Amount: math.NewInt(-1), + }, + false, + }, + { + "fail - invalid sender address", + &types.MsgBurn{ + ContractAddress: utiltx.GenerateAddress().String(), + Amount: math.NewInt(100), + Sender: "invalid", + }, + false, + }, + { + "pass - valid msg", + &types.MsgBurn{ + ContractAddress: utiltx.GenerateAddress().String(), + Amount: math.NewInt(100), + Sender: sdk.AccAddress(utiltx.GenerateAddress().Bytes()).String(), + }, + true, + }, + } + + for _, tc := range testcases { + suite.Run(tc.name, func() { + err := tc.msgBurn.ValidateBasic() + if tc.expPass { + suite.NoError(err) + } else { + suite.Error(err) + } + }) + } +} + +func (suite *MsgsTestSuite) TestMsgTransferOwnershipValidateBasic() { + testcases := []struct { + name string + msg *types.MsgTransferOwnership + expPass bool + }{ + { + "fail - invalid authority address", + &types.MsgTransferOwnership{ + Authority: "invalid", + }, + false, + }, + { + "fail - invalid contract address", + &types.MsgTransferOwnership{ + Authority: authtypes.NewModuleAddress(govtypes.ModuleName).String(), + Token: "invalid", + }, + false, + }, + { + "fail - invalid new owner address", + &types.MsgTransferOwnership{ + Authority: authtypes.NewModuleAddress(govtypes.ModuleName).String(), + NewOwner: "invalid", + }, + false, + }, + { + "pass - valid msg", + &types.MsgTransferOwnership{ + Authority: authtypes.NewModuleAddress(govtypes.ModuleName).String(), + NewOwner: sdk.AccAddress(utiltx.GenerateAddress().Bytes()).String(), + Token: utiltx.GenerateAddress().String(), + }, + true, + }, + } + + for _, tc := range testcases { + suite.Run(tc.name, func() { + err := tc.msg.ValidateBasic() + if tc.expPass { + suite.NoError(err) + } else { + suite.Error(err) + } + }) + } +} diff --git a/x/erc20/types/proposal_test.go b/x/erc20/types/proposal_test.go index 63137695d..081120fb6 100644 --- a/x/erc20/types/proposal_test.go +++ b/x/erc20/types/proposal_test.go @@ -145,16 +145,16 @@ func (suite *ProposalTestSuite) TestRegisterERC20Proposal() { expectPass bool }{ // Valid tests - {msg: "Register token pair - valid pair enabled", title: "test", description: "test desc", pair: types.TokenPair{utiltx.GenerateAddress().String(), "test", true, types.OWNER_MODULE}, expectPass: true}, - {msg: "Register token pair - valid pair dissabled", title: "test", description: "test desc", pair: types.TokenPair{utiltx.GenerateAddress().String(), "test", false, types.OWNER_MODULE}, expectPass: true}, + {msg: "Register token pair - valid pair enabled", title: "test", description: "test desc", pair: types.TokenPair{utiltx.GenerateAddress().String(), "test", true, types.OWNER_MODULE, ""}, expectPass: true}, + {msg: "Register token pair - valid pair dissabled", title: "test", description: "test desc", pair: types.TokenPair{utiltx.GenerateAddress().String(), "test", false, types.OWNER_MODULE, ""}, expectPass: true}, // Missing params valid - {msg: "Register token pair - invalid missing title ", title: "", description: "test desc", pair: types.TokenPair{utiltx.GenerateAddress().String(), "test", false, types.OWNER_MODULE}, expectPass: false}, - {msg: "Register token pair - invalid missing description ", title: "test", description: "", pair: types.TokenPair{utiltx.GenerateAddress().String(), "test", false, types.OWNER_MODULE}, expectPass: false}, + {msg: "Register token pair - invalid missing title ", title: "", description: "test desc", pair: types.TokenPair{utiltx.GenerateAddress().String(), "test", false, types.OWNER_MODULE, ""}, expectPass: false}, + {msg: "Register token pair - invalid missing description ", title: "test", description: "", pair: types.TokenPair{utiltx.GenerateAddress().String(), "test", false, types.OWNER_MODULE, ""}, expectPass: false}, // Invalid address - {msg: "Register token pair - invalid address (no hex)", title: "test", description: "test desc", pair: types.TokenPair{"0x5dCA2483280D9727c80b5518faC4556617fb19ZZ", "test", true, types.OWNER_MODULE}, expectPass: false}, - {msg: "Register token pair - invalid address (invalid length 1)", title: "test", description: "test desc", pair: types.TokenPair{"0x5dCA2483280D9727c80b5518faC4556617fb19", "test", true, types.OWNER_MODULE}, expectPass: false}, - {msg: "Register token pair - invalid address (invalid length 2)", title: "test", description: "test desc", pair: types.TokenPair{"0x5dCA2483280D9727c80b5518faC4556617fb194FFF", "test", true, types.OWNER_MODULE}, expectPass: false}, - {msg: "Register token pair - invalid address (invalid prefix)", title: "test", description: "test desc", pair: types.TokenPair{"1x5dCA2483280D9727c80b5518faC4556617fb19F", "test", true, types.OWNER_MODULE}, expectPass: false}, + {msg: "Register token pair - invalid address (no hex)", title: "test", description: "test desc", pair: types.TokenPair{"0x5dCA2483280D9727c80b5518faC4556617fb19ZZ", "test", true, types.OWNER_MODULE, ""}, expectPass: false}, + {msg: "Register token pair - invalid address (invalid length 1)", title: "test", description: "test desc", pair: types.TokenPair{"0x5dCA2483280D9727c80b5518faC4556617fb19", "test", true, types.OWNER_MODULE, ""}, expectPass: false}, + {msg: "Register token pair - invalid address (invalid length 2)", title: "test", description: "test desc", pair: types.TokenPair{"0x5dCA2483280D9727c80b5518faC4556617fb194FFF", "test", true, types.OWNER_MODULE, ""}, expectPass: false}, + {msg: "Register token pair - invalid address (invalid prefix)", title: "test", description: "test desc", pair: types.TokenPair{"1x5dCA2483280D9727c80b5518faC4556617fb19F", "test", true, types.OWNER_MODULE, ""}, expectPass: false}, } for i, tc := range testCases { diff --git a/x/erc20/types/query.pb.go b/x/erc20/types/query.pb.go index 7c396c160..6faee4220 100644 --- a/x/erc20/types/query.pb.go +++ b/x/erc20/types/query.pb.go @@ -313,6 +313,94 @@ func (m *QueryParamsResponse) GetParams() Params { return Params{} } +type QueryOwnerAddressRequest struct { + ContractAddress string `protobuf:"bytes,1,opt,name=contract_address,json=contractAddress,proto3" json:"contract_address,omitempty"` +} + +func (m *QueryOwnerAddressRequest) Reset() { *m = QueryOwnerAddressRequest{} } +func (m *QueryOwnerAddressRequest) String() string { return proto.CompactTextString(m) } +func (*QueryOwnerAddressRequest) ProtoMessage() {} +func (*QueryOwnerAddressRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_f1630a6677a16bf4, []int{6} +} +func (m *QueryOwnerAddressRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryOwnerAddressRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryOwnerAddressRequest.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 *QueryOwnerAddressRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryOwnerAddressRequest.Merge(m, src) +} +func (m *QueryOwnerAddressRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryOwnerAddressRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryOwnerAddressRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryOwnerAddressRequest proto.InternalMessageInfo + +func (m *QueryOwnerAddressRequest) GetContractAddress() string { + if m != nil { + return m.ContractAddress + } + return "" +} + +type QueryOwnerAddressResponse struct { + OwnerAddress string `protobuf:"bytes,1,opt,name=owner_address,json=ownerAddress,proto3" json:"owner_address,omitempty"` +} + +func (m *QueryOwnerAddressResponse) Reset() { *m = QueryOwnerAddressResponse{} } +func (m *QueryOwnerAddressResponse) String() string { return proto.CompactTextString(m) } +func (*QueryOwnerAddressResponse) ProtoMessage() {} +func (*QueryOwnerAddressResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_f1630a6677a16bf4, []int{7} +} +func (m *QueryOwnerAddressResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryOwnerAddressResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryOwnerAddressResponse.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 *QueryOwnerAddressResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryOwnerAddressResponse.Merge(m, src) +} +func (m *QueryOwnerAddressResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryOwnerAddressResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryOwnerAddressResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryOwnerAddressResponse proto.InternalMessageInfo + +func (m *QueryOwnerAddressResponse) GetOwnerAddress() string { + if m != nil { + return m.OwnerAddress + } + return "" +} + func init() { proto.RegisterType((*QueryTokenPairsRequest)(nil), "cosmos.evm.erc20.v1.QueryTokenPairsRequest") proto.RegisterType((*QueryTokenPairsResponse)(nil), "cosmos.evm.erc20.v1.QueryTokenPairsResponse") @@ -320,45 +408,53 @@ func init() { proto.RegisterType((*QueryTokenPairResponse)(nil), "cosmos.evm.erc20.v1.QueryTokenPairResponse") proto.RegisterType((*QueryParamsRequest)(nil), "cosmos.evm.erc20.v1.QueryParamsRequest") proto.RegisterType((*QueryParamsResponse)(nil), "cosmos.evm.erc20.v1.QueryParamsResponse") + proto.RegisterType((*QueryOwnerAddressRequest)(nil), "cosmos.evm.erc20.v1.QueryOwnerAddressRequest") + proto.RegisterType((*QueryOwnerAddressResponse)(nil), "cosmos.evm.erc20.v1.QueryOwnerAddressResponse") } func init() { proto.RegisterFile("cosmos/evm/erc20/v1/query.proto", fileDescriptor_f1630a6677a16bf4) } var fileDescriptor_f1630a6677a16bf4 = []byte{ - // 524 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x94, 0x41, 0x8b, 0xd3, 0x40, - 0x14, 0xc7, 0x3b, 0xbb, 0x6c, 0xa1, 0xaf, 0x27, 0x67, 0xab, 0x2e, 0x5d, 0xcd, 0xd6, 0x2c, 0xb8, - 0xa1, 0xab, 0x33, 0xdb, 0x7a, 0xd6, 0xc3, 0x1e, 0x54, 0x3c, 0xd5, 0xa2, 0x17, 0x2f, 0x3a, 0x29, - 0x43, 0x0c, 0x9a, 0x4c, 0x36, 0x33, 0x0d, 0x2e, 0x22, 0x88, 0x9f, 0x40, 0x11, 0xfc, 0x0c, 0x9e, - 0xc4, 0x9b, 0x5f, 0x61, 0x8f, 0x05, 0x2f, 0x9e, 0x44, 0x5a, 0xc1, 0xaf, 0x21, 0x99, 0x99, 0xa6, - 0x8d, 0x46, 0x5a, 0x2f, 0x25, 0xf3, 0xf8, 0xbf, 0xff, 0xff, 0xf7, 0xde, 0x0c, 0x85, 0xbd, 0x91, - 0x90, 0x91, 0x90, 0x94, 0x67, 0x11, 0xe5, 0xe9, 0xa8, 0x7f, 0x44, 0xb3, 0x1e, 0x3d, 0x19, 0xf3, - 0xf4, 0x94, 0x24, 0xa9, 0x50, 0x02, 0x6f, 0x1b, 0x01, 0xe1, 0x59, 0x44, 0xb4, 0x80, 0x64, 0xbd, - 0xf6, 0x39, 0x16, 0x85, 0xb1, 0xa0, 0xfa, 0xd7, 0xe8, 0xda, 0x5d, 0x6b, 0xe4, 0x33, 0xc9, 0x8d, - 0x01, 0xcd, 0x7a, 0x3e, 0x57, 0xac, 0x47, 0x13, 0x16, 0x84, 0x31, 0x53, 0xa1, 0x88, 0xad, 0xb6, - 0x32, 0xd4, 0x98, 0x1b, 0xc1, 0x95, 0x2a, 0x41, 0xc0, 0x63, 0x2e, 0x43, 0x69, 0x25, 0xad, 0x40, - 0x04, 0x42, 0x7f, 0xd2, 0xfc, 0xcb, 0x56, 0x2f, 0x05, 0x42, 0x04, 0xcf, 0x39, 0x65, 0x49, 0x48, - 0x59, 0x1c, 0x0b, 0xa5, 0x63, 0x6d, 0x8f, 0xfb, 0x04, 0x2e, 0xdc, 0xcf, 0xc9, 0x1e, 0x88, 0x67, - 0x3c, 0x1e, 0xb0, 0x30, 0x95, 0x43, 0x7e, 0x32, 0xe6, 0x52, 0xe1, 0xdb, 0x00, 0x0b, 0xca, 0x1d, - 0xd4, 0x41, 0x5e, 0xb3, 0x7f, 0x95, 0xd8, 0xd1, 0xf3, 0x91, 0x88, 0xd9, 0x89, 0x1d, 0x89, 0x0c, - 0x58, 0xc0, 0x6d, 0xef, 0x70, 0xa9, 0xd3, 0xfd, 0x84, 0xe0, 0xe2, 0x5f, 0x11, 0x32, 0x11, 0xb1, - 0xe4, 0xf8, 0x1e, 0x34, 0x55, 0x5e, 0x7d, 0x9c, 0xe4, 0xe5, 0x1d, 0xd4, 0xd9, 0xf4, 0x9a, 0x7d, - 0x87, 0x54, 0xec, 0x97, 0x14, 0xdd, 0xc7, 0x8d, 0xb3, 0xef, 0x7b, 0xb5, 0x8f, 0xbf, 0x3e, 0x77, - 0xd1, 0x10, 0x54, 0xe1, 0x89, 0xef, 0x94, 0x78, 0x37, 0x34, 0xef, 0xc1, 0x4a, 0x5e, 0x03, 0x52, - 0x02, 0xbe, 0x0e, 0xe7, 0xcb, 0xbc, 0xf3, 0x8d, 0xb4, 0x60, 0x4b, 0xe7, 0xe9, 0x65, 0x34, 0x86, - 0xe6, 0xe0, 0xfa, 0x7f, 0x6e, 0xb0, 0x98, 0xee, 0x2e, 0xc0, 0x62, 0x3a, 0xbb, 0xc1, 0xff, 0x18, - 0xae, 0x51, 0x0c, 0xe7, 0xb6, 0x00, 0xeb, 0x8c, 0x01, 0x4b, 0x59, 0x34, 0xbf, 0x21, 0xf7, 0x21, - 0x6c, 0x97, 0xaa, 0x36, 0xf6, 0x16, 0xd4, 0x13, 0x5d, 0xb1, 0x91, 0xbb, 0x95, 0x91, 0xa6, 0x69, - 0x39, 0xcf, 0x76, 0xf5, 0xbf, 0x6c, 0xc2, 0x96, 0xf6, 0xc5, 0xef, 0x10, 0xc0, 0xe2, 0xd6, 0xf0, - 0x61, 0xa5, 0x51, 0xf5, 0xf3, 0x69, 0x5f, 0x5b, 0x4f, 0x6c, 0x98, 0x5d, 0xef, 0xcd, 0xd7, 0x9f, - 0xef, 0x37, 0x5c, 0xdc, 0xa1, 0x55, 0xcf, 0x7c, 0xe9, 0x8d, 0xe0, 0x0f, 0x08, 0x1a, 0x85, 0x01, - 0xee, 0xae, 0x91, 0x32, 0x27, 0x3a, 0x5c, 0x4b, 0x6b, 0x81, 0x8e, 0x34, 0x50, 0x17, 0x7b, 0xab, - 0x80, 0xe8, 0x4b, 0x7d, 0x78, 0x85, 0x5f, 0x23, 0xa8, 0x9b, 0xa5, 0xe2, 0x83, 0x7f, 0x27, 0x95, - 0x6e, 0xb0, 0xed, 0xad, 0x16, 0x5a, 0x9e, 0x7d, 0xcd, 0x73, 0x19, 0xef, 0x56, 0xf2, 0x98, 0x9b, - 0x3b, 0xbe, 0x79, 0x36, 0x75, 0xd0, 0x64, 0xea, 0xa0, 0x1f, 0x53, 0x07, 0xbd, 0x9d, 0x39, 0xb5, - 0xc9, 0xcc, 0xa9, 0x7d, 0x9b, 0x39, 0xb5, 0x47, 0xfb, 0x41, 0xa8, 0x9e, 0x8e, 0x7d, 0x32, 0x12, - 0xd1, 0xb2, 0xc1, 0x0b, 0x6b, 0xa1, 0x4e, 0x13, 0x2e, 0xfd, 0xba, 0xfe, 0x4b, 0xb8, 0xf1, 0x3b, - 0x00, 0x00, 0xff, 0xff, 0xdc, 0xca, 0x86, 0x63, 0x01, 0x05, 0x00, 0x00, + // 620 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x94, 0xcf, 0x6e, 0xd3, 0x40, + 0x10, 0xc6, 0xb3, 0x85, 0x56, 0xca, 0xb4, 0x08, 0xd8, 0x06, 0x08, 0x29, 0xb8, 0xc1, 0x91, 0x68, + 0x48, 0xa9, 0x37, 0x09, 0x17, 0x2e, 0x20, 0xa8, 0xc4, 0x1f, 0x71, 0x21, 0x44, 0x70, 0xe1, 0x52, + 0x36, 0xe9, 0xca, 0x58, 0x60, 0xaf, 0x6b, 0x6f, 0x02, 0x55, 0x55, 0x09, 0xf1, 0x04, 0x20, 0x24, + 0x5e, 0x01, 0x4e, 0x88, 0xc7, 0xe8, 0xb1, 0x12, 0x17, 0x4e, 0x08, 0x12, 0x24, 0x5e, 0x03, 0x79, + 0x77, 0xe3, 0xd8, 0xc1, 0x55, 0xc2, 0xa5, 0xb2, 0xa7, 0xdf, 0x7c, 0xdf, 0x6f, 0xc6, 0xd3, 0xc2, + 0x6a, 0x97, 0x87, 0x2e, 0x0f, 0x09, 0xeb, 0xbb, 0x84, 0x05, 0xdd, 0x66, 0x9d, 0xf4, 0x1b, 0x64, + 0xa7, 0xc7, 0x82, 0x5d, 0xcb, 0x0f, 0xb8, 0xe0, 0x78, 0x59, 0x09, 0x2c, 0xd6, 0x77, 0x2d, 0x29, + 0xb0, 0xfa, 0x8d, 0xd2, 0x69, 0xea, 0x3a, 0x1e, 0x27, 0xf2, 0xa7, 0xd2, 0x95, 0x6a, 0xda, 0xa8, + 0x43, 0x43, 0xa6, 0x0c, 0x48, 0xbf, 0xd1, 0x61, 0x82, 0x36, 0x88, 0x4f, 0x6d, 0xc7, 0xa3, 0xc2, + 0xe1, 0x9e, 0xd6, 0x66, 0x86, 0x2a, 0x73, 0x25, 0xb8, 0x94, 0x25, 0xb0, 0x99, 0xc7, 0x42, 0x27, + 0xd4, 0x92, 0x82, 0xcd, 0x6d, 0x2e, 0x1f, 0x49, 0xf4, 0xa4, 0xab, 0x17, 0x6c, 0xce, 0xed, 0x97, + 0x8c, 0x50, 0xdf, 0x21, 0xd4, 0xf3, 0xb8, 0x90, 0xb1, 0xba, 0xc7, 0x7c, 0x06, 0x67, 0x1f, 0x45, + 0x64, 0x8f, 0xf9, 0x0b, 0xe6, 0xb5, 0xa8, 0x13, 0x84, 0x6d, 0xb6, 0xd3, 0x63, 0xa1, 0xc0, 0x77, + 0x01, 0xc6, 0x94, 0x45, 0x54, 0x46, 0xd5, 0xc5, 0xe6, 0x65, 0x4b, 0x8f, 0x1e, 0x8d, 0x64, 0xa9, + 0x9d, 0xe8, 0x91, 0xac, 0x16, 0xb5, 0x99, 0xee, 0x6d, 0x27, 0x3a, 0xcd, 0x2f, 0x08, 0xce, 0xfd, + 0x13, 0x11, 0xfa, 0xdc, 0x0b, 0x19, 0x7e, 0x00, 0x8b, 0x22, 0xaa, 0x6e, 0xf9, 0x51, 0xb9, 0x88, + 0xca, 0xc7, 0xaa, 0x8b, 0x4d, 0xc3, 0xca, 0xd8, 0xaf, 0x15, 0x77, 0x6f, 0xe6, 0x0f, 0x7e, 0xac, + 0xe6, 0x3e, 0xff, 0xf9, 0x5a, 0x43, 0x6d, 0x10, 0xb1, 0x27, 0xbe, 0x97, 0xe2, 0x9d, 0x93, 0xbc, + 0x6b, 0x53, 0x79, 0x15, 0x48, 0x0a, 0x78, 0x03, 0xce, 0xa4, 0x79, 0x47, 0x1b, 0x29, 0xc0, 0xbc, + 0xcc, 0x93, 0xcb, 0xc8, 0xb7, 0xd5, 0x8b, 0xd9, 0x99, 0xdc, 0x60, 0x3c, 0xdd, 0x7d, 0x80, 0xf1, + 0x74, 0x7a, 0x83, 0xff, 0x31, 0x5c, 0x3e, 0x1e, 0xce, 0x2c, 0x00, 0x96, 0x19, 0x2d, 0x1a, 0x50, + 0x77, 0xf4, 0x85, 0xcc, 0x27, 0xb0, 0x9c, 0xaa, 0xea, 0xd8, 0x9b, 0xb0, 0xe0, 0xcb, 0x8a, 0x8e, + 0x5c, 0xc9, 0x8c, 0x54, 0x4d, 0xc9, 0x3c, 0xdd, 0x65, 0xde, 0x81, 0xa2, 0xb4, 0x7d, 0xf8, 0xca, + 0x63, 0xc1, 0xed, 0xed, 0xed, 0x80, 0x85, 0xf1, 0x51, 0x5c, 0x81, 0x53, 0x5d, 0xee, 0x89, 0x80, + 0x76, 0xc5, 0x16, 0x55, 0xbf, 0xd2, 0xdb, 0x38, 0x39, 0xaa, 0xeb, 0x0e, 0xf3, 0x16, 0x9c, 0xcf, + 0xb0, 0xd1, 0x8c, 0x15, 0x38, 0xc1, 0xa3, 0xfa, 0x84, 0xc9, 0x12, 0x4f, 0x88, 0x9b, 0xbf, 0x8e, + 0xc3, 0xbc, 0xb4, 0xc0, 0xef, 0x11, 0xc0, 0xf8, 0x7c, 0xf0, 0x7a, 0xe6, 0x44, 0xd9, 0x77, 0x5c, + 0xba, 0x3a, 0x9b, 0x58, 0x81, 0x99, 0xd5, 0xb7, 0xdf, 0x7e, 0x7f, 0x98, 0x33, 0x71, 0x99, 0x64, + 0xfd, 0xbd, 0x25, 0x8e, 0x15, 0x7f, 0x44, 0x90, 0x8f, 0x0d, 0x70, 0x6d, 0x86, 0x94, 0x11, 0xd1, + 0xfa, 0x4c, 0x5a, 0x0d, 0x54, 0x97, 0x40, 0x35, 0x5c, 0x9d, 0x06, 0x44, 0xf6, 0xe4, 0xcb, 0x3e, + 0x7e, 0x83, 0x60, 0x41, 0x7d, 0x5d, 0xbc, 0x76, 0x74, 0x52, 0xea, 0x94, 0x4a, 0xd5, 0xe9, 0x42, + 0xcd, 0x53, 0x91, 0x3c, 0x17, 0xf1, 0x4a, 0x26, 0x8f, 0x3a, 0x21, 0xfc, 0x09, 0xc1, 0x52, 0xf2, + 0xbb, 0xe3, 0x8d, 0xa3, 0xfd, 0x33, 0xce, 0xac, 0x64, 0xcd, 0x2a, 0xd7, 0x50, 0xd7, 0x25, 0x54, + 0x13, 0xd7, 0x23, 0x9a, 0x88, 0x69, 0xc4, 0x93, 0x3a, 0x32, 0xb2, 0x37, 0x79, 0xbb, 0xfb, 0x9b, + 0x37, 0x0e, 0x06, 0x06, 0x3a, 0x1c, 0x18, 0xe8, 0xe7, 0xc0, 0x40, 0xef, 0x86, 0x46, 0xee, 0x70, + 0x68, 0xe4, 0xbe, 0x0f, 0x8d, 0xdc, 0xd3, 0x8a, 0xed, 0x88, 0xe7, 0xbd, 0x8e, 0xd5, 0xe5, 0x6e, + 0x72, 0xd4, 0xd7, 0xda, 0x5c, 0xec, 0xfa, 0x2c, 0xec, 0x2c, 0xc8, 0xff, 0xa2, 0xd7, 0xfe, 0x06, + 0x00, 0x00, 0xff, 0xff, 0xd7, 0xee, 0x11, 0xd0, 0x34, 0x06, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -379,6 +475,8 @@ type QueryClient interface { TokenPair(ctx context.Context, in *QueryTokenPairRequest, opts ...grpc.CallOption) (*QueryTokenPairResponse, error) // Params retrieves the erc20 module params Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) + // OwnerAddress retrieves the owner address for a given ERC20 contract address + OwnerAddress(ctx context.Context, in *QueryOwnerAddressRequest, opts ...grpc.CallOption) (*QueryOwnerAddressResponse, error) } type queryClient struct { @@ -416,6 +514,15 @@ func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts . return out, nil } +func (c *queryClient) OwnerAddress(ctx context.Context, in *QueryOwnerAddressRequest, opts ...grpc.CallOption) (*QueryOwnerAddressResponse, error) { + out := new(QueryOwnerAddressResponse) + err := c.cc.Invoke(ctx, "/cosmos.evm.erc20.v1.Query/OwnerAddress", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // QueryServer is the server API for Query service. type QueryServer interface { // TokenPairs retrieves registered token pairs @@ -424,6 +531,8 @@ type QueryServer interface { TokenPair(context.Context, *QueryTokenPairRequest) (*QueryTokenPairResponse, error) // Params retrieves the erc20 module params Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) + // OwnerAddress retrieves the owner address for a given ERC20 contract address + OwnerAddress(context.Context, *QueryOwnerAddressRequest) (*QueryOwnerAddressResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -439,6 +548,9 @@ func (*UnimplementedQueryServer) TokenPair(ctx context.Context, req *QueryTokenP func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") } +func (*UnimplementedQueryServer) OwnerAddress(ctx context.Context, req *QueryOwnerAddressRequest) (*QueryOwnerAddressResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method OwnerAddress not implemented") +} func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) @@ -498,6 +610,24 @@ func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interf return interceptor(ctx, in, info, handler) } +func _Query_OwnerAddress_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryOwnerAddressRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).OwnerAddress(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.evm.erc20.v1.Query/OwnerAddress", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).OwnerAddress(ctx, req.(*QueryOwnerAddressRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "cosmos.evm.erc20.v1.Query", HandlerType: (*QueryServer)(nil), @@ -514,6 +644,10 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "Params", Handler: _Query_Params_Handler, }, + { + MethodName: "OwnerAddress", + Handler: _Query_OwnerAddress_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "cosmos/evm/erc20/v1/query.proto", @@ -722,6 +856,66 @@ func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *QueryOwnerAddressRequest) 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 *QueryOwnerAddressRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryOwnerAddressRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ContractAddress) > 0 { + i -= len(m.ContractAddress) + copy(dAtA[i:], m.ContractAddress) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ContractAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryOwnerAddressResponse) 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 *QueryOwnerAddressResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryOwnerAddressResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.OwnerAddress) > 0 { + i -= len(m.OwnerAddress) + copy(dAtA[i:], m.OwnerAddress) + i = encodeVarintQuery(dAtA, i, uint64(len(m.OwnerAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { offset -= sovQuery(v) base := offset @@ -809,6 +1003,32 @@ func (m *QueryParamsResponse) Size() (n int) { return n } +func (m *QueryOwnerAddressRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ContractAddress) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryOwnerAddressResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.OwnerAddress) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + func sovQuery(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -1319,6 +1539,170 @@ func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *QueryOwnerAddressRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryOwnerAddressRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryOwnerAddressRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ContractAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ContractAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryOwnerAddressResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryOwnerAddressResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryOwnerAddressResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OwnerAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OwnerAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipQuery(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/erc20/types/query.pb.gw.go b/x/erc20/types/query.pb.gw.go index 2a3ad976b..22cd18d8b 100644 --- a/x/erc20/types/query.pb.gw.go +++ b/x/erc20/types/query.pb.gw.go @@ -141,6 +141,60 @@ func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshal } +func request_Query_OwnerAddress_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryOwnerAddressRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["contract_address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "contract_address") + } + + protoReq.ContractAddress, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "contract_address", err) + } + + msg, err := client.OwnerAddress(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_OwnerAddress_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryOwnerAddressRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["contract_address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "contract_address") + } + + protoReq.ContractAddress, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "contract_address", err) + } + + msg, err := server.OwnerAddress(ctx, &protoReq) + return msg, metadata, err + +} + // RegisterQueryHandlerServer registers the http handlers for service Query to "mux". // UnaryRPC :call QueryServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. @@ -216,6 +270,29 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + mux.Handle("GET", pattern_Query_OwnerAddress_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_OwnerAddress_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_OwnerAddress_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -317,6 +394,26 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_OwnerAddress_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_OwnerAddress_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_OwnerAddress_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -326,6 +423,8 @@ var ( pattern_Query_TokenPair_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5}, []string{"cosmos", "evm", "erc20", "v1", "token_pairs", "token"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"cosmos", "evm", "erc20", "v1", "params"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_OwnerAddress_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"evmos", "erc20", "v1", "owner_address", "contract_address"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( @@ -334,4 +433,6 @@ var ( forward_Query_TokenPair_0 = runtime.ForwardResponseMessage forward_Query_Params_0 = runtime.ForwardResponseMessage + + forward_Query_OwnerAddress_0 = runtime.ForwardResponseMessage ) diff --git a/x/erc20/types/token_pair.go b/x/erc20/types/token_pair.go index 0b19df00f..09991514e 100644 --- a/x/erc20/types/token_pair.go +++ b/x/erc20/types/token_pair.go @@ -50,6 +50,11 @@ func (tp TokenPair) GetERC20Contract() common.Address { return common.HexToAddress(tp.Erc20Address) } +// SetOwnerAddress sets the address of the owner of the ERC20 contract +func (tp *TokenPair) SetOwnerAddress(address string) { + tp.OwnerAddress = address +} + // Validate performs a stateless validation of a TokenPair func (tp TokenPair) Validate() error { if err := sdk.ValidateDenom(tp.Denom); err != nil { diff --git a/x/erc20/types/token_pair_test.go b/x/erc20/types/token_pair_test.go index e29ce121e..61b296767 100644 --- a/x/erc20/types/token_pair_test.go +++ b/x/erc20/types/token_pair_test.go @@ -59,10 +59,10 @@ func (suite *TokenPairTestSuite) TestTokenPair() { pair types.TokenPair expectPass bool }{ - {msg: "Register token pair - invalid address (no hex)", pair: types.TokenPair{"0x5dCA2483280D9727c80b5518faC4556617fb19ZZ", "test", true, types.OWNER_MODULE}, expectPass: false}, - {msg: "Register token pair - invalid address (invalid length 1)", pair: types.TokenPair{"0x5dCA2483280D9727c80b5518faC4556617fb19", "test", true, types.OWNER_MODULE}, expectPass: false}, - {msg: "Register token pair - invalid address (invalid length 2)", pair: types.TokenPair{"0x5dCA2483280D9727c80b5518faC4556617fb194FFF", "test", true, types.OWNER_MODULE}, expectPass: false}, - {msg: "pass", pair: types.TokenPair{utiltx.GenerateAddress().String(), "test", true, types.OWNER_MODULE}, expectPass: true}, + {msg: "Register token pair - invalid address (no hex)", pair: types.TokenPair{"0x5dCA2483280D9727c80b5518faC4556617fb19ZZ", "test", true, types.OWNER_MODULE, ""}, expectPass: false}, + {msg: "Register token pair - invalid address (invalid length 1)", pair: types.TokenPair{"0x5dCA2483280D9727c80b5518faC4556617fb19", "test", true, types.OWNER_MODULE, ""}, expectPass: false}, + {msg: "Register token pair - invalid address (invalid length 2)", pair: types.TokenPair{"0x5dCA2483280D9727c80b5518faC4556617fb194FFF", "test", true, types.OWNER_MODULE, ""}, expectPass: false}, + {msg: "pass", pair: types.TokenPair{utiltx.GenerateAddress().String(), "test", true, types.OWNER_MODULE, ""}, expectPass: true}, } for i, tc := range testCases { @@ -101,17 +101,17 @@ func (suite *TokenPairTestSuite) TestIsNativeCoin() { }{ { "no owner", - types.TokenPair{utiltx.GenerateAddress().String(), "test", true, types.OWNER_UNSPECIFIED}, + types.TokenPair{utiltx.GenerateAddress().String(), "test", true, types.OWNER_UNSPECIFIED, ""}, false, }, { "external ERC20 owner", - types.TokenPair{utiltx.GenerateAddress().String(), "test", true, types.OWNER_EXTERNAL}, + types.TokenPair{utiltx.GenerateAddress().String(), "test", true, types.OWNER_EXTERNAL, ""}, false, }, { "pass", - types.TokenPair{utiltx.GenerateAddress().String(), "test", true, types.OWNER_MODULE}, + types.TokenPair{utiltx.GenerateAddress().String(), "test", true, types.OWNER_MODULE, ""}, true, }, } @@ -134,17 +134,17 @@ func (suite *TokenPairTestSuite) TestIsNativeERC20() { }{ { "no owner", - types.TokenPair{utiltx.GenerateAddress().String(), "test", true, types.OWNER_UNSPECIFIED}, + types.TokenPair{utiltx.GenerateAddress().String(), "test", true, types.OWNER_UNSPECIFIED, ""}, false, }, { "module owner", - types.TokenPair{utiltx.GenerateAddress().String(), "test", true, types.OWNER_MODULE}, + types.TokenPair{utiltx.GenerateAddress().String(), "test", true, types.OWNER_MODULE, ""}, false, }, { "pass", - types.TokenPair{utiltx.GenerateAddress().String(), "test", true, types.OWNER_EXTERNAL}, + types.TokenPair{utiltx.GenerateAddress().String(), "test", true, types.OWNER_EXTERNAL, ""}, true, }, } diff --git a/x/erc20/types/tx.pb.go b/x/erc20/types/tx.pb.go index 5e68426eb..112610bb0 100644 --- a/x/erc20/types/tx.pb.go +++ b/x/erc20/types/tx.pb.go @@ -527,6 +527,305 @@ func (m *MsgToggleConversionResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgToggleConversionResponse proto.InternalMessageInfo +// MsgTransferOwnership defines a Msg to transfer the ownership of the ERC20 +// token pair to the new owner +type MsgTransferOwnership struct { + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // token identifier can be either the hex contract address of the ERC20 or the + // Cosmos base denomination + Token string `protobuf:"bytes,2,opt,name=token,proto3" json:"token,omitempty"` + // new_owner is the hex address of the new owner + NewOwner string `protobuf:"bytes,3,opt,name=new_owner,json=newOwner,proto3" json:"new_owner,omitempty"` +} + +func (m *MsgTransferOwnership) Reset() { *m = MsgTransferOwnership{} } +func (m *MsgTransferOwnership) String() string { return proto.CompactTextString(m) } +func (*MsgTransferOwnership) ProtoMessage() {} +func (*MsgTransferOwnership) Descriptor() ([]byte, []int) { + return fileDescriptor_e06c8e6992ada536, []int{10} +} +func (m *MsgTransferOwnership) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgTransferOwnership) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgTransferOwnership.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 *MsgTransferOwnership) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgTransferOwnership.Merge(m, src) +} +func (m *MsgTransferOwnership) XXX_Size() int { + return m.Size() +} +func (m *MsgTransferOwnership) XXX_DiscardUnknown() { + xxx_messageInfo_MsgTransferOwnership.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgTransferOwnership proto.InternalMessageInfo + +func (m *MsgTransferOwnership) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" +} + +func (m *MsgTransferOwnership) GetToken() string { + if m != nil { + return m.Token + } + return "" +} + +func (m *MsgTransferOwnership) GetNewOwner() string { + if m != nil { + return m.NewOwner + } + return "" +} + +// MsgTransferOwnershipResponse returns no fields +type MsgTransferOwnershipResponse struct { +} + +func (m *MsgTransferOwnershipResponse) Reset() { *m = MsgTransferOwnershipResponse{} } +func (m *MsgTransferOwnershipResponse) String() string { return proto.CompactTextString(m) } +func (*MsgTransferOwnershipResponse) ProtoMessage() {} +func (*MsgTransferOwnershipResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_e06c8e6992ada536, []int{11} +} +func (m *MsgTransferOwnershipResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgTransferOwnershipResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgTransferOwnershipResponse.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 *MsgTransferOwnershipResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgTransferOwnershipResponse.Merge(m, src) +} +func (m *MsgTransferOwnershipResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgTransferOwnershipResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgTransferOwnershipResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgTransferOwnershipResponse proto.InternalMessageInfo + +// MsgMint defines a Msg to mint ERC20 tokens +type MsgMint struct { + // contract_address of an ERC20 token contract, that is registered in a token + // pair + ContractAddress string `protobuf:"bytes,1,opt,name=contract_address,json=contractAddress,proto3" json:"contract_address,omitempty"` + // amount of ERC20 tokens to mint + Amount cosmossdk_io_math.Int `protobuf:"bytes,2,opt,name=amount,proto3,customtype=cosmossdk.io/math.Int" json:"amount"` + // to is the address to mint the tokens to + To string `protobuf:"bytes,3,opt,name=to,proto3" json:"to,omitempty"` + // sender is the address of the sender + Sender string `protobuf:"bytes,4,opt,name=sender,proto3" json:"sender,omitempty"` +} + +func (m *MsgMint) Reset() { *m = MsgMint{} } +func (m *MsgMint) String() string { return proto.CompactTextString(m) } +func (*MsgMint) ProtoMessage() {} +func (*MsgMint) Descriptor() ([]byte, []int) { + return fileDescriptor_e06c8e6992ada536, []int{12} +} +func (m *MsgMint) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgMint) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgMint.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgMint) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgMint.Merge(m, src) +} +func (m *MsgMint) XXX_Size() int { + return m.Size() +} +func (m *MsgMint) XXX_DiscardUnknown() { + xxx_messageInfo_MsgMint.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgMint proto.InternalMessageInfo + +func (m *MsgMint) GetContractAddress() string { + if m != nil { + return m.ContractAddress + } + return "" +} + +func (m *MsgMint) GetTo() string { + if m != nil { + return m.To + } + return "" +} + +func (m *MsgMint) GetSender() string { + if m != nil { + return m.Sender + } + return "" +} + +type MsgMintResponse struct { +} + +func (m *MsgMintResponse) Reset() { *m = MsgMintResponse{} } +func (m *MsgMintResponse) String() string { return proto.CompactTextString(m) } +func (*MsgMintResponse) ProtoMessage() {} +func (*MsgMintResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_e06c8e6992ada536, []int{13} +} +func (m *MsgMintResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgMintResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgMintResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgMintResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgMintResponse.Merge(m, src) +} +func (m *MsgMintResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgMintResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgMintResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgMintResponse proto.InternalMessageInfo + +// MsgBurn defines a Msg to burn ERC20 tokens +type MsgBurn struct { + // contract_address of an ERC20 token contract, that is registered in a token + // pair + ContractAddress string `protobuf:"bytes,1,opt,name=contract_address,json=contractAddress,proto3" json:"contract_address,omitempty"` + // amount of ERC20 tokens to burn + Amount cosmossdk_io_math.Int `protobuf:"bytes,2,opt,name=amount,proto3,customtype=cosmossdk.io/math.Int" json:"amount"` + // sender is the address of the sender + Sender string `protobuf:"bytes,3,opt,name=sender,proto3" json:"sender,omitempty"` +} + +func (m *MsgBurn) Reset() { *m = MsgBurn{} } +func (m *MsgBurn) String() string { return proto.CompactTextString(m) } +func (*MsgBurn) ProtoMessage() {} +func (*MsgBurn) Descriptor() ([]byte, []int) { + return fileDescriptor_e06c8e6992ada536, []int{14} +} +func (m *MsgBurn) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgBurn) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgBurn.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 *MsgBurn) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgBurn.Merge(m, src) +} +func (m *MsgBurn) XXX_Size() int { + return m.Size() +} +func (m *MsgBurn) XXX_DiscardUnknown() { + xxx_messageInfo_MsgBurn.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgBurn proto.InternalMessageInfo + +func (m *MsgBurn) GetContractAddress() string { + if m != nil { + return m.ContractAddress + } + return "" +} + +func (m *MsgBurn) GetSender() string { + if m != nil { + return m.Sender + } + return "" +} + +type MsgBurnResponse struct { +} + +func (m *MsgBurnResponse) Reset() { *m = MsgBurnResponse{} } +func (m *MsgBurnResponse) String() string { return proto.CompactTextString(m) } +func (*MsgBurnResponse) ProtoMessage() {} +func (*MsgBurnResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_e06c8e6992ada536, []int{15} +} +func (m *MsgBurnResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgBurnResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgBurnResponse.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 *MsgBurnResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgBurnResponse.Merge(m, src) +} +func (m *MsgBurnResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgBurnResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgBurnResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgBurnResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*MsgConvertERC20)(nil), "cosmos.evm.erc20.v1.MsgConvertERC20") proto.RegisterType((*MsgConvertERC20Response)(nil), "cosmos.evm.erc20.v1.MsgConvertERC20Response") @@ -538,62 +837,80 @@ func init() { proto.RegisterType((*MsgRegisterERC20Response)(nil), "cosmos.evm.erc20.v1.MsgRegisterERC20Response") proto.RegisterType((*MsgToggleConversion)(nil), "cosmos.evm.erc20.v1.MsgToggleConversion") proto.RegisterType((*MsgToggleConversionResponse)(nil), "cosmos.evm.erc20.v1.MsgToggleConversionResponse") + proto.RegisterType((*MsgTransferOwnership)(nil), "cosmos.evm.erc20.v1.MsgTransferOwnership") + proto.RegisterType((*MsgTransferOwnershipResponse)(nil), "cosmos.evm.erc20.v1.MsgTransferOwnershipResponse") + proto.RegisterType((*MsgMint)(nil), "cosmos.evm.erc20.v1.MsgMint") + proto.RegisterType((*MsgMintResponse)(nil), "cosmos.evm.erc20.v1.MsgMintResponse") + proto.RegisterType((*MsgBurn)(nil), "cosmos.evm.erc20.v1.MsgBurn") + proto.RegisterType((*MsgBurnResponse)(nil), "cosmos.evm.erc20.v1.MsgBurnResponse") } func init() { proto.RegisterFile("cosmos/evm/erc20/v1/tx.proto", fileDescriptor_e06c8e6992ada536) } var fileDescriptor_e06c8e6992ada536 = []byte{ - // 796 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x55, 0xcf, 0x4f, 0x13, 0x4d, - 0x18, 0xee, 0x42, 0x69, 0xbe, 0x0e, 0x7c, 0xc0, 0xb7, 0xf0, 0x41, 0x59, 0xf8, 0xca, 0xe7, 0xf2, - 0x43, 0xac, 0xb0, 0xdb, 0x16, 0x35, 0xb1, 0x89, 0x26, 0x96, 0x78, 0xf0, 0xd0, 0xc4, 0xac, 0x7a, - 0xf1, 0x42, 0xb6, 0xdb, 0xc9, 0xb0, 0x81, 0x9d, 0x69, 0x76, 0x86, 0x06, 0x6e, 0x86, 0xa3, 0x89, - 0x89, 0xc6, 0xbb, 0x89, 0x37, 0x8f, 0x1c, 0xfc, 0x03, 0x3c, 0x19, 0x8e, 0x44, 0x2f, 0xc6, 0x03, - 0x31, 0x60, 0xc2, 0xc1, 0x9b, 0x7f, 0x81, 0xd9, 0x99, 0xe9, 0xb2, 0x5d, 0xb6, 0xb6, 0xf1, 0xd2, - 0x74, 0xde, 0xf7, 0x79, 0xe7, 0x7d, 0x9e, 0xf7, 0xc7, 0x2c, 0x98, 0x73, 0x08, 0xf5, 0x08, 0x35, - 0x61, 0xcb, 0x33, 0xa1, 0xef, 0x94, 0x8b, 0x66, 0xab, 0x64, 0xb2, 0x3d, 0xa3, 0xe9, 0x13, 0x46, - 0xd4, 0x09, 0xe1, 0x35, 0x60, 0xcb, 0x33, 0xb8, 0xd7, 0x68, 0x95, 0xb4, 0x7f, 0x6c, 0xcf, 0xc5, - 0xc4, 0xe4, 0xbf, 0x02, 0xa7, 0xe5, 0xe5, 0x2d, 0x75, 0x9b, 0x42, 0xb3, 0x55, 0xaa, 0x43, 0x66, - 0x97, 0x4c, 0x87, 0xb8, 0x58, 0xfa, 0xaf, 0x24, 0x65, 0x41, 0x10, 0x43, 0xea, 0x52, 0x09, 0x99, - 0x96, 0x10, 0x8f, 0xa2, 0xc0, 0xe9, 0x51, 0x24, 0x1d, 0x33, 0xc2, 0xb1, 0xc9, 0x4f, 0xa6, 0x24, - 0x24, 0x5c, 0x93, 0x88, 0x20, 0x22, 0xec, 0xc1, 0x3f, 0x69, 0x9d, 0x43, 0x84, 0xa0, 0x1d, 0x68, - 0xda, 0x4d, 0xd7, 0xb4, 0x31, 0x26, 0xcc, 0x66, 0x2e, 0xc1, 0x32, 0x46, 0xff, 0xa9, 0x80, 0xb1, - 0x1a, 0x45, 0x1b, 0x04, 0xb7, 0xa0, 0xcf, 0xee, 0x5b, 0x1b, 0xe5, 0xa2, 0x7a, 0x0d, 0x8c, 0x3b, - 0x04, 0x33, 0xdf, 0x76, 0xd8, 0xa6, 0xdd, 0x68, 0xf8, 0x90, 0xd2, 0x9c, 0xf2, 0xbf, 0xb2, 0x92, - 0xb5, 0xc6, 0xda, 0xf6, 0x7b, 0xc2, 0xac, 0x56, 0x40, 0xc6, 0xf6, 0xc8, 0x2e, 0x66, 0xb9, 0x81, - 0x00, 0x50, 0xd5, 0x8f, 0x4e, 0xe6, 0x53, 0x5f, 0x4f, 0xe6, 0xff, 0x15, 0xc4, 0x68, 0x63, 0xdb, - 0x70, 0x89, 0xe9, 0xd9, 0x6c, 0xcb, 0x78, 0x80, 0xd9, 0xbb, 0xf3, 0xc3, 0x82, 0x62, 0xc9, 0x08, - 0xf5, 0x06, 0xf8, 0xcb, 0x87, 0x0e, 0x74, 0x5b, 0xd0, 0xcf, 0x0d, 0xf2, 0xe8, 0xdc, 0xa7, 0xf7, - 0x6b, 0x93, 0x52, 0x92, 0xcc, 0xf0, 0x88, 0xf9, 0x2e, 0x46, 0x56, 0x88, 0x54, 0xa7, 0x40, 0x86, - 0x42, 0xdc, 0x80, 0x7e, 0x2e, 0xcd, 0x29, 0xc9, 0x53, 0xa5, 0x70, 0x70, 0x7e, 0x58, 0x90, 0x87, - 0xe7, 0xe7, 0x87, 0x05, 0x2d, 0x52, 0xe3, 0x98, 0x40, 0x7d, 0x06, 0x4c, 0xc7, 0x4c, 0x16, 0xa4, - 0x4d, 0x82, 0x29, 0xd4, 0x3f, 0x2a, 0x60, 0xf4, 0xc2, 0xb7, 0x41, 0x5c, 0xac, 0xae, 0x83, 0x74, - 0xd0, 0x3b, 0x5e, 0x82, 0xe1, 0xf2, 0x8c, 0x21, 0x09, 0x06, 0xcd, 0x35, 0x64, 0x73, 0x8d, 0x00, - 0x58, 0x4d, 0x07, 0xe2, 0x2d, 0x0e, 0x56, 0xb5, 0x88, 0x38, 0x5e, 0x9a, 0x88, 0x84, 0x62, 0x28, - 0xa1, 0x97, 0xec, 0xb6, 0xb8, 0x52, 0x4c, 0x5c, 0x74, 0x80, 0xf6, 0xe4, 0x08, 0x75, 0xb2, 0xd6, - 0x73, 0x60, 0xaa, 0xd3, 0x12, 0x4a, 0xfc, 0x20, 0x5a, 0xfe, 0xa4, 0xd9, 0xb0, 0x19, 0x7c, 0x68, - 0xfb, 0xb6, 0x47, 0xd5, 0x5b, 0x20, 0x6b, 0xef, 0xb2, 0x2d, 0xe2, 0xbb, 0x6c, 0x5f, 0xf4, 0xfa, - 0x37, 0xac, 0x2e, 0xa0, 0xea, 0x5d, 0x90, 0x69, 0xf2, 0x1b, 0xb8, 0xc8, 0xe1, 0xf2, 0xac, 0x91, - 0xb0, 0x22, 0x86, 0x48, 0x52, 0xcd, 0x06, 0xf5, 0x91, 0x33, 0x20, 0xa2, 0x2a, 0x37, 0x03, 0x61, - 0x17, 0xf7, 0x05, 0xda, 0xf4, 0x64, 0x6d, 0x51, 0xba, 0xb2, 0x81, 0x51, 0x53, 0xa8, 0xee, 0xad, - 0x02, 0xc6, 0x6b, 0x14, 0x59, 0x10, 0xb9, 0x94, 0x41, 0x5f, 0x4c, 0x74, 0x50, 0x71, 0x17, 0x61, - 0xe8, 0xf7, 0xd4, 0x26, 0x71, 0xea, 0x32, 0x18, 0xe5, 0xa9, 0xe5, 0xfc, 0xc3, 0x40, 0xe0, 0xe0, - 0x4a, 0xd6, 0x8a, 0x59, 0x2b, 0xeb, 0xa2, 0x33, 0x3c, 0x28, 0x60, 0xbf, 0x90, 0xcc, 0xbe, 0x83, - 0x8e, 0xae, 0x81, 0x5c, 0xdc, 0x16, 0xf2, 0x7f, 0xa3, 0x80, 0x89, 0x1a, 0x45, 0x8f, 0x09, 0x42, - 0x3b, 0x50, 0xb4, 0x8f, 0xba, 0x04, 0xff, 0x71, 0x87, 0x26, 0xc1, 0x10, 0x23, 0xdb, 0x10, 0xcb, - 0x29, 0x14, 0x87, 0xca, 0xed, 0xcb, 0x75, 0x5f, 0x4e, 0x66, 0x1e, 0x27, 0xa2, 0xff, 0x07, 0x66, - 0x13, 0xcc, 0x6d, 0xfe, 0xe5, 0x1f, 0x69, 0x30, 0x58, 0xa3, 0x48, 0x7d, 0xa5, 0x80, 0x91, 0x8e, - 0x57, 0x65, 0x31, 0x71, 0x34, 0x62, 0x7b, 0xa8, 0xad, 0xf6, 0x83, 0x0a, 0x8b, 0xb5, 0x76, 0xf0, - 0xf9, 0xfb, 0xeb, 0x81, 0xab, 0xea, 0x92, 0x99, 0xfc, 0x6e, 0x9b, 0x8e, 0x88, 0xda, 0xe4, 0x36, - 0xf5, 0x85, 0x02, 0x86, 0xa3, 0x9b, 0xbd, 0xd0, 0x23, 0x59, 0x00, 0xd2, 0xae, 0xf7, 0x01, 0x0a, - 0x09, 0xad, 0x72, 0x42, 0xcb, 0xea, 0x62, 0x2f, 0x42, 0xfc, 0x91, 0xa8, 0x83, 0x91, 0x8e, 0x2d, - 0xec, 0x5a, 0xa2, 0x28, 0xaa, 0x7b, 0x89, 0x92, 0xf6, 0x41, 0x85, 0xe0, 0xef, 0xce, 0x5d, 0x58, - 0xea, 0x16, 0xde, 0x01, 0xd3, 0xd6, 0xfa, 0x82, 0x85, 0x69, 0x30, 0x18, 0xbf, 0x34, 0xb2, 0x2b, - 0xdd, 0xae, 0x88, 0x23, 0xb5, 0x62, 0xbf, 0xc8, 0x76, 0x3e, 0x6d, 0xe8, 0x59, 0xf0, 0x8e, 0x54, - 0xef, 0x1c, 0x9d, 0xe6, 0x95, 0xe3, 0xd3, 0xbc, 0xf2, 0xed, 0x34, 0xaf, 0xbc, 0x3c, 0xcb, 0xa7, - 0x8e, 0xcf, 0xf2, 0xa9, 0x2f, 0x67, 0xf9, 0xd4, 0xd3, 0x05, 0xe4, 0xb2, 0xad, 0xdd, 0xba, 0xe1, - 0x10, 0xcf, 0x4c, 0x98, 0x6c, 0xb6, 0xdf, 0x84, 0xb4, 0x9e, 0xe1, 0x1f, 0xc1, 0xf5, 0x5f, 0x01, - 0x00, 0x00, 0xff, 0xff, 0x3b, 0x2d, 0x64, 0x53, 0xf7, 0x07, 0x00, 0x00, + // 980 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x56, 0xcf, 0x6f, 0xdc, 0x44, + 0x14, 0x8e, 0x93, 0x6d, 0xda, 0x9d, 0x94, 0x34, 0x75, 0x43, 0xba, 0x71, 0xb6, 0x2e, 0x38, 0x69, + 0x48, 0x43, 0x63, 0x67, 0x37, 0x14, 0x89, 0x95, 0x40, 0x62, 0x23, 0x0e, 0x1c, 0x56, 0x20, 0x03, + 0x17, 0x2e, 0x91, 0xd7, 0x3b, 0x4c, 0xac, 0xd6, 0x33, 0xd6, 0xcc, 0x64, 0xd3, 0xdc, 0x50, 0x8f, + 0x48, 0x48, 0xad, 0xb8, 0x23, 0xb8, 0x71, 0xcc, 0x81, 0x3f, 0x80, 0x13, 0xaa, 0x38, 0x55, 0x70, + 0x41, 0x1c, 0x2a, 0x94, 0x20, 0xe5, 0xce, 0x5f, 0x80, 0xe6, 0x47, 0x1c, 0xdb, 0xb1, 0xb3, 0x0b, + 0x42, 0xbd, 0x44, 0xf1, 0x7b, 0xdf, 0x9b, 0xf7, 0x7d, 0xef, 0xbd, 0x79, 0xb3, 0xa0, 0x19, 0x12, + 0x16, 0x13, 0xe6, 0xc1, 0x61, 0xec, 0x41, 0x1a, 0xb6, 0x37, 0xbd, 0x61, 0xcb, 0xe3, 0x8f, 0xdc, + 0x84, 0x12, 0x4e, 0xcc, 0x1b, 0xca, 0xeb, 0xc2, 0x61, 0xec, 0x4a, 0xaf, 0x3b, 0x6c, 0x59, 0xd7, + 0x83, 0x38, 0xc2, 0xc4, 0x93, 0x7f, 0x15, 0xce, 0xb2, 0xf5, 0x29, 0xfd, 0x80, 0x41, 0x6f, 0xd8, + 0xea, 0x43, 0x1e, 0xb4, 0xbc, 0x90, 0x44, 0x58, 0xfb, 0x5f, 0x2f, 0xcb, 0x82, 0x20, 0x86, 0x2c, + 0x62, 0x1a, 0x72, 0x53, 0x43, 0x62, 0x86, 0x84, 0x33, 0x66, 0x48, 0x3b, 0x16, 0x95, 0x63, 0x47, + 0x7e, 0x79, 0x9a, 0x90, 0x72, 0xcd, 0x23, 0x82, 0x88, 0xb2, 0x8b, 0xff, 0xb4, 0xb5, 0x89, 0x08, + 0x41, 0x0f, 0xa1, 0x17, 0x24, 0x91, 0x17, 0x60, 0x4c, 0x78, 0xc0, 0x23, 0x82, 0x75, 0x8c, 0xf3, + 0xb7, 0x01, 0xae, 0xf5, 0x18, 0xda, 0x26, 0x78, 0x08, 0x29, 0xff, 0xc0, 0xdf, 0x6e, 0x6f, 0x9a, + 0x77, 0xc1, 0x5c, 0x48, 0x30, 0xa7, 0x41, 0xc8, 0x77, 0x82, 0xc1, 0x80, 0x42, 0xc6, 0x1a, 0xc6, + 0x6b, 0xc6, 0x5a, 0xdd, 0xbf, 0x76, 0x6a, 0x7f, 0x5f, 0x99, 0xcd, 0x0e, 0x98, 0x0e, 0x62, 0xb2, + 0x87, 0x79, 0x63, 0x52, 0x00, 0xba, 0xce, 0xb3, 0x17, 0xb7, 0x27, 0xfe, 0x78, 0x71, 0xfb, 0x55, + 0x45, 0x8c, 0x0d, 0x1e, 0xb8, 0x11, 0xf1, 0xe2, 0x80, 0xef, 0xba, 0x1f, 0x62, 0xfe, 0xc3, 0xc9, + 0xe1, 0xba, 0xe1, 0xeb, 0x08, 0xf3, 0x2d, 0x70, 0x85, 0xc2, 0x10, 0x46, 0x43, 0x48, 0x1b, 0x53, + 0x32, 0xba, 0xf1, 0xeb, 0x8f, 0x1b, 0xf3, 0x5a, 0x92, 0xce, 0xf0, 0x09, 0xa7, 0x11, 0x46, 0x7e, + 0x8a, 0x34, 0x17, 0xc0, 0x34, 0x83, 0x78, 0x00, 0x69, 0xa3, 0x26, 0x29, 0xe9, 0xaf, 0xce, 0xfa, + 0xe3, 0x93, 0xc3, 0x75, 0xfd, 0xf1, 0xd5, 0xc9, 0xe1, 0xba, 0x95, 0xa9, 0x71, 0x41, 0xa0, 0xb3, + 0x08, 0x6e, 0x16, 0x4c, 0x3e, 0x64, 0x09, 0xc1, 0x0c, 0x3a, 0x3f, 0x1b, 0x60, 0xf6, 0xcc, 0xb7, + 0x4d, 0x22, 0x6c, 0x6e, 0x81, 0x9a, 0xe8, 0x9d, 0x2c, 0xc1, 0x4c, 0x7b, 0xd1, 0xd5, 0x04, 0x45, + 0x73, 0x5d, 0xdd, 0x5c, 0x57, 0x00, 0xbb, 0x35, 0x21, 0xde, 0x97, 0x60, 0xd3, 0xca, 0x88, 0x93, + 0xa5, 0xc9, 0x48, 0xd8, 0x4c, 0x25, 0x8c, 0x92, 0x7d, 0x2a, 0xae, 0x55, 0x10, 0x97, 0x1d, 0xa0, + 0x47, 0x7a, 0x84, 0xf2, 0xac, 0x9d, 0x06, 0x58, 0xc8, 0x5b, 0x52, 0x89, 0x3f, 0xa9, 0x96, 0x7f, + 0x96, 0x0c, 0x02, 0x0e, 0x3f, 0x0e, 0x68, 0x10, 0x33, 0xf3, 0x6d, 0x50, 0x0f, 0xf6, 0xf8, 0x2e, + 0xa1, 0x11, 0x3f, 0x50, 0xbd, 0xbe, 0x80, 0xd5, 0x19, 0xd4, 0x7c, 0x0f, 0x4c, 0x27, 0xf2, 0x04, + 0x29, 0x72, 0xa6, 0xbd, 0xe4, 0x96, 0x5c, 0x11, 0x57, 0x25, 0xe9, 0xd6, 0x45, 0x7d, 0xf4, 0x0c, + 0xa8, 0xa8, 0xce, 0x7d, 0x21, 0xec, 0xec, 0x3c, 0xa1, 0xcd, 0x29, 0xd7, 0x96, 0xa5, 0xab, 0x1b, + 0x98, 0x35, 0xa5, 0xea, 0xbe, 0x37, 0xc0, 0x5c, 0x8f, 0x21, 0x1f, 0xa2, 0x88, 0x71, 0x48, 0xd5, + 0x44, 0x8b, 0x8a, 0x47, 0x08, 0x43, 0x3a, 0x52, 0x9b, 0xc6, 0x99, 0xab, 0x60, 0x56, 0xa6, 0xd6, + 0xf3, 0x0f, 0x85, 0xc0, 0xa9, 0xb5, 0xba, 0x5f, 0xb0, 0x76, 0xb6, 0x54, 0x67, 0x64, 0x90, 0x60, + 0xbf, 0x5c, 0xce, 0x3e, 0x47, 0xc7, 0xb1, 0x40, 0xa3, 0x68, 0x4b, 0xf9, 0x7f, 0x6b, 0x80, 0x1b, + 0x3d, 0x86, 0x3e, 0x25, 0x08, 0x3d, 0x84, 0xaa, 0x7d, 0x2c, 0x22, 0xf8, 0x3f, 0x77, 0x68, 0x1e, + 0x5c, 0xe2, 0xe4, 0x01, 0xc4, 0x7a, 0x0a, 0xd5, 0x47, 0xe7, 0x9d, 0xf3, 0x75, 0x5f, 0x2d, 0x67, + 0x5e, 0x24, 0xe2, 0xdc, 0x02, 0x4b, 0x25, 0xe6, 0x94, 0xff, 0x53, 0x03, 0xcc, 0x0b, 0x3f, 0x0d, + 0x30, 0xfb, 0x02, 0xd2, 0x8f, 0xf6, 0x31, 0xa4, 0x6c, 0x37, 0x4a, 0xfe, 0x5f, 0x01, 0xe6, 0x12, + 0xa8, 0x63, 0xb8, 0xbf, 0x43, 0xc4, 0xf1, 0xea, 0x1a, 0xf9, 0x57, 0x30, 0xdc, 0x97, 0xe9, 0x3a, + 0xb3, 0x79, 0x75, 0x8e, 0x0d, 0x9a, 0x65, 0x94, 0x52, 0xce, 0xdf, 0x19, 0xe0, 0x72, 0x8f, 0xa1, + 0x5e, 0x84, 0xf9, 0xbf, 0x59, 0x7e, 0xf7, 0x0b, 0xcb, 0xef, 0xd6, 0x85, 0xcb, 0x2f, 0xdd, 0x7b, + 0xb3, 0x60, 0x92, 0x13, 0xcd, 0x79, 0x92, 0x93, 0xca, 0x8d, 0x36, 0x93, 0xb9, 0xf4, 0xce, 0x75, + 0x79, 0x67, 0x05, 0xc3, 0x94, 0xf5, 0x13, 0xc5, 0xba, 0xbb, 0x47, 0xf1, 0x4b, 0x60, 0xbd, 0x90, + 0x5f, 0x5a, 0x17, 0xb1, 0x14, 0x8c, 0x4e, 0x59, 0xb6, 0x7f, 0xb9, 0x0c, 0xa6, 0x7a, 0x0c, 0x99, + 0x4f, 0x0d, 0x70, 0x35, 0xf7, 0xca, 0xac, 0x94, 0xae, 0x8a, 0xc2, 0x5e, 0xb6, 0xee, 0x8d, 0x83, + 0x4a, 0x4b, 0xb2, 0xf1, 0xf8, 0xb7, 0xbf, 0xbe, 0x99, 0x7c, 0xc3, 0xbc, 0xe3, 0x95, 0xbf, 0xe3, + 0x5e, 0xa8, 0xa2, 0x76, 0xa4, 0xcd, 0xfc, 0xda, 0x00, 0x33, 0xd9, 0x4d, 0xbf, 0x3c, 0x22, 0x99, + 0x00, 0x59, 0x6f, 0x8e, 0x01, 0x4a, 0x09, 0xdd, 0x93, 0x84, 0x56, 0xcd, 0x95, 0x51, 0x84, 0xe4, + 0xa3, 0xd1, 0x07, 0x57, 0x73, 0x5b, 0xb9, 0xb2, 0x44, 0x59, 0x54, 0x75, 0x89, 0xca, 0xf6, 0xa3, + 0x09, 0xc1, 0x2b, 0xf9, 0xdd, 0x78, 0xa7, 0x2a, 0x3c, 0x07, 0xb3, 0x36, 0xc6, 0x82, 0xa5, 0x69, + 0x30, 0x98, 0x3b, 0xb7, 0xc2, 0xd6, 0xaa, 0x8e, 0x28, 0x22, 0xad, 0xcd, 0x71, 0x91, 0x69, 0xbe, + 0x03, 0xb0, 0x78, 0x7a, 0xbf, 0xb7, 0xf5, 0xc0, 0x9f, 0xad, 0x9e, 0xbb, 0x95, 0xc7, 0x15, 0x57, + 0x82, 0xd5, 0x1a, 0x1b, 0x9a, 0xa6, 0x4e, 0x40, 0x4d, 0x6e, 0x8e, 0x66, 0x55, 0xa8, 0xf0, 0x5a, + 0x2b, 0x17, 0x79, 0xd3, 0x79, 0x59, 0x91, 0xf3, 0x62, 0x3b, 0xcd, 0xaa, 0x79, 0x89, 0x45, 0xa6, + 0x04, 0xd4, 0xe4, 0xad, 0xaf, 0xcc, 0x28, 0xbc, 0xd5, 0x19, 0xb3, 0xf7, 0x73, 0x74, 0xc6, 0xbe, + 0x38, 0xeb, 0xd2, 0x97, 0xe2, 0xd9, 0xee, 0xbe, 0xfb, 0xec, 0xc8, 0x36, 0x9e, 0x1f, 0xd9, 0xc6, + 0x9f, 0x47, 0xb6, 0xf1, 0xe4, 0xd8, 0x9e, 0x78, 0x7e, 0x6c, 0x4f, 0xfc, 0x7e, 0x6c, 0x4f, 0x7c, + 0xbe, 0x8c, 0x22, 0xbe, 0xbb, 0xd7, 0x77, 0x43, 0x12, 0x7b, 0x25, 0x0f, 0x09, 0x3f, 0x48, 0x20, + 0xeb, 0x4f, 0xcb, 0xdf, 0x9c, 0x5b, 0xff, 0x04, 0x00, 0x00, 0xff, 0xff, 0x74, 0x49, 0xf4, 0x0d, + 0x66, 0x0b, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -626,6 +943,13 @@ type MsgClient interface { // token pair conversion. The authority is hard-coded to the Cosmos SDK x/gov // module account ToggleConversion(ctx context.Context, in *MsgToggleConversion, opts ...grpc.CallOption) (*MsgToggleConversionResponse, error) + // TransferContractOwnership defines a Msg to transfer the ownership of the + // ERC20 token pair to the new owner + TransferContractOwnership(ctx context.Context, in *MsgTransferOwnership, opts ...grpc.CallOption) (*MsgTransferOwnershipResponse, error) + // Mint mints ERC20 tokens + Mint(ctx context.Context, in *MsgMint, opts ...grpc.CallOption) (*MsgMintResponse, error) + // Burn burns ERC20 tokens + Burn(ctx context.Context, in *MsgBurn, opts ...grpc.CallOption) (*MsgBurnResponse, error) } type msgClient struct { @@ -681,6 +1005,33 @@ func (c *msgClient) ToggleConversion(ctx context.Context, in *MsgToggleConversio return out, nil } +func (c *msgClient) TransferContractOwnership(ctx context.Context, in *MsgTransferOwnership, opts ...grpc.CallOption) (*MsgTransferOwnershipResponse, error) { + out := new(MsgTransferOwnershipResponse) + err := c.cc.Invoke(ctx, "/cosmos.evm.erc20.v1.Msg/TransferContractOwnership", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) Mint(ctx context.Context, in *MsgMint, opts ...grpc.CallOption) (*MsgMintResponse, error) { + out := new(MsgMintResponse) + err := c.cc.Invoke(ctx, "/cosmos.evm.erc20.v1.Msg/Mint", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) Burn(ctx context.Context, in *MsgBurn, opts ...grpc.CallOption) (*MsgBurnResponse, error) { + out := new(MsgBurnResponse) + err := c.cc.Invoke(ctx, "/cosmos.evm.erc20.v1.Msg/Burn", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { // ConvertERC20 mints a native Cosmos coin representation of the ERC20 token @@ -701,6 +1052,13 @@ type MsgServer interface { // token pair conversion. The authority is hard-coded to the Cosmos SDK x/gov // module account ToggleConversion(context.Context, *MsgToggleConversion) (*MsgToggleConversionResponse, error) + // TransferContractOwnership defines a Msg to transfer the ownership of the + // ERC20 token pair to the new owner + TransferContractOwnership(context.Context, *MsgTransferOwnership) (*MsgTransferOwnershipResponse, error) + // Mint mints ERC20 tokens + Mint(context.Context, *MsgMint) (*MsgMintResponse, error) + // Burn burns ERC20 tokens + Burn(context.Context, *MsgBurn) (*MsgBurnResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -722,6 +1080,15 @@ func (*UnimplementedMsgServer) RegisterERC20(ctx context.Context, req *MsgRegist func (*UnimplementedMsgServer) ToggleConversion(ctx context.Context, req *MsgToggleConversion) (*MsgToggleConversionResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ToggleConversion not implemented") } +func (*UnimplementedMsgServer) TransferContractOwnership(ctx context.Context, req *MsgTransferOwnership) (*MsgTransferOwnershipResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method TransferContractOwnership not implemented") +} +func (*UnimplementedMsgServer) Mint(ctx context.Context, req *MsgMint) (*MsgMintResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Mint not implemented") +} +func (*UnimplementedMsgServer) Burn(ctx context.Context, req *MsgBurn) (*MsgBurnResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Burn not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -817,6 +1184,60 @@ func _Msg_ToggleConversion_Handler(srv interface{}, ctx context.Context, dec fun return interceptor(ctx, in, info, handler) } +func _Msg_TransferContractOwnership_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgTransferOwnership) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).TransferContractOwnership(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.evm.erc20.v1.Msg/TransferContractOwnership", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).TransferContractOwnership(ctx, req.(*MsgTransferOwnership)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_Mint_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgMint) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).Mint(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.evm.erc20.v1.Msg/Mint", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).Mint(ctx, req.(*MsgMint)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_Burn_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgBurn) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).Burn(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.evm.erc20.v1.Msg/Burn", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).Burn(ctx, req.(*MsgBurn)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "cosmos.evm.erc20.v1.Msg", HandlerType: (*MsgServer)(nil), @@ -841,6 +1262,18 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "ToggleConversion", Handler: _Msg_ToggleConversion_Handler, }, + { + MethodName: "TransferContractOwnership", + Handler: _Msg_TransferContractOwnership_Handler, + }, + { + MethodName: "Mint", + Handler: _Msg_Mint_Handler, + }, + { + MethodName: "Burn", + Handler: _Msg_Burn_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "cosmos/evm/erc20/v1/tx.proto", @@ -1178,10 +1611,224 @@ func (m *MsgToggleConversionResponse) MarshalToSizedBuffer(dAtA []byte) (int, er return len(dAtA) - i, nil } -func encodeVarintTx(dAtA []byte, offset int, v uint64) int { - offset -= sovTx(v) - base := offset - for v >= 1<<7 { +func (m *MsgTransferOwnership) 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 *MsgTransferOwnership) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgTransferOwnership) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.NewOwner) > 0 { + i -= len(m.NewOwner) + copy(dAtA[i:], m.NewOwner) + i = encodeVarintTx(dAtA, i, uint64(len(m.NewOwner))) + i-- + dAtA[i] = 0x1a + } + if len(m.Token) > 0 { + i -= len(m.Token) + copy(dAtA[i:], m.Token) + i = encodeVarintTx(dAtA, i, uint64(len(m.Token))) + i-- + dAtA[i] = 0x12 + } + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgTransferOwnershipResponse) 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 *MsgTransferOwnershipResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgTransferOwnershipResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgMint) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgMint) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgMint) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) + i-- + dAtA[i] = 0x22 + } + if len(m.To) > 0 { + i -= len(m.To) + copy(dAtA[i:], m.To) + i = encodeVarintTx(dAtA, i, uint64(len(m.To))) + i-- + dAtA[i] = 0x1a + } + { + size := m.Amount.Size() + i -= size + if _, err := m.Amount.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.ContractAddress) > 0 { + i -= len(m.ContractAddress) + copy(dAtA[i:], m.ContractAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.ContractAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgMintResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgMintResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgMintResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgBurn) 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 *MsgBurn) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgBurn) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) + i-- + dAtA[i] = 0x1a + } + { + size := m.Amount.Size() + i -= size + if _, err := m.Amount.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.ContractAddress) > 0 { + i -= len(m.ContractAddress) + copy(dAtA[i:], m.ContractAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.ContractAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgBurnResponse) 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 *MsgBurnResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgBurnResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func encodeVarintTx(dAtA []byte, offset int, v uint64) int { + offset -= sovTx(v) + base := offset + for v >= 1<<7 { dAtA[offset] = uint8(v&0x7f | 0x80) v >>= 7 offset++ @@ -1327,48 +1974,138 @@ func (m *MsgToggleConversionResponse) Size() (n int) { return n } -func sovTx(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 +func (m *MsgTransferOwnership) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Token) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.NewOwner) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n } -func sozTx(x uint64) (n int) { - return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) + +func (m *MsgTransferOwnershipResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n } -func (m *MsgConvertERC20) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgConvertERC20: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgConvertERC20: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ContractAddress", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { + +func (m *MsgMint) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ContractAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Amount.Size() + n += 1 + l + sovTx(uint64(l)) + l = len(m.To) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgMintResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgBurn) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ContractAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Amount.Size() + n += 1 + l + sovTx(uint64(l)) + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgBurnResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func sovTx(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTx(x uint64) (n int) { + return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *MsgConvertERC20) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgConvertERC20: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgConvertERC20: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ContractAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { return ErrIntOverflowTx } if iNdEx >= l { @@ -1430,7 +2167,533 @@ func (m *MsgConvertERC20) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Receiver", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Receiver", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Receiver = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgConvertERC20Response) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgConvertERC20Response: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgConvertERC20Response: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgConvertCoin) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgConvertCoin: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgConvertCoin: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Coin", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Coin.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Receiver", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Receiver = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgConvertCoinResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgConvertCoinResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgConvertCoinResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgRegisterERC20) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgRegisterERC20: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgRegisterERC20: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1458,11 +2721,11 @@ func (m *MsgConvertERC20) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Receiver = string(dAtA[iNdEx:postIndex]) + m.Signer = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 4: + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Erc20Addresses", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1490,7 +2753,7 @@ func (m *MsgConvertERC20) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Sender = string(dAtA[iNdEx:postIndex]) + m.Erc20Addresses = append(m.Erc20Addresses, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex default: iNdEx = preIndex @@ -1513,7 +2776,7 @@ func (m *MsgConvertERC20) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgConvertERC20Response) Unmarshal(dAtA []byte) error { +func (m *MsgRegisterERC20Response) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1536,10 +2799,10 @@ func (m *MsgConvertERC20Response) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgConvertERC20Response: wiretype end group for non-group") + return fmt.Errorf("proto: MsgRegisterERC20Response: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgConvertERC20Response: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgRegisterERC20Response: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -1563,7 +2826,7 @@ func (m *MsgConvertERC20Response) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgConvertCoin) Unmarshal(dAtA []byte) error { +func (m *MsgToggleConversion) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1586,48 +2849,15 @@ func (m *MsgConvertCoin) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgConvertCoin: wiretype end group for non-group") + return fmt.Errorf("proto: MsgToggleConversion: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgConvertCoin: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgToggleConversion: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Coin", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Coin.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Receiver", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1655,11 +2885,11 @@ func (m *MsgConvertCoin) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Receiver = string(dAtA[iNdEx:postIndex]) + m.Authority = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 3: + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Token", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1687,7 +2917,7 @@ func (m *MsgConvertCoin) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Sender = string(dAtA[iNdEx:postIndex]) + m.Token = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -1710,7 +2940,7 @@ func (m *MsgConvertCoin) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgConvertCoinResponse) Unmarshal(dAtA []byte) error { +func (m *MsgToggleConversionResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1733,10 +2963,10 @@ func (m *MsgConvertCoinResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgConvertCoinResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgToggleConversionResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgConvertCoinResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgToggleConversionResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -1760,7 +2990,7 @@ func (m *MsgConvertCoinResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { +func (m *MsgTransferOwnership) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1783,10 +3013,10 @@ func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgUpdateParams: wiretype end group for non-group") + return fmt.Errorf("proto: MsgTransferOwnership: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUpdateParams: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgTransferOwnership: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1823,9 +3053,9 @@ func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Token", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -1835,24 +3065,55 @@ func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err + m.Token = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NewOwner", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NewOwner = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -1875,7 +3136,7 @@ func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error { +func (m *MsgTransferOwnershipResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1898,10 +3159,10 @@ func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgUpdateParamsResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgTransferOwnershipResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUpdateParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgTransferOwnershipResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -1925,7 +3186,7 @@ func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgRegisterERC20) Unmarshal(dAtA []byte) error { +func (m *MsgMint) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1948,15 +3209,15 @@ func (m *MsgRegisterERC20) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgRegisterERC20: wiretype end group for non-group") + return fmt.Errorf("proto: MsgMint: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgRegisterERC20: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgMint: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ContractAddress", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1984,11 +3245,11 @@ func (m *MsgRegisterERC20) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Signer = string(dAtA[iNdEx:postIndex]) + m.ContractAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Erc20Addresses", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2016,7 +3277,73 @@ func (m *MsgRegisterERC20) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Erc20Addresses = append(m.Erc20Addresses, string(dAtA[iNdEx:postIndex])) + if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field To", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.To = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sender = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -2039,7 +3366,7 @@ func (m *MsgRegisterERC20) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgRegisterERC20Response) Unmarshal(dAtA []byte) error { +func (m *MsgMintResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2062,10 +3389,10 @@ func (m *MsgRegisterERC20Response) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgRegisterERC20Response: wiretype end group for non-group") + return fmt.Errorf("proto: MsgMintResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgRegisterERC20Response: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgMintResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -2089,7 +3416,7 @@ func (m *MsgRegisterERC20Response) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgToggleConversion) Unmarshal(dAtA []byte) error { +func (m *MsgBurn) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2112,15 +3439,15 @@ func (m *MsgToggleConversion) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgToggleConversion: wiretype end group for non-group") + return fmt.Errorf("proto: MsgBurn: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgToggleConversion: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgBurn: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ContractAddress", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2148,11 +3475,11 @@ func (m *MsgToggleConversion) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Authority = string(dAtA[iNdEx:postIndex]) + m.ContractAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Token", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2180,7 +3507,41 @@ func (m *MsgToggleConversion) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Token = string(dAtA[iNdEx:postIndex]) + if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sender = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -2203,7 +3564,7 @@ func (m *MsgToggleConversion) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgToggleConversionResponse) Unmarshal(dAtA []byte) error { +func (m *MsgBurnResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2226,10 +3587,10 @@ func (m *MsgToggleConversionResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgToggleConversionResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgBurnResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgToggleConversionResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgBurnResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: diff --git a/x/erc20/types/tx.pb.gw.go b/x/erc20/types/tx.pb.gw.go index ea477d402..c7f36fdbc 100644 --- a/x/erc20/types/tx.pb.gw.go +++ b/x/erc20/types/tx.pb.gw.go @@ -105,6 +105,78 @@ func local_request_Msg_ConvertCoin_0(ctx context.Context, marshaler runtime.Mars } +var ( + filter_Msg_Mint_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Msg_Mint_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq MsgMint + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_Mint_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.Mint(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Msg_Mint_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq MsgMint + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_Mint_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.Mint(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Msg_Burn_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Msg_Burn_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq MsgBurn + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_Burn_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.Burn(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Msg_Burn_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq MsgBurn + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_Burn_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.Burn(ctx, &protoReq) + return msg, metadata, err + +} + // RegisterMsgHandlerServer registers the http handlers for service Msg to "mux". // UnaryRPC :call MsgServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. @@ -157,6 +229,52 @@ func RegisterMsgHandlerServer(ctx context.Context, mux *runtime.ServeMux, server }) + mux.Handle("POST", pattern_Msg_Mint_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Msg_Mint_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Msg_Mint_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_Msg_Burn_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Msg_Burn_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Msg_Burn_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -238,6 +356,46 @@ func RegisterMsgHandlerClient(ctx context.Context, mux *runtime.ServeMux, client }) + mux.Handle("POST", pattern_Msg_Mint_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Msg_Mint_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Msg_Mint_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_Msg_Burn_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Msg_Burn_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Msg_Burn_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -245,10 +403,18 @@ var ( pattern_Msg_ConvertERC20_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 2, 5}, []string{"cosmos", "evm", "erc20", "v1", "tx", "convert_erc20"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Msg_ConvertCoin_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 2, 5}, []string{"cosmos", "evm", "erc20", "v1", "tx", "convert_coin"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Msg_Mint_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 2, 5}, []string{"cosmos", "evm", "erc20", "v1", "tx", "mint"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Msg_Burn_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 2, 5}, []string{"cosmos", "evm", "erc20", "v1", "tx", "burn"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( forward_Msg_ConvertERC20_0 = runtime.ForwardResponseMessage forward_Msg_ConvertCoin_0 = runtime.ForwardResponseMessage + + forward_Msg_Mint_0 = runtime.ForwardResponseMessage + + forward_Msg_Burn_0 = runtime.ForwardResponseMessage )