From 9b3a7585c8c17ca3f0f4ccb90f2b421cbd83fdae Mon Sep 17 00:00:00 2001 From: GuillemGarciaDev Date: Tue, 17 Feb 2026 15:34:13 +0100 Subject: [PATCH 01/10] feat: add erc20 forked capabilities --- api/cosmos/evm/erc20/v1/erc20.pulsar.go | 191 +- api/cosmos/evm/erc20/v1/query.pulsar.go | 1089 +++++- api/cosmos/evm/erc20/v1/query_grpc.pb.go | 45 +- api/cosmos/evm/erc20/v1/tx.pulsar.go | 3247 ++++++++++++++++- api/cosmos/evm/erc20/v1/tx_grpc.pb.go | 129 +- precompiles/erc20/IERC20Burnable.sol | 39 + precompiles/erc20/IERC20Metadata.sol | 5 +- precompiles/erc20/IERC20Mintable.sol | 9 + precompiles/erc20/IOwnable.sol | 42 + precompiles/erc20/abi.json | 112 + precompiles/erc20/erc20.go | 51 +- precompiles/erc20/errors.go | 11 + precompiles/erc20/events.go | 32 + precompiles/erc20/interfaces.go | 6 + precompiles/erc20/query.go | 24 + precompiles/erc20/tx.go | 245 ++ precompiles/erc20/types.go | 95 + precompiles/werc20/abi.json | 112 + precompiles/werc20/interfaces.go | 6 + proto/cosmos/evm/erc20/v1/erc20.proto | 3 + proto/cosmos/evm/erc20/v1/query.proto | 11 + proto/cosmos/evm/erc20/v1/tx.proto | 65 + .../precompiles/erc20/test_burn.go | 94 + .../precompiles/erc20/test_erc20.go | 14 + .../precompiles/erc20/test_mint.go | 264 ++ .../precompiles/erc20/test_params.go | 38 + .../precompiles/erc20/test_token_pairs.go | 492 +++ .../integration/precompiles/erc20/test_tx.go | 532 +++ .../precompiles/erc20/test_types.go | 34 + .../precompiles/erc20/test_utils.go | 51 + .../suites/precompiles/test/3_erc20/erc20.js | 263 +- x/erc20/client/cli/query.go | 37 + x/erc20/client/cli/tx.go | 84 + x/erc20/keeper/burn.go | 45 + x/erc20/keeper/grpc_query.go | 7 + x/erc20/keeper/mint.go | 44 + x/erc20/keeper/msg_server.go | 60 + x/erc20/keeper/token_pairs.go | 22 + x/erc20/keeper/transfer_ownership.go | 67 + x/erc20/types/erc20.pb.go | 131 +- x/erc20/types/errors.go | 43 +- x/erc20/types/msg.go | 84 + x/erc20/types/msg_test.go | 169 + x/erc20/types/proposal_test.go | 16 +- x/erc20/types/query.pb.go | 452 ++- x/erc20/types/query.pb.gw.go | 101 + x/erc20/types/token_pair.go | 5 + x/erc20/types/token_pair_test.go | 20 +- x/erc20/types/tx.pb.go | 1721 ++++++++- x/erc20/types/tx.pb.gw.go | 166 + x/vm/statedb/statedb.go | 2 +- 51 files changed, 10151 insertions(+), 476 deletions(-) create mode 100644 precompiles/erc20/IERC20Burnable.sol create mode 100644 precompiles/erc20/IERC20Mintable.sol create mode 100644 precompiles/erc20/IOwnable.sol create mode 100644 tests/integration/precompiles/erc20/test_burn.go create mode 100644 tests/integration/precompiles/erc20/test_mint.go create mode 100644 tests/integration/precompiles/erc20/test_params.go create mode 100644 tests/integration/precompiles/erc20/test_token_pairs.go create mode 100644 x/erc20/keeper/burn.go create mode 100644 x/erc20/keeper/transfer_ownership.go diff --git a/api/cosmos/evm/erc20/v1/erc20.pulsar.go b/api/cosmos/evm/erc20/v1/erc20.pulsar.go index 388117150..368e0ed52 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 766fa21bb..af9491312 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, 0xba, 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, 0x99, - 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, 0x33, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2d, 0x12, 0x2b, 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, 0x3d, 0x2a, 0x2a, 0x7d, 0x12, 0x80, 0x01, 0x0a, 0x06, 0x50, - 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x27, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x65, + 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, 0xe4, 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, 0x99, 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, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x28, + 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, 0x33, + 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2d, 0x12, 0x2b, 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, 0x3d, + 0x2a, 0x2a, 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, + 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 c31355491..0b8a70016 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/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..9443662f8 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 12121b7c4..6220ac3f7 100644 --- a/precompiles/erc20/erc20.go +++ b/precompiles/erc20/erc20.go @@ -27,15 +27,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 ) var ( @@ -121,6 +123,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 @@ -134,6 +146,8 @@ func (p Precompile) RequiredGas(input []byte) uint64 { return GasBalanceOf case AllowanceMethod: return GasAllowance + case OwnerMethod: + return GasOwner default: return 0 } @@ -167,7 +181,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 @@ -190,6 +209,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) @@ -203,6 +232,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 e0c7b72fb..1e7ca782a 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 @@ -200,6 +203,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 f1ed409f2..c27b6da5c 100644 --- a/precompiles/erc20/tx.go +++ b/precompiles/erc20/tx.go @@ -5,8 +5,12 @@ import ( "github.com/ethereum/go-ethereum/accounts/abi" "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/tracing" "github.com/ethereum/go-ethereum/core/vm" + "github.com/cosmos/evm/utils" + evmtypes "github.com/cosmos/evm/x/vm/types" + "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" @@ -20,11 +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" ) +// 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( @@ -129,3 +146,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.Expand commentComment on line R188Resolved + // 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.Expand commentComment on line R309Resolved + // Currently, decimal conversion issues exist with the precisebank module.Expand commentComment on line R310Resolved + // 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..f7631fb64 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": [ @@ -274,6 +293,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 d7cd29d2d..94e722df9 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 a23a6832c..ebefa3b5a 100644 --- a/proto/cosmos/evm/erc20/v1/query.proto +++ b/proto/cosmos/evm/erc20/v1/query.proto @@ -27,6 +27,13 @@ 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 +79,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..b70694548 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,56 @@ 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 {} \ No newline at end of file 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..d5bbb4dce 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() { diff --git a/tests/integration/precompiles/erc20/test_mint.go b/tests/integration/precompiles/erc20/test_mint.go new file mode 100644 index 000000000..284da6bd0 --- /dev/null +++ b/tests/integration/precompiles/erc20/test_mint.go @@ -0,0 +1,264 @@ +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 + 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, 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 e68530faa..269d5b829 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. @@ -448,3 +452,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/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 6e54481f3..36458fb3f 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 } @@ -128,3 +131,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 34b1b8e7a..c61d3a09d 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 := utils.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 := utils.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 8ca7191df..da6985203 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 be8fb44fa..9076569d2 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, 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 79e029260..7fcda36ec 100644 --- a/x/erc20/keeper/msg_server.go +++ b/x/erc20/keeper/msg_server.go @@ -171,6 +171,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 6957ab35b..3ca0fc138 100644 --- a/x/erc20/keeper/token_pairs.go +++ b/x/erc20/keeper/token_pairs.go @@ -218,3 +218,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 9370f63d2..43a59d137 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 a6649cad7..12db3cb50 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{ @@ -134,3 +146,75 @@ func (msg MsgConvertCoin) ValidateBasic() error { } return nil } + +// 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)) //nolint:staticcheck +} + +// 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 b71a4ad3b..9ff3aa2b2 100644 --- a/x/erc20/types/msg_test.go +++ b/x/erc20/types/msg_test.go @@ -275,3 +275,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..ce2d63144 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)", 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 { diff --git a/x/erc20/types/query.pb.go b/x/erc20/types/query.pb.go index ac5fe18e8..5cbec4b02 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{ - // 528 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x94, 0x41, 0x6b, 0x13, 0x41, - 0x14, 0xc7, 0x33, 0x2d, 0x2d, 0xe4, 0xe5, 0xe4, 0x34, 0x6a, 0x49, 0x75, 0x1b, 0xb7, 0x60, 0xc3, - 0xc6, 0xce, 0x98, 0xf4, 0x5c, 0x0f, 0x3d, 0xa8, 0x78, 0x8a, 0x41, 0x2f, 0x5e, 0x74, 0x36, 0x0c, - 0xeb, 0xa2, 0xbb, 0xb3, 0xdd, 0x99, 0x2c, 0x16, 0x11, 0xc4, 0x4f, 0xa0, 0x78, 0xf2, 0x1b, 0x78, - 0x12, 0xcf, 0x7e, 0x82, 0x1e, 0x0b, 0x5e, 0x3c, 0x89, 0x24, 0x82, 0x5f, 0x43, 0x76, 0x66, 0xb2, - 0xc9, 0xea, 0x4a, 0xe2, 0x25, 0xec, 0x3c, 0xfe, 0xef, 0xff, 0xff, 0xbd, 0x37, 0x43, 0x60, 0x77, - 0x24, 0x64, 0x24, 0x24, 0xe5, 0x59, 0x44, 0x79, 0x3a, 0xea, 0xdf, 0xa4, 0x59, 0x8f, 0x9e, 0x8c, - 0x79, 0x7a, 0x4a, 0x92, 0x54, 0x28, 0x81, 0xb7, 0x8c, 0x80, 0xf0, 0x2c, 0x22, 0x5a, 0x40, 0xb2, - 0x5e, 0xeb, 0x02, 0x8b, 0xc2, 0x58, 0x50, 0xfd, 0x6b, 0x74, 0x2d, 0xcf, 0x1a, 0xf9, 0x4c, 0x72, - 0x63, 0x40, 0xb3, 0x9e, 0xcf, 0x15, 0xeb, 0xd1, 0x84, 0x05, 0x61, 0xcc, 0x54, 0x28, 0x62, 0xab, - 0xad, 0x0c, 0x35, 0xe6, 0x46, 0x70, 0xad, 0x4a, 0x10, 0xf0, 0x98, 0xcb, 0x50, 0x5a, 0x49, 0x33, - 0x10, 0x81, 0xd0, 0x9f, 0x34, 0xff, 0xb2, 0xd5, 0x2b, 0x81, 0x10, 0xc1, 0x73, 0x4e, 0x59, 0x12, - 0x52, 0x16, 0xc7, 0x42, 0xe9, 0x58, 0xdb, 0xe3, 0x3e, 0x81, 0x4b, 0xf7, 0x73, 0xb2, 0x07, 0xe2, - 0x19, 0x8f, 0x07, 0x2c, 0x4c, 0xe5, 0x90, 0x9f, 0x8c, 0xb9, 0x54, 0xf8, 0x36, 0xc0, 0x9c, 0x72, - 0x1b, 0xb5, 0x51, 0xa7, 0xd1, 0xbf, 0x4e, 0xec, 0xe8, 0xf9, 0x48, 0xc4, 0xec, 0xc4, 0x8e, 0x44, - 0x06, 0x2c, 0xe0, 0xb6, 0x77, 0xb8, 0xd0, 0xe9, 0x7e, 0x42, 0x70, 0xf9, 0xaf, 0x08, 0x99, 0x88, - 0x58, 0x72, 0x7c, 0x0f, 0x1a, 0x2a, 0xaf, 0x3e, 0x4e, 0xf2, 0xf2, 0x36, 0x6a, 0xaf, 0x77, 0x1a, - 0x7d, 0x87, 0x54, 0xec, 0x97, 0x14, 0xdd, 0xc7, 0xf5, 0xb3, 0xef, 0xbb, 0xb5, 0x8f, 0xbf, 0x3e, - 0x7b, 0x68, 0x08, 0xaa, 0xf0, 0xc4, 0x77, 0x4a, 0xbc, 0x6b, 0x9a, 0x77, 0x7f, 0x29, 0xaf, 0x01, - 0x29, 0x01, 0x1f, 0xc0, 0xc5, 0x32, 0xef, 0x6c, 0x23, 0x4d, 0xd8, 0xd0, 0x79, 0x7a, 0x19, 0xf5, - 0xa1, 0x39, 0xb8, 0xfe, 0x9f, 0x1b, 0x2c, 0xa6, 0xbb, 0x0b, 0x30, 0x9f, 0xce, 0x6e, 0xf0, 0x3f, - 0x86, 0xab, 0x17, 0xc3, 0xb9, 0x4d, 0xc0, 0x3a, 0x63, 0xc0, 0x52, 0x16, 0xcd, 0x6e, 0xc8, 0x7d, - 0x08, 0x5b, 0xa5, 0xaa, 0x8d, 0xbd, 0x05, 0x9b, 0x89, 0xae, 0xd8, 0xc8, 0x9d, 0xca, 0x48, 0xd3, - 0xb4, 0x98, 0x67, 0xbb, 0xfa, 0x5f, 0xd6, 0x61, 0x43, 0xfb, 0xe2, 0x77, 0x08, 0x60, 0x7e, 0x6b, - 0xb8, 0x5b, 0x69, 0x54, 0xfd, 0x7c, 0x5a, 0x37, 0x56, 0x13, 0x1b, 0x66, 0xb7, 0xf3, 0xe6, 0xeb, - 0xcf, 0xf7, 0x6b, 0x2e, 0x6e, 0xd3, 0xaa, 0x67, 0xbe, 0xf0, 0x46, 0xf0, 0x07, 0x04, 0xf5, 0xc2, - 0x00, 0x7b, 0x2b, 0xa4, 0xcc, 0x88, 0xba, 0x2b, 0x69, 0x2d, 0xd0, 0xa1, 0x06, 0x3a, 0xc0, 0xdd, - 0x65, 0x40, 0xf4, 0xa5, 0x3e, 0x1c, 0x79, 0xde, 0x2b, 0xfc, 0x1a, 0xc1, 0xa6, 0xd9, 0x2b, 0xde, - 0xff, 0x77, 0x58, 0xe9, 0x12, 0x5b, 0x9d, 0xe5, 0x42, 0x8b, 0xb4, 0xa7, 0x91, 0xae, 0xe2, 0x9d, - 0x4a, 0x24, 0x73, 0x79, 0xc7, 0x47, 0x67, 0x13, 0x07, 0x9d, 0x4f, 0x1c, 0xf4, 0x63, 0xe2, 0xa0, - 0xb7, 0x53, 0xa7, 0x76, 0x3e, 0x75, 0x6a, 0xdf, 0xa6, 0x4e, 0xed, 0xd1, 0x5e, 0x10, 0xaa, 0xa7, - 0x63, 0x9f, 0x8c, 0x44, 0xb4, 0x68, 0xf0, 0xc2, 0x5a, 0xa8, 0xd3, 0x84, 0x4b, 0x7f, 0x53, 0xff, - 0x2b, 0x1c, 0xfe, 0x0e, 0x00, 0x00, 0xff, 0xff, 0xa9, 0xe7, 0x87, 0x8b, 0x04, 0x05, 0x00, 0x00, + // 623 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, 0x46, 0xca, 0xa4, 0x08, 0xd8, 0x06, 0x08, 0x29, 0xb8, 0xc1, 0x91, 0x68, + 0x48, 0x88, 0xb7, 0x49, 0x2f, 0x5c, 0x8a, 0xa0, 0x12, 0x7f, 0xc4, 0x85, 0x10, 0xc1, 0x85, 0x4b, + 0xd9, 0xa4, 0x2b, 0x63, 0x81, 0xbd, 0xae, 0xed, 0x04, 0xaa, 0xaa, 0x12, 0xe2, 0x09, 0x40, 0x9c, + 0x78, 0x02, 0x38, 0x21, 0x1e, 0xa3, 0xc7, 0x4a, 0x5c, 0x38, 0x21, 0x94, 0x54, 0xe2, 0x35, 0x90, + 0x77, 0x37, 0x8e, 0x1d, 0x5c, 0x25, 0x5c, 0x2a, 0x7b, 0xfa, 0xcd, 0xf7, 0xfd, 0x66, 0x3c, 0x2d, + 0xac, 0xf6, 0xb8, 0x6f, 0x73, 0x9f, 0xb0, 0x81, 0x4d, 0x98, 0xd7, 0x6b, 0xad, 0x93, 0x41, 0x93, + 0xec, 0xf6, 0x99, 0xb7, 0x67, 0xb8, 0x1e, 0x0f, 0x38, 0x5e, 0x96, 0x02, 0x83, 0x0d, 0x6c, 0x43, + 0x08, 0x8c, 0x41, 0xb3, 0x74, 0x9e, 0xda, 0x96, 0xc3, 0x89, 0xf8, 0x29, 0x75, 0xa5, 0x9a, 0x32, + 0xea, 0x52, 0x9f, 0x49, 0x03, 0x32, 0x68, 0x76, 0x59, 0x40, 0x9b, 0xc4, 0xa5, 0xa6, 0xe5, 0xd0, + 0xc0, 0xe2, 0x8e, 0xd2, 0xa6, 0x86, 0x4a, 0x73, 0x29, 0xb8, 0x96, 0x26, 0x30, 0x99, 0xc3, 0x7c, + 0xcb, 0x57, 0x92, 0x82, 0xc9, 0x4d, 0x2e, 0x1e, 0x49, 0xf8, 0xa4, 0xaa, 0x57, 0x4c, 0xce, 0xcd, + 0xd7, 0x8c, 0x50, 0xd7, 0x22, 0xd4, 0x71, 0x78, 0x20, 0x62, 0x55, 0x8f, 0xfe, 0x02, 0x2e, 0x3e, + 0x09, 0xc9, 0x9e, 0xf2, 0x57, 0xcc, 0x69, 0x53, 0xcb, 0xf3, 0x3b, 0x6c, 0xb7, 0xcf, 0xfc, 0x00, + 0xdf, 0x07, 0x98, 0x50, 0x16, 0x51, 0x19, 0x55, 0xf3, 0xad, 0xeb, 0x86, 0x1a, 0x3d, 0x1c, 0xc9, + 0x90, 0x3b, 0x51, 0x23, 0x19, 0x6d, 0x6a, 0x32, 0xd5, 0xdb, 0x89, 0x75, 0xea, 0xdf, 0x10, 0x5c, + 0xfa, 0x27, 0xc2, 0x77, 0xb9, 0xe3, 0x33, 0xfc, 0x08, 0xf2, 0x41, 0x58, 0xdd, 0x76, 0xc3, 0x72, + 0x11, 0x95, 0x4f, 0x55, 0xf3, 0x2d, 0xcd, 0x48, 0xd9, 0xaf, 0x11, 0x75, 0x6f, 0xe5, 0x0e, 0x7f, + 0xad, 0x66, 0xbe, 0xfe, 0xf9, 0x5e, 0x43, 0x1d, 0x08, 0x22, 0x4f, 0xfc, 0x20, 0xc1, 0xbb, 0x20, + 0x78, 0xd7, 0x66, 0xf2, 0x4a, 0x90, 0x04, 0x70, 0x03, 0x2e, 0x24, 0x79, 0xc7, 0x1b, 0x29, 0xc0, + 0xa2, 0xc8, 0x13, 0xcb, 0xc8, 0x75, 0xe4, 0x8b, 0xde, 0x9d, 0xde, 0x60, 0x34, 0xdd, 0x43, 0x80, + 0xc9, 0x74, 0x6a, 0x83, 0xff, 0x31, 0x5c, 0x2e, 0x1a, 0x4e, 0x2f, 0x00, 0x16, 0x19, 0x6d, 0xea, + 0x51, 0x7b, 0xfc, 0x85, 0xf4, 0x67, 0xb0, 0x9c, 0xa8, 0xaa, 0xd8, 0xdb, 0x90, 0x75, 0x45, 0x45, + 0x45, 0xae, 0xa4, 0x46, 0xca, 0xa6, 0x78, 0x9e, 0xea, 0xd2, 0xef, 0x41, 0x51, 0xd8, 0x3e, 0x7e, + 0xe3, 0x30, 0xef, 0xee, 0xce, 0x8e, 0xc7, 0xfc, 0xe8, 0x28, 0x6e, 0xc0, 0xb9, 0x1e, 0x77, 0x02, + 0x8f, 0xf6, 0x82, 0x6d, 0x2a, 0x7f, 0xa5, 0xb6, 0x71, 0x76, 0x5c, 0x57, 0x1d, 0xfa, 0x1d, 0xb8, + 0x9c, 0x62, 0xa3, 0x18, 0x2b, 0x70, 0x86, 0x87, 0xf5, 0x29, 0x93, 0x25, 0x1e, 0x13, 0xb7, 0x8e, + 0x4f, 0xc3, 0xa2, 0xb0, 0xc0, 0x1f, 0x11, 0xc0, 0xe4, 0x7c, 0x70, 0x3d, 0x75, 0xa2, 0xf4, 0x3b, + 0x2e, 0xdd, 0x9c, 0x4f, 0x2c, 0xc1, 0xf4, 0xea, 0xfb, 0x1f, 0xc7, 0x9f, 0x16, 0x74, 0x5c, 0x26, + 0x69, 0x7f, 0x6f, 0xb1, 0x63, 0xc5, 0x9f, 0x11, 0xe4, 0x22, 0x03, 0x5c, 0x9b, 0x23, 0x65, 0x4c, + 0x54, 0x9f, 0x4b, 0xab, 0x80, 0x36, 0x04, 0x50, 0x03, 0xd7, 0x67, 0x01, 0x91, 0x7d, 0xf1, 0xb2, + 0x59, 0xab, 0x1d, 0xe0, 0x77, 0x08, 0xb2, 0xf2, 0x03, 0xe3, 0xb5, 0x93, 0xc3, 0x12, 0xd7, 0x54, + 0xaa, 0xce, 0x16, 0x2a, 0xa4, 0x8a, 0x40, 0xba, 0x8a, 0x57, 0x52, 0x91, 0xe4, 0x15, 0xe1, 0x2f, + 0x08, 0x96, 0xe2, 0x9f, 0x1e, 0x37, 0x4e, 0xf6, 0x4f, 0xb9, 0xb4, 0x92, 0x31, 0xaf, 0x5c, 0x41, + 0xdd, 0x12, 0x50, 0x2d, 0xbc, 0x1e, 0xd2, 0x84, 0x4c, 0x63, 0x9e, 0xc4, 0x9d, 0x91, 0xfd, 0xe9, + 0xf3, 0x3d, 0xd8, 0xda, 0x3c, 0x1c, 0x6a, 0xe8, 0x68, 0xa8, 0xa1, 0xdf, 0x43, 0x0d, 0x7d, 0x18, + 0x69, 0x99, 0xa3, 0x91, 0x96, 0xf9, 0x39, 0xd2, 0x32, 0xcf, 0x2b, 0xa6, 0x15, 0xbc, 0xec, 0x77, + 0x8d, 0x1e, 0xb7, 0xe3, 0xa3, 0xbe, 0x55, 0xe6, 0xc1, 0x9e, 0xcb, 0xfc, 0x6e, 0x56, 0xfc, 0x23, + 0xdd, 0xf8, 0x1b, 0x00, 0x00, 0xff, 0xff, 0xbf, 0x38, 0xe3, 0xd0, 0x37, 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 (mappings)x @@ -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 18dafd224..0e4962fa3 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, 3, 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 4da8ba4b4..3c361d9cc 100644 --- a/x/erc20/types/token_pair.go +++ b/x/erc20/types/token_pair.go @@ -49,6 +49,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 ) diff --git a/x/vm/statedb/statedb.go b/x/vm/statedb/statedb.go index d10d1cd39..b3ba592e2 100644 --- a/x/vm/statedb/statedb.go +++ b/x/vm/statedb/statedb.go @@ -438,7 +438,7 @@ func (s *StateDB) setStateObject(object *stateObject) { // to the precompile call. func (s *StateDB) AddPrecompileFn(snapshot int) error { // Capture events before the precompile call - var prevEvents sdk.Events = s.cacheCtx.EventManager().Events() + prevEvents := s.cacheCtx.EventManager().Events() s.journal.append(precompileCallChange{ snapshot: snapshot, From 07ad25259aa042bbd9c1d50f4472e1d804a50ec7 Mon Sep 17 00:00:00 2001 From: GuillemGarciaDev Date: Wed, 18 Feb 2026 11:26:56 +0100 Subject: [PATCH 02/10] fix: erc20 proposal test fix --- x/erc20/types/proposal_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/erc20/types/proposal_test.go b/x/erc20/types/proposal_test.go index ce2d63144..c63533ba5 100644 --- a/x/erc20/types/proposal_test.go +++ b/x/erc20/types/proposal_test.go @@ -154,7 +154,7 @@ func (suite *ProposalTestSuite) TestRegisterERC20Proposal() { {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: "pass", title: "test", description: "test desc", pair: types.TokenPair{utiltx.GenerateAddress().String(), "test", true, types.OWNER_MODULE, ""}, expectPass: true}, } for i, tc := range testCases { From 9f1414049e208af57c6004a3be7b00c13b4fa43b Mon Sep 17 00:00:00 2001 From: GuillemGarciaDev Date: Wed, 18 Feb 2026 14:10:45 +0100 Subject: [PATCH 03/10] fix: linting revert --- local_node.sh | 2 +- x/vm/statedb/statedb.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/local_node.sh b/local_node.sh index a7e410825..096b72d9c 100755 --- a/local_node.sh +++ b/local_node.sh @@ -245,7 +245,7 @@ if [[ $overwrite == "y" || $overwrite == "Y" ]]; then jq '.app_state["evm"]["params"]["evm_denom"]="atest"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" 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" jq '.consensus.params.block.max_gas="10000000"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" diff --git a/x/vm/statedb/statedb.go b/x/vm/statedb/statedb.go index b3ba592e2..d10d1cd39 100644 --- a/x/vm/statedb/statedb.go +++ b/x/vm/statedb/statedb.go @@ -438,7 +438,7 @@ func (s *StateDB) setStateObject(object *stateObject) { // to the precompile call. func (s *StateDB) AddPrecompileFn(snapshot int) error { // Capture events before the precompile call - prevEvents := s.cacheCtx.EventManager().Events() + var prevEvents sdk.Events = s.cacheCtx.EventManager().Events() s.journal.append(precompileCallChange{ snapshot: snapshot, From 1ba6955a17baeac30c39e17b29aecb03c976315a Mon Sep 17 00:00:00 2001 From: GuillemGarciaDev Date: Wed, 18 Feb 2026 14:48:02 +0100 Subject: [PATCH 04/10] refactor: add support for preupgrade MsgEthereum transactions --- ethereum/eip712/codec.go | 23 + rpc/backend/comet_to_eth.go | 17 +- rpc/backend/eth/adapter.go | 37 + rpc/backend/eth/evm.go | 62 + rpc/backend/eth/evmos.go | 73 + rpc/backend/eth/msg.go | 20 + rpc/backend/tracing.go | 51 +- rpc/backend/tx_info.go | 40 +- rpc/backend/utils.go | 11 +- rpc/types/legacy/access_list.go | 57 + rpc/types/legacy/access_list_tx.go | 250 ++ rpc/types/legacy/codec.go | 55 + rpc/types/legacy/dynamic_fee_tx.go | 282 ++ rpc/types/legacy/errors.go | 38 + rpc/types/legacy/evm.pb.go | 4585 ++++++++++++++++++++++++++++ rpc/types/legacy/key.go | 19 + rpc/types/legacy/legacy_tx.go | 228 ++ rpc/types/legacy/msg.go | 300 ++ rpc/types/legacy/tx.go | 25 + rpc/types/legacy/tx.pb.go | 3276 ++++++++++++++++++++ rpc/types/legacy/tx_data.go | 80 + rpc/types/legacy/utils.go | 84 + rpc/types/legacy/validation.go | 22 + 23 files changed, 9610 insertions(+), 25 deletions(-) create mode 100644 rpc/backend/eth/adapter.go create mode 100644 rpc/backend/eth/evm.go create mode 100644 rpc/backend/eth/evmos.go create mode 100644 rpc/backend/eth/msg.go create mode 100644 rpc/types/legacy/access_list.go create mode 100644 rpc/types/legacy/access_list_tx.go create mode 100644 rpc/types/legacy/codec.go create mode 100644 rpc/types/legacy/dynamic_fee_tx.go create mode 100644 rpc/types/legacy/errors.go create mode 100644 rpc/types/legacy/evm.pb.go create mode 100644 rpc/types/legacy/key.go create mode 100644 rpc/types/legacy/legacy_tx.go create mode 100644 rpc/types/legacy/msg.go create mode 100644 rpc/types/legacy/tx.go create mode 100644 rpc/types/legacy/tx.pb.go create mode 100644 rpc/types/legacy/tx_data.go create mode 100644 rpc/types/legacy/utils.go create mode 100644 rpc/types/legacy/validation.go diff --git a/ethereum/eip712/codec.go b/ethereum/eip712/codec.go index f8a6391f3..04da97406 100644 --- a/ethereum/eip712/codec.go +++ b/ethereum/eip712/codec.go @@ -2,6 +2,7 @@ package eip712 import ( antetypes "github.com/cosmos/evm/ante/types" + legacytypes "github.com/cosmos/evm/rpc/types/legacy" codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdktypes "github.com/cosmos/cosmos-sdk/types" @@ -27,4 +28,26 @@ func RegisterInterfaces(registry codectypes.InterfaceRegistry) { &ExtensionOptionsWeb3Tx{}, &antetypes.ExtensionOptionDynamicFeeTx{}, ) + + // Register the TxData interface for legacy ethermint transaction types. + // These are needed to decode pre-v9 upgrade transactions that use ethermint.evm.v1 proto package. + // The proto types are registered in evm/rpc/types/legacy/tx.pb.go via init(). + registry.RegisterInterface( + "ethermint.evm.v1.TxData", + (*legacytypes.TxData)(nil), + &legacytypes.LegacyTx{}, + &legacytypes.AccessListTx{}, + &legacytypes.DynamicFeeTx{}, + ) + + registry.RegisterImplementations( + (*sdktypes.Msg)(nil), + &legacytypes.MsgEthereumTx{}, + &legacytypes.MsgUpdateParams{}, + ) + + registry.RegisterImplementations( + (*tx.TxExtensionOptionI)(nil), + &legacytypes.ExtensionOptionsEthereumTx{}, + ) } diff --git a/rpc/backend/comet_to_eth.go b/rpc/backend/comet_to_eth.go index 8b4847726..cbbbf1b7a 100644 --- a/rpc/backend/comet_to_eth.go +++ b/rpc/backend/comet_to_eth.go @@ -13,6 +13,7 @@ import ( cmtrpctypes "github.com/cometbft/cometbft/rpc/core/types" + "github.com/cosmos/evm/rpc/backend/eth" rpctypes "github.com/cosmos/evm/rpc/types" evmtypes "github.com/cosmos/evm/x/vm/types" @@ -110,12 +111,22 @@ func (b *Backend) EthMsgsFromCometBlock( } for _, msg := range tx.GetMsgs() { - ethMsg, ok := msg.(*evmtypes.MsgEthereumTx) - if !ok { + // Try to adapt the message to our unified interface + ethMsg := eth.TryAdaptEthTxMsg(msg) + if ethMsg == nil { + // Not an Ethereum transaction message continue } - result = append(result, ethMsg) + // Convert to new EVM format for return + // Use the chain ID from the backend + convertedMsg, err := eth.ConvertToNewEVMMsgWithChainID(ethMsg, b.EvmChainID) + if err != nil { + b.Logger.Debug("failed to convert ethereum tx", "height", block.Height, "error", err.Error()) + continue + } + + result = append(result, convertedMsg) } } diff --git a/rpc/backend/eth/adapter.go b/rpc/backend/eth/adapter.go new file mode 100644 index 000000000..4cbb12321 --- /dev/null +++ b/rpc/backend/eth/adapter.go @@ -0,0 +1,37 @@ +package eth + +import ( + "fmt" + + legacytypes "github.com/cosmos/evm/rpc/types/legacy" + evmtypes "github.com/cosmos/evm/x/vm/types" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// AdaptEthTxMsg converts an sdk.Msg to our unified TxMsg interface. +// This function tries to match the message to known MsgEthereumTx types +// and returns an appropriate adapter. This makes it easy to add support +// for new message types in the future by adding new case statements. +func AdaptEthTxMsg(msg sdk.Msg) (TxMsg, error) { + switch m := msg.(type) { + case *evmtypes.MsgEthereumTx: + // New EVM type + return &NewEVMEthTxMsg{MsgEthereumTx: m}, nil + case *legacytypes.MsgEthereumTx: + // Legacy Evmos type + return &LegacyEvmosEthTxMsg{MsgEthereumTx: m}, nil + default: + return nil, fmt.Errorf("unsupported message type: %T", msg) + } +} + +// TryAdaptEthTxMsg attempts to adapt a message to TxMsg. +// Returns nil if the message is not an Ethereum transaction type. +func TryAdaptEthTxMsg(msg sdk.Msg) TxMsg { + adapted, err := AdaptEthTxMsg(msg) + if err != nil { + return nil + } + return adapted +} diff --git a/rpc/backend/eth/evm.go b/rpc/backend/eth/evm.go new file mode 100644 index 000000000..e77a49719 --- /dev/null +++ b/rpc/backend/eth/evm.go @@ -0,0 +1,62 @@ +package eth + +import ( + "fmt" + + "github.com/ethereum/go-ethereum/common" + ethtypes "github.com/ethereum/go-ethereum/core/types" + + evmtypes "github.com/cosmos/evm/x/vm/types" +) + +var _ TxMsg = NewEVMEthTxMsg{} + +// NewEVMEthTxMsg creates an adapter for the new EVM MsgEthereumTx +type NewEVMEthTxMsg struct { + *evmtypes.MsgEthereumTx +} + +// AsTransaction returns the underlying Ethereum transaction for the new EVM type +func (m NewEVMEthTxMsg) AsTransaction() *ethtypes.Transaction { + return m.MsgEthereumTx.AsTransaction() +} + +// Hash returns the transaction hash for the new EVM type +func (m NewEVMEthTxMsg) Hash() common.Hash { + return m.MsgEthereumTx.Hash() +} + +// GetSenderLegacy returns the sender address for the new EVM type +func (m NewEVMEthTxMsg) GetSenderLegacy(signer ethtypes.Signer) (common.Address, error) { + return m.MsgEthereumTx.GetSenderLegacy(signer) +} + +// GetGas returns the gas limit for the new EVM type +func (m NewEVMEthTxMsg) GetGas() uint64 { + return m.MsgEthereumTx.GetGas() +} + +// ConvertToNewEVMMsg converts any TxMsg to the new EVM MsgEthereumTx format. +// This is useful when we need to work with code that specifically requires +// the new format. For legacy messages, this creates a new message with +// the converted data. +func ConvertToNewEVMMsg(msg TxMsg, signer ethtypes.Signer) (*evmtypes.MsgEthereumTx, error) { + // If it's already the new format, return as-is + if newMsg, ok := msg.(*NewEVMEthTxMsg); ok { + return newMsg.MsgEthereumTx, nil + } + + // For legacy messages, create a new message + tx := msg.AsTransaction() + sender, err := msg.GetSenderLegacy(signer) + if err != nil { + return nil, fmt.Errorf("failed to get sender: %w", err) + } + + newMsg := &evmtypes.MsgEthereumTx{ + From: sender.Bytes(), + } + newMsg.FromEthereumTx(tx) + + return newMsg, nil +} diff --git a/rpc/backend/eth/evmos.go b/rpc/backend/eth/evmos.go new file mode 100644 index 000000000..7aec4038a --- /dev/null +++ b/rpc/backend/eth/evmos.go @@ -0,0 +1,73 @@ +package eth + +import ( + "math/big" + + "github.com/ethereum/go-ethereum/common" + ethtypes "github.com/ethereum/go-ethereum/core/types" + + legacytypes "github.com/cosmos/evm/rpc/types/legacy" + evmtypes "github.com/cosmos/evm/x/vm/types" +) + +var _ TxMsg = LegacyEvmosEthTxMsg{} + +// LegacyEvmosEthTxMsg creates an adapter for the old Evmos MsgEthereumTx +type LegacyEvmosEthTxMsg struct { + *legacytypes.MsgEthereumTx +} + +// AsTransaction returns the underlying Ethereum transaction for the legacy Evmos type +func (m LegacyEvmosEthTxMsg) AsTransaction() *ethtypes.Transaction { + return m.MsgEthereumTx.AsTransaction() +} + +// Hash returns the transaction hash for the legacy Evmos type +func (m LegacyEvmosEthTxMsg) Hash() common.Hash { + // The old type stores hash as hex string, convert it back + if m.MsgEthereumTx.Hash != "" { + return common.HexToHash(m.MsgEthereumTx.Hash) + } + // Fallback: compute from transaction + return m.AsTransaction().Hash() +} + +// GetSenderLegacy returns the sender address for the legacy Evmos type +func (m LegacyEvmosEthTxMsg) GetSenderLegacy(signer ethtypes.Signer) (common.Address, error) { + // If From field is set, use it + if m.From != "" { + return common.HexToAddress(m.From), nil + } + // Otherwise recover from signature + tx := m.AsTransaction() + sender, err := signer.Sender(tx) + if err != nil { + return common.Address{}, err + } + // Cache the sender for future use + m.From = sender.Hex() + return sender, nil +} + +// GetGas returns the gas limit for the legacy Evmos type +func (m LegacyEvmosEthTxMsg) GetGas() uint64 { + return m.MsgEthereumTx.GetGas() +} + +// ConvertToNewEVMMsgWithChainID is like ConvertToNewEVMMsg but uses chainID to create signer +func ConvertToNewEVMMsgWithChainID(msg TxMsg, chainID *big.Int) (*evmtypes.MsgEthereumTx, error) { + // If it's already the new format, return as-is + if newMsg, ok := msg.(*NewEVMEthTxMsg); ok { + return newMsg.MsgEthereumTx, nil + } + + tx := msg.AsTransaction() + var signer ethtypes.Signer + if tx.Protected() { + signer = ethtypes.LatestSignerForChainID(tx.ChainId()) + } else { + signer = ethtypes.FrontierSigner{} + } + + return ConvertToNewEVMMsg(msg, signer) +} diff --git a/rpc/backend/eth/msg.go b/rpc/backend/eth/msg.go new file mode 100644 index 000000000..8e8e117f6 --- /dev/null +++ b/rpc/backend/eth/msg.go @@ -0,0 +1,20 @@ +package eth + +import ( + "github.com/ethereum/go-ethereum/common" + ethtypes "github.com/ethereum/go-ethereum/core/types" +) + +// TxMsg is a unified interface for different versions of MsgEthereumTx +// This interface abstracts the differences between the old Evmos format +// and the new EVM format, making it easy to add support for future versions. +type TxMsg interface { + // AsTransaction returns the underlying Ethereum transaction + AsTransaction() *ethtypes.Transaction + // Hash returns the transaction hash + Hash() common.Hash + // GetSenderLegacy returns the sender address, recovering from signature if needed + GetSenderLegacy(signer ethtypes.Signer) (common.Address, error) + // GetGas returns the gas limit + GetGas() uint64 +} diff --git a/rpc/backend/tracing.go b/rpc/backend/tracing.go index fa1ee67c4..2dfaec58a 100644 --- a/rpc/backend/tracing.go +++ b/rpc/backend/tracing.go @@ -12,6 +12,7 @@ import ( tmrpcclient "github.com/cometbft/cometbft/rpc/client" tmrpctypes "github.com/cometbft/cometbft/rpc/core/types" + "github.com/cosmos/evm/rpc/backend/eth" rpctypes "github.com/cosmos/evm/rpc/types" evmtypes "github.com/cosmos/evm/x/vm/types" @@ -57,12 +58,19 @@ func (b *Backend) TraceTransaction(hash common.Hash, config *rpctypes.TraceConfi continue } for _, msg := range tx.GetMsgs() { - ethMsg, ok := msg.(*evmtypes.MsgEthereumTx) - if !ok { + // Try to adapt the message to our unified interface + ethMsg := eth.TryAdaptEthTxMsg(msg) + if ethMsg == nil { continue } - predecessors = append(predecessors, ethMsg) + // Convert to new format for predecessors + convertedMsg, err := eth.ConvertToNewEVMMsgWithChainID(ethMsg, b.EvmChainID) + if err != nil { + b.Logger.Debug("failed to convert ethereum tx", "height", blk.Block.Height, "error", err.Error()) + continue + } + predecessors = append(predecessors, convertedMsg) } } @@ -75,19 +83,33 @@ func (b *Backend) TraceTransaction(hash common.Hash, config *rpctypes.TraceConfi // add predecessor messages in current cosmos tx index := int(transaction.MsgIndex) // #nosec G115 for i := 0; i < index; i++ { - ethMsg, ok := tx.GetMsgs()[i].(*evmtypes.MsgEthereumTx) - if !ok { + ethMsg := eth.TryAdaptEthTxMsg(tx.GetMsgs()[i]) + if ethMsg == nil { + continue + } + // Convert to new format for predecessors + convertedMsg, err := eth.ConvertToNewEVMMsgWithChainID(ethMsg, b.EvmChainID) + if err != nil { + b.Logger.Debug("failed to convert ethereum tx", "error", err.Error()) continue } - predecessors = append(predecessors, ethMsg) + predecessors = append(predecessors, convertedMsg) } - ethMessage, ok := tx.GetMsgs()[transaction.MsgIndex].(*evmtypes.MsgEthereumTx) - if !ok { + // Adapt the target message + adaptedMsg, err := eth.AdaptEthTxMsg(tx.GetMsgs()[transaction.MsgIndex]) + if err != nil { b.Logger.Debug("invalid transaction type", "type", fmt.Sprintf("%T", tx)) return nil, fmt.Errorf("invalid transaction type %T", tx) } + // Convert to new format + ethMessage, err := eth.ConvertToNewEVMMsgWithChainID(adaptedMsg, b.EvmChainID) + if err != nil { + b.Logger.Debug("failed to convert ethereum tx", "error", err.Error()) + return nil, fmt.Errorf("failed to convert ethereum tx: %w", err) + } + nc, ok := b.ClientCtx.Client.(tmrpcclient.NetworkClient) if !ok { return nil, errors.New("invalid rpc client") @@ -180,12 +202,19 @@ func (b *Backend) TraceBlock(height rpctypes.BlockNumber, } for _, msg := range decodedTx.GetMsgs() { - ethMessage, ok := msg.(*evmtypes.MsgEthereumTx) - if !ok { + // Try to adapt the message to our unified interface + ethMsg := eth.TryAdaptEthTxMsg(msg) + if ethMsg == nil { // Just considers Ethereum transactions continue } - txsMessages = append(txsMessages, ethMessage) + // Convert to new format + convertedMsg, err := eth.ConvertToNewEVMMsgWithChainID(ethMsg, b.EvmChainID) + if err != nil { + b.Logger.Debug("failed to convert ethereum tx", "error", err.Error()) + continue + } + txsMessages = append(txsMessages, convertedMsg) } } diff --git a/rpc/backend/tx_info.go b/rpc/backend/tx_info.go index 9c84198ff..658cbd98c 100644 --- a/rpc/backend/tx_info.go +++ b/rpc/backend/tx_info.go @@ -19,6 +19,7 @@ import ( cmtrpctypes "github.com/cometbft/cometbft/rpc/core/types" "github.com/cosmos/evm/mempool/txpool" + "github.com/cosmos/evm/rpc/backend/eth" rpctypes "github.com/cosmos/evm/rpc/types" servertypes "github.com/cosmos/evm/server/types" "github.com/cosmos/evm/utils" @@ -47,9 +48,16 @@ func (b *Backend) GetTransactionByHash(txHash common.Hash) (*rpctypes.RPCTransac } // the `res.MsgIndex` is inferred from tx index, should be within the bound. - msg, ok := tx.GetMsgs()[res.MsgIndex].(*evmtypes.MsgEthereumTx) - if !ok { - return nil, errors.New("invalid ethereum tx") + // Support both new EVM and legacy Evmos message types + ethMsg, err := eth.AdaptEthTxMsg(tx.GetMsgs()[res.MsgIndex]) + if err != nil { + return nil, fmt.Errorf("invalid ethereum tx: %w", err) + } + + // Convert to new format for further processing + msg, err := eth.ConvertToNewEVMMsgWithChainID(ethMsg, b.EvmChainID) + if err != nil { + return nil, fmt.Errorf("failed to convert ethereum tx: %w", err) } blockRes, err := b.RPCClient.BlockResults(b.Ctx, &block.Block.Height) @@ -192,7 +200,19 @@ func (b *Backend) GetTransactionReceipt(hash common.Hash) (map[string]interface{ return nil, fmt.Errorf("block result not found at height %d: %w", res.Height, err) } - ethMsg := tx.GetMsgs()[res.MsgIndex].(*evmtypes.MsgEthereumTx) + // Support both new EVM and legacy Evmos message types + adaptedMsg, err := eth.AdaptEthTxMsg(tx.GetMsgs()[res.MsgIndex]) + if err != nil { + b.Logger.Debug("invalid ethereum tx", "error", err.Error()) + return nil, fmt.Errorf("invalid ethereum tx: %w", err) + } + + // Convert to new format for receipt formatting + ethMsg, err := eth.ConvertToNewEVMMsgWithChainID(adaptedMsg, b.EvmChainID) + if err != nil { + b.Logger.Debug("failed to convert ethereum tx", "error", err.Error()) + return nil, fmt.Errorf("failed to convert ethereum tx: %w", err) + } receipts, err := b.ReceiptsFromCometBlock(resBlock, blockRes, []*evmtypes.MsgEthereumTx{ethMsg}) if err != nil { return nil, fmt.Errorf("failed to get receipts from comet block") @@ -374,13 +394,19 @@ func (b *Backend) GetTransactionByBlockAndIndex(block *cmtrpctypes.ResultBlock, return nil, nil } - var ok bool // msgIndex is inferred from tx events, should be within bound. - msg, ok = tx.GetMsgs()[res.MsgIndex].(*evmtypes.MsgEthereumTx) - if !ok { + // Support both new EVM and legacy Evmos message types + adaptedMsg, err := eth.AdaptEthTxMsg(tx.GetMsgs()[res.MsgIndex]) + if err != nil { b.Logger.Debug("invalid ethereum tx", "height", block.Block.Header, "index", idx) return nil, nil } + // Convert to new format + msg, err = eth.ConvertToNewEVMMsgWithChainID(adaptedMsg, b.EvmChainID) + if err != nil { + b.Logger.Debug("failed to convert ethereum tx", "height", block.Block.Header, "index", idx, "error", err.Error()) + return nil, nil + } } else { i := int(idx) // #nosec G115 ethMsgs := b.EthMsgsFromCometBlock(block, blockRes) diff --git a/rpc/backend/utils.go b/rpc/backend/utils.go index ca46109b0..a2d76eaa1 100644 --- a/rpc/backend/utils.go +++ b/rpc/backend/utils.go @@ -18,6 +18,7 @@ import ( "github.com/cometbft/cometbft/proto/tendermint/crypto" cmtrpctypes "github.com/cometbft/cometbft/rpc/core/types" + "github.com/cosmos/evm/rpc/backend/eth" "github.com/cosmos/evm/rpc/types" "github.com/cosmos/evm/utils" feemarkettypes "github.com/cosmos/evm/x/feemarket/types" @@ -91,8 +92,9 @@ func (b *Backend) getAccountNonce(accAddr common.Address, pending bool, height i // only supports `MsgEthereumTx` style tx for _, tx := range pendingTxs { for _, msg := range (*tx).GetMsgs() { - ethMsg, ok := msg.(*evmtypes.MsgEthereumTx) - if !ok { + // Try to adapt the message to our unified interface + ethMsg := eth.TryAdaptEthTxMsg(msg) + if ethMsg == nil { // not ethereum tx break } @@ -247,8 +249,9 @@ func (b *Backend) ProcessBlock( } txGasUsed := uint64(cometTxResult.GasUsed) // #nosec G115 for _, msg := range tx.GetMsgs() { - ethMsg, ok := msg.(*evmtypes.MsgEthereumTx) - if !ok { + // Try to adapt the message to our unified interface + ethMsg := eth.TryAdaptEthTxMsg(msg) + if ethMsg == nil { continue } tx := ethMsg.AsTransaction() diff --git a/rpc/types/legacy/access_list.go b/rpc/types/legacy/access_list.go new file mode 100644 index 000000000..50de8b2ac --- /dev/null +++ b/rpc/types/legacy/access_list.go @@ -0,0 +1,57 @@ +// Copyright Tharsis Labs Ltd.(Evmos) +// SPDX-License-Identifier:ENCL-1.0(https://github.com/evmos/evmos/blob/main/LICENSE) +package types + +import ( + "github.com/ethereum/go-ethereum/common" + ethtypes "github.com/ethereum/go-ethereum/core/types" +) + +// AccessList is an EIP-2930 access list that represents the slice of +// the protobuf AccessTuples. +type AccessList []AccessTuple + +// NewAccessList creates a new protobuf-compatible AccessList from an ethereum +// core AccessList type +func NewAccessList(ethAccessList *ethtypes.AccessList) AccessList { + if ethAccessList == nil { + return nil + } + + al := AccessList{} + for _, tuple := range *ethAccessList { + storageKeys := make([]string, len(tuple.StorageKeys)) + + for i := range tuple.StorageKeys { + storageKeys[i] = tuple.StorageKeys[i].String() + } + + al = append(al, AccessTuple{ + Address: tuple.Address.String(), + StorageKeys: storageKeys, + }) + } + + return al +} + +// ToEthAccessList is an utility function to convert the protobuf compatible +// AccessList to eth core AccessList from go-ethereum +func (al AccessList) ToEthAccessList() *ethtypes.AccessList { + var ethAccessList ethtypes.AccessList + + for _, tuple := range al { + storageKeys := make([]common.Hash, len(tuple.StorageKeys)) + + for i := range tuple.StorageKeys { + storageKeys[i] = common.HexToHash(tuple.StorageKeys[i]) + } + + ethAccessList = append(ethAccessList, ethtypes.AccessTuple{ + Address: common.HexToAddress(tuple.Address), + StorageKeys: storageKeys, + }) + } + + return ðAccessList +} diff --git a/rpc/types/legacy/access_list_tx.go b/rpc/types/legacy/access_list_tx.go new file mode 100644 index 000000000..be24aae53 --- /dev/null +++ b/rpc/types/legacy/access_list_tx.go @@ -0,0 +1,250 @@ +// Copyright Tharsis Labs Ltd.(Evmos) +// SPDX-License-Identifier:ENCL-1.0(https://github.com/evmos/evmos/blob/main/LICENSE) +package types + +import ( + "math/big" + + "github.com/ethereum/go-ethereum/common" + ethtypes "github.com/ethereum/go-ethereum/core/types" + + errorsmod "cosmossdk.io/errors" + sdkmath "cosmossdk.io/math" + + errortypes "github.com/cosmos/cosmos-sdk/types/errors" +) + +func newAccessListTx(tx *ethtypes.Transaction) (*AccessListTx, error) { + txData := &AccessListTx{ + Nonce: tx.Nonce(), + Data: tx.Data(), + GasLimit: tx.Gas(), + } + + v, r, s := tx.RawSignatureValues() + if to := tx.To(); to != nil { + txData.To = to.Hex() + } + + if tx.Value() != nil { + amountInt, err := SafeNewIntFromBigInt(tx.Value()) + if err != nil { + return nil, err + } + txData.Amount = &amountInt + } + + if tx.GasPrice() != nil { + gasPriceInt, err := SafeNewIntFromBigInt(tx.GasPrice()) + if err != nil { + return nil, err + } + txData.GasPrice = &gasPriceInt + } + + if tx.AccessList() != nil { + al := tx.AccessList() + txData.Accesses = NewAccessList(&al) + } + + txData.SetSignatureValues(tx.ChainId(), v, r, s) + return txData, nil +} + +// TxType returns the tx type +func (tx *AccessListTx) TxType() uint8 { + return ethtypes.AccessListTxType +} + +// Copy returns an instance with the same field values +func (tx *AccessListTx) Copy() TxData { + return &AccessListTx{ + ChainID: tx.ChainID, + Nonce: tx.Nonce, + GasPrice: tx.GasPrice, + GasLimit: tx.GasLimit, + To: tx.To, + Amount: tx.Amount, + Data: common.CopyBytes(tx.Data), + Accesses: tx.Accesses, + V: common.CopyBytes(tx.V), + R: common.CopyBytes(tx.R), + S: common.CopyBytes(tx.S), + } +} + +// GetChainID returns the chain id field from the AccessListTx +func (tx *AccessListTx) GetChainID() *big.Int { + if tx.ChainID == nil { + return nil + } + + return tx.ChainID.BigInt() +} + +// GetAccessList returns the AccessList field. +func (tx *AccessListTx) GetAccessList() ethtypes.AccessList { + if tx.Accesses == nil { + return nil + } + return *tx.Accesses.ToEthAccessList() +} + +// GetData returns the a copy of the input data bytes. +func (tx *AccessListTx) GetData() []byte { + return common.CopyBytes(tx.Data) +} + +// GetGas returns the gas limit. +func (tx *AccessListTx) GetGas() uint64 { + return tx.GasLimit +} + +// GetGasPrice returns the gas price field. +func (tx *AccessListTx) GetGasPrice() *big.Int { + if tx.GasPrice == nil { + return nil + } + return tx.GasPrice.BigInt() +} + +// GetGasTipCap returns the gas price field. +func (tx *AccessListTx) GetGasTipCap() *big.Int { + return tx.GetGasPrice() +} + +// GetGasFeeCap returns the gas price field. +func (tx *AccessListTx) GetGasFeeCap() *big.Int { + return tx.GetGasPrice() +} + +// GetValue returns the tx amount. +func (tx *AccessListTx) GetValue() *big.Int { + if tx.Amount == nil { + return nil + } + + return tx.Amount.BigInt() +} + +// GetNonce returns the account sequence for the transaction. +func (tx *AccessListTx) GetNonce() uint64 { return tx.Nonce } + +// GetTo returns the pointer to the recipient address. +func (tx *AccessListTx) GetTo() *common.Address { + if tx.To == "" { + return nil + } + to := common.HexToAddress(tx.To) + return &to +} + +// AsEthereumData returns an AccessListTx transaction tx from the proto-formatted +// TxData defined on the Cosmos EVM. +func (tx *AccessListTx) AsEthereumData() ethtypes.TxData { + v, r, s := tx.GetRawSignatureValues() + return ðtypes.AccessListTx{ + ChainID: tx.GetChainID(), + Nonce: tx.GetNonce(), + GasPrice: tx.GetGasPrice(), + Gas: tx.GetGas(), + To: tx.GetTo(), + Value: tx.GetValue(), + Data: tx.GetData(), + AccessList: tx.GetAccessList(), + V: v, + R: r, + S: s, + } +} + +// GetRawSignatureValues returns the V, R, S signature values of the transaction. +// The return values should not be modified by the caller. +func (tx *AccessListTx) GetRawSignatureValues() (v, r, s *big.Int) { + return RawSignatureValues(tx.V, tx.R, tx.S) +} + +// SetSignatureValues sets the signature values to the transaction. +func (tx *AccessListTx) SetSignatureValues(chainID, v, r, s *big.Int) { + if v != nil { + tx.V = v.Bytes() + } + if r != nil { + tx.R = r.Bytes() + } + if s != nil { + tx.S = s.Bytes() + } + if chainID != nil { + chainIDInt := sdkmath.NewIntFromBigInt(chainID) + tx.ChainID = &chainIDInt + } +} + +// Validate performs a stateless validation of the tx fields. +func (tx AccessListTx) Validate() error { + gasPrice := tx.GetGasPrice() + if gasPrice == nil { + return errorsmod.Wrap(ErrInvalidGasPrice, "cannot be nil") + } + if !IsValidInt256(gasPrice) { + return errorsmod.Wrap(ErrInvalidGasPrice, "out of bound") + } + + if gasPrice.Sign() == -1 { + return errorsmod.Wrapf(ErrInvalidGasPrice, "gas price cannot be negative %s", gasPrice) + } + + amount := tx.GetValue() + // Amount can be 0 + if amount != nil && amount.Sign() == -1 { + return errorsmod.Wrapf(ErrInvalidAmount, "amount cannot be negative %s", amount) + } + if !IsValidInt256(amount) { + return errorsmod.Wrap(ErrInvalidAmount, "out of bound") + } + + if !IsValidInt256(tx.Fee()) { + return errorsmod.Wrap(ErrInvalidGasFee, "out of bound") + } + + if tx.To != "" { + if err := ValidateAddress(tx.To); err != nil { + return errorsmod.Wrap(err, "invalid to address") + } + } + + if tx.GetChainID() == nil { + return errorsmod.Wrap( + errortypes.ErrInvalidChainID, + "chain ID must be present on AccessList txs", + ) + } + + return nil +} + +// Fee returns gasprice * gaslimit. +func (tx AccessListTx) Fee() *big.Int { + return fee(tx.GetGasPrice(), tx.GetGas()) +} + +// Cost returns amount + gasprice * gaslimit. +func (tx AccessListTx) Cost() *big.Int { + return cost(tx.Fee(), tx.GetValue()) +} + +// EffectiveGasPrice is the same as GasPrice for AccessListTx +func (tx AccessListTx) EffectiveGasPrice(_ *big.Int) *big.Int { + return tx.GetGasPrice() +} + +// EffectiveFee is the same as Fee for AccessListTx +func (tx AccessListTx) EffectiveFee(_ *big.Int) *big.Int { + return tx.Fee() +} + +// EffectiveCost is the same as Cost for AccessListTx +func (tx AccessListTx) EffectiveCost(_ *big.Int) *big.Int { + return tx.Cost() +} diff --git a/rpc/types/legacy/codec.go b/rpc/types/legacy/codec.go new file mode 100644 index 000000000..d2656b654 --- /dev/null +++ b/rpc/types/legacy/codec.go @@ -0,0 +1,55 @@ +// Copyright Tharsis Labs Ltd.(Evmos) +// SPDX-License-Identifier:ENCL-1.0(https://github.com/evmos/evmos/blob/main/LICENSE) +package types + +import ( + "github.com/cosmos/gogoproto/proto" + + errorsmod "cosmossdk.io/errors" + + "github.com/cosmos/cosmos-sdk/codec" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + errortypes "github.com/cosmos/cosmos-sdk/types/errors" +) + +var ( + amino = codec.NewLegacyAmino() + // ModuleCdc references the global evm module codec. Note, the codec should + // ONLY be used in certain instances of tests and for JSON encoding. + ModuleCdc = codec.NewProtoCodec(codectypes.NewInterfaceRegistry()) + + // AminoCdc is a amino codec created to support amino JSON compatible msgs. + AminoCdc = codec.NewAminoCodec(amino) //nolint:staticcheck +) + +// PackTxData constructs a new Any packed with the given tx data value. It returns +// an error if the client state can't be casted to a protobuf message or if the concrete +// implementation is not registered to the protobuf codec. +func PackTxData(txData TxData) (*codectypes.Any, error) { + msg, ok := txData.(proto.Message) + if !ok { + return nil, errorsmod.Wrapf(errortypes.ErrPackAny, "cannot proto marshal %T", txData) + } + + anyTxData, err := codectypes.NewAnyWithValue(msg) + if err != nil { + return nil, errorsmod.Wrap(errortypes.ErrPackAny, err.Error()) + } + + return anyTxData, nil +} + +// UnpackTxData unpacks an Any into a TxData. It returns an error if the +// client state can't be unpacked into a TxData. +func UnpackTxData(anyTx *codectypes.Any) (TxData, error) { + if anyTx == nil { + return nil, errorsmod.Wrap(errortypes.ErrUnpackAny, "protobuf Any message cannot be nil") + } + + txData, ok := anyTx.GetCachedValue().(TxData) + if !ok { + return nil, errorsmod.Wrapf(errortypes.ErrUnpackAny, "cannot unpack Any into TxData %T", anyTx) + } + + return txData, nil +} diff --git a/rpc/types/legacy/dynamic_fee_tx.go b/rpc/types/legacy/dynamic_fee_tx.go new file mode 100644 index 000000000..8bb172c1c --- /dev/null +++ b/rpc/types/legacy/dynamic_fee_tx.go @@ -0,0 +1,282 @@ +// Copyright Tharsis Labs Ltd.(Evmos) +// SPDX-License-Identifier:ENCL-1.0(https://github.com/evmos/evmos/blob/main/LICENSE) +package types + +import ( + "math/big" + + "github.com/ethereum/go-ethereum/common" + ethtypes "github.com/ethereum/go-ethereum/core/types" + + errorsmod "cosmossdk.io/errors" + sdkmath "cosmossdk.io/math" + + errortypes "github.com/cosmos/cosmos-sdk/types/errors" +) + +func NewDynamicFeeTx(tx *ethtypes.Transaction) (*DynamicFeeTx, error) { + txData := &DynamicFeeTx{ + Nonce: tx.Nonce(), + Data: tx.Data(), + GasLimit: tx.Gas(), + } + + v, r, s := tx.RawSignatureValues() + if to := tx.To(); to != nil { + txData.To = to.Hex() + } + + if tx.Value() != nil { + amountInt, err := SafeNewIntFromBigInt(tx.Value()) + if err != nil { + return nil, err + } + txData.Amount = &amountInt + } + + if tx.GasFeeCap() != nil { + gasFeeCapInt, err := SafeNewIntFromBigInt(tx.GasFeeCap()) + if err != nil { + return nil, err + } + txData.GasFeeCap = &gasFeeCapInt + } + + if tx.GasTipCap() != nil { + gasTipCapInt, err := SafeNewIntFromBigInt(tx.GasTipCap()) + if err != nil { + return nil, err + } + txData.GasTipCap = &gasTipCapInt + } + + if tx.AccessList() != nil { + al := tx.AccessList() + txData.Accesses = NewAccessList(&al) + } + + txData.SetSignatureValues(tx.ChainId(), v, r, s) + return txData, nil +} + +// TxType returns the tx type +func (tx *DynamicFeeTx) TxType() uint8 { + return ethtypes.DynamicFeeTxType +} + +// Copy returns an instance with the same field values +func (tx *DynamicFeeTx) Copy() TxData { + return &DynamicFeeTx{ + ChainID: tx.ChainID, + Nonce: tx.Nonce, + GasTipCap: tx.GasTipCap, + GasFeeCap: tx.GasFeeCap, + GasLimit: tx.GasLimit, + To: tx.To, + Amount: tx.Amount, + Data: common.CopyBytes(tx.Data), + Accesses: tx.Accesses, + V: common.CopyBytes(tx.V), + R: common.CopyBytes(tx.R), + S: common.CopyBytes(tx.S), + } +} + +// GetChainID returns the chain id field from the DynamicFeeTx +func (tx *DynamicFeeTx) GetChainID() *big.Int { + if tx.ChainID == nil { + return nil + } + + return tx.ChainID.BigInt() +} + +// GetAccessList returns the AccessList field. +func (tx *DynamicFeeTx) GetAccessList() ethtypes.AccessList { + if tx.Accesses == nil { + return nil + } + return *tx.Accesses.ToEthAccessList() +} + +// GetData returns the a copy of the input data bytes. +func (tx *DynamicFeeTx) GetData() []byte { + return common.CopyBytes(tx.Data) +} + +// GetGas returns the gas limit. +func (tx *DynamicFeeTx) GetGas() uint64 { + return tx.GasLimit +} + +// GetGasPrice returns the gas fee cap field. +func (tx *DynamicFeeTx) GetGasPrice() *big.Int { + return tx.GetGasFeeCap() +} + +// GetGasTipCap returns the gas tip cap field. +func (tx *DynamicFeeTx) GetGasTipCap() *big.Int { + if tx.GasTipCap == nil { + return nil + } + return tx.GasTipCap.BigInt() +} + +// GetGasFeeCap returns the gas fee cap field. +func (tx *DynamicFeeTx) GetGasFeeCap() *big.Int { + if tx.GasFeeCap == nil { + return nil + } + return tx.GasFeeCap.BigInt() +} + +// GetValue returns the tx amount. +func (tx *DynamicFeeTx) GetValue() *big.Int { + if tx.Amount == nil { + return nil + } + + return tx.Amount.BigInt() +} + +// GetNonce returns the account sequence for the transaction. +func (tx *DynamicFeeTx) GetNonce() uint64 { return tx.Nonce } + +// GetTo returns the pointer to the recipient address. +func (tx *DynamicFeeTx) GetTo() *common.Address { + if tx.To == "" { + return nil + } + to := common.HexToAddress(tx.To) + return &to +} + +// AsEthereumData returns an DynamicFeeTx transaction tx from the proto-formatted +// TxData defined on the Cosmos EVM. +func (tx *DynamicFeeTx) AsEthereumData() ethtypes.TxData { + v, r, s := tx.GetRawSignatureValues() + return ðtypes.DynamicFeeTx{ + ChainID: tx.GetChainID(), + Nonce: tx.GetNonce(), + GasTipCap: tx.GetGasTipCap(), + GasFeeCap: tx.GetGasFeeCap(), + Gas: tx.GetGas(), + To: tx.GetTo(), + Value: tx.GetValue(), + Data: tx.GetData(), + AccessList: tx.GetAccessList(), + V: v, + R: r, + S: s, + } +} + +// GetRawSignatureValues returns the V, R, S signature values of the transaction. +// The return values should not be modified by the caller. +func (tx *DynamicFeeTx) GetRawSignatureValues() (v, r, s *big.Int) { + return RawSignatureValues(tx.V, tx.R, tx.S) +} + +// SetSignatureValues sets the signature values to the transaction. +func (tx *DynamicFeeTx) SetSignatureValues(chainID, v, r, s *big.Int) { + if v != nil { + tx.V = v.Bytes() + } + if r != nil { + tx.R = r.Bytes() + } + if s != nil { + tx.S = s.Bytes() + } + if chainID != nil { + chainIDInt := sdkmath.NewIntFromBigInt(chainID) + tx.ChainID = &chainIDInt + } +} + +// Validate performs a stateless validation of the tx fields. +func (tx DynamicFeeTx) Validate() error { + if tx.GasTipCap == nil { + return errorsmod.Wrap(ErrInvalidGasCap, "gas tip cap cannot nil") + } + + if tx.GasFeeCap == nil { + return errorsmod.Wrap(ErrInvalidGasCap, "gas fee cap cannot nil") + } + + if tx.GasTipCap.IsNegative() { + return errorsmod.Wrapf(ErrInvalidGasCap, "gas tip cap cannot be negative %s", tx.GasTipCap) + } + + if tx.GasFeeCap.IsNegative() { + return errorsmod.Wrapf(ErrInvalidGasCap, "gas fee cap cannot be negative %s", tx.GasFeeCap) + } + + if !IsValidInt256(tx.GetGasTipCap()) { + return errorsmod.Wrap(ErrInvalidGasCap, "out of bound") + } + + if !IsValidInt256(tx.GetGasFeeCap()) { + return errorsmod.Wrap(ErrInvalidGasCap, "out of bound") + } + + if tx.GasFeeCap.LT(*tx.GasTipCap) { + return errorsmod.Wrapf( + ErrInvalidGasCap, "max priority fee per gas higher than max fee per gas (%s > %s)", + tx.GasTipCap, tx.GasFeeCap, + ) + } + + if !IsValidInt256(tx.Fee()) { + return errorsmod.Wrap(ErrInvalidGasFee, "out of bound") + } + + amount := tx.GetValue() + // Amount can be 0 + if amount != nil && amount.Sign() == -1 { + return errorsmod.Wrapf(ErrInvalidAmount, "amount cannot be negative %s", amount) + } + if !IsValidInt256(amount) { + return errorsmod.Wrap(ErrInvalidAmount, "out of bound") + } + + if tx.To != "" { + if err := ValidateAddress(tx.To); err != nil { + return errorsmod.Wrap(err, "invalid to address") + } + } + + if tx.GetChainID() == nil { + return errorsmod.Wrap( + errortypes.ErrInvalidChainID, + "chain ID must be present on DynamicFee txs", + ) + } + + return nil +} + +// Fee returns gasprice * gaslimit. +func (tx DynamicFeeTx) Fee() *big.Int { + return fee(tx.GetGasFeeCap(), tx.GasLimit) +} + +// Cost returns amount + gasprice * gaslimit. +func (tx DynamicFeeTx) Cost() *big.Int { + return cost(tx.Fee(), tx.GetValue()) +} + +// EffectiveGasPrice returns the effective gas price +func (tx *DynamicFeeTx) EffectiveGasPrice(baseFee *big.Int) *big.Int { + return EffectiveGasPrice(baseFee, tx.GasFeeCap.BigInt(), tx.GasTipCap.BigInt()) +} + +// EffectiveFee returns effective_gasprice * gaslimit. +func (tx DynamicFeeTx) EffectiveFee(baseFee *big.Int) *big.Int { + return fee(tx.EffectiveGasPrice(baseFee), tx.GasLimit) +} + +// EffectiveCost returns amount + effective_gasprice * gaslimit. +func (tx DynamicFeeTx) EffectiveCost(baseFee *big.Int) *big.Int { + return cost(tx.EffectiveFee(baseFee), tx.GetValue()) +} diff --git a/rpc/types/legacy/errors.go b/rpc/types/legacy/errors.go new file mode 100644 index 000000000..783c7716a --- /dev/null +++ b/rpc/types/legacy/errors.go @@ -0,0 +1,38 @@ +// Copyright Tharsis Labs Ltd.(Evmos) +// SPDX-License-Identifier:ENCL-1.0(https://github.com/evmos/evmos/blob/main/LICENSE) +package types + +import ( + errorsmod "cosmossdk.io/errors" +) + +const ( + // ModuleName is the name of the legacy types module (for error registration) + + codeErrInvalidAmount = uint32(iota) + 2 + codeErrInvalidGasPrice + codeErrInvalidGasFee + codeErrInvalidGasCap + codeErrGasOverflow + codeErrInvalidGasLimit +) + +var ( + // ErrInvalidAmount returns an error if a tx contains an invalid amount. + ErrInvalidAmount = errorsmod.Register(ModuleName, codeErrInvalidAmount, "invalid transaction amount") + + // ErrInvalidGasPrice returns an error if an invalid gas price is provided to the tx. + ErrInvalidGasPrice = errorsmod.Register(ModuleName, codeErrInvalidGasPrice, "invalid gas price") + + // ErrInvalidGasFee returns an error if the tx gas fee is out of bound. + ErrInvalidGasFee = errorsmod.Register(ModuleName, codeErrInvalidGasFee, "invalid gas fee") + + // ErrInvalidGasCap returns an error if a the gas cap value is negative or invalid + ErrInvalidGasCap = errorsmod.Register(ModuleName, codeErrInvalidGasCap, "invalid gas cap") + + // ErrGasOverflow returns an error if gas computation overflow/underflow + ErrGasOverflow = errorsmod.Register(ModuleName, codeErrGasOverflow, "gas computation overflow/underflow") + + // ErrInvalidGasLimit returns an error if gas limit value is invalid + ErrInvalidGasLimit = errorsmod.Register(ModuleName, codeErrInvalidGasLimit, "invalid gas limit") +) diff --git a/rpc/types/legacy/evm.pb.go b/rpc/types/legacy/evm.pb.go new file mode 100644 index 000000000..2cd565e59 --- /dev/null +++ b/rpc/types/legacy/evm.pb.go @@ -0,0 +1,4585 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: ethermint/evm/v1/evm.proto + +package types + +import ( + cosmossdk_io_math "cosmossdk.io/math" + fmt "fmt" + _ "github.com/cosmos/cosmos-sdk/types/tx/amino" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// AccessType defines the types of permissions for the operations +type AccessType int32 + +const ( + // ACCESS_TYPE_PERMISSIONLESS does not restrict the operation to anyone + AccessTypePermissionless AccessType = 0 + // ACCESS_TYPE_RESTRICTED restrict the operation to anyone + AccessTypeRestricted AccessType = 1 + // ACCESS_TYPE_PERMISSIONED only allows the operation for specific addresses + AccessTypePermissioned AccessType = 2 +) + +var AccessType_name = map[int32]string{ + 0: "ACCESS_TYPE_PERMISSIONLESS", + 1: "ACCESS_TYPE_RESTRICTED", + 2: "ACCESS_TYPE_PERMISSIONED", +} + +var AccessType_value = map[string]int32{ + "ACCESS_TYPE_PERMISSIONLESS": 0, + "ACCESS_TYPE_RESTRICTED": 1, + "ACCESS_TYPE_PERMISSIONED": 2, +} + +func (x AccessType) String() string { + return proto.EnumName(AccessType_name, int32(x)) +} + +func (AccessType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_d21ecc92c8c8583e, []int{0} +} + +// Params defines the EVM module parameters +type Params struct { + // evm_denom represents the token denomination used to run the EVM state + // transitions. + EvmDenom string `protobuf:"bytes,1,opt,name=evm_denom,json=evmDenom,proto3" json:"evm_denom,omitempty" yaml:"evm_denom"` + // extra_eips defines the additional EIPs for the vm.Config + ExtraEIPs []string `protobuf:"bytes,4,rep,name=extra_eips,json=extraEips,proto3" json:"extra_eips,omitempty" yaml:"extra_eips"` + // chain_config defines the EVM chain configuration parameters + ChainConfig ChainConfig `protobuf:"bytes,5,opt,name=chain_config,json=chainConfig,proto3" json:"chain_config" yaml:"chain_config"` + // allow_unprotected_txs defines if replay-protected (i.e non EIP155 + // signed) transactions can be executed on the state machine. + AllowUnprotectedTxs bool `protobuf:"varint,6,opt,name=allow_unprotected_txs,json=allowUnprotectedTxs,proto3" json:"allow_unprotected_txs,omitempty"` + // evm_channels is the list of channel identifiers from EVM compatible chains + EVMChannels []string `protobuf:"bytes,8,rep,name=evm_channels,json=evmChannels,proto3" json:"evm_channels,omitempty"` + // access_control defines the permission policy of the EVM + AccessControl AccessControl `protobuf:"bytes,9,opt,name=access_control,json=accessControl,proto3" json:"access_control"` + // active_static_precompiles defines the slice of hex addresses of the precompiled + // contracts that are active + ActiveStaticPrecompiles []string `protobuf:"bytes,10,rep,name=active_static_precompiles,json=activeStaticPrecompiles,proto3" json:"active_static_precompiles,omitempty"` +} + +func (m *Params) Reset() { *m = Params{} } +func (m *Params) String() string { return proto.CompactTextString(m) } +func (*Params) ProtoMessage() {} +func (*Params) Descriptor() ([]byte, []int) { + return fileDescriptor_d21ecc92c8c8583e, []int{0} +} +func (m *Params) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Params.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Params) XXX_Merge(src proto.Message) { + xxx_messageInfo_Params.Merge(m, src) +} +func (m *Params) XXX_Size() int { + return m.Size() +} +func (m *Params) XXX_DiscardUnknown() { + xxx_messageInfo_Params.DiscardUnknown(m) +} + +var xxx_messageInfo_Params proto.InternalMessageInfo + +func (m *Params) GetEvmDenom() string { + if m != nil { + return m.EvmDenom + } + return "" +} + +func (m *Params) GetExtraEIPs() []string { + if m != nil { + return m.ExtraEIPs + } + return nil +} + +func (m *Params) GetChainConfig() ChainConfig { + if m != nil { + return m.ChainConfig + } + return ChainConfig{} +} + +func (m *Params) GetAllowUnprotectedTxs() bool { + if m != nil { + return m.AllowUnprotectedTxs + } + return false +} + +func (m *Params) GetEVMChannels() []string { + if m != nil { + return m.EVMChannels + } + return nil +} + +func (m *Params) GetAccessControl() AccessControl { + if m != nil { + return m.AccessControl + } + return AccessControl{} +} + +func (m *Params) GetActiveStaticPrecompiles() []string { + if m != nil { + return m.ActiveStaticPrecompiles + } + return nil +} + +// AccessControl defines the permission policy of the EVM +// for creating and calling contracts +type AccessControl struct { + // create defines the permission policy for creating contracts + Create AccessControlType `protobuf:"bytes,1,opt,name=create,proto3" json:"create"` + // call defines the permission policy for calling contracts + Call AccessControlType `protobuf:"bytes,2,opt,name=call,proto3" json:"call"` +} + +func (m *AccessControl) Reset() { *m = AccessControl{} } +func (m *AccessControl) String() string { return proto.CompactTextString(m) } +func (*AccessControl) ProtoMessage() {} +func (*AccessControl) Descriptor() ([]byte, []int) { + return fileDescriptor_d21ecc92c8c8583e, []int{1} +} +func (m *AccessControl) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AccessControl) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AccessControl.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 *AccessControl) XXX_Merge(src proto.Message) { + xxx_messageInfo_AccessControl.Merge(m, src) +} +func (m *AccessControl) XXX_Size() int { + return m.Size() +} +func (m *AccessControl) XXX_DiscardUnknown() { + xxx_messageInfo_AccessControl.DiscardUnknown(m) +} + +var xxx_messageInfo_AccessControl proto.InternalMessageInfo + +func (m *AccessControl) GetCreate() AccessControlType { + if m != nil { + return m.Create + } + return AccessControlType{} +} + +func (m *AccessControl) GetCall() AccessControlType { + if m != nil { + return m.Call + } + return AccessControlType{} +} + +// AccessControlType defines the permission type for policies +type AccessControlType struct { + // access_type defines which type of permission is required for the operation + AccessType AccessType `protobuf:"varint,1,opt,name=access_type,json=accessType,proto3,enum=ethermint.evm.v1.AccessType" json:"access_type,omitempty" yaml:"access_type"` + // access_control_list defines defines different things depending on the AccessType: + // - ACCESS_TYPE_PERMISSIONLESS: list of addresses that are blocked from performing the operation + // - ACCESS_TYPE_RESTRICTED: ignored + // - ACCESS_TYPE_PERMISSIONED: list of addresses that are allowed to perform the operation + AccessControlList []string `protobuf:"bytes,2,rep,name=access_control_list,json=accessControlList,proto3" json:"access_control_list,omitempty" yaml:"access_control_list"` +} + +func (m *AccessControlType) Reset() { *m = AccessControlType{} } +func (m *AccessControlType) String() string { return proto.CompactTextString(m) } +func (*AccessControlType) ProtoMessage() {} +func (*AccessControlType) Descriptor() ([]byte, []int) { + return fileDescriptor_d21ecc92c8c8583e, []int{2} +} +func (m *AccessControlType) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AccessControlType) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AccessControlType.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 *AccessControlType) XXX_Merge(src proto.Message) { + xxx_messageInfo_AccessControlType.Merge(m, src) +} +func (m *AccessControlType) XXX_Size() int { + return m.Size() +} +func (m *AccessControlType) XXX_DiscardUnknown() { + xxx_messageInfo_AccessControlType.DiscardUnknown(m) +} + +var xxx_messageInfo_AccessControlType proto.InternalMessageInfo + +func (m *AccessControlType) GetAccessType() AccessType { + if m != nil { + return m.AccessType + } + return AccessTypePermissionless +} + +func (m *AccessControlType) GetAccessControlList() []string { + if m != nil { + return m.AccessControlList + } + return nil +} + +// ChainConfig defines the Ethereum ChainConfig parameters using *sdk.Int values +// instead of *big.Int. +type ChainConfig struct { + // homestead_block switch (nil no fork, 0 = already homestead) + HomesteadBlock *cosmossdk_io_math.Int `protobuf:"bytes,1,opt,name=homestead_block,json=homesteadBlock,proto3,customtype=cosmossdk.io/math.Int" json:"homestead_block,omitempty" yaml:"homestead_block"` + // dao_fork_block corresponds to TheDAO hard-fork switch block (nil no fork) + DAOForkBlock *cosmossdk_io_math.Int `protobuf:"bytes,2,opt,name=dao_fork_block,json=daoForkBlock,proto3,customtype=cosmossdk.io/math.Int" json:"dao_fork_block,omitempty" yaml:"dao_fork_block"` + // dao_fork_support defines whether the nodes supports or opposes the DAO hard-fork + DAOForkSupport bool `protobuf:"varint,3,opt,name=dao_fork_support,json=daoForkSupport,proto3" json:"dao_fork_support,omitempty" yaml:"dao_fork_support"` + // eip150_block: EIP150 implements the Gas price changes + // (https://github.com/ethereum/EIPs/issues/150) EIP150 HF block (nil no fork) + EIP150Block *cosmossdk_io_math.Int `protobuf:"bytes,4,opt,name=eip150_block,json=eip150Block,proto3,customtype=cosmossdk.io/math.Int" json:"eip150_block,omitempty" yaml:"eip150_block"` + // eip150_hash: EIP150 HF hash (needed for header only clients as only gas pricing changed) + EIP150Hash string `protobuf:"bytes,5,opt,name=eip150_hash,json=eip150Hash,proto3" json:"eip150_hash,omitempty" yaml:"byzantium_block"` + // eip155_block: EIP155Block HF block + EIP155Block *cosmossdk_io_math.Int `protobuf:"bytes,6,opt,name=eip155_block,json=eip155Block,proto3,customtype=cosmossdk.io/math.Int" json:"eip155_block,omitempty" yaml:"eip155_block"` + // eip158_block: EIP158 HF block + EIP158Block *cosmossdk_io_math.Int `protobuf:"bytes,7,opt,name=eip158_block,json=eip158Block,proto3,customtype=cosmossdk.io/math.Int" json:"eip158_block,omitempty" yaml:"eip158_block"` + // byzantium_block: Byzantium switch block (nil no fork, 0 = already on byzantium) + ByzantiumBlock *cosmossdk_io_math.Int `protobuf:"bytes,8,opt,name=byzantium_block,json=byzantiumBlock,proto3,customtype=cosmossdk.io/math.Int" json:"byzantium_block,omitempty" yaml:"byzantium_block"` + // constantinople_block: Constantinople switch block (nil no fork, 0 = already activated) + ConstantinopleBlock *cosmossdk_io_math.Int `protobuf:"bytes,9,opt,name=constantinople_block,json=constantinopleBlock,proto3,customtype=cosmossdk.io/math.Int" json:"constantinople_block,omitempty" yaml:"constantinople_block"` + // petersburg_block: Petersburg switch block (nil same as Constantinople) + PetersburgBlock *cosmossdk_io_math.Int `protobuf:"bytes,10,opt,name=petersburg_block,json=petersburgBlock,proto3,customtype=cosmossdk.io/math.Int" json:"petersburg_block,omitempty" yaml:"petersburg_block"` + // istanbul_block: Istanbul switch block (nil no fork, 0 = already on istanbul) + IstanbulBlock *cosmossdk_io_math.Int `protobuf:"bytes,11,opt,name=istanbul_block,json=istanbulBlock,proto3,customtype=cosmossdk.io/math.Int" json:"istanbul_block,omitempty" yaml:"istanbul_block"` + // muir_glacier_block: Eip-2384 (bomb delay) switch block (nil no fork, 0 = already activated) + MuirGlacierBlock *cosmossdk_io_math.Int `protobuf:"bytes,12,opt,name=muir_glacier_block,json=muirGlacierBlock,proto3,customtype=cosmossdk.io/math.Int" json:"muir_glacier_block,omitempty" yaml:"muir_glacier_block"` + // berlin_block: Berlin switch block (nil = no fork, 0 = already on berlin) + BerlinBlock *cosmossdk_io_math.Int `protobuf:"bytes,13,opt,name=berlin_block,json=berlinBlock,proto3,customtype=cosmossdk.io/math.Int" json:"berlin_block,omitempty" yaml:"berlin_block"` + // london_block: London switch block (nil = no fork, 0 = already on london) + LondonBlock *cosmossdk_io_math.Int `protobuf:"bytes,17,opt,name=london_block,json=londonBlock,proto3,customtype=cosmossdk.io/math.Int" json:"london_block,omitempty" yaml:"london_block"` + // arrow_glacier_block: Eip-4345 (bomb delay) switch block (nil = no fork, 0 = already activated) + ArrowGlacierBlock *cosmossdk_io_math.Int `protobuf:"bytes,18,opt,name=arrow_glacier_block,json=arrowGlacierBlock,proto3,customtype=cosmossdk.io/math.Int" json:"arrow_glacier_block,omitempty" yaml:"arrow_glacier_block"` + // gray_glacier_block: EIP-5133 (bomb delay) switch block (nil = no fork, 0 = already activated) + GrayGlacierBlock *cosmossdk_io_math.Int `protobuf:"bytes,20,opt,name=gray_glacier_block,json=grayGlacierBlock,proto3,customtype=cosmossdk.io/math.Int" json:"gray_glacier_block,omitempty" yaml:"gray_glacier_block"` + // merge_netsplit_block: Virtual fork after The Merge to use as a network splitter + MergeNetsplitBlock *cosmossdk_io_math.Int `protobuf:"bytes,21,opt,name=merge_netsplit_block,json=mergeNetsplitBlock,proto3,customtype=cosmossdk.io/math.Int" json:"merge_netsplit_block,omitempty" yaml:"merge_netsplit_block"` + // shanghai_block switch block (nil = no fork, 0 = already on shanghai) + ShanghaiBlock *cosmossdk_io_math.Int `protobuf:"bytes,22,opt,name=shanghai_block,json=shanghaiBlock,proto3,customtype=cosmossdk.io/math.Int" json:"shanghai_block,omitempty" yaml:"shanghai_block"` + // cancun_block switch block (nil = no fork, 0 = already on cancun) + CancunBlock *cosmossdk_io_math.Int `protobuf:"bytes,23,opt,name=cancun_block,json=cancunBlock,proto3,customtype=cosmossdk.io/math.Int" json:"cancun_block,omitempty" yaml:"cancun_block"` +} + +func (m *ChainConfig) Reset() { *m = ChainConfig{} } +func (m *ChainConfig) String() string { return proto.CompactTextString(m) } +func (*ChainConfig) ProtoMessage() {} +func (*ChainConfig) Descriptor() ([]byte, []int) { + return fileDescriptor_d21ecc92c8c8583e, []int{3} +} +func (m *ChainConfig) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ChainConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ChainConfig.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 *ChainConfig) XXX_Merge(src proto.Message) { + xxx_messageInfo_ChainConfig.Merge(m, src) +} +func (m *ChainConfig) XXX_Size() int { + return m.Size() +} +func (m *ChainConfig) XXX_DiscardUnknown() { + xxx_messageInfo_ChainConfig.DiscardUnknown(m) +} + +var xxx_messageInfo_ChainConfig proto.InternalMessageInfo + +func (m *ChainConfig) GetDAOForkSupport() bool { + if m != nil { + return m.DAOForkSupport + } + return false +} + +func (m *ChainConfig) GetEIP150Hash() string { + if m != nil { + return m.EIP150Hash + } + return "" +} + +// State represents a single Storage key value pair item. +type State struct { + // key is the stored key + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + // value is the stored value for the given key + Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` +} + +func (m *State) Reset() { *m = State{} } +func (m *State) String() string { return proto.CompactTextString(m) } +func (*State) ProtoMessage() {} +func (*State) Descriptor() ([]byte, []int) { + return fileDescriptor_d21ecc92c8c8583e, []int{4} +} +func (m *State) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *State) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_State.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 *State) XXX_Merge(src proto.Message) { + xxx_messageInfo_State.Merge(m, src) +} +func (m *State) XXX_Size() int { + return m.Size() +} +func (m *State) XXX_DiscardUnknown() { + xxx_messageInfo_State.DiscardUnknown(m) +} + +var xxx_messageInfo_State proto.InternalMessageInfo + +func (m *State) GetKey() string { + if m != nil { + return m.Key + } + return "" +} + +func (m *State) GetValue() string { + if m != nil { + return m.Value + } + return "" +} + +// TransactionLogs define the logs generated from a transaction execution +// with a given hash. It it used for import/export data as transactions are not +// persisted on blockchain state after an upgrade. +type TransactionLogs struct { + // hash of the transaction + Hash string `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"` + // logs is an array of Logs for the given transaction hash + Logs []*Log `protobuf:"bytes,2,rep,name=logs,proto3" json:"logs,omitempty"` +} + +func (m *TransactionLogs) Reset() { *m = TransactionLogs{} } +func (m *TransactionLogs) String() string { return proto.CompactTextString(m) } +func (*TransactionLogs) ProtoMessage() {} +func (*TransactionLogs) Descriptor() ([]byte, []int) { + return fileDescriptor_d21ecc92c8c8583e, []int{5} +} +func (m *TransactionLogs) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TransactionLogs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_TransactionLogs.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 *TransactionLogs) XXX_Merge(src proto.Message) { + xxx_messageInfo_TransactionLogs.Merge(m, src) +} +func (m *TransactionLogs) XXX_Size() int { + return m.Size() +} +func (m *TransactionLogs) XXX_DiscardUnknown() { + xxx_messageInfo_TransactionLogs.DiscardUnknown(m) +} + +var xxx_messageInfo_TransactionLogs proto.InternalMessageInfo + +func (m *TransactionLogs) GetHash() string { + if m != nil { + return m.Hash + } + return "" +} + +func (m *TransactionLogs) GetLogs() []*Log { + if m != nil { + return m.Logs + } + return nil +} + +// Log represents an protobuf compatible Ethereum Log that defines a contract +// log event. These events are generated by the LOG opcode and stored/indexed by +// the node. +// +// NOTE: address, topics and data are consensus fields. The rest of the fields +// are derived, i.e. filled in by the nodes, but not secured by consensus. +type Log struct { + // address of the contract that generated the event + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + // topics is a list of topics provided by the contract. + Topics []string `protobuf:"bytes,2,rep,name=topics,proto3" json:"topics,omitempty"` + // data which is supplied by the contract, usually ABI-encoded + Data []byte `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"` + // block_number of the block in which the transaction was included + BlockNumber uint64 `protobuf:"varint,4,opt,name=block_number,json=blockNumber,proto3" json:"blockNumber"` + // tx_hash is the transaction hash + TxHash string `protobuf:"bytes,5,opt,name=tx_hash,json=txHash,proto3" json:"transactionHash"` + // tx_index of the transaction in the block + TxIndex uint64 `protobuf:"varint,6,opt,name=tx_index,json=txIndex,proto3" json:"transactionIndex"` + // block_hash of the block in which the transaction was included + BlockHash string `protobuf:"bytes,7,opt,name=block_hash,json=blockHash,proto3" json:"blockHash"` + // index of the log in the block + Index uint64 `protobuf:"varint,8,opt,name=index,proto3" json:"logIndex"` + // removed is true if this log was reverted due to a chain + // reorganisation. You must pay attention to this field if you receive logs + // through a filter query. + Removed bool `protobuf:"varint,9,opt,name=removed,proto3" json:"removed,omitempty"` +} + +func (m *Log) Reset() { *m = Log{} } +func (m *Log) String() string { return proto.CompactTextString(m) } +func (*Log) ProtoMessage() {} +func (*Log) Descriptor() ([]byte, []int) { + return fileDescriptor_d21ecc92c8c8583e, []int{6} +} +func (m *Log) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Log) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Log.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 *Log) XXX_Merge(src proto.Message) { + xxx_messageInfo_Log.Merge(m, src) +} +func (m *Log) XXX_Size() int { + return m.Size() +} +func (m *Log) XXX_DiscardUnknown() { + xxx_messageInfo_Log.DiscardUnknown(m) +} + +var xxx_messageInfo_Log proto.InternalMessageInfo + +func (m *Log) GetAddress() string { + if m != nil { + return m.Address + } + return "" +} + +func (m *Log) GetTopics() []string { + if m != nil { + return m.Topics + } + return nil +} + +func (m *Log) GetData() []byte { + if m != nil { + return m.Data + } + return nil +} + +func (m *Log) GetBlockNumber() uint64 { + if m != nil { + return m.BlockNumber + } + return 0 +} + +func (m *Log) GetTxHash() string { + if m != nil { + return m.TxHash + } + return "" +} + +func (m *Log) GetTxIndex() uint64 { + if m != nil { + return m.TxIndex + } + return 0 +} + +func (m *Log) GetBlockHash() string { + if m != nil { + return m.BlockHash + } + return "" +} + +func (m *Log) GetIndex() uint64 { + if m != nil { + return m.Index + } + return 0 +} + +func (m *Log) GetRemoved() bool { + if m != nil { + return m.Removed + } + return false +} + +// TxResult stores results of Tx execution. +type TxResult struct { + // contract_address contains the ethereum address of the created contract (if + // any). If the state transition is an evm.Call, the contract address will be + // empty. + ContractAddress string `protobuf:"bytes,1,opt,name=contract_address,json=contractAddress,proto3" json:"contract_address,omitempty" yaml:"contract_address"` + // bloom represents the bloom filter bytes + Bloom []byte `protobuf:"bytes,2,opt,name=bloom,proto3" json:"bloom,omitempty"` + // tx_logs contains the transaction hash and the proto-compatible ethereum + // logs. + TxLogs TransactionLogs `protobuf:"bytes,3,opt,name=tx_logs,json=txLogs,proto3" json:"tx_logs" yaml:"tx_logs"` + // ret defines the bytes from the execution. + Ret []byte `protobuf:"bytes,4,opt,name=ret,proto3" json:"ret,omitempty"` + // reverted flag is set to true when the call has been reverted + Reverted bool `protobuf:"varint,5,opt,name=reverted,proto3" json:"reverted,omitempty"` + // gas_used notes the amount of gas consumed while execution + GasUsed uint64 `protobuf:"varint,6,opt,name=gas_used,json=gasUsed,proto3" json:"gas_used,omitempty"` +} + +func (m *TxResult) Reset() { *m = TxResult{} } +func (m *TxResult) String() string { return proto.CompactTextString(m) } +func (*TxResult) ProtoMessage() {} +func (*TxResult) Descriptor() ([]byte, []int) { + return fileDescriptor_d21ecc92c8c8583e, []int{7} +} +func (m *TxResult) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TxResult) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_TxResult.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 *TxResult) XXX_Merge(src proto.Message) { + xxx_messageInfo_TxResult.Merge(m, src) +} +func (m *TxResult) XXX_Size() int { + return m.Size() +} +func (m *TxResult) XXX_DiscardUnknown() { + xxx_messageInfo_TxResult.DiscardUnknown(m) +} + +var xxx_messageInfo_TxResult proto.InternalMessageInfo + +// AccessTuple is the element type of an access list. +type AccessTuple struct { + // address is a hex formatted ethereum address + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + // storage_keys are hex formatted hashes of the storage keys + StorageKeys []string `protobuf:"bytes,2,rep,name=storage_keys,json=storageKeys,proto3" json:"storageKeys"` +} + +func (m *AccessTuple) Reset() { *m = AccessTuple{} } +func (m *AccessTuple) String() string { return proto.CompactTextString(m) } +func (*AccessTuple) ProtoMessage() {} +func (*AccessTuple) Descriptor() ([]byte, []int) { + return fileDescriptor_d21ecc92c8c8583e, []int{8} +} +func (m *AccessTuple) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AccessTuple) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AccessTuple.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 *AccessTuple) XXX_Merge(src proto.Message) { + xxx_messageInfo_AccessTuple.Merge(m, src) +} +func (m *AccessTuple) XXX_Size() int { + return m.Size() +} +func (m *AccessTuple) XXX_DiscardUnknown() { + xxx_messageInfo_AccessTuple.DiscardUnknown(m) +} + +var xxx_messageInfo_AccessTuple proto.InternalMessageInfo + +// TraceConfig holds extra parameters to trace functions. +type TraceConfig struct { + // tracer is a custom javascript tracer + Tracer string `protobuf:"bytes,1,opt,name=tracer,proto3" json:"tracer,omitempty"` + // timeout overrides the default timeout of 5 seconds for JavaScript-based tracing + // calls + Timeout string `protobuf:"bytes,2,opt,name=timeout,proto3" json:"timeout,omitempty"` + // reexec defines the number of blocks the tracer is willing to go back + Reexec uint64 `protobuf:"varint,3,opt,name=reexec,proto3" json:"reexec,omitempty"` + // disable_stack switches stack capture + DisableStack bool `protobuf:"varint,5,opt,name=disable_stack,json=disableStack,proto3" json:"disableStack"` + // disable_storage switches storage capture + DisableStorage bool `protobuf:"varint,6,opt,name=disable_storage,json=disableStorage,proto3" json:"disableStorage"` + // debug can be used to print output during capture end + Debug bool `protobuf:"varint,8,opt,name=debug,proto3" json:"debug,omitempty"` + // limit defines the maximum length of output, but zero means unlimited + Limit int32 `protobuf:"varint,9,opt,name=limit,proto3" json:"limit,omitempty"` + // overrides can be used to execute a trace using future fork rules + Overrides *ChainConfig `protobuf:"bytes,10,opt,name=overrides,proto3" json:"overrides,omitempty"` + // enable_memory switches memory capture + EnableMemory bool `protobuf:"varint,11,opt,name=enable_memory,json=enableMemory,proto3" json:"enableMemory"` + // enable_return_data switches the capture of return data + EnableReturnData bool `protobuf:"varint,12,opt,name=enable_return_data,json=enableReturnData,proto3" json:"enableReturnData"` + // tracer_json_config configures the tracer using a JSON string + TracerJsonConfig string `protobuf:"bytes,13,opt,name=tracer_json_config,json=tracerJsonConfig,proto3" json:"tracerConfig"` +} + +func (m *TraceConfig) Reset() { *m = TraceConfig{} } +func (m *TraceConfig) String() string { return proto.CompactTextString(m) } +func (*TraceConfig) ProtoMessage() {} +func (*TraceConfig) Descriptor() ([]byte, []int) { + return fileDescriptor_d21ecc92c8c8583e, []int{9} +} +func (m *TraceConfig) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TraceConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_TraceConfig.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 *TraceConfig) XXX_Merge(src proto.Message) { + xxx_messageInfo_TraceConfig.Merge(m, src) +} +func (m *TraceConfig) XXX_Size() int { + return m.Size() +} +func (m *TraceConfig) XXX_DiscardUnknown() { + xxx_messageInfo_TraceConfig.DiscardUnknown(m) +} + +var xxx_messageInfo_TraceConfig proto.InternalMessageInfo + +func (m *TraceConfig) GetTracer() string { + if m != nil { + return m.Tracer + } + return "" +} + +func (m *TraceConfig) GetTimeout() string { + if m != nil { + return m.Timeout + } + return "" +} + +func (m *TraceConfig) GetReexec() uint64 { + if m != nil { + return m.Reexec + } + return 0 +} + +func (m *TraceConfig) GetDisableStack() bool { + if m != nil { + return m.DisableStack + } + return false +} + +func (m *TraceConfig) GetDisableStorage() bool { + if m != nil { + return m.DisableStorage + } + return false +} + +func (m *TraceConfig) GetDebug() bool { + if m != nil { + return m.Debug + } + return false +} + +func (m *TraceConfig) GetLimit() int32 { + if m != nil { + return m.Limit + } + return 0 +} + +func (m *TraceConfig) GetOverrides() *ChainConfig { + if m != nil { + return m.Overrides + } + return nil +} + +func (m *TraceConfig) GetEnableMemory() bool { + if m != nil { + return m.EnableMemory + } + return false +} + +func (m *TraceConfig) GetEnableReturnData() bool { + if m != nil { + return m.EnableReturnData + } + return false +} + +func (m *TraceConfig) GetTracerJsonConfig() string { + if m != nil { + return m.TracerJsonConfig + } + return "" +} + +//func init() { +// proto.RegisterEnum("ethermint.evm.v1.AccessType", AccessType_name, AccessType_value) +// proto.RegisterType((*Params)(nil), "ethermint.evm.v1.Params") +// proto.RegisterType((*AccessControl)(nil), "ethermint.evm.v1.AccessControl") +// proto.RegisterType((*AccessControlType)(nil), "ethermint.evm.v1.AccessControlType") +// proto.RegisterType((*ChainConfig)(nil), "ethermint.evm.v1.ChainConfig") +// proto.RegisterType((*State)(nil), "ethermint.evm.v1.State") +// proto.RegisterType((*TransactionLogs)(nil), "ethermint.evm.v1.TransactionLogs") +// proto.RegisterType((*Log)(nil), "ethermint.evm.v1.Log") +// proto.RegisterType((*TxResult)(nil), "ethermint.evm.v1.TxResult") +// proto.RegisterType((*AccessTuple)(nil), "ethermint.evm.v1.AccessTuple") +// proto.RegisterType((*TraceConfig)(nil), "ethermint.evm.v1.TraceConfig") +//} + +//func init() { proto.RegisterFile("ethermint/evm/v1/evm.proto", fileDescriptor_d21ecc92c8c8583e) } + +var fileDescriptor_d21ecc92c8c8583e = []byte{ + // 1927 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x58, 0x4b, 0x6f, 0x23, 0xc7, + 0x11, 0x16, 0xa5, 0x91, 0x34, 0x6c, 0x52, 0xe4, 0xa8, 0x45, 0xed, 0x72, 0xb9, 0x8e, 0x46, 0x99, + 0x04, 0xc1, 0x66, 0xe1, 0x48, 0x2b, 0xad, 0x95, 0x08, 0xeb, 0xbc, 0x44, 0x89, 0x4e, 0xa4, 0x68, + 0xd7, 0x42, 0x53, 0x8e, 0xe1, 0x20, 0xc1, 0xa0, 0x39, 0xd3, 0x26, 0xc7, 0x9a, 0x99, 0x26, 0xa6, + 0x9b, 0x5c, 0x32, 0xbf, 0xc0, 0xd8, 0xd3, 0xe6, 0x07, 0x2c, 0x60, 0x20, 0x97, 0x1c, 0xfd, 0x13, + 0x72, 0x34, 0x72, 0xf2, 0x31, 0x08, 0x90, 0x41, 0xc0, 0x3d, 0x18, 0xd0, 0x51, 0xf7, 0x00, 0x41, + 0x3f, 0xf8, 0x94, 0x2c, 0x2b, 0x17, 0xaa, 0xab, 0xba, 0xea, 0xfb, 0xaa, 0xaa, 0x6b, 0xfa, 0x21, + 0x50, 0x21, 0xbc, 0x45, 0x92, 0x28, 0x88, 0xf9, 0x36, 0xe9, 0x46, 0xdb, 0xdd, 0x1d, 0xf1, 0x67, + 0xab, 0x9d, 0x50, 0x4e, 0xa1, 0x35, 0x9a, 0xdb, 0x12, 0xca, 0xee, 0x4e, 0x65, 0x15, 0x47, 0x41, + 0x4c, 0xb7, 0xe5, 0xaf, 0x32, 0xaa, 0x94, 0x9a, 0xb4, 0x49, 0xe5, 0x70, 0x5b, 0x8c, 0x94, 0xd6, + 0x79, 0x6d, 0x80, 0xa5, 0x33, 0x9c, 0xe0, 0x88, 0xc1, 0x1d, 0x90, 0x25, 0xdd, 0xc8, 0xf5, 0x49, + 0x4c, 0xa3, 0x72, 0x66, 0x33, 0xf3, 0x28, 0x5b, 0x2d, 0x5d, 0xa5, 0xb6, 0xd5, 0xc7, 0x51, 0xf8, + 0xcc, 0x19, 0x4d, 0x39, 0xc8, 0x24, 0xdd, 0xe8, 0x48, 0x0c, 0xe1, 0x01, 0x00, 0xa4, 0xc7, 0x13, + 0xec, 0x92, 0xa0, 0xcd, 0xca, 0xc6, 0xe6, 0xc2, 0xa3, 0x6c, 0xd5, 0x19, 0xa4, 0x76, 0xb6, 0x26, + 0xb4, 0xb5, 0xe3, 0x33, 0x76, 0x95, 0xda, 0xab, 0x1a, 0x60, 0x64, 0xe8, 0xa0, 0xac, 0x14, 0x6a, + 0x41, 0x9b, 0xc1, 0x06, 0xc8, 0x7b, 0x2d, 0x1c, 0xc4, 0xae, 0x47, 0xe3, 0x4f, 0x83, 0x66, 0x79, + 0x71, 0x33, 0xf3, 0x28, 0xb7, 0xfb, 0xbd, 0xad, 0xd9, 0x94, 0xb6, 0x0e, 0x85, 0xd5, 0xa1, 0x34, + 0xaa, 0x6e, 0x7e, 0x95, 0xda, 0x73, 0x57, 0xa9, 0xbd, 0xa6, 0xa0, 0x27, 0x01, 0x9c, 0xbf, 0x7d, + 0xf3, 0xe5, 0xe3, 0x0c, 0xca, 0x79, 0x63, 0x73, 0xb8, 0x0b, 0xd6, 0x71, 0x18, 0xd2, 0x97, 0x6e, + 0x27, 0x16, 0x59, 0x13, 0x8f, 0x13, 0xdf, 0xe5, 0x3d, 0x56, 0x5e, 0xda, 0xcc, 0x3c, 0x32, 0xd1, + 0x9a, 0x9c, 0xfc, 0x68, 0x3c, 0x77, 0xde, 0x63, 0x70, 0x17, 0xe4, 0x45, 0xca, 0x5e, 0x0b, 0xc7, + 0x31, 0x09, 0x59, 0xd9, 0x94, 0xc9, 0x15, 0x07, 0xa9, 0x9d, 0xab, 0xfd, 0xfe, 0xf9, 0xa1, 0x56, + 0xa3, 0x1c, 0xe9, 0x46, 0x43, 0x01, 0xfe, 0x09, 0x14, 0xb0, 0xe7, 0x11, 0xc6, 0x44, 0x2c, 0x3c, + 0xa1, 0x61, 0x39, 0x2b, 0xb3, 0xb1, 0xaf, 0x67, 0x73, 0x20, 0xed, 0x0e, 0x95, 0x59, 0x75, 0x5d, + 0xe4, 0x33, 0x48, 0xed, 0x95, 0x29, 0x35, 0x5a, 0xc1, 0x93, 0x22, 0x7c, 0x06, 0x1e, 0x60, 0x8f, + 0x07, 0x5d, 0xe2, 0x32, 0x8e, 0x79, 0xe0, 0xb9, 0xed, 0x84, 0x78, 0x34, 0x6a, 0x07, 0x21, 0x61, + 0x65, 0x20, 0xe2, 0x43, 0xf7, 0x95, 0x41, 0x5d, 0xce, 0x9f, 0x8d, 0xa7, 0x9f, 0xdd, 0x7f, 0xf5, + 0xcd, 0x97, 0x8f, 0x21, 0xe9, 0x46, 0x94, 0x6d, 0xf7, 0x64, 0x07, 0xa9, 0x55, 0x3f, 0x31, 0xcc, + 0x79, 0x6b, 0xe1, 0xc4, 0x30, 0x17, 0x2c, 0xe3, 0xc4, 0x30, 0x97, 0x2d, 0xd3, 0xf9, 0x4b, 0x06, + 0x4c, 0xc7, 0x01, 0x0f, 0xc0, 0x92, 0x97, 0x10, 0xcc, 0x89, 0x6c, 0x8b, 0xdc, 0xee, 0x0f, 0xbe, + 0x23, 0x9f, 0xf3, 0x7e, 0x9b, 0x54, 0x0d, 0x91, 0x13, 0xd2, 0x8e, 0xf0, 0x17, 0xc0, 0xf0, 0x70, + 0x18, 0x96, 0xe7, 0xff, 0x5f, 0x00, 0xe9, 0xe6, 0xfc, 0x3b, 0x03, 0x56, 0xaf, 0x59, 0x40, 0x0f, + 0xe4, 0x74, 0xbd, 0x79, 0xbf, 0xad, 0x82, 0x2b, 0xec, 0xbe, 0xf3, 0x6d, 0xd8, 0x12, 0xf4, 0x87, + 0x83, 0xd4, 0x06, 0x63, 0xf9, 0x2a, 0xb5, 0xa1, 0xea, 0xa1, 0x09, 0x20, 0x07, 0x01, 0x3c, 0xb2, + 0x80, 0x1e, 0x58, 0x9b, 0x5e, 0x54, 0x37, 0x0c, 0x18, 0x2f, 0xcf, 0xcb, 0x7e, 0x78, 0x3a, 0x48, + 0xed, 0xe9, 0xc0, 0x4e, 0x03, 0xc6, 0xaf, 0x52, 0xbb, 0x32, 0x85, 0x3a, 0xe9, 0xe9, 0xa0, 0x55, + 0x3c, 0xeb, 0xe0, 0xfc, 0xb7, 0x00, 0x72, 0x13, 0x0d, 0x0e, 0xff, 0x08, 0x8a, 0x2d, 0x1a, 0x11, + 0xc6, 0x09, 0xf6, 0xdd, 0x46, 0x48, 0xbd, 0x0b, 0xfd, 0x45, 0x3e, 0xfd, 0x57, 0x6a, 0xaf, 0x7b, + 0x94, 0x45, 0x94, 0x31, 0xff, 0x62, 0x2b, 0xa0, 0xdb, 0x11, 0xe6, 0xad, 0xad, 0xe3, 0x58, 0x90, + 0xde, 0x53, 0xa4, 0x33, 0x9e, 0x0e, 0x2a, 0x8c, 0x34, 0x55, 0xa1, 0x80, 0x2d, 0x50, 0xf0, 0x31, + 0x75, 0x3f, 0xa5, 0xc9, 0x85, 0x06, 0x9f, 0x97, 0xe0, 0xd5, 0x6f, 0x05, 0x1f, 0xa4, 0x76, 0xfe, + 0xe8, 0xe0, 0xc3, 0x0f, 0x68, 0x72, 0x21, 0x21, 0xae, 0x52, 0x7b, 0x5d, 0x91, 0x4d, 0x03, 0x39, + 0x28, 0xef, 0x63, 0x3a, 0x32, 0x83, 0x1f, 0x03, 0x6b, 0x64, 0xc0, 0x3a, 0xed, 0x36, 0x4d, 0x78, + 0x79, 0x41, 0x7c, 0x74, 0xd5, 0x9f, 0x0c, 0x52, 0xbb, 0xa0, 0x21, 0xeb, 0x6a, 0xe6, 0x2a, 0xb5, + 0xef, 0xcf, 0x80, 0x6a, 0x1f, 0x07, 0x15, 0x34, 0xac, 0x36, 0x15, 0xdb, 0x06, 0x09, 0xda, 0x3b, + 0x7b, 0x4f, 0x74, 0x02, 0x86, 0x4c, 0xe0, 0x57, 0xb7, 0x25, 0x90, 0xab, 0x1d, 0x9f, 0xed, 0xec, + 0x3d, 0x19, 0xc6, 0xaf, 0xf7, 0x8e, 0x49, 0x14, 0x07, 0xe5, 0x94, 0xa8, 0x82, 0x3f, 0x06, 0x5a, + 0x74, 0x5b, 0x98, 0xb5, 0xe4, 0xce, 0x94, 0xad, 0x3e, 0x12, 0x0d, 0xa4, 0x90, 0x7e, 0x8b, 0x59, + 0x6b, 0x5c, 0xf5, 0x46, 0xff, 0xcf, 0x38, 0xe6, 0x41, 0x27, 0x1a, 0x62, 0x01, 0xe5, 0x2c, 0xac, + 0x46, 0xe1, 0xee, 0xe9, 0x70, 0x97, 0xee, 0x1a, 0xee, 0xde, 0x4d, 0xe1, 0xee, 0x4d, 0x87, 0xab, + 0x6c, 0x46, 0x1c, 0xfb, 0x9a, 0x63, 0xf9, 0xae, 0x1c, 0xfb, 0x37, 0x71, 0xec, 0x4f, 0x73, 0x28, + 0x1b, 0xd1, 0x97, 0x33, 0x79, 0x96, 0xcd, 0x3b, 0xf7, 0xe5, 0xb5, 0x0a, 0x15, 0x46, 0x1a, 0x85, + 0x7e, 0x01, 0x4a, 0x1e, 0x8d, 0x19, 0x17, 0xba, 0x98, 0xb6, 0x43, 0xa2, 0x29, 0xb2, 0x92, 0x62, + 0xff, 0x36, 0x8a, 0x87, 0xfa, 0x24, 0xb8, 0xc1, 0xdd, 0x41, 0x6b, 0xd3, 0x6a, 0x45, 0xe6, 0x02, + 0xab, 0x4d, 0x38, 0x49, 0x58, 0xa3, 0x93, 0x34, 0x35, 0x11, 0x90, 0x44, 0xef, 0xdd, 0x46, 0xa4, + 0x3b, 0x74, 0xd6, 0xd5, 0x41, 0xc5, 0xb1, 0x4a, 0x11, 0x7c, 0x02, 0x0a, 0x81, 0x60, 0x6d, 0x74, + 0x42, 0x0d, 0x9f, 0x93, 0xf0, 0xbb, 0xb7, 0xc1, 0xeb, 0xaf, 0x6a, 0xda, 0xd1, 0x41, 0x2b, 0x43, + 0x85, 0x82, 0xf6, 0x01, 0x8c, 0x3a, 0x41, 0xe2, 0x36, 0x43, 0xec, 0x05, 0x24, 0xd1, 0xf0, 0x79, + 0x09, 0xff, 0xd3, 0xdb, 0xe0, 0x1f, 0x28, 0xf8, 0xeb, 0xce, 0x0e, 0xb2, 0x84, 0xf2, 0x37, 0x4a, + 0xa7, 0x58, 0xea, 0x20, 0xdf, 0x20, 0x49, 0x18, 0xc4, 0x1a, 0x7f, 0x45, 0xe2, 0x3f, 0xb9, 0x0d, + 0x5f, 0x77, 0xd0, 0xa4, 0x9b, 0x83, 0x72, 0x4a, 0x1c, 0x81, 0x86, 0x34, 0xf6, 0xe9, 0x10, 0x74, + 0xf5, 0xce, 0xa0, 0x93, 0x6e, 0x0e, 0xca, 0x29, 0x51, 0x81, 0x36, 0xc1, 0x1a, 0x4e, 0x12, 0xfa, + 0x72, 0xa6, 0x20, 0x50, 0x62, 0xff, 0xec, 0x36, 0xec, 0xe1, 0x3e, 0x7d, 0xdd, 0x5b, 0xec, 0xd3, + 0x42, 0x3b, 0x55, 0x12, 0x1f, 0xc0, 0x66, 0x82, 0xfb, 0x33, 0x3c, 0xa5, 0x3b, 0x17, 0xfe, 0xba, + 0xb3, 0x83, 0x2c, 0xa1, 0x9c, 0x62, 0xf9, 0x0c, 0x94, 0x22, 0x92, 0x34, 0x89, 0x1b, 0x13, 0xce, + 0xda, 0x61, 0xc0, 0x35, 0xcf, 0xfa, 0x9d, 0xbf, 0x83, 0x9b, 0xdc, 0x1d, 0x04, 0xa5, 0xfa, 0x85, + 0xd6, 0x8e, 0xba, 0x94, 0xb5, 0x70, 0xdc, 0x6c, 0xe1, 0x40, 0xb3, 0xdc, 0xbb, 0x73, 0x97, 0x4e, + 0x3b, 0x3a, 0x68, 0x65, 0xa8, 0x18, 0x2d, 0xb5, 0x87, 0x63, 0xaf, 0x33, 0x5c, 0xea, 0xfb, 0x77, + 0x5e, 0xea, 0x49, 0x37, 0x07, 0xe5, 0x94, 0x28, 0x41, 0x4f, 0x0c, 0xb3, 0x60, 0x15, 0x4f, 0x0c, + 0xb3, 0x68, 0x59, 0x27, 0x86, 0x69, 0x59, 0xab, 0x27, 0x86, 0xb9, 0x66, 0x95, 0xd0, 0x4a, 0x9f, + 0x86, 0xd4, 0xed, 0x3e, 0x55, 0x4e, 0x28, 0x47, 0x5e, 0x62, 0xa6, 0x37, 0x1a, 0x54, 0xf0, 0x30, + 0xc7, 0x61, 0x9f, 0xe9, 0x42, 0x20, 0x4b, 0x95, 0x67, 0xe2, 0xd8, 0xda, 0x06, 0x8b, 0xe2, 0xce, + 0x44, 0xa0, 0x05, 0x16, 0x2e, 0x48, 0x5f, 0x1d, 0xb6, 0x48, 0x0c, 0x61, 0x09, 0x2c, 0x76, 0x71, + 0xd8, 0x21, 0xea, 0x8c, 0x44, 0x4a, 0x70, 0xce, 0x40, 0xf1, 0x3c, 0xc1, 0x31, 0x13, 0xf7, 0x2d, + 0x1a, 0x9f, 0xd2, 0x26, 0x83, 0x10, 0x18, 0xf2, 0x9c, 0x50, 0xbe, 0x72, 0x0c, 0x7f, 0x0c, 0x8c, + 0x90, 0x36, 0x99, 0xbc, 0x2d, 0xe4, 0x76, 0xd7, 0xaf, 0x5f, 0x4d, 0x4e, 0x69, 0x13, 0x49, 0x13, + 0xe7, 0x1f, 0xf3, 0x60, 0xe1, 0x94, 0x36, 0x61, 0x19, 0x2c, 0x63, 0xdf, 0x4f, 0x08, 0x63, 0x1a, + 0x69, 0x28, 0xc2, 0x7b, 0x60, 0x89, 0xd3, 0x76, 0xe0, 0x29, 0xb8, 0x2c, 0xd2, 0x92, 0x20, 0xf6, + 0x31, 0xc7, 0xf2, 0x60, 0xcd, 0x23, 0x39, 0x16, 0xd7, 0x57, 0x99, 0x99, 0x1b, 0x77, 0xa2, 0x06, + 0x49, 0xe4, 0xf9, 0x68, 0x54, 0x8b, 0x97, 0xa9, 0x9d, 0x93, 0xfa, 0x17, 0x52, 0x8d, 0x26, 0x05, + 0xf8, 0x2e, 0x58, 0xe6, 0xbd, 0xc9, 0xb3, 0x6e, 0xed, 0x32, 0xb5, 0x8b, 0x7c, 0x9c, 0xa6, 0x38, + 0xca, 0xd0, 0x12, 0xef, 0xc9, 0x23, 0x6d, 0x1b, 0x98, 0xbc, 0xe7, 0x06, 0xb1, 0x4f, 0x7a, 0xf2, + 0x38, 0x33, 0xaa, 0xa5, 0xcb, 0xd4, 0xb6, 0x26, 0xcc, 0x8f, 0xc5, 0x1c, 0x5a, 0xe6, 0x3d, 0x39, + 0x80, 0xef, 0x02, 0xa0, 0x42, 0x92, 0x0c, 0xea, 0x74, 0x5a, 0xb9, 0x4c, 0xed, 0xac, 0xd4, 0x4a, + 0xec, 0xf1, 0x10, 0x3a, 0x60, 0x51, 0x61, 0x9b, 0x12, 0x3b, 0x7f, 0x99, 0xda, 0x66, 0x48, 0x9b, + 0x0a, 0x53, 0x4d, 0x89, 0x52, 0x25, 0x24, 0xa2, 0x5d, 0xe2, 0xcb, 0x23, 0xc2, 0x44, 0x43, 0xd1, + 0x79, 0x3d, 0x0f, 0xcc, 0xf3, 0x1e, 0x22, 0xac, 0x13, 0x72, 0xf8, 0x01, 0xb0, 0xe4, 0x05, 0x0c, + 0x7b, 0xdc, 0x9d, 0x2a, 0x6d, 0xf5, 0xe1, 0x78, 0x43, 0x9f, 0xb5, 0x70, 0x50, 0x71, 0xa8, 0x3a, + 0xd0, 0xf5, 0x2f, 0x81, 0xc5, 0x46, 0x48, 0x69, 0x24, 0x3b, 0x21, 0x8f, 0x94, 0x00, 0x3f, 0x96, + 0x55, 0x93, 0xab, 0xbc, 0x20, 0x2f, 0xb7, 0xdf, 0xbf, 0xbe, 0xca, 0x33, 0xad, 0x52, 0x7d, 0xa8, + 0xdf, 0x2f, 0x05, 0xc5, 0xad, 0xfd, 0xf5, 0xd3, 0x65, 0x89, 0xf7, 0x64, 0x3f, 0x59, 0x60, 0x21, + 0x21, 0x5c, 0xae, 0x5c, 0x1e, 0x89, 0x21, 0xac, 0x00, 0x33, 0x21, 0x5d, 0x92, 0x70, 0xe2, 0xcb, + 0x15, 0x32, 0xd1, 0x48, 0x86, 0x0f, 0x80, 0xd9, 0xc4, 0xcc, 0xed, 0x30, 0xe2, 0xab, 0xe5, 0x40, + 0xcb, 0x4d, 0xcc, 0x3e, 0x62, 0xc4, 0x7f, 0x66, 0x7c, 0xfe, 0x85, 0x3d, 0xe7, 0x60, 0x90, 0xd3, + 0xf7, 0xde, 0x4e, 0x3b, 0x24, 0xb7, 0xb4, 0xd9, 0x2e, 0xc8, 0x33, 0x4e, 0x13, 0xdc, 0x24, 0xee, + 0x05, 0xe9, 0xeb, 0x66, 0x53, 0xad, 0xa3, 0xf5, 0xbf, 0x23, 0x7d, 0x86, 0x26, 0x05, 0x4d, 0xf1, + 0x85, 0x01, 0x72, 0xe7, 0x09, 0xf6, 0x88, 0xbe, 0xc5, 0x8a, 0x86, 0x15, 0x62, 0xa2, 0x29, 0xb4, + 0x24, 0xb8, 0x79, 0x10, 0x11, 0xda, 0xe1, 0xfa, 0xa3, 0x1a, 0x8a, 0xc2, 0x23, 0x21, 0xa4, 0x47, + 0x3c, 0x59, 0x4b, 0x03, 0x69, 0x09, 0xee, 0x81, 0x15, 0x3f, 0x60, 0xb8, 0x11, 0xca, 0xb7, 0x8f, + 0x77, 0xa1, 0xd2, 0xaf, 0x5a, 0x97, 0xa9, 0x9d, 0xd7, 0x13, 0x75, 0xa1, 0x47, 0x53, 0x12, 0x7c, + 0x1f, 0x14, 0xc7, 0x6e, 0x32, 0x5a, 0xf5, 0xe4, 0xab, 0xc2, 0xcb, 0xd4, 0x2e, 0x8c, 0x4c, 0xe5, + 0x0c, 0x9a, 0x91, 0xc5, 0x72, 0xfb, 0xa4, 0xd1, 0x69, 0xca, 0x0e, 0x34, 0x91, 0x12, 0x84, 0x36, + 0x0c, 0xa2, 0x80, 0xcb, 0x8e, 0x5b, 0x44, 0x4a, 0x80, 0xef, 0x83, 0x2c, 0xed, 0x92, 0x24, 0x09, + 0x7c, 0xf9, 0x14, 0xfb, 0xee, 0x27, 0x2c, 0x1a, 0xdb, 0x8b, 0xe4, 0x48, 0x2c, 0x83, 0x8c, 0x48, + 0x44, 0x93, 0xbe, 0xbc, 0x27, 0xe8, 0xe4, 0xd4, 0xc4, 0x73, 0xa9, 0x47, 0x53, 0x12, 0xac, 0x02, + 0xa8, 0xdd, 0x12, 0xc2, 0x3b, 0x49, 0xec, 0xca, 0x4d, 0x20, 0x2f, 0x7d, 0xe5, 0xa7, 0xa8, 0x66, + 0x91, 0x9c, 0x3c, 0xc2, 0x1c, 0xa3, 0x6b, 0x1a, 0xf8, 0x4b, 0x00, 0xd5, 0x9a, 0xb8, 0x9f, 0x31, + 0x3a, 0x7a, 0x83, 0xab, 0x83, 0x5e, 0xf2, 0xab, 0x59, 0x1d, 0xb3, 0xa5, 0xa4, 0x13, 0x46, 0x75, + 0x16, 0x27, 0x86, 0x69, 0x58, 0x8b, 0xea, 0xdd, 0x38, 0xaa, 0x9f, 0xce, 0x02, 0xad, 0x0d, 0xe5, + 0x89, 0xf0, 0x1e, 0xff, 0x3d, 0x03, 0x26, 0x9e, 0x5f, 0xf0, 0xe7, 0xa0, 0x72, 0x70, 0x78, 0x58, + 0xab, 0xd7, 0xdd, 0xf3, 0x4f, 0xce, 0x6a, 0xee, 0x59, 0x0d, 0x3d, 0x3f, 0xae, 0xd7, 0x8f, 0x3f, + 0x7c, 0x71, 0x5a, 0xab, 0xd7, 0xad, 0xb9, 0xca, 0x3b, 0xaf, 0xde, 0x6c, 0x96, 0xc7, 0xf6, 0x67, + 0xa2, 0x9e, 0x8c, 0x05, 0x34, 0x0e, 0x45, 0xa7, 0xbe, 0x07, 0xee, 0x4d, 0x7a, 0xa3, 0x5a, 0xfd, + 0x1c, 0x1d, 0x1f, 0x9e, 0xd7, 0x8e, 0xac, 0x4c, 0xa5, 0xfc, 0xea, 0xcd, 0x66, 0x69, 0xec, 0x89, + 0x08, 0xe3, 0x49, 0x20, 0x1e, 0xf7, 0x70, 0x1f, 0x94, 0x6f, 0xe6, 0xac, 0x1d, 0x59, 0xf3, 0x95, + 0xca, 0xab, 0x37, 0x9b, 0xf7, 0x6e, 0x62, 0x24, 0x7e, 0xc5, 0xf8, 0xfc, 0xaf, 0x1b, 0x73, 0xd5, + 0x5f, 0x7f, 0x35, 0xd8, 0xc8, 0x7c, 0x3d, 0xd8, 0xc8, 0xfc, 0x67, 0xb0, 0x91, 0x79, 0xfd, 0x76, + 0x63, 0xee, 0xeb, 0xb7, 0x1b, 0x73, 0xff, 0x7c, 0xbb, 0x31, 0xf7, 0x87, 0x1f, 0x35, 0x03, 0xde, + 0xea, 0x34, 0xb6, 0x3c, 0x1a, 0x6d, 0xab, 0xa7, 0xb6, 0xfa, 0xed, 0xee, 0x3e, 0xd1, 0x8f, 0x6e, + 0xf1, 0xbc, 0x64, 0x8d, 0x25, 0xf9, 0xbf, 0x97, 0xa7, 0xff, 0x0b, 0x00, 0x00, 0xff, 0xff, 0x80, + 0xcf, 0xeb, 0x91, 0xd4, 0x11, 0x00, 0x00, +} + +func (m *Params) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Params) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ActiveStaticPrecompiles) > 0 { + for iNdEx := len(m.ActiveStaticPrecompiles) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.ActiveStaticPrecompiles[iNdEx]) + copy(dAtA[i:], m.ActiveStaticPrecompiles[iNdEx]) + i = encodeVarintEvm(dAtA, i, uint64(len(m.ActiveStaticPrecompiles[iNdEx]))) + i-- + dAtA[i] = 0x52 + } + } + { + size, err := m.AccessControl.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintEvm(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x4a + if len(m.EVMChannels) > 0 { + for iNdEx := len(m.EVMChannels) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.EVMChannels[iNdEx]) + copy(dAtA[i:], m.EVMChannels[iNdEx]) + i = encodeVarintEvm(dAtA, i, uint64(len(m.EVMChannels[iNdEx]))) + i-- + dAtA[i] = 0x42 + } + } + if m.AllowUnprotectedTxs { + i-- + if m.AllowUnprotectedTxs { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x30 + } + { + size, err := m.ChainConfig.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintEvm(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + if len(m.ExtraEIPs) > 0 { + for iNdEx := len(m.ExtraEIPs) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.ExtraEIPs[iNdEx]) + copy(dAtA[i:], m.ExtraEIPs[iNdEx]) + i = encodeVarintEvm(dAtA, i, uint64(len(m.ExtraEIPs[iNdEx]))) + i-- + dAtA[i] = 0x22 + } + } + if len(m.EvmDenom) > 0 { + i -= len(m.EvmDenom) + copy(dAtA[i:], m.EvmDenom) + i = encodeVarintEvm(dAtA, i, uint64(len(m.EvmDenom))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *AccessControl) 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 *AccessControl) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AccessControl) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Call.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintEvm(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size, err := m.Create.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintEvm(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *AccessControlType) 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 *AccessControlType) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AccessControlType) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.AccessControlList) > 0 { + for iNdEx := len(m.AccessControlList) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.AccessControlList[iNdEx]) + copy(dAtA[i:], m.AccessControlList[iNdEx]) + i = encodeVarintEvm(dAtA, i, uint64(len(m.AccessControlList[iNdEx]))) + i-- + dAtA[i] = 0x12 + } + } + if m.AccessType != 0 { + i = encodeVarintEvm(dAtA, i, uint64(m.AccessType)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *ChainConfig) 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 *ChainConfig) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ChainConfig) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.CancunBlock != nil { + { + size := m.CancunBlock.Size() + i -= size + if _, err := m.CancunBlock.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintEvm(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0xba + } + if m.ShanghaiBlock != nil { + { + size := m.ShanghaiBlock.Size() + i -= size + if _, err := m.ShanghaiBlock.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintEvm(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0xb2 + } + if m.MergeNetsplitBlock != nil { + { + size := m.MergeNetsplitBlock.Size() + i -= size + if _, err := m.MergeNetsplitBlock.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintEvm(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0xaa + } + if m.GrayGlacierBlock != nil { + { + size := m.GrayGlacierBlock.Size() + i -= size + if _, err := m.GrayGlacierBlock.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintEvm(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0xa2 + } + if m.ArrowGlacierBlock != nil { + { + size := m.ArrowGlacierBlock.Size() + i -= size + if _, err := m.ArrowGlacierBlock.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintEvm(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x92 + } + if m.LondonBlock != nil { + { + size := m.LondonBlock.Size() + i -= size + if _, err := m.LondonBlock.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintEvm(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x8a + } + if m.BerlinBlock != nil { + { + size := m.BerlinBlock.Size() + i -= size + if _, err := m.BerlinBlock.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintEvm(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6a + } + if m.MuirGlacierBlock != nil { + { + size := m.MuirGlacierBlock.Size() + i -= size + if _, err := m.MuirGlacierBlock.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintEvm(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x62 + } + if m.IstanbulBlock != nil { + { + size := m.IstanbulBlock.Size() + i -= size + if _, err := m.IstanbulBlock.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintEvm(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x5a + } + if m.PetersburgBlock != nil { + { + size := m.PetersburgBlock.Size() + i -= size + if _, err := m.PetersburgBlock.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintEvm(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x52 + } + if m.ConstantinopleBlock != nil { + { + size := m.ConstantinopleBlock.Size() + i -= size + if _, err := m.ConstantinopleBlock.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintEvm(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x4a + } + if m.ByzantiumBlock != nil { + { + size := m.ByzantiumBlock.Size() + i -= size + if _, err := m.ByzantiumBlock.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintEvm(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x42 + } + if m.EIP158Block != nil { + { + size := m.EIP158Block.Size() + i -= size + if _, err := m.EIP158Block.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintEvm(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a + } + if m.EIP155Block != nil { + { + size := m.EIP155Block.Size() + i -= size + if _, err := m.EIP155Block.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintEvm(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + } + if len(m.EIP150Hash) > 0 { + i -= len(m.EIP150Hash) + copy(dAtA[i:], m.EIP150Hash) + i = encodeVarintEvm(dAtA, i, uint64(len(m.EIP150Hash))) + i-- + dAtA[i] = 0x2a + } + if m.EIP150Block != nil { + { + size := m.EIP150Block.Size() + i -= size + if _, err := m.EIP150Block.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintEvm(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + if m.DAOForkSupport { + i-- + if m.DAOForkSupport { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x18 + } + if m.DAOForkBlock != nil { + { + size := m.DAOForkBlock.Size() + i -= size + if _, err := m.DAOForkBlock.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintEvm(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.HomesteadBlock != nil { + { + size := m.HomesteadBlock.Size() + i -= size + if _, err := m.HomesteadBlock.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintEvm(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *State) 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 *State) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *State) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Value) > 0 { + i -= len(m.Value) + copy(dAtA[i:], m.Value) + i = encodeVarintEvm(dAtA, i, uint64(len(m.Value))) + i-- + dAtA[i] = 0x12 + } + if len(m.Key) > 0 { + i -= len(m.Key) + copy(dAtA[i:], m.Key) + i = encodeVarintEvm(dAtA, i, uint64(len(m.Key))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *TransactionLogs) 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 *TransactionLogs) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TransactionLogs) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Logs) > 0 { + for iNdEx := len(m.Logs) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Logs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintEvm(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if len(m.Hash) > 0 { + i -= len(m.Hash) + copy(dAtA[i:], m.Hash) + i = encodeVarintEvm(dAtA, i, uint64(len(m.Hash))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Log) 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 *Log) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Log) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Removed { + i-- + if m.Removed { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x48 + } + if m.Index != 0 { + i = encodeVarintEvm(dAtA, i, uint64(m.Index)) + i-- + dAtA[i] = 0x40 + } + if len(m.BlockHash) > 0 { + i -= len(m.BlockHash) + copy(dAtA[i:], m.BlockHash) + i = encodeVarintEvm(dAtA, i, uint64(len(m.BlockHash))) + i-- + dAtA[i] = 0x3a + } + if m.TxIndex != 0 { + i = encodeVarintEvm(dAtA, i, uint64(m.TxIndex)) + i-- + dAtA[i] = 0x30 + } + if len(m.TxHash) > 0 { + i -= len(m.TxHash) + copy(dAtA[i:], m.TxHash) + i = encodeVarintEvm(dAtA, i, uint64(len(m.TxHash))) + i-- + dAtA[i] = 0x2a + } + if m.BlockNumber != 0 { + i = encodeVarintEvm(dAtA, i, uint64(m.BlockNumber)) + i-- + dAtA[i] = 0x20 + } + if len(m.Data) > 0 { + i -= len(m.Data) + copy(dAtA[i:], m.Data) + i = encodeVarintEvm(dAtA, i, uint64(len(m.Data))) + i-- + dAtA[i] = 0x1a + } + if len(m.Topics) > 0 { + for iNdEx := len(m.Topics) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Topics[iNdEx]) + copy(dAtA[i:], m.Topics[iNdEx]) + i = encodeVarintEvm(dAtA, i, uint64(len(m.Topics[iNdEx]))) + i-- + dAtA[i] = 0x12 + } + } + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintEvm(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *TxResult) 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 *TxResult) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TxResult) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.GasUsed != 0 { + i = encodeVarintEvm(dAtA, i, uint64(m.GasUsed)) + i-- + dAtA[i] = 0x30 + } + if m.Reverted { + i-- + if m.Reverted { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x28 + } + if len(m.Ret) > 0 { + i -= len(m.Ret) + copy(dAtA[i:], m.Ret) + i = encodeVarintEvm(dAtA, i, uint64(len(m.Ret))) + i-- + dAtA[i] = 0x22 + } + { + size, err := m.TxLogs.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintEvm(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if len(m.Bloom) > 0 { + i -= len(m.Bloom) + copy(dAtA[i:], m.Bloom) + i = encodeVarintEvm(dAtA, i, uint64(len(m.Bloom))) + i-- + dAtA[i] = 0x12 + } + if len(m.ContractAddress) > 0 { + i -= len(m.ContractAddress) + copy(dAtA[i:], m.ContractAddress) + i = encodeVarintEvm(dAtA, i, uint64(len(m.ContractAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *AccessTuple) 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 *AccessTuple) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AccessTuple) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.StorageKeys) > 0 { + for iNdEx := len(m.StorageKeys) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.StorageKeys[iNdEx]) + copy(dAtA[i:], m.StorageKeys[iNdEx]) + i = encodeVarintEvm(dAtA, i, uint64(len(m.StorageKeys[iNdEx]))) + i-- + dAtA[i] = 0x12 + } + } + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintEvm(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *TraceConfig) 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 *TraceConfig) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TraceConfig) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.TracerJsonConfig) > 0 { + i -= len(m.TracerJsonConfig) + copy(dAtA[i:], m.TracerJsonConfig) + i = encodeVarintEvm(dAtA, i, uint64(len(m.TracerJsonConfig))) + i-- + dAtA[i] = 0x6a + } + if m.EnableReturnData { + i-- + if m.EnableReturnData { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x60 + } + if m.EnableMemory { + i-- + if m.EnableMemory { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x58 + } + if m.Overrides != nil { + { + size, err := m.Overrides.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintEvm(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x52 + } + if m.Limit != 0 { + i = encodeVarintEvm(dAtA, i, uint64(m.Limit)) + i-- + dAtA[i] = 0x48 + } + if m.Debug { + i-- + if m.Debug { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x40 + } + if m.DisableStorage { + i-- + if m.DisableStorage { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x30 + } + if m.DisableStack { + i-- + if m.DisableStack { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x28 + } + if m.Reexec != 0 { + i = encodeVarintEvm(dAtA, i, uint64(m.Reexec)) + i-- + dAtA[i] = 0x18 + } + if len(m.Timeout) > 0 { + i -= len(m.Timeout) + copy(dAtA[i:], m.Timeout) + i = encodeVarintEvm(dAtA, i, uint64(len(m.Timeout))) + i-- + dAtA[i] = 0x12 + } + if len(m.Tracer) > 0 { + i -= len(m.Tracer) + copy(dAtA[i:], m.Tracer) + i = encodeVarintEvm(dAtA, i, uint64(len(m.Tracer))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintEvm(dAtA []byte, offset int, v uint64) int { + offset -= sovEvm(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Params) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.EvmDenom) + if l > 0 { + n += 1 + l + sovEvm(uint64(l)) + } + if len(m.ExtraEIPs) > 0 { + for _, s := range m.ExtraEIPs { + l = len(s) + n += 1 + l + sovEvm(uint64(l)) + } + } + l = m.ChainConfig.Size() + n += 1 + l + sovEvm(uint64(l)) + if m.AllowUnprotectedTxs { + n += 2 + } + if len(m.EVMChannels) > 0 { + for _, s := range m.EVMChannels { + l = len(s) + n += 1 + l + sovEvm(uint64(l)) + } + } + l = m.AccessControl.Size() + n += 1 + l + sovEvm(uint64(l)) + if len(m.ActiveStaticPrecompiles) > 0 { + for _, s := range m.ActiveStaticPrecompiles { + l = len(s) + n += 1 + l + sovEvm(uint64(l)) + } + } + return n +} + +func (m *AccessControl) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Create.Size() + n += 1 + l + sovEvm(uint64(l)) + l = m.Call.Size() + n += 1 + l + sovEvm(uint64(l)) + return n +} + +func (m *AccessControlType) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.AccessType != 0 { + n += 1 + sovEvm(uint64(m.AccessType)) + } + if len(m.AccessControlList) > 0 { + for _, s := range m.AccessControlList { + l = len(s) + n += 1 + l + sovEvm(uint64(l)) + } + } + return n +} + +func (m *ChainConfig) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.HomesteadBlock != nil { + l = m.HomesteadBlock.Size() + n += 1 + l + sovEvm(uint64(l)) + } + if m.DAOForkBlock != nil { + l = m.DAOForkBlock.Size() + n += 1 + l + sovEvm(uint64(l)) + } + if m.DAOForkSupport { + n += 2 + } + if m.EIP150Block != nil { + l = m.EIP150Block.Size() + n += 1 + l + sovEvm(uint64(l)) + } + l = len(m.EIP150Hash) + if l > 0 { + n += 1 + l + sovEvm(uint64(l)) + } + if m.EIP155Block != nil { + l = m.EIP155Block.Size() + n += 1 + l + sovEvm(uint64(l)) + } + if m.EIP158Block != nil { + l = m.EIP158Block.Size() + n += 1 + l + sovEvm(uint64(l)) + } + if m.ByzantiumBlock != nil { + l = m.ByzantiumBlock.Size() + n += 1 + l + sovEvm(uint64(l)) + } + if m.ConstantinopleBlock != nil { + l = m.ConstantinopleBlock.Size() + n += 1 + l + sovEvm(uint64(l)) + } + if m.PetersburgBlock != nil { + l = m.PetersburgBlock.Size() + n += 1 + l + sovEvm(uint64(l)) + } + if m.IstanbulBlock != nil { + l = m.IstanbulBlock.Size() + n += 1 + l + sovEvm(uint64(l)) + } + if m.MuirGlacierBlock != nil { + l = m.MuirGlacierBlock.Size() + n += 1 + l + sovEvm(uint64(l)) + } + if m.BerlinBlock != nil { + l = m.BerlinBlock.Size() + n += 1 + l + sovEvm(uint64(l)) + } + if m.LondonBlock != nil { + l = m.LondonBlock.Size() + n += 2 + l + sovEvm(uint64(l)) + } + if m.ArrowGlacierBlock != nil { + l = m.ArrowGlacierBlock.Size() + n += 2 + l + sovEvm(uint64(l)) + } + if m.GrayGlacierBlock != nil { + l = m.GrayGlacierBlock.Size() + n += 2 + l + sovEvm(uint64(l)) + } + if m.MergeNetsplitBlock != nil { + l = m.MergeNetsplitBlock.Size() + n += 2 + l + sovEvm(uint64(l)) + } + if m.ShanghaiBlock != nil { + l = m.ShanghaiBlock.Size() + n += 2 + l + sovEvm(uint64(l)) + } + if m.CancunBlock != nil { + l = m.CancunBlock.Size() + n += 2 + l + sovEvm(uint64(l)) + } + return n +} + +func (m *State) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Key) + if l > 0 { + n += 1 + l + sovEvm(uint64(l)) + } + l = len(m.Value) + if l > 0 { + n += 1 + l + sovEvm(uint64(l)) + } + return n +} + +func (m *TransactionLogs) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Hash) + if l > 0 { + n += 1 + l + sovEvm(uint64(l)) + } + if len(m.Logs) > 0 { + for _, e := range m.Logs { + l = e.Size() + n += 1 + l + sovEvm(uint64(l)) + } + } + return n +} + +func (m *Log) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovEvm(uint64(l)) + } + if len(m.Topics) > 0 { + for _, s := range m.Topics { + l = len(s) + n += 1 + l + sovEvm(uint64(l)) + } + } + l = len(m.Data) + if l > 0 { + n += 1 + l + sovEvm(uint64(l)) + } + if m.BlockNumber != 0 { + n += 1 + sovEvm(uint64(m.BlockNumber)) + } + l = len(m.TxHash) + if l > 0 { + n += 1 + l + sovEvm(uint64(l)) + } + if m.TxIndex != 0 { + n += 1 + sovEvm(uint64(m.TxIndex)) + } + l = len(m.BlockHash) + if l > 0 { + n += 1 + l + sovEvm(uint64(l)) + } + if m.Index != 0 { + n += 1 + sovEvm(uint64(m.Index)) + } + if m.Removed { + n += 2 + } + return n +} + +func (m *TxResult) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ContractAddress) + if l > 0 { + n += 1 + l + sovEvm(uint64(l)) + } + l = len(m.Bloom) + if l > 0 { + n += 1 + l + sovEvm(uint64(l)) + } + l = m.TxLogs.Size() + n += 1 + l + sovEvm(uint64(l)) + l = len(m.Ret) + if l > 0 { + n += 1 + l + sovEvm(uint64(l)) + } + if m.Reverted { + n += 2 + } + if m.GasUsed != 0 { + n += 1 + sovEvm(uint64(m.GasUsed)) + } + return n +} + +func (m *AccessTuple) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovEvm(uint64(l)) + } + if len(m.StorageKeys) > 0 { + for _, s := range m.StorageKeys { + l = len(s) + n += 1 + l + sovEvm(uint64(l)) + } + } + return n +} + +func (m *TraceConfig) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Tracer) + if l > 0 { + n += 1 + l + sovEvm(uint64(l)) + } + l = len(m.Timeout) + if l > 0 { + n += 1 + l + sovEvm(uint64(l)) + } + if m.Reexec != 0 { + n += 1 + sovEvm(uint64(m.Reexec)) + } + if m.DisableStack { + n += 2 + } + if m.DisableStorage { + n += 2 + } + if m.Debug { + n += 2 + } + if m.Limit != 0 { + n += 1 + sovEvm(uint64(m.Limit)) + } + if m.Overrides != nil { + l = m.Overrides.Size() + n += 1 + l + sovEvm(uint64(l)) + } + if m.EnableMemory { + n += 2 + } + if m.EnableReturnData { + n += 2 + } + l = len(m.TracerJsonConfig) + if l > 0 { + n += 1 + l + sovEvm(uint64(l)) + } + return n +} + +func sovEvm(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozEvm(x uint64) (n int) { + return sovEvm(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Params) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Params: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EvmDenom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + 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 ErrInvalidLengthEvm + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.EvmDenom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ExtraEIPs", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + 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 ErrInvalidLengthEvm + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ExtraEIPs = append(m.ExtraEIPs, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ChainConfig", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthEvm + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthEvm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ChainConfig.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AllowUnprotectedTxs", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.AllowUnprotectedTxs = bool(v != 0) + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EVMChannels", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + 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 ErrInvalidLengthEvm + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.EVMChannels = append(m.EVMChannels, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AccessControl", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthEvm + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthEvm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.AccessControl.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ActiveStaticPrecompiles", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + 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 ErrInvalidLengthEvm + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ActiveStaticPrecompiles = append(m.ActiveStaticPrecompiles, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEvm(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvm + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *AccessControl) 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 ErrIntOverflowEvm + } + 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: AccessControl: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AccessControl: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Create", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthEvm + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthEvm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Create.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Call", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthEvm + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthEvm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Call.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEvm(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvm + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *AccessControlType) 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 ErrIntOverflowEvm + } + 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: AccessControlType: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AccessControlType: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AccessType", wireType) + } + m.AccessType = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.AccessType |= AccessType(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AccessControlList", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + 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 ErrInvalidLengthEvm + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AccessControlList = append(m.AccessControlList, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEvm(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvm + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ChainConfig) 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 ErrIntOverflowEvm + } + 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: ChainConfig: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ChainConfig: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field HomesteadBlock", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + 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 ErrInvalidLengthEvm + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var v cosmossdk_io_math.Int + m.HomesteadBlock = &v + if err := m.HomesteadBlock.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DAOForkBlock", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + 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 ErrInvalidLengthEvm + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var v cosmossdk_io_math.Int + m.DAOForkBlock = &v + if err := m.DAOForkBlock.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DAOForkSupport", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.DAOForkSupport = bool(v != 0) + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EIP150Block", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + 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 ErrInvalidLengthEvm + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var v cosmossdk_io_math.Int + m.EIP150Block = &v + if err := m.EIP150Block.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EIP150Hash", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + 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 ErrInvalidLengthEvm + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.EIP150Hash = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EIP155Block", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + 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 ErrInvalidLengthEvm + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var v cosmossdk_io_math.Int + m.EIP155Block = &v + if err := m.EIP155Block.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EIP158Block", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + 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 ErrInvalidLengthEvm + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var v cosmossdk_io_math.Int + m.EIP158Block = &v + if err := m.EIP158Block.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ByzantiumBlock", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + 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 ErrInvalidLengthEvm + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var v cosmossdk_io_math.Int + m.ByzantiumBlock = &v + if err := m.ByzantiumBlock.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ConstantinopleBlock", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + 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 ErrInvalidLengthEvm + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var v cosmossdk_io_math.Int + m.ConstantinopleBlock = &v + if err := m.ConstantinopleBlock.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PetersburgBlock", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + 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 ErrInvalidLengthEvm + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var v cosmossdk_io_math.Int + m.PetersburgBlock = &v + if err := m.PetersburgBlock.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 11: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field IstanbulBlock", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + 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 ErrInvalidLengthEvm + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var v cosmossdk_io_math.Int + m.IstanbulBlock = &v + if err := m.IstanbulBlock.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 12: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MuirGlacierBlock", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + 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 ErrInvalidLengthEvm + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var v cosmossdk_io_math.Int + m.MuirGlacierBlock = &v + if err := m.MuirGlacierBlock.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 13: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BerlinBlock", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + 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 ErrInvalidLengthEvm + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var v cosmossdk_io_math.Int + m.BerlinBlock = &v + if err := m.BerlinBlock.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 17: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LondonBlock", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + 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 ErrInvalidLengthEvm + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var v cosmossdk_io_math.Int + m.LondonBlock = &v + if err := m.LondonBlock.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 18: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ArrowGlacierBlock", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + 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 ErrInvalidLengthEvm + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var v cosmossdk_io_math.Int + m.ArrowGlacierBlock = &v + if err := m.ArrowGlacierBlock.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 20: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field GrayGlacierBlock", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + 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 ErrInvalidLengthEvm + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var v cosmossdk_io_math.Int + m.GrayGlacierBlock = &v + if err := m.GrayGlacierBlock.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 21: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MergeNetsplitBlock", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + 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 ErrInvalidLengthEvm + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var v cosmossdk_io_math.Int + m.MergeNetsplitBlock = &v + if err := m.MergeNetsplitBlock.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 22: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ShanghaiBlock", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + 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 ErrInvalidLengthEvm + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var v cosmossdk_io_math.Int + m.ShanghaiBlock = &v + if err := m.ShanghaiBlock.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 23: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CancunBlock", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + 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 ErrInvalidLengthEvm + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var v cosmossdk_io_math.Int + m.CancunBlock = &v + if err := m.CancunBlock.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEvm(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvm + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *State) 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 ErrIntOverflowEvm + } + 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: State: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: State: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + 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 ErrInvalidLengthEvm + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Key = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + 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 ErrInvalidLengthEvm + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Value = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEvm(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvm + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TransactionLogs) 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 ErrIntOverflowEvm + } + 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: TransactionLogs: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TransactionLogs: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Hash", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + 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 ErrInvalidLengthEvm + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Hash = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Logs", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthEvm + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthEvm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Logs = append(m.Logs, &Log{}) + if err := m.Logs[len(m.Logs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEvm(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvm + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Log) 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 ErrIntOverflowEvm + } + 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: Log: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Log: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + 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 ErrInvalidLengthEvm + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Topics", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + 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 ErrInvalidLengthEvm + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Topics = append(m.Topics, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthEvm + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthEvm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) + if m.Data == nil { + m.Data = []byte{} + } + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BlockNumber", wireType) + } + m.BlockNumber = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BlockNumber |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TxHash", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + 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 ErrInvalidLengthEvm + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TxHash = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TxIndex", wireType) + } + m.TxIndex = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TxIndex |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BlockHash", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + 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 ErrInvalidLengthEvm + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BlockHash = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) + } + m.Index = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Index |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 9: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Removed", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Removed = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipEvm(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvm + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TxResult) 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 ErrIntOverflowEvm + } + 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: TxResult: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TxResult: 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 ErrIntOverflowEvm + } + 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 ErrInvalidLengthEvm + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ContractAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Bloom", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthEvm + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthEvm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Bloom = append(m.Bloom[:0], dAtA[iNdEx:postIndex]...) + if m.Bloom == nil { + m.Bloom = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TxLogs", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthEvm + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthEvm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.TxLogs.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Ret", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthEvm + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthEvm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Ret = append(m.Ret[:0], dAtA[iNdEx:postIndex]...) + if m.Ret == nil { + m.Ret = []byte{} + } + iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Reverted", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Reverted = bool(v != 0) + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field GasUsed", wireType) + } + m.GasUsed = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.GasUsed |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipEvm(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvm + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *AccessTuple) 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 ErrIntOverflowEvm + } + 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: AccessTuple: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AccessTuple: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + 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 ErrInvalidLengthEvm + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StorageKeys", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + 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 ErrInvalidLengthEvm + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.StorageKeys = append(m.StorageKeys, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEvm(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvm + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TraceConfig) 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 ErrIntOverflowEvm + } + 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: TraceConfig: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TraceConfig: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Tracer", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + 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 ErrInvalidLengthEvm + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Tracer = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Timeout", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + 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 ErrInvalidLengthEvm + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Timeout = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Reexec", wireType) + } + m.Reexec = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Reexec |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DisableStack", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.DisableStack = bool(v != 0) + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DisableStorage", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.DisableStorage = bool(v != 0) + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Debug", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Debug = bool(v != 0) + case 9: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Limit", wireType) + } + m.Limit = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Limit |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Overrides", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthEvm + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthEvm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Overrides == nil { + m.Overrides = &ChainConfig{} + } + if err := m.Overrides.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 11: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field EnableMemory", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.EnableMemory = bool(v != 0) + case 12: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field EnableReturnData", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.EnableReturnData = bool(v != 0) + case 13: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TracerJsonConfig", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + 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 ErrInvalidLengthEvm + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TracerJsonConfig = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEvm(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvm + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipEvm(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEvm + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEvm + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEvm + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthEvm + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupEvm + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthEvm + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthEvm = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowEvm = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupEvm = fmt.Errorf("proto: unexpected end of group") +) diff --git a/rpc/types/legacy/key.go b/rpc/types/legacy/key.go new file mode 100644 index 000000000..8cba0020f --- /dev/null +++ b/rpc/types/legacy/key.go @@ -0,0 +1,19 @@ +// Copyright Tharsis Labs Ltd.(Evmos) +// SPDX-License-Identifier:ENCL-1.0(https://github.com/evmos/evmos/blob/main/LICENSE) +package types + +const ( + // ModuleName string name of module + ModuleName = "legacy_evm" + // StoreKey key for ethereum storage data, account code (StateDB) or block + // related data for Web3. + // The EVM module should use a prefix store. + StoreKey = ModuleName + + // TransientKey is the key to access the EVM transient store, that is reset + // during the Commit phase. + TransientKey = "transient_" + ModuleName + + // RouterKey uses module name for routing + RouterKey = ModuleName +) diff --git a/rpc/types/legacy/legacy_tx.go b/rpc/types/legacy/legacy_tx.go new file mode 100644 index 000000000..7f4acf05a --- /dev/null +++ b/rpc/types/legacy/legacy_tx.go @@ -0,0 +1,228 @@ +// Copyright Tharsis Labs Ltd.(Evmos) +// SPDX-License-Identifier:ENCL-1.0(https://github.com/evmos/evmos/blob/main/LICENSE) +package types + +import ( + "math/big" + + "github.com/ethereum/go-ethereum/common" + ethtypes "github.com/ethereum/go-ethereum/core/types" + + errorsmod "cosmossdk.io/errors" + + errortypes "github.com/cosmos/cosmos-sdk/types/errors" +) + +func NewLegacyTx(tx *ethtypes.Transaction) (*LegacyTx, error) { + txData := &LegacyTx{ + Nonce: tx.Nonce(), + Data: tx.Data(), + GasLimit: tx.Gas(), + } + + v, r, s := tx.RawSignatureValues() + if to := tx.To(); to != nil { + txData.To = to.Hex() + } + + if tx.Value() != nil { + amountInt, err := SafeNewIntFromBigInt(tx.Value()) + if err != nil { + return nil, err + } + txData.Amount = &amountInt + } + + if tx.GasPrice() != nil { + gasPriceInt, err := SafeNewIntFromBigInt(tx.GasPrice()) + if err != nil { + return nil, err + } + txData.GasPrice = &gasPriceInt + } + + txData.SetSignatureValues(tx.ChainId(), v, r, s) + return txData, nil +} + +// TxType returns the tx type +func (tx *LegacyTx) TxType() uint8 { + return ethtypes.LegacyTxType +} + +// Copy returns an instance with the same field values +func (tx *LegacyTx) Copy() TxData { + return &LegacyTx{ + Nonce: tx.Nonce, + GasPrice: tx.GasPrice, + GasLimit: tx.GasLimit, + To: tx.To, + Amount: tx.Amount, + Data: common.CopyBytes(tx.Data), + V: common.CopyBytes(tx.V), + R: common.CopyBytes(tx.R), + S: common.CopyBytes(tx.S), + } +} + +// GetChainID returns the chain id field from the derived signature values +func (tx *LegacyTx) GetChainID() *big.Int { + v, _, _ := tx.GetRawSignatureValues() + return DeriveChainID(v) +} + +// GetAccessList returns nil +func (tx *LegacyTx) GetAccessList() ethtypes.AccessList { + return nil +} + +// GetData returns the a copy of the input data bytes. +func (tx *LegacyTx) GetData() []byte { + return common.CopyBytes(tx.Data) +} + +// GetGas returns the gas limit. +func (tx *LegacyTx) GetGas() uint64 { + return tx.GasLimit +} + +// GetGasPrice returns the gas price field. +func (tx *LegacyTx) GetGasPrice() *big.Int { + if tx.GasPrice == nil { + return nil + } + return tx.GasPrice.BigInt() +} + +// GetGasTipCap returns the gas price field. +func (tx *LegacyTx) GetGasTipCap() *big.Int { + return tx.GetGasPrice() +} + +// GetGasFeeCap returns the gas price field. +func (tx *LegacyTx) GetGasFeeCap() *big.Int { + return tx.GetGasPrice() +} + +// GetValue returns the tx amount. +func (tx *LegacyTx) GetValue() *big.Int { + if tx.Amount == nil { + return nil + } + return tx.Amount.BigInt() +} + +// GetNonce returns the account sequence for the transaction. +func (tx *LegacyTx) GetNonce() uint64 { return tx.Nonce } + +// GetTo returns the pointer to the recipient address. +func (tx *LegacyTx) GetTo() *common.Address { + if tx.To == "" { + return nil + } + to := common.HexToAddress(tx.To) + return &to +} + +// AsEthereumData returns an LegacyTx transaction tx from the proto-formatted +// TxData defined on the Cosmos EVM. +func (tx *LegacyTx) AsEthereumData() ethtypes.TxData { + v, r, s := tx.GetRawSignatureValues() + return ðtypes.LegacyTx{ + Nonce: tx.GetNonce(), + GasPrice: tx.GetGasPrice(), + Gas: tx.GetGas(), + To: tx.GetTo(), + Value: tx.GetValue(), + Data: tx.GetData(), + V: v, + R: r, + S: s, + } +} + +// GetRawSignatureValues returns the V, R, S signature values of the transaction. +// The return values should not be modified by the caller. +func (tx *LegacyTx) GetRawSignatureValues() (v, r, s *big.Int) { + return RawSignatureValues(tx.V, tx.R, tx.S) +} + +// SetSignatureValues sets the signature values to the transaction. +func (tx *LegacyTx) SetSignatureValues(_, v, r, s *big.Int) { + if v != nil { + tx.V = v.Bytes() + } + if r != nil { + tx.R = r.Bytes() + } + if s != nil { + tx.S = s.Bytes() + } +} + +// Validate performs a stateless validation of the tx fields. +func (tx LegacyTx) Validate() error { + gasPrice := tx.GetGasPrice() + if gasPrice == nil { + return errorsmod.Wrap(ErrInvalidGasPrice, "gas price cannot be nil") + } + + if gasPrice.Sign() == -1 { + return errorsmod.Wrapf(ErrInvalidGasPrice, "gas price cannot be negative %s", gasPrice) + } + if !IsValidInt256(gasPrice) { + return errorsmod.Wrap(ErrInvalidGasPrice, "out of bound") + } + if !IsValidInt256(tx.Fee()) { + return errorsmod.Wrap(ErrInvalidGasFee, "out of bound") + } + + amount := tx.GetValue() + // Amount can be 0 + if amount != nil && amount.Sign() == -1 { + return errorsmod.Wrapf(ErrInvalidAmount, "amount cannot be negative %s", amount) + } + if !IsValidInt256(amount) { + return errorsmod.Wrap(ErrInvalidAmount, "out of bound") + } + + if tx.To != "" { + if err := ValidateAddress(tx.To); err != nil { + return errorsmod.Wrap(err, "invalid to address") + } + } + + if tx.GetChainID() == nil { + return errorsmod.Wrap( + errortypes.ErrInvalidChainID, + "chain ID must be derived from LegacyTx txs", + ) + } + + return nil +} + +// Fee returns gasprice * gaslimit. +func (tx LegacyTx) Fee() *big.Int { + return fee(tx.GetGasPrice(), tx.GetGas()) +} + +// Cost returns amount + gasprice * gaslimit. +func (tx LegacyTx) Cost() *big.Int { + return cost(tx.Fee(), tx.GetValue()) +} + +// EffectiveGasPrice is the same as GasPrice for LegacyTx +func (tx LegacyTx) EffectiveGasPrice(_ *big.Int) *big.Int { + return tx.GetGasPrice() +} + +// EffectiveFee is the same as Fee for LegacyTx +func (tx LegacyTx) EffectiveFee(_ *big.Int) *big.Int { + return tx.Fee() +} + +// EffectiveCost is the same as Cost for LegacyTx +func (tx LegacyTx) EffectiveCost(_ *big.Int) *big.Int { + return tx.Cost() +} diff --git a/rpc/types/legacy/msg.go b/rpc/types/legacy/msg.go new file mode 100644 index 000000000..435b0dc3e --- /dev/null +++ b/rpc/types/legacy/msg.go @@ -0,0 +1,300 @@ +// Copyright Tharsis Labs Ltd.(Evmos) +// SPDX-License-Identifier:ENCL-1.0(https://github.com/evmos/evmos/blob/main/LICENSE) +package types + +import ( + "errors" + "fmt" + "math/big" + + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core" + ethtypes "github.com/ethereum/go-ethereum/core/types" + protov2 "google.golang.org/protobuf/proto" + + errorsmod "cosmossdk.io/errors" + sdkmath "cosmossdk.io/math" + + "github.com/cosmos/cosmos-sdk/client" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/crypto/keyring" + sdk "github.com/cosmos/cosmos-sdk/types" + errortypes "github.com/cosmos/cosmos-sdk/types/errors" + signingtypes "github.com/cosmos/cosmos-sdk/types/tx/signing" + "github.com/cosmos/cosmos-sdk/x/auth/ante" + "github.com/cosmos/cosmos-sdk/x/auth/signing" + authtx "github.com/cosmos/cosmos-sdk/x/auth/tx" +) + +var ( + _ sdk.Msg = &MsgEthereumTx{} + _ sdk.Tx = &MsgEthereumTx{} + _ ante.GasTx = &MsgEthereumTx{} + _ sdk.Msg = &MsgUpdateParams{} + + _ codectypes.UnpackInterfacesMessage = MsgEthereumTx{} +) + +// message type and route constants +const ( + // TypeMsgEthereumTx defines the type string of an Ethereum transaction + TypeMsgEthereumTx = "ethereum_tx" +) + +// FromEthereumTx populates the message fields from the given ethereum transaction +func (msg *MsgEthereumTx) FromEthereumTx(tx *ethtypes.Transaction) error { + txData, err := NewTxDataFromTx(tx) + if err != nil { + return err + } + + anyTxData, err := PackTxData(txData) + if err != nil { + return err + } + + msg.Data = anyTxData + msg.Hash = tx.Hash().Hex() + return nil +} + +// Route returns the route value of an MsgEthereumTx. +func (msg MsgEthereumTx) Route() string { return RouterKey } + +// Type returns the type value of an MsgEthereumTx. +func (msg MsgEthereumTx) Type() string { return TypeMsgEthereumTx } + +// ValidateBasic implements the sdk.Msg interface. It performs basic validation +// checks of a Transaction. If returns an error if validation fails. +func (msg MsgEthereumTx) ValidateBasic() error { + if msg.From != "" { + if err := ValidateAddress(msg.From); err != nil { + return errorsmod.Wrap(err, "invalid from address") + } + } + + // Validate Size_ field, should be kept empty + if msg.Size_ != 0 { + return errorsmod.Wrapf(errortypes.ErrInvalidRequest, "tx size is deprecated") + } + + txData, err := UnpackTxData(msg.Data) + if err != nil { + return errorsmod.Wrap(err, "failed to unpack tx data") + } + + gas := txData.GetGas() + + // prevent txs with 0 gas to fill up the mempool + if gas == 0 { + return errorsmod.Wrap(ErrInvalidGasLimit, "gas limit must not be zero") + } + + // prevent gas limit from overflow + if g := new(big.Int).SetUint64(gas); !g.IsInt64() { + return errorsmod.Wrap(ErrGasOverflow, "gas limit must be less than math.MaxInt64") + } + + if err := txData.Validate(); err != nil { + return err + } + + // Validate Hash field after validated txData to avoid panic + txHash := msg.AsTransaction().Hash().Hex() + if msg.Hash != txHash { + return errorsmod.Wrapf(errortypes.ErrInvalidRequest, "invalid tx hash %s, expected: %s", msg.Hash, txHash) + } + + return nil +} + +// GetMsgs returns a single MsgEthereumTx as an sdk.Msg. +func (msg *MsgEthereumTx) GetMsgs() []sdk.Msg { + return []sdk.Msg{msg} +} + +func (msg *MsgEthereumTx) GetMsgsV2() ([]protov2.Message, error) { + return nil, errors.New("not implemented") +} + +// GetSignBytes returns the Amino bytes of an Ethereum transaction message used +// for signing. +// +// NOTE: This method cannot be used as a chain ID is needed to create valid bytes +// to sign over. Use 'RLPSignBytes' instead. +func (msg MsgEthereumTx) GetSignBytes() []byte { + panic("must use 'RLPSignBytes' with a chain ID to get the valid bytes to sign") +} + +// Sign calculates a secp256k1 ECDSA signature and signs the transaction. It +// takes a keyring signer and the chainID to sign an Ethereum transaction according to +// EIP155 standard. +// This method mutates the transaction as it populates the V, R, S +// fields of the Transaction's Signature. +// The function will fail if the sender address is not defined for the msg or if +// the sender is not registered on the keyring +func (msg *MsgEthereumTx) Sign(ethSigner ethtypes.Signer, keyringSigner keyring.Signer) error { + from := msg.GetFrom() + if from.Empty() { + return fmt.Errorf("sender address not defined for message") + } + + tx := msg.AsTransaction() + txHash := ethSigner.Hash(tx) + + sig, _, err := keyringSigner.SignByAddress(from, txHash.Bytes(), signingtypes.SignMode_SIGN_MODE_TEXTUAL) + if err != nil { + return err + } + + tx, err = tx.WithSignature(ethSigner, sig) + if err != nil { + return err + } + + return msg.FromEthereumTx(tx) +} + +// GetGas implements the GasTx interface. It returns the GasLimit of the transaction. +func (msg MsgEthereumTx) GetGas() uint64 { + txData, err := UnpackTxData(msg.Data) + if err != nil { + return 0 + } + return txData.GetGas() +} + +// GetFee returns the fee for non dynamic fee tx +func (msg MsgEthereumTx) GetFee() *big.Int { + txData, err := UnpackTxData(msg.Data) + if err != nil { + return nil + } + return txData.Fee() +} + +// GetEffectiveFee returns the fee for dynamic fee tx +func (msg MsgEthereumTx) GetEffectiveFee(baseFee *big.Int) *big.Int { + txData, err := UnpackTxData(msg.Data) + if err != nil { + return nil + } + return txData.EffectiveFee(baseFee) +} + +// GetFrom loads the ethereum sender address from the sigcache and returns an +// sdk.AccAddress from its bytes +func (msg *MsgEthereumTx) GetFrom() sdk.AccAddress { + if msg.From == "" { + return nil + } + + return common.HexToAddress(msg.From).Bytes() +} + +// AsTransaction creates an Ethereum Transaction type from the msg fields +func (msg MsgEthereumTx) AsTransaction() *ethtypes.Transaction { + txData, err := UnpackTxData(msg.Data) + if err != nil { + return nil + } + + return ethtypes.NewTx(txData.AsEthereumData()) +} + +// AsMessage creates an Ethereum core.Message from the msg fields +func (msg MsgEthereumTx) AsMessage(signer ethtypes.Signer, baseFee *big.Int) (core.Message, error) { + tx := msg.AsTransaction() + ethMsg := core.Message{ + Nonce: tx.Nonce(), + GasLimit: tx.Gas(), + GasPrice: new(big.Int).Set(tx.GasPrice()), + GasFeeCap: new(big.Int).Set(tx.GasFeeCap()), + GasTipCap: new(big.Int).Set(tx.GasTipCap()), + To: tx.To(), + Value: tx.Value(), + Data: tx.Data(), + AccessList: tx.AccessList(), + SetCodeAuthorizations: tx.SetCodeAuthorizations(), + SkipNonceChecks: false, + SkipFromEOACheck: false, + BlobHashes: tx.BlobHashes(), + BlobGasFeeCap: tx.BlobGasFeeCap(), + } + // If baseFee provided, set gasPrice to effectiveGasPrice. + if baseFee != nil { + ethMsg.GasPrice = ethMsg.GasPrice.Add(ethMsg.GasTipCap, baseFee) + if ethMsg.GasPrice.Cmp(ethMsg.GasFeeCap) > 0 { + ethMsg.GasPrice = ethMsg.GasFeeCap + } + } + var err error + ethMsg.From, err = msg.GetSender(signer.ChainID()) + if err != nil { + return core.Message{}, err + } + return ethMsg, nil +} + +// GetSender extracts the sender address from the signature values using the latest signer for the given chainID. +func (msg *MsgEthereumTx) GetSender(chainID *big.Int) (common.Address, error) { + signer := ethtypes.LatestSignerForChainID(chainID) + from, err := signer.Sender(msg.AsTransaction()) + if err != nil { + return common.Address{}, err + } + + msg.From = from.Hex() + return from, nil +} + +// UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces +func (msg MsgEthereumTx) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error { + return unpacker.UnpackAny(msg.Data, new(TxData)) +} + +// UnmarshalBinary decodes the canonical encoding of transactions. +func (msg *MsgEthereumTx) UnmarshalBinary(b []byte) error { + tx := ðtypes.Transaction{} + if err := tx.UnmarshalBinary(b); err != nil { + return err + } + return msg.FromEthereumTx(tx) +} + +// BuildTx builds the canonical cosmos tx from ethereum msg +func (msg *MsgEthereumTx) BuildTx(b client.TxBuilder, evmDenom string) (signing.Tx, error) { + builder, ok := b.(authtx.ExtensionOptionsTxBuilder) + if !ok { + return nil, errors.New("unsupported builder") + } + + option, err := codectypes.NewAnyWithValue(&ExtensionOptionsEthereumTx{}) + if err != nil { + return nil, err + } + + txData, err := UnpackTxData(msg.Data) + if err != nil { + return nil, err + } + fees := make(sdk.Coins, 0) + feeAmt := sdkmath.NewIntFromBigInt(txData.Fee()) + if feeAmt.Sign() > 0 { + fees = append(fees, sdk.NewCoin(evmDenom, feeAmt)) + } + + builder.SetExtensionOptions(option) + + // A valid msg should have empty `From` + msg.From = "" + + err = builder.SetMsgs(msg) + if err != nil { + return nil, err + } + builder.SetFeeAmount(fees) + builder.SetGasLimit(msg.GetGas()) + tx := builder.GetTx() + return tx, nil +} diff --git a/rpc/types/legacy/tx.go b/rpc/types/legacy/tx.go new file mode 100644 index 000000000..cb1ce27c1 --- /dev/null +++ b/rpc/types/legacy/tx.go @@ -0,0 +1,25 @@ +// Copyright Tharsis Labs Ltd.(Evmos) +// SPDX-License-Identifier:ENCL-1.0(https://github.com/evmos/evmos/blob/main/LICENSE) +package types + +import ( + "math/big" + + "github.com/ethereum/go-ethereum/common" + ethtypes "github.com/ethereum/go-ethereum/core/types" +) + +// EvmTxArgs encapsulates all possible params to create all EVM txs types. +// This includes LegacyTx, DynamicFeeTx and AccessListTx +type EvmTxArgs struct { + Nonce uint64 + GasLimit uint64 + Input []byte + GasFeeCap *big.Int + GasPrice *big.Int + ChainID *big.Int + Amount *big.Int + GasTipCap *big.Int + To *common.Address + Accesses *ethtypes.AccessList +} diff --git a/rpc/types/legacy/tx.pb.go b/rpc/types/legacy/tx.pb.go new file mode 100644 index 000000000..94f2601bd --- /dev/null +++ b/rpc/types/legacy/tx.pb.go @@ -0,0 +1,3276 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: ethermint/evm/v1/tx.proto + +package types + +import ( + context "context" + cosmossdk_io_math "cosmossdk.io/math" + encoding_binary "encoding/binary" + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + types "github.com/cosmos/cosmos-sdk/codec/types" + _ "github.com/cosmos/cosmos-sdk/types/msgservice" + _ "github.com/cosmos/cosmos-sdk/types/tx/amino" + _ "github.com/cosmos/gogoproto/gogoproto" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" + _ "google.golang.org/genproto/googleapis/api/annotations" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// MsgEthereumTx encapsulates an Ethereum transaction as an SDK message. +type MsgEthereumTx struct { + // data is inner transaction data of the Ethereum transaction + Data *types.Any `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` + // size is the encoded storage size of the transaction (DEPRECATED) + Size_ float64 `protobuf:"fixed64,2,opt,name=size,proto3" json:"-"` + // hash of the transaction in hex format + Hash string `protobuf:"bytes,3,opt,name=hash,proto3" json:"hash,omitempty" rlp:"-"` + // from is the ethereum signer address in hex format. This address value is checked + // against the address derived from the signature (V, R, S) using the + // secp256k1 elliptic curve + From string `protobuf:"bytes,4,opt,name=from,proto3" json:"from,omitempty"` +} + +func (m *MsgEthereumTx) Reset() { *m = MsgEthereumTx{} } +func (m *MsgEthereumTx) String() string { return proto.CompactTextString(m) } +func (*MsgEthereumTx) ProtoMessage() {} +func (*MsgEthereumTx) Descriptor() ([]byte, []int) { + return fileDescriptor_f75ac0a12d075f21, []int{0} +} +func (m *MsgEthereumTx) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgEthereumTx) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgEthereumTx.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 *MsgEthereumTx) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgEthereumTx.Merge(m, src) +} +func (m *MsgEthereumTx) XXX_Size() int { + return m.Size() +} +func (m *MsgEthereumTx) XXX_DiscardUnknown() { + xxx_messageInfo_MsgEthereumTx.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgEthereumTx proto.InternalMessageInfo + +// LegacyTx is the transaction data of regular Ethereum transactions. +// NOTE: All non-protected transactions (i.e non EIP155 signed) will fail if the +// AllowUnprotectedTxs parameter is disabled. +type LegacyTx struct { + // nonce corresponds to the account nonce (transaction sequence). + Nonce uint64 `protobuf:"varint,1,opt,name=nonce,proto3" json:"nonce,omitempty"` + // gas_price defines the value for each gas unit + GasPrice *cosmossdk_io_math.Int `protobuf:"bytes,2,opt,name=gas_price,json=gasPrice,proto3,customtype=cosmossdk.io/math.Int" json:"gas_price,omitempty"` + // gas defines the gas limit defined for the transaction. + GasLimit uint64 `protobuf:"varint,3,opt,name=gas,proto3" json:"gas,omitempty"` + // to is the hex formatted address of the recipient + To string `protobuf:"bytes,4,opt,name=to,proto3" json:"to,omitempty"` + // value defines the unsigned integer value of the transaction amount. + Amount *cosmossdk_io_math.Int `protobuf:"bytes,5,opt,name=value,proto3,customtype=cosmossdk.io/math.Int" json:"value,omitempty"` + // data is the data payload bytes of the transaction. + Data []byte `protobuf:"bytes,6,opt,name=data,proto3" json:"data,omitempty"` + // v defines the signature value + V []byte `protobuf:"bytes,7,opt,name=v,proto3" json:"v,omitempty"` + // r defines the signature value + R []byte `protobuf:"bytes,8,opt,name=r,proto3" json:"r,omitempty"` + // s define the signature value + S []byte `protobuf:"bytes,9,opt,name=s,proto3" json:"s,omitempty"` +} + +func (m *LegacyTx) Reset() { *m = LegacyTx{} } +func (m *LegacyTx) String() string { return proto.CompactTextString(m) } +func (*LegacyTx) ProtoMessage() {} +func (*LegacyTx) Descriptor() ([]byte, []int) { + return fileDescriptor_f75ac0a12d075f21, []int{1} +} +func (m *LegacyTx) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *LegacyTx) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_LegacyTx.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 *LegacyTx) XXX_Merge(src proto.Message) { + xxx_messageInfo_LegacyTx.Merge(m, src) +} +func (m *LegacyTx) XXX_Size() int { + return m.Size() +} +func (m *LegacyTx) XXX_DiscardUnknown() { + xxx_messageInfo_LegacyTx.DiscardUnknown(m) +} + +var xxx_messageInfo_LegacyTx proto.InternalMessageInfo + +// AccessListTx is the data of EIP-2930 access list transactions. +type AccessListTx struct { + // chain_id of the destination EVM chain + ChainID *cosmossdk_io_math.Int `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3,customtype=cosmossdk.io/math.Int" json:"chainID"` + // nonce corresponds to the account nonce (transaction sequence). + Nonce uint64 `protobuf:"varint,2,opt,name=nonce,proto3" json:"nonce,omitempty"` + // gas_price defines the value for each gas unit + GasPrice *cosmossdk_io_math.Int `protobuf:"bytes,3,opt,name=gas_price,json=gasPrice,proto3,customtype=cosmossdk.io/math.Int" json:"gas_price,omitempty"` + // gas defines the gas limit defined for the transaction. + GasLimit uint64 `protobuf:"varint,4,opt,name=gas,proto3" json:"gas,omitempty"` + // to is the recipient address in hex format + To string `protobuf:"bytes,5,opt,name=to,proto3" json:"to,omitempty"` + // value defines the unsigned integer value of the transaction amount. + Amount *cosmossdk_io_math.Int `protobuf:"bytes,6,opt,name=value,proto3,customtype=cosmossdk.io/math.Int" json:"value,omitempty"` + // data is the data payload bytes of the transaction. + Data []byte `protobuf:"bytes,7,opt,name=data,proto3" json:"data,omitempty"` + // accesses is an array of access tuples + Accesses AccessList `protobuf:"bytes,8,rep,name=accesses,proto3,castrepeated=AccessList" json:"accessList"` + // v defines the signature value + V []byte `protobuf:"bytes,9,opt,name=v,proto3" json:"v,omitempty"` + // r defines the signature value + R []byte `protobuf:"bytes,10,opt,name=r,proto3" json:"r,omitempty"` + // s define the signature value + S []byte `protobuf:"bytes,11,opt,name=s,proto3" json:"s,omitempty"` +} + +func (m *AccessListTx) Reset() { *m = AccessListTx{} } +func (m *AccessListTx) String() string { return proto.CompactTextString(m) } +func (*AccessListTx) ProtoMessage() {} +func (*AccessListTx) Descriptor() ([]byte, []int) { + return fileDescriptor_f75ac0a12d075f21, []int{2} +} +func (m *AccessListTx) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AccessListTx) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AccessListTx.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 *AccessListTx) XXX_Merge(src proto.Message) { + xxx_messageInfo_AccessListTx.Merge(m, src) +} +func (m *AccessListTx) XXX_Size() int { + return m.Size() +} +func (m *AccessListTx) XXX_DiscardUnknown() { + xxx_messageInfo_AccessListTx.DiscardUnknown(m) +} + +var xxx_messageInfo_AccessListTx proto.InternalMessageInfo + +// DynamicFeeTx is the data of EIP-1559 dynamic fee transactions. +type DynamicFeeTx struct { + // chain_id of the destination EVM chain + ChainID *cosmossdk_io_math.Int `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3,customtype=cosmossdk.io/math.Int" json:"chainID"` + // nonce corresponds to the account nonce (transaction sequence). + Nonce uint64 `protobuf:"varint,2,opt,name=nonce,proto3" json:"nonce,omitempty"` + // gas_tip_cap defines the max value for the gas tip + GasTipCap *cosmossdk_io_math.Int `protobuf:"bytes,3,opt,name=gas_tip_cap,json=gasTipCap,proto3,customtype=cosmossdk.io/math.Int" json:"gas_tip_cap,omitempty"` + // gas_fee_cap defines the max value for the gas fee + GasFeeCap *cosmossdk_io_math.Int `protobuf:"bytes,4,opt,name=gas_fee_cap,json=gasFeeCap,proto3,customtype=cosmossdk.io/math.Int" json:"gas_fee_cap,omitempty"` + // gas defines the gas limit defined for the transaction. + GasLimit uint64 `protobuf:"varint,5,opt,name=gas,proto3" json:"gas,omitempty"` + // to is the hex formatted address of the recipient + To string `protobuf:"bytes,6,opt,name=to,proto3" json:"to,omitempty"` + // value defines the transaction amount. + Amount *cosmossdk_io_math.Int `protobuf:"bytes,7,opt,name=value,proto3,customtype=cosmossdk.io/math.Int" json:"value,omitempty"` + // data is the data payload bytes of the transaction. + Data []byte `protobuf:"bytes,8,opt,name=data,proto3" json:"data,omitempty"` + // accesses is an array of access tuples + Accesses AccessList `protobuf:"bytes,9,rep,name=accesses,proto3,castrepeated=AccessList" json:"accessList"` + // v defines the signature value + V []byte `protobuf:"bytes,10,opt,name=v,proto3" json:"v,omitempty"` + // r defines the signature value + R []byte `protobuf:"bytes,11,opt,name=r,proto3" json:"r,omitempty"` + // s define the signature value + S []byte `protobuf:"bytes,12,opt,name=s,proto3" json:"s,omitempty"` +} + +func (m *DynamicFeeTx) Reset() { *m = DynamicFeeTx{} } +func (m *DynamicFeeTx) String() string { return proto.CompactTextString(m) } +func (*DynamicFeeTx) ProtoMessage() {} +func (*DynamicFeeTx) Descriptor() ([]byte, []int) { + return fileDescriptor_f75ac0a12d075f21, []int{3} +} +func (m *DynamicFeeTx) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DynamicFeeTx) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DynamicFeeTx.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 *DynamicFeeTx) XXX_Merge(src proto.Message) { + xxx_messageInfo_DynamicFeeTx.Merge(m, src) +} +func (m *DynamicFeeTx) XXX_Size() int { + return m.Size() +} +func (m *DynamicFeeTx) XXX_DiscardUnknown() { + xxx_messageInfo_DynamicFeeTx.DiscardUnknown(m) +} + +var xxx_messageInfo_DynamicFeeTx proto.InternalMessageInfo + +// ExtensionOptionsEthereumTx is an extension option for ethereum transactions +type ExtensionOptionsEthereumTx struct { +} + +func (m *ExtensionOptionsEthereumTx) Reset() { *m = ExtensionOptionsEthereumTx{} } +func (m *ExtensionOptionsEthereumTx) String() string { return proto.CompactTextString(m) } +func (*ExtensionOptionsEthereumTx) ProtoMessage() {} +func (*ExtensionOptionsEthereumTx) Descriptor() ([]byte, []int) { + return fileDescriptor_f75ac0a12d075f21, []int{4} +} +func (m *ExtensionOptionsEthereumTx) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ExtensionOptionsEthereumTx) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ExtensionOptionsEthereumTx.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 *ExtensionOptionsEthereumTx) XXX_Merge(src proto.Message) { + xxx_messageInfo_ExtensionOptionsEthereumTx.Merge(m, src) +} +func (m *ExtensionOptionsEthereumTx) XXX_Size() int { + return m.Size() +} +func (m *ExtensionOptionsEthereumTx) XXX_DiscardUnknown() { + xxx_messageInfo_ExtensionOptionsEthereumTx.DiscardUnknown(m) +} + +var xxx_messageInfo_ExtensionOptionsEthereumTx proto.InternalMessageInfo + +// MsgEthereumTxResponse defines the Msg/EthereumTx response type. +type MsgEthereumTxResponse struct { + // hash of the ethereum transaction in hex format. This hash differs from the + // Tendermint sha256 hash of the transaction bytes. See + // https://github.com/tendermint/tendermint/issues/6539 for reference + Hash string `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"` + // logs contains the transaction hash and the proto-compatible ethereum + // logs. + Logs []*Log `protobuf:"bytes,2,rep,name=logs,proto3" json:"logs,omitempty"` + // ret is the returned data from evm function (result or data supplied with revert + // opcode) + Ret []byte `protobuf:"bytes,3,opt,name=ret,proto3" json:"ret,omitempty"` + // vm_error is the error returned by vm execution + VmError string `protobuf:"bytes,4,opt,name=vm_error,json=vmError,proto3" json:"vm_error,omitempty"` + // gas_used specifies how much gas was consumed by the transaction + GasUsed uint64 `protobuf:"varint,5,opt,name=gas_used,json=gasUsed,proto3" json:"gas_used,omitempty"` +} + +func (m *MsgEthereumTxResponse) Reset() { *m = MsgEthereumTxResponse{} } +func (m *MsgEthereumTxResponse) String() string { return proto.CompactTextString(m) } +func (*MsgEthereumTxResponse) ProtoMessage() {} +func (*MsgEthereumTxResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_f75ac0a12d075f21, []int{5} +} +func (m *MsgEthereumTxResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgEthereumTxResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgEthereumTxResponse.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 *MsgEthereumTxResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgEthereumTxResponse.Merge(m, src) +} +func (m *MsgEthereumTxResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgEthereumTxResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgEthereumTxResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgEthereumTxResponse proto.InternalMessageInfo + +// MsgUpdateParams defines a Msg for updating the x/evm module parameters. +type MsgUpdateParams struct { + // authority is the address of the governance account. + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // params defines the x/evm parameters to update. + // NOTE: All parameters must be supplied. + Params Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params"` +} + +func (m *MsgUpdateParams) Reset() { *m = MsgUpdateParams{} } +func (m *MsgUpdateParams) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParams) ProtoMessage() {} +func (*MsgUpdateParams) Descriptor() ([]byte, []int) { + return fileDescriptor_f75ac0a12d075f21, []int{6} +} +func (m *MsgUpdateParams) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateParams.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUpdateParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParams.Merge(m, src) +} +func (m *MsgUpdateParams) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateParams) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParams.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateParams proto.InternalMessageInfo + +func (m *MsgUpdateParams) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" +} + +func (m *MsgUpdateParams) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +type MsgUpdateParamsResponse struct { +} + +func (m *MsgUpdateParamsResponse) Reset() { *m = MsgUpdateParamsResponse{} } +func (m *MsgUpdateParamsResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParamsResponse) ProtoMessage() {} +func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_f75ac0a12d075f21, []int{7} +} +func (m *MsgUpdateParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateParamsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUpdateParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParamsResponse.Merge(m, src) +} +func (m *MsgUpdateParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo + +func init() { + // NOTE: Proto type registration is enabled here for the EVM module. + // Since the node application uses a local replace (github.com/cosmos/evm => ../evm), + // both the node and EVM will use these same proto registrations. + // + // To avoid duplicate registration errors, ensure that node/types/legacy/ethermint/evm/tx.pb.go + // has proto registration DISABLED (commented out). + + proto.RegisterType((*MsgEthereumTx)(nil), "ethermint.evm.v1.MsgEthereumTx") + proto.RegisterType((*LegacyTx)(nil), "ethermint.evm.v1.LegacyTx") + proto.RegisterType((*AccessListTx)(nil), "ethermint.evm.v1.AccessListTx") + proto.RegisterType((*DynamicFeeTx)(nil), "ethermint.evm.v1.DynamicFeeTx") + proto.RegisterType((*ExtensionOptionsEthereumTx)(nil), "ethermint.evm.v1.ExtensionOptionsEthereumTx") + proto.RegisterType((*MsgEthereumTxResponse)(nil), "ethermint.evm.v1.MsgEthereumTxResponse") + proto.RegisterType((*MsgUpdateParams)(nil), "ethermint.evm.v1.MsgUpdateParams") + proto.RegisterType((*MsgUpdateParamsResponse)(nil), "ethermint.evm.v1.MsgUpdateParamsResponse") +} + +//func init() { proto.RegisterFile("ethermint/evm/v1/tx.proto", fileDescriptor_f75ac0a12d075f21) } + +var fileDescriptor_f75ac0a12d075f21 = []byte{ + // 1038 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x96, 0x4f, 0x6f, 0xe3, 0xc4, + 0x1b, 0xc7, 0xeb, 0xc4, 0xf9, 0x37, 0xc9, 0xef, 0x47, 0xb1, 0x5a, 0xea, 0x64, 0x21, 0xce, 0x1a, + 0x16, 0xd2, 0x4a, 0xb5, 0xd9, 0x22, 0x21, 0x6d, 0xb8, 0xd0, 0x6c, 0xbb, 0x68, 0x51, 0x2b, 0x56, + 0x26, 0x7b, 0x41, 0x48, 0x61, 0xea, 0x4c, 0x9d, 0x11, 0xb1, 0xc7, 0xf2, 0x4c, 0xac, 0x84, 0x13, + 0xda, 0x13, 0xe2, 0x84, 0xc4, 0x95, 0x03, 0x07, 0x0e, 0x2b, 0x4e, 0x3d, 0x2c, 0xbc, 0x86, 0x15, + 0xa7, 0x15, 0x5c, 0x10, 0x87, 0x80, 0x52, 0x50, 0xa5, 0x1e, 0x79, 0x05, 0x68, 0x66, 0x9c, 0x26, + 0x69, 0x68, 0xbb, 0xac, 0x04, 0x97, 0x6a, 0x9e, 0x79, 0xfe, 0xcc, 0x93, 0xcf, 0xf3, 0xed, 0x8c, + 0x41, 0x19, 0xb1, 0x2e, 0x8a, 0x7c, 0x1c, 0x30, 0x1b, 0xc5, 0xbe, 0x1d, 0xdf, 0xb4, 0xd9, 0xc0, + 0x0a, 0x23, 0xc2, 0x88, 0xb6, 0x7c, 0xe6, 0xb2, 0x50, 0xec, 0x5b, 0xf1, 0xcd, 0xca, 0xf3, 0xd0, + 0xc7, 0x01, 0xb1, 0xc5, 0x5f, 0x19, 0x54, 0x59, 0x73, 0x09, 0xf5, 0x09, 0xb5, 0x7d, 0xea, 0xf1, + 0x64, 0x9f, 0x7a, 0x89, 0xa3, 0x2c, 0x1d, 0x6d, 0x61, 0xd9, 0xd2, 0x48, 0x5c, 0x95, 0x85, 0x33, + 0x79, 0x7d, 0xe9, 0x5b, 0xf1, 0x88, 0x47, 0x64, 0x0e, 0x5f, 0x25, 0xbb, 0x2f, 0x7a, 0x84, 0x78, + 0x3d, 0x64, 0xc3, 0x10, 0xdb, 0x30, 0x08, 0x08, 0x83, 0x0c, 0x93, 0x60, 0x52, 0xaf, 0x9c, 0x78, + 0x85, 0x75, 0xd0, 0x3f, 0xb4, 0x61, 0x30, 0x94, 0x2e, 0xf3, 0x3b, 0x05, 0xfc, 0x6f, 0x9f, 0x7a, + 0xbb, 0xfc, 0x40, 0xd4, 0xf7, 0x5b, 0x03, 0xad, 0x0e, 0xd4, 0x0e, 0x64, 0x50, 0x57, 0x6a, 0x4a, + 0xbd, 0xb8, 0xb5, 0x62, 0xc9, 0x5c, 0x6b, 0x92, 0x6b, 0x6d, 0x07, 0x43, 0x47, 0x44, 0x68, 0x55, + 0xa0, 0x52, 0xfc, 0x09, 0xd2, 0x53, 0x35, 0xa5, 0xae, 0x34, 0xc1, 0xe9, 0xc8, 0x50, 0x36, 0x1f, + 0x9e, 0x1c, 0x6d, 0x28, 0x8e, 0xd8, 0xd7, 0x5e, 0x01, 0x6a, 0x17, 0xd2, 0xae, 0x9e, 0xae, 0x29, + 0xf5, 0x42, 0x73, 0xf9, 0xcf, 0x91, 0x91, 0x8b, 0x7a, 0x61, 0xc3, 0xdc, 0x34, 0x93, 0x28, 0xee, + 0xd5, 0x34, 0xa0, 0x1e, 0x46, 0xc4, 0xd7, 0x55, 0x1e, 0xe5, 0x88, 0x75, 0xa3, 0xf6, 0xd9, 0xd7, + 0xc6, 0xd2, 0xe7, 0x27, 0x47, 0x1b, 0x6b, 0x53, 0x12, 0x73, 0x5d, 0x9a, 0x0f, 0x53, 0x20, 0xbf, + 0x87, 0x3c, 0xe8, 0x0e, 0x5b, 0x03, 0x6d, 0x05, 0x64, 0x02, 0x12, 0xb8, 0x48, 0xf4, 0xac, 0x3a, + 0xd2, 0xd0, 0xde, 0x04, 0x05, 0x0f, 0x72, 0xbe, 0xd8, 0x95, 0x3d, 0x16, 0x9a, 0xe5, 0x5f, 0x46, + 0xc6, 0xaa, 0x44, 0x4d, 0x3b, 0x1f, 0x5b, 0x98, 0xd8, 0x3e, 0x64, 0x5d, 0xeb, 0x6e, 0xc0, 0x9c, + 0xbc, 0x07, 0xe9, 0x3d, 0x1e, 0xaa, 0x55, 0x41, 0xda, 0x83, 0x54, 0x74, 0xad, 0x36, 0x4b, 0xe3, + 0x91, 0x91, 0x7f, 0x07, 0xd2, 0x3d, 0xec, 0x63, 0xe6, 0x70, 0x87, 0xf6, 0x7f, 0x90, 0x62, 0x24, + 0x69, 0x37, 0xc5, 0x88, 0x76, 0x0b, 0x64, 0x62, 0xd8, 0xeb, 0x23, 0x3d, 0x23, 0xce, 0x78, 0xf9, + 0xc2, 0x33, 0xc6, 0x23, 0x23, 0xbb, 0xed, 0x93, 0x7e, 0xc0, 0x1c, 0x99, 0xc1, 0x7f, 0xbb, 0x60, + 0x9d, 0xad, 0x29, 0xf5, 0x52, 0x42, 0xb5, 0x04, 0x94, 0x58, 0xcf, 0x89, 0x0d, 0x25, 0xe6, 0x56, + 0xa4, 0xe7, 0xa5, 0x15, 0x71, 0x8b, 0xea, 0x05, 0x69, 0xd1, 0xc6, 0x0d, 0x4e, 0xe9, 0x87, 0x47, + 0x9b, 0xd9, 0xd6, 0x60, 0x07, 0x32, 0xc8, 0x79, 0x69, 0x53, 0x5e, 0x13, 0x3a, 0xe6, 0x28, 0x0d, + 0x4a, 0xdb, 0xae, 0x8b, 0x28, 0xdd, 0xc3, 0x94, 0xb5, 0x06, 0xda, 0xbb, 0x20, 0xef, 0x76, 0x21, + 0x0e, 0xda, 0xb8, 0x23, 0x88, 0x15, 0x9a, 0xf6, 0x65, 0x3d, 0xe7, 0x6e, 0xf3, 0xe0, 0xbb, 0x3b, + 0xa7, 0x23, 0x23, 0xe7, 0xca, 0xa5, 0x93, 0x2c, 0x3a, 0x53, 0xf4, 0xa9, 0x0b, 0xd1, 0xa7, 0xff, + 0x31, 0x7a, 0xf5, 0x72, 0xf4, 0x99, 0x45, 0xf4, 0xd9, 0x67, 0x46, 0x9f, 0x9b, 0x41, 0xff, 0x11, + 0xc8, 0x43, 0x01, 0x0a, 0x51, 0x3d, 0x5f, 0x4b, 0xd7, 0x8b, 0x5b, 0x2f, 0x59, 0xe7, 0xff, 0xc7, + 0x2d, 0x89, 0xb2, 0xd5, 0x0f, 0x7b, 0xa8, 0x79, 0xe3, 0xf1, 0xc8, 0x58, 0x3a, 0x1d, 0x19, 0x00, + 0x9e, 0xf1, 0xfd, 0xf6, 0x57, 0x03, 0x4c, 0x69, 0x4b, 0xa1, 0x9f, 0x55, 0x95, 0xc3, 0x2d, 0xcc, + 0x0d, 0x17, 0xcc, 0x0d, 0xb7, 0x38, 0x19, 0xee, 0xfa, 0xe2, 0x70, 0x5f, 0x98, 0x0e, 0x77, 0x76, + 0x9e, 0xe6, 0x57, 0x2a, 0x28, 0xed, 0x0c, 0x03, 0xe8, 0x63, 0xf7, 0x0e, 0x42, 0xff, 0xc9, 0x80, + 0x6f, 0x81, 0x22, 0x1f, 0x30, 0xc3, 0x61, 0xdb, 0x85, 0xe1, 0xd5, 0x23, 0xe6, 0x72, 0x68, 0xe1, + 0xf0, 0x36, 0x0c, 0x27, 0xa9, 0x87, 0x08, 0x89, 0x54, 0xf5, 0x69, 0x52, 0xef, 0x20, 0xc4, 0x53, + 0x13, 0x79, 0x64, 0x2e, 0x97, 0x47, 0x76, 0x51, 0x1e, 0xb9, 0x67, 0x96, 0x47, 0xfe, 0x02, 0x79, + 0x14, 0xfe, 0x3d, 0x79, 0x80, 0x39, 0x79, 0x14, 0xe7, 0xe4, 0x51, 0x7a, 0x3a, 0x79, 0xcc, 0xaa, + 0xc1, 0x34, 0x41, 0x65, 0x77, 0xc0, 0x50, 0x40, 0x31, 0x09, 0xde, 0x0b, 0xc5, 0xbb, 0x30, 0xbd, + 0x48, 0x1b, 0x2a, 0x2f, 0x64, 0x7e, 0xa3, 0x80, 0xd5, 0xb9, 0x0b, 0xd6, 0x41, 0x34, 0x24, 0x01, + 0x15, 0x20, 0xc4, 0x25, 0xae, 0xc8, 0xeb, 0x59, 0x5c, 0xd9, 0xeb, 0x40, 0xed, 0x11, 0x8f, 0xea, + 0x29, 0x01, 0x61, 0x75, 0x11, 0xc2, 0x1e, 0xf1, 0x1c, 0x11, 0xa2, 0x2d, 0x83, 0x74, 0x84, 0x98, + 0x10, 0x48, 0xc9, 0xe1, 0x4b, 0xad, 0x0c, 0xf2, 0xb1, 0xdf, 0x46, 0x51, 0x44, 0xa2, 0xe4, 0x12, + 0xcd, 0xc5, 0xfe, 0x2e, 0x37, 0xb9, 0x8b, 0x4b, 0xa3, 0x4f, 0x51, 0x47, 0x0e, 0xd9, 0xc9, 0x79, + 0x90, 0xde, 0xa7, 0xa8, 0x93, 0xb4, 0xf9, 0xbd, 0x02, 0x9e, 0xdb, 0xa7, 0xde, 0xfd, 0xb0, 0x03, + 0x19, 0xba, 0x07, 0x23, 0xe8, 0x53, 0x7e, 0xd7, 0xc0, 0x3e, 0xeb, 0x92, 0x08, 0xb3, 0x61, 0xa2, + 0x76, 0xfd, 0xc7, 0x47, 0x9b, 0x2b, 0xc9, 0x8b, 0xba, 0xdd, 0xe9, 0x44, 0x88, 0xd2, 0xf7, 0x59, + 0x84, 0x03, 0xcf, 0x99, 0x86, 0x6a, 0x6f, 0x81, 0x6c, 0x28, 0x2a, 0x08, 0x65, 0x17, 0xb7, 0xf4, + 0xc5, 0x9f, 0x21, 0x4f, 0x68, 0x16, 0xf8, 0x18, 0xe5, 0xa8, 0x92, 0x94, 0x86, 0xf5, 0xe0, 0xe4, + 0x68, 0x63, 0x5a, 0x8c, 0xe3, 0xbf, 0x86, 0x62, 0xfe, 0xce, 0x0f, 0xc4, 0x93, 0x7d, 0xae, 0x49, + 0xb3, 0x0c, 0xd6, 0xce, 0x6d, 0x4d, 0x00, 0x6f, 0xfd, 0xa1, 0x80, 0xf4, 0x3e, 0xf5, 0xb4, 0x21, + 0x00, 0x33, 0xaf, 0xb0, 0xb1, 0xd8, 0xcd, 0xdc, 0x7c, 0x2a, 0xaf, 0x5d, 0x11, 0x30, 0xa9, 0x6f, + 0x5e, 0x7f, 0xf0, 0xd3, 0xef, 0x5f, 0xa6, 0xae, 0x99, 0x65, 0x5b, 0x36, 0x38, 0xf9, 0xa2, 0x48, + 0x22, 0xdb, 0x6c, 0xa0, 0x7d, 0x08, 0x4a, 0x73, 0x48, 0xaf, 0xff, 0x6d, 0xed, 0xd9, 0x90, 0xca, + 0xfa, 0x95, 0x21, 0x93, 0x06, 0x2a, 0x99, 0x4f, 0x39, 0xba, 0xe6, 0xdb, 0x8f, 0xc7, 0x55, 0xe5, + 0xc9, 0xb8, 0xaa, 0xfc, 0x36, 0xae, 0x2a, 0x5f, 0x1c, 0x57, 0x97, 0x9e, 0x1c, 0x57, 0x97, 0x7e, + 0x3e, 0xae, 0x2e, 0x7d, 0xf0, 0xaa, 0x87, 0x59, 0xb7, 0x7f, 0x60, 0xb9, 0xc4, 0x9f, 0xf6, 0x48, + 0xa8, 0x1d, 0x6f, 0xbd, 0x9e, 0xe0, 0x64, 0xc3, 0x10, 0xd1, 0x83, 0xac, 0xf8, 0x06, 0x79, 0xe3, + 0xaf, 0x00, 0x00, 0x00, 0xff, 0xff, 0xe7, 0x94, 0x7d, 0xc7, 0x93, 0x09, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// MsgClient is the client API for Msg service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type MsgClient interface { + // EthereumTx defines a method submitting Ethereum transactions. + EthereumTx(ctx context.Context, in *MsgEthereumTx, opts ...grpc.CallOption) (*MsgEthereumTxResponse, error) + // UpdateParams defined a governance operation for updating the x/evm module parameters. + // The authority is hard-coded to the Cosmos SDK x/gov module account + UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) +} + +type msgClient struct { + cc grpc1.ClientConn +} + +func NewMsgClient(cc grpc1.ClientConn) MsgClient { + return &msgClient{cc} +} + +func (c *msgClient) EthereumTx(ctx context.Context, in *MsgEthereumTx, opts ...grpc.CallOption) (*MsgEthereumTxResponse, error) { + out := new(MsgEthereumTxResponse) + err := c.cc.Invoke(ctx, "/ethermint.evm.v1.Msg/EthereumTx", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) { + out := new(MsgUpdateParamsResponse) + err := c.cc.Invoke(ctx, "/ethermint.evm.v1.Msg/UpdateParams", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// MsgServer is the server API for Msg service. +type MsgServer interface { + // EthereumTx defines a method submitting Ethereum transactions. + EthereumTx(context.Context, *MsgEthereumTx) (*MsgEthereumTxResponse, error) + // UpdateParams defined a governance operation for updating the x/evm module parameters. + // The authority is hard-coded to the Cosmos SDK x/gov module account + UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) +} + +// UnimplementedMsgServer can be embedded to have forward compatible implementations. +type UnimplementedMsgServer struct { +} + +func (*UnimplementedMsgServer) EthereumTx(ctx context.Context, req *MsgEthereumTx) (*MsgEthereumTxResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method EthereumTx not implemented") +} +func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") +} + +func RegisterMsgServer(s grpc1.Server, srv MsgServer) { + s.RegisterService(&_Msg_serviceDesc, srv) +} + +func _Msg_EthereumTx_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgEthereumTx) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).EthereumTx(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/ethermint.evm.v1.Msg/EthereumTx", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).EthereumTx(ctx, req.(*MsgEthereumTx)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateParams) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdateParams(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/ethermint.evm.v1.Msg/UpdateParams", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateParams(ctx, req.(*MsgUpdateParams)) + } + return interceptor(ctx, in, info, handler) +} + +var _Msg_serviceDesc = grpc.ServiceDesc{ + ServiceName: "ethermint.evm.v1.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "EthereumTx", + Handler: _Msg_EthereumTx_Handler, + }, + { + MethodName: "UpdateParams", + Handler: _Msg_UpdateParams_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "ethermint/evm/v1/tx.proto", +} + +func (m *MsgEthereumTx) 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 *MsgEthereumTx) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgEthereumTx) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.From) > 0 { + i -= len(m.From) + copy(dAtA[i:], m.From) + i = encodeVarintTx(dAtA, i, uint64(len(m.From))) + i-- + dAtA[i] = 0x22 + } + if len(m.Hash) > 0 { + i -= len(m.Hash) + copy(dAtA[i:], m.Hash) + i = encodeVarintTx(dAtA, i, uint64(len(m.Hash))) + i-- + dAtA[i] = 0x1a + } + if m.Size_ != 0 { + i -= 8 + encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(m.Size_)))) + i-- + dAtA[i] = 0x11 + } + if m.Data != nil { + { + size, err := m.Data.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *LegacyTx) 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 *LegacyTx) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *LegacyTx) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.S) > 0 { + i -= len(m.S) + copy(dAtA[i:], m.S) + i = encodeVarintTx(dAtA, i, uint64(len(m.S))) + i-- + dAtA[i] = 0x4a + } + if len(m.R) > 0 { + i -= len(m.R) + copy(dAtA[i:], m.R) + i = encodeVarintTx(dAtA, i, uint64(len(m.R))) + i-- + dAtA[i] = 0x42 + } + if len(m.V) > 0 { + i -= len(m.V) + copy(dAtA[i:], m.V) + i = encodeVarintTx(dAtA, i, uint64(len(m.V))) + i-- + dAtA[i] = 0x3a + } + if len(m.Data) > 0 { + i -= len(m.Data) + copy(dAtA[i:], m.Data) + i = encodeVarintTx(dAtA, i, uint64(len(m.Data))) + i-- + dAtA[i] = 0x32 + } + if m.Amount != nil { + { + 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] = 0x2a + } + 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] = 0x22 + } + if m.GasLimit != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.GasLimit)) + i-- + dAtA[i] = 0x18 + } + if m.GasPrice != nil { + { + size := m.GasPrice.Size() + i -= size + if _, err := m.GasPrice.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.Nonce != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.Nonce)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *AccessListTx) 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 *AccessListTx) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AccessListTx) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.S) > 0 { + i -= len(m.S) + copy(dAtA[i:], m.S) + i = encodeVarintTx(dAtA, i, uint64(len(m.S))) + i-- + dAtA[i] = 0x5a + } + if len(m.R) > 0 { + i -= len(m.R) + copy(dAtA[i:], m.R) + i = encodeVarintTx(dAtA, i, uint64(len(m.R))) + i-- + dAtA[i] = 0x52 + } + if len(m.V) > 0 { + i -= len(m.V) + copy(dAtA[i:], m.V) + i = encodeVarintTx(dAtA, i, uint64(len(m.V))) + i-- + dAtA[i] = 0x4a + } + if len(m.Accesses) > 0 { + for iNdEx := len(m.Accesses) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Accesses[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x42 + } + } + if len(m.Data) > 0 { + i -= len(m.Data) + copy(dAtA[i:], m.Data) + i = encodeVarintTx(dAtA, i, uint64(len(m.Data))) + i-- + dAtA[i] = 0x3a + } + if m.Amount != nil { + { + 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] = 0x32 + } + 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] = 0x2a + } + if m.GasLimit != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.GasLimit)) + i-- + dAtA[i] = 0x20 + } + if m.GasPrice != nil { + { + size := m.GasPrice.Size() + i -= size + if _, err := m.GasPrice.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if m.Nonce != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.Nonce)) + i-- + dAtA[i] = 0x10 + } + if m.ChainID != nil { + { + size := m.ChainID.Size() + i -= size + if _, err := m.ChainID.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *DynamicFeeTx) 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 *DynamicFeeTx) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DynamicFeeTx) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.S) > 0 { + i -= len(m.S) + copy(dAtA[i:], m.S) + i = encodeVarintTx(dAtA, i, uint64(len(m.S))) + i-- + dAtA[i] = 0x62 + } + if len(m.R) > 0 { + i -= len(m.R) + copy(dAtA[i:], m.R) + i = encodeVarintTx(dAtA, i, uint64(len(m.R))) + i-- + dAtA[i] = 0x5a + } + if len(m.V) > 0 { + i -= len(m.V) + copy(dAtA[i:], m.V) + i = encodeVarintTx(dAtA, i, uint64(len(m.V))) + i-- + dAtA[i] = 0x52 + } + if len(m.Accesses) > 0 { + for iNdEx := len(m.Accesses) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Accesses[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x4a + } + } + if len(m.Data) > 0 { + i -= len(m.Data) + copy(dAtA[i:], m.Data) + i = encodeVarintTx(dAtA, i, uint64(len(m.Data))) + i-- + dAtA[i] = 0x42 + } + if m.Amount != nil { + { + 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] = 0x3a + } + 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] = 0x32 + } + if m.GasLimit != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.GasLimit)) + i-- + dAtA[i] = 0x28 + } + if m.GasFeeCap != nil { + { + size := m.GasFeeCap.Size() + i -= size + if _, err := m.GasFeeCap.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + if m.GasTipCap != nil { + { + size := m.GasTipCap.Size() + i -= size + if _, err := m.GasTipCap.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if m.Nonce != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.Nonce)) + i-- + dAtA[i] = 0x10 + } + if m.ChainID != nil { + { + size := m.ChainID.Size() + i -= size + if _, err := m.ChainID.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *ExtensionOptionsEthereumTx) 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 *ExtensionOptionsEthereumTx) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ExtensionOptionsEthereumTx) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgEthereumTxResponse) 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 *MsgEthereumTxResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgEthereumTxResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.GasUsed != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.GasUsed)) + i-- + dAtA[i] = 0x28 + } + if len(m.VmError) > 0 { + i -= len(m.VmError) + copy(dAtA[i:], m.VmError) + i = encodeVarintTx(dAtA, i, uint64(len(m.VmError))) + i-- + dAtA[i] = 0x22 + } + if len(m.Ret) > 0 { + i -= len(m.Ret) + copy(dAtA[i:], m.Ret) + i = encodeVarintTx(dAtA, i, uint64(len(m.Ret))) + i-- + dAtA[i] = 0x1a + } + if len(m.Logs) > 0 { + for iNdEx := len(m.Logs) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Logs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if len(m.Hash) > 0 { + i -= len(m.Hash) + copy(dAtA[i:], m.Hash) + i = encodeVarintTx(dAtA, i, uint64(len(m.Hash))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUpdateParams) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUpdateParams) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUpdateParamsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUpdateParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func encodeVarintTx(dAtA []byte, offset int, v uint64) int { + offset -= sovTx(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *MsgEthereumTx) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Data != nil { + l = m.Data.Size() + n += 1 + l + sovTx(uint64(l)) + } + if m.Size_ != 0 { + n += 9 + } + l = len(m.Hash) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.From) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *LegacyTx) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Nonce != 0 { + n += 1 + sovTx(uint64(m.Nonce)) + } + if m.GasPrice != nil { + l = m.GasPrice.Size() + n += 1 + l + sovTx(uint64(l)) + } + if m.GasLimit != 0 { + n += 1 + sovTx(uint64(m.GasLimit)) + } + l = len(m.To) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.Amount != nil { + l = m.Amount.Size() + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Data) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.V) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.R) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.S) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *AccessListTx) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ChainID != nil { + l = m.ChainID.Size() + n += 1 + l + sovTx(uint64(l)) + } + if m.Nonce != 0 { + n += 1 + sovTx(uint64(m.Nonce)) + } + if m.GasPrice != nil { + l = m.GasPrice.Size() + n += 1 + l + sovTx(uint64(l)) + } + if m.GasLimit != 0 { + n += 1 + sovTx(uint64(m.GasLimit)) + } + l = len(m.To) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.Amount != nil { + l = m.Amount.Size() + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Data) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if len(m.Accesses) > 0 { + for _, e := range m.Accesses { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } + l = len(m.V) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.R) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.S) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *DynamicFeeTx) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ChainID != nil { + l = m.ChainID.Size() + n += 1 + l + sovTx(uint64(l)) + } + if m.Nonce != 0 { + n += 1 + sovTx(uint64(m.Nonce)) + } + if m.GasTipCap != nil { + l = m.GasTipCap.Size() + n += 1 + l + sovTx(uint64(l)) + } + if m.GasFeeCap != nil { + l = m.GasFeeCap.Size() + n += 1 + l + sovTx(uint64(l)) + } + if m.GasLimit != 0 { + n += 1 + sovTx(uint64(m.GasLimit)) + } + l = len(m.To) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.Amount != nil { + l = m.Amount.Size() + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Data) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if len(m.Accesses) > 0 { + for _, e := range m.Accesses { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } + l = len(m.V) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.R) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.S) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *ExtensionOptionsEthereumTx) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgEthereumTxResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Hash) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if len(m.Logs) > 0 { + for _, e := range m.Logs { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } + l = len(m.Ret) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.VmError) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.GasUsed != 0 { + n += 1 + sovTx(uint64(m.GasUsed)) + } + return n +} + +func (m *MsgUpdateParams) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Params.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgUpdateParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func 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 *MsgEthereumTx) 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: MsgEthereumTx: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgEthereumTx: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Data == nil { + m.Data = &types.Any{} + } + if err := m.Data.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 1 { + return fmt.Errorf("proto: wrong wireType = %d for field Size_", wireType) + } + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(encoding_binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.Size_ = float64(math.Float64frombits(v)) + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Hash", 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.Hash = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field From", 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.From = 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 *LegacyTx) 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: LegacyTx: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: LegacyTx: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Nonce", wireType) + } + m.Nonce = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Nonce |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field GasPrice", 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 + } + var v cosmossdk_io_math.Int + m.GasPrice = &v + if err := m.GasPrice.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field GasLimit", wireType) + } + m.GasLimit = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.GasLimit |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + 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 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", 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 + } + var v cosmossdk_io_math.Int + m.Amount = &v + if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) + if m.Data == nil { + m.Data = []byte{} + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field V", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.V = append(m.V[:0], dAtA[iNdEx:postIndex]...) + if m.V == nil { + m.V = []byte{} + } + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field R", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.R = append(m.R[:0], dAtA[iNdEx:postIndex]...) + if m.R == nil { + m.R = []byte{} + } + iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field S", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.S = append(m.S[:0], dAtA[iNdEx:postIndex]...) + if m.S == nil { + m.S = []byte{} + } + 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 *AccessListTx) 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: AccessListTx: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AccessListTx: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ChainID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 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 + } + var v cosmossdk_io_math.Int + m.ChainID = &v + if err := m.ChainID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Nonce", wireType) + } + m.Nonce = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Nonce |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field GasPrice", 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 + } + var v cosmossdk_io_math.Int + m.GasPrice = &v + if err := m.GasPrice.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field GasLimit", wireType) + } + m.GasLimit = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.GasLimit |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + 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 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", 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 + } + var v cosmossdk_io_math.Int + m.Amount = &v + if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) + if m.Data == nil { + m.Data = []byte{} + } + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Accesses", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Accesses = append(m.Accesses, AccessTuple{}) + if err := m.Accesses[len(m.Accesses)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field V", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.V = append(m.V[:0], dAtA[iNdEx:postIndex]...) + if m.V == nil { + m.V = []byte{} + } + iNdEx = postIndex + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field R", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.R = append(m.R[:0], dAtA[iNdEx:postIndex]...) + if m.R == nil { + m.R = []byte{} + } + iNdEx = postIndex + case 11: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field S", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.S = append(m.S[:0], dAtA[iNdEx:postIndex]...) + if m.S == nil { + m.S = []byte{} + } + 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 *DynamicFeeTx) 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: DynamicFeeTx: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DynamicFeeTx: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ChainID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 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 + } + var v cosmossdk_io_math.Int + m.ChainID = &v + if err := m.ChainID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Nonce", wireType) + } + m.Nonce = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Nonce |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field GasTipCap", 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 + } + var v cosmossdk_io_math.Int + m.GasTipCap = &v + if err := m.GasTipCap.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field GasFeeCap", 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 + } + var v cosmossdk_io_math.Int + m.GasFeeCap = &v + if err := m.GasFeeCap.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field GasLimit", wireType) + } + m.GasLimit = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.GasLimit |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + 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 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", 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 + } + var v cosmossdk_io_math.Int + m.Amount = &v + if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) + if m.Data == nil { + m.Data = []byte{} + } + iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Accesses", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Accesses = append(m.Accesses, AccessTuple{}) + if err := m.Accesses[len(m.Accesses)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field V", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.V = append(m.V[:0], dAtA[iNdEx:postIndex]...) + if m.V == nil { + m.V = []byte{} + } + iNdEx = postIndex + case 11: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field R", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.R = append(m.R[:0], dAtA[iNdEx:postIndex]...) + if m.R == nil { + m.R = []byte{} + } + iNdEx = postIndex + case 12: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field S", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.S = append(m.S[:0], dAtA[iNdEx:postIndex]...) + if m.S == nil { + m.S = []byte{} + } + 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 *ExtensionOptionsEthereumTx) 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: ExtensionOptionsEthereumTx: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ExtensionOptionsEthereumTx: 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 *MsgEthereumTxResponse) 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: MsgEthereumTxResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgEthereumTxResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Hash", 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.Hash = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Logs", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Logs = append(m.Logs, &Log{}) + if err := m.Logs[len(m.Logs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Ret", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Ret = append(m.Ret[:0], dAtA[iNdEx:postIndex]...) + if m.Ret == nil { + m.Ret = []byte{} + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VmError", 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.VmError = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field GasUsed", wireType) + } + m.GasUsed = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.GasUsed |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *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 skipTx(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthTx + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTx + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTx + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTx = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTx = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group") +) diff --git a/rpc/types/legacy/tx_data.go b/rpc/types/legacy/tx_data.go new file mode 100644 index 000000000..81ad1e521 --- /dev/null +++ b/rpc/types/legacy/tx_data.go @@ -0,0 +1,80 @@ +// Copyright Tharsis Labs Ltd.(Evmos) +// SPDX-License-Identifier:ENCL-1.0(https://github.com/evmos/evmos/blob/main/LICENSE) +package types + +import ( + "math/big" + + "github.com/ethereum/go-ethereum/common" + ethtypes "github.com/ethereum/go-ethereum/core/types" +) + +var ( + _ TxData = &LegacyTx{} + _ TxData = &AccessListTx{} + _ TxData = &DynamicFeeTx{} +) + +// TxData implements the Ethereum transaction tx structure. It is used +// solely as intended in Ethereum abiding by the protocol. +type TxData interface { + TxType() byte + Copy() TxData + GetChainID() *big.Int + GetAccessList() ethtypes.AccessList + GetData() []byte + GetNonce() uint64 + GetGas() uint64 + GetGasPrice() *big.Int + GetGasTipCap() *big.Int + GetGasFeeCap() *big.Int + GetValue() *big.Int + GetTo() *common.Address + + GetRawSignatureValues() (v, r, s *big.Int) + SetSignatureValues(chainID, v, r, s *big.Int) + + AsEthereumData() ethtypes.TxData + Validate() error + + // static fee + Fee() *big.Int + Cost() *big.Int + + // effective gasPrice/fee/cost according to current base fee + EffectiveGasPrice(baseFee *big.Int) *big.Int + EffectiveFee(baseFee *big.Int) *big.Int + EffectiveCost(baseFee *big.Int) *big.Int +} + +// NOTE: All non-protected transactions (i.e non EIP155 signed) will fail if the +// AllowUnprotectedTxs parameter is disabled. +func NewTxDataFromTx(tx *ethtypes.Transaction) (TxData, error) { + var txData TxData + var err error + switch tx.Type() { + case ethtypes.DynamicFeeTxType: + txData, err = NewDynamicFeeTx(tx) + case ethtypes.AccessListTxType: + txData, err = newAccessListTx(tx) + default: + txData, err = NewLegacyTx(tx) + } + if err != nil { + return nil, err + } + + return txData, nil +} + +func fee(gasPrice *big.Int, gas uint64) *big.Int { + gasLimit := new(big.Int).SetUint64(gas) + return new(big.Int).Mul(gasPrice, gasLimit) +} + +func cost(fee, value *big.Int) *big.Int { + if value != nil { + return new(big.Int).Add(fee, value) + } + return fee +} diff --git a/rpc/types/legacy/utils.go b/rpc/types/legacy/utils.go new file mode 100644 index 000000000..196758cdf --- /dev/null +++ b/rpc/types/legacy/utils.go @@ -0,0 +1,84 @@ +// Copyright Tharsis Labs Ltd.(Evmos) +// SPDX-License-Identifier:ENCL-1.0(https://github.com/evmos/evmos/blob/main/LICENSE) +package types + +import ( + "fmt" + "math/big" + + sdkmath "cosmossdk.io/math" +) + +const maxBitLen = 256 + +// SafeNewIntFromBigInt constructs Int from big.Int, return error if more than 256bits +func SafeNewIntFromBigInt(i *big.Int) (sdkmath.Int, error) { + if !IsValidInt256(i) { + return sdkmath.NewInt(0), fmt.Errorf("big int out of bound: %s", i) + } + return sdkmath.NewIntFromBigInt(i), nil +} + +// IsValidInt256 check the bound of 256 bit number +func IsValidInt256(i *big.Int) bool { + return i == nil || i.BitLen() <= maxBitLen +} + +// DeriveChainID derives the chain id from the given v parameter. +// +// CONTRACT: v value is either: +// +// - {0,1} + CHAIN_ID * 2 + 35, if EIP155 is used +// - {0,1} + 27, otherwise +// +// Ref: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-155.md +func DeriveChainID(v *big.Int) *big.Int { + if v == nil || v.Sign() < 1 { + return nil + } + + if v.BitLen() <= 64 { + v := v.Uint64() + if v == 27 || v == 28 { + return new(big.Int) + } + + if v < 35 { + return nil + } + + // V MUST be of the form {0,1} + CHAIN_ID * 2 + 35 + return new(big.Int).SetUint64((v - 35) / 2) + } + v = new(big.Int).Sub(v, big.NewInt(35)) + return v.Div(v, big.NewInt(2)) +} + +// RawSignatureValues is a helper function +// that parses the v,r and s fields of an Ethereum transaction +func RawSignatureValues(vBz, rBz, sBz []byte) (v, r, s *big.Int) { + if len(vBz) > 0 { + v = new(big.Int).SetBytes(vBz) + } + if len(rBz) > 0 { + r = new(big.Int).SetBytes(rBz) + } + if len(sBz) > 0 { + s = new(big.Int).SetBytes(sBz) + } + return v, r, s +} + +// EffectiveGasPrice computes the effective gas price based on eip-1559 rules +// `effectiveGasPrice = min(baseFee + tipCap, feeCap)` +func EffectiveGasPrice(baseFee, feeCap, tipCap *big.Int) *big.Int { + return bigMin(new(big.Int).Add(tipCap, baseFee), feeCap) +} + +// bigMin returns the smaller of a and b +func bigMin(a, b *big.Int) *big.Int { + if a.Cmp(b) < 0 { + return a + } + return b +} diff --git a/rpc/types/legacy/validation.go b/rpc/types/legacy/validation.go new file mode 100644 index 000000000..d25214767 --- /dev/null +++ b/rpc/types/legacy/validation.go @@ -0,0 +1,22 @@ +// Copyright Tharsis Labs Ltd.(Evmos) +// SPDX-License-Identifier:ENCL-1.0(https://github.com/evmos/evmos/blob/main/LICENSE) +package types + +import ( + "github.com/ethereum/go-ethereum/common" + + errorsmod "cosmossdk.io/errors" + + errortypes "github.com/cosmos/cosmos-sdk/types/errors" +) + +// ValidateAddress returns an error if the provided string is either not a hex formatted string address +func ValidateAddress(address string) error { + if !common.IsHexAddress(address) { + return errorsmod.Wrapf( + errortypes.ErrInvalidAddress, "address '%s' is not a valid ethereum hex address", + address, + ) + } + return nil +} From 16a9990722c91a9239b470e7c486eee93f0d4b54 Mon Sep 17 00:00:00 2001 From: AdriaCarrera Date: Thu, 19 Feb 2026 10:42:48 +0100 Subject: [PATCH 05/10] fix: OwnershipTransferred event type --- precompiles/erc20/events.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/precompiles/erc20/events.go b/precompiles/erc20/events.go index a4ab52bf7..c08623380 100644 --- a/precompiles/erc20/events.go +++ b/precompiles/erc20/events.go @@ -21,7 +21,7 @@ const ( EventTypeApproval = "Approval" // EventTypeTransferOwnership defines the event type for the ERC-20 transferOwnership transaction. - EventTypeTransferOwnership = "TransferOwnership" + EventTypeTransferOwnership = "OwnershipTransferred" ) // EmitTransferEvent creates a new Transfer event emitted on transfer and transferFrom transactions. From 60cb063fe5bfcb0ecd5a2c40e7c47522e9aa96eb Mon Sep 17 00:00:00 2001 From: GuillemGarciaDev Date: Thu, 19 Feb 2026 12:22:48 +0100 Subject: [PATCH 06/10] fix: ethermint types on crypto/ethsecp256k1 --- crypto/ethsecp256k1/keys.pb.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crypto/ethsecp256k1/keys.pb.go b/crypto/ethsecp256k1/keys.pb.go index 90f1bbd22..be92d2a6e 100644 --- a/crypto/ethsecp256k1/keys.pb.go +++ b/crypto/ethsecp256k1/keys.pb.go @@ -118,12 +118,12 @@ 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_3033ac433209de5f) } var fileDescriptor_3033ac433209de5f = []byte{ From f77f97b858a96bb8df259a4e47580b1f04e6e23c Mon Sep 17 00:00:00 2001 From: GuillemGarciaDev Date: Thu, 19 Feb 2026 12:27:41 +0100 Subject: [PATCH 07/10] fix: add missing proto --- .../crypto/v1/ethsecp256k1/keys.proto | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 proto/ethermint/crypto/v1/ethsecp256k1/keys.proto diff --git a/proto/ethermint/crypto/v1/ethsecp256k1/keys.proto b/proto/ethermint/crypto/v1/ethsecp256k1/keys.proto new file mode 100644 index 000000000..4a061fb75 --- /dev/null +++ b/proto/ethermint/crypto/v1/ethsecp256k1/keys.proto @@ -0,0 +1,24 @@ + +syntax = "proto3"; +package ethermint.crypto.v1.ethsecp256k1; + +import "gogoproto/gogo.proto"; + +option go_package = "github.com/cosmos/evm/crypto/ethsecp256k1"; + +// PubKey defines a type alias for an ecdsa.PublicKey that implements +// CometBFT's PubKey interface. It represents the 33-byte compressed public +// key format. +message PubKey { + option (gogoproto.goproto_stringer) = false; + + // key is the public key in byte form + bytes key = 1; +} + +// PrivKey defines a type alias for an ecdsa.PrivateKey that implements +// CometBFT's PrivateKey interface. +message PrivKey { + // key is the private key in byte form + bytes key = 1; +} From 05949ffcac43952d60236ae73c07220aeaa4a87f Mon Sep 17 00:00:00 2001 From: AdriaCarrera Date: Thu, 19 Feb 2026 12:36:10 +0100 Subject: [PATCH 08/10] fix: proto-gen --- crypto/ethsecp256k1/keys.pb.go | 38 +++++++++---------- .../evm/crypto/v1/ethsecp256k1/keys.proto | 24 ------------ 2 files changed, 19 insertions(+), 43 deletions(-) delete mode 100644 proto/cosmos/evm/crypto/v1/ethsecp256k1/keys.proto diff --git a/crypto/ethsecp256k1/keys.pb.go b/crypto/ethsecp256k1/keys.pb.go index be92d2a6e..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) @@ -123,24 +123,24 @@ func init() { } func init() { - proto.RegisterFile("ethermint/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/proto/cosmos/evm/crypto/v1/ethsecp256k1/keys.proto b/proto/cosmos/evm/crypto/v1/ethsecp256k1/keys.proto deleted file mode 100644 index 4f1303bc7..000000000 --- a/proto/cosmos/evm/crypto/v1/ethsecp256k1/keys.proto +++ /dev/null @@ -1,24 +0,0 @@ - -syntax = "proto3"; -package cosmos.evm.crypto.v1.ethsecp256k1; - -import "gogoproto/gogo.proto"; - -option go_package = "github.com/cosmos/evm/crypto/ethsecp256k1"; - -// PubKey defines a type alias for an ecdsa.PublicKey that implements -// CometBFT's PubKey interface. It represents the 33-byte compressed public -// key format. -message PubKey { - option (gogoproto.goproto_stringer) = false; - - // key is the public key in byte form - bytes key = 1; -} - -// PrivKey defines a type alias for an ecdsa.PrivateKey that implements -// CometBFT's PrivateKey interface. -message PrivKey { - // key is the private key in byte form - bytes key = 1; -} From 027c24fac033cacdfdf495433e79cbcd4b156bca Mon Sep 17 00:00:00 2001 From: AdriaCarrera Date: Thu, 19 Feb 2026 13:10:24 +0100 Subject: [PATCH 09/10] fix: remove statedb manipulation for native balance changes in mint / burn / burnFrom --- precompiles/erc20/tx.go | 43 ----------------------------------------- 1 file changed, 43 deletions(-) diff --git a/precompiles/erc20/tx.go b/precompiles/erc20/tx.go index c27b6da5c..e634e9fcd 100644 --- a/precompiles/erc20/tx.go +++ b/precompiles/erc20/tx.go @@ -5,12 +5,8 @@ import ( "github.com/ethereum/go-ethereum/accounts/abi" "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/tracing" "github.com/ethereum/go-ethereum/core/vm" - "github.com/cosmos/evm/utils" - evmtypes "github.com/cosmos/evm/x/vm/types" - "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" @@ -169,19 +165,6 @@ func (p *Precompile) Mint( return nil, ConvertErrToERC20Error(err) } - // TODO: Properly handle native balance changes via the balance handler.Expand commentComment on line R188Resolved - // 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 } @@ -290,19 +273,6 @@ func (p *Precompile) BurnFrom( return nil, ConvertErrToERC20Error(err) } - // TODO: Properly handle native balance changes via the balance handler.Expand commentComment on line R309Resolved - // Currently, decimal conversion issues exist with the precisebank module.Expand commentComment on line R310Resolved - // 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 } @@ -359,18 +329,5 @@ func (p *Precompile) burn(ctx sdk.Context, stateDB vm.StateDB, burnerAddr common 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) } From f9cdf28fa149fd353bc703f74cc360f293b4a213 Mon Sep 17 00:00:00 2001 From: AdriaCarrera Date: Mon, 23 Feb 2026 21:12:10 +0100 Subject: [PATCH 10/10] fix: check all EVM coin info fields before returning set errors --- x/vm/types/denom_config.go | 5 ++++- x/vm/types/denom_config_testing.go | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/x/vm/types/denom_config.go b/x/vm/types/denom_config.go index e3f0fac5b..e4bc839ba 100644 --- a/x/vm/types/denom_config.go +++ b/x/vm/types/denom_config.go @@ -97,7 +97,10 @@ func GetEVMCoinDisplayDenom() string { // setEVMCoinInfo allows to define denom and decimals of the coin used in the EVM. func setEVMCoinInfo(eci EvmCoinInfo) error { - if evmCoinInfo != nil { + if evmCoinInfo != nil && (evmCoinInfo.Denom != eci.Denom || + evmCoinInfo.ExtendedDenom != eci.ExtendedDenom || + evmCoinInfo.DisplayDenom != eci.DisplayDenom || + evmCoinInfo.Decimals != eci.Decimals) { return errors.New("EVM coin info already set") } diff --git a/x/vm/types/denom_config_testing.go b/x/vm/types/denom_config_testing.go index 9e731d7db..137d0dcf8 100644 --- a/x/vm/types/denom_config_testing.go +++ b/x/vm/types/denom_config_testing.go @@ -84,7 +84,10 @@ func GetEVMCoinDisplayDenom() string { // setTestingEVMCoinInfo allows to define denom and decimals of the coin used in the EVM. func setTestingEVMCoinInfo(eci EvmCoinInfo) error { - if testingEvmCoinInfo != nil { + if testingEvmCoinInfo != nil && (testingEvmCoinInfo.Denom != eci.Denom || + testingEvmCoinInfo.ExtendedDenom != eci.ExtendedDenom || + testingEvmCoinInfo.DisplayDenom != eci.DisplayDenom || + testingEvmCoinInfo.Decimals != eci.Decimals) { return errors.New("testing EVM coin info already set. Make sure you run the configurator's ResetTestConfig before trying to set a new evm coin info") }