diff --git a/api/cosmos/bank/v1beta1/bank.pulsar.go b/api/cosmos/bank/v1beta1/bank.pulsar.go index 8e3a54902656..c1d2ed32c2f1 100644 --- a/api/cosmos/bank/v1beta1/bank.pulsar.go +++ b/api/cosmos/bank/v1beta1/bank.pulsar.go @@ -3302,6 +3302,7 @@ var ( fd_Metadata_symbol protoreflect.FieldDescriptor fd_Metadata_uri protoreflect.FieldDescriptor fd_Metadata_uri_hash protoreflect.FieldDescriptor + fd_Metadata_decimals protoreflect.FieldDescriptor ) func init() { @@ -3315,6 +3316,7 @@ func init() { fd_Metadata_symbol = md_Metadata.Fields().ByName("symbol") fd_Metadata_uri = md_Metadata.Fields().ByName("uri") fd_Metadata_uri_hash = md_Metadata.Fields().ByName("uri_hash") + fd_Metadata_decimals = md_Metadata.Fields().ByName("decimals") } var _ protoreflect.Message = (*fastReflection_Metadata)(nil) @@ -3430,6 +3432,12 @@ func (x *fastReflection_Metadata) Range(f func(protoreflect.FieldDescriptor, pro return } } + if x.Decimals != uint32(0) { + value := protoreflect.ValueOfUint32(x.Decimals) + if !f(fd_Metadata_decimals, value) { + return + } + } } // Has reports whether a field is populated. @@ -3461,6 +3469,8 @@ func (x *fastReflection_Metadata) Has(fd protoreflect.FieldDescriptor) bool { return x.Uri != "" case "cosmos.bank.v1beta1.Metadata.uri_hash": return x.UriHash != "" + case "cosmos.bank.v1beta1.Metadata.decimals": + return x.Decimals != uint32(0) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.bank.v1beta1.Metadata")) @@ -3493,6 +3503,8 @@ func (x *fastReflection_Metadata) Clear(fd protoreflect.FieldDescriptor) { x.Uri = "" case "cosmos.bank.v1beta1.Metadata.uri_hash": x.UriHash = "" + case "cosmos.bank.v1beta1.Metadata.decimals": + x.Decimals = uint32(0) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.bank.v1beta1.Metadata")) @@ -3536,6 +3548,9 @@ func (x *fastReflection_Metadata) Get(descriptor protoreflect.FieldDescriptor) p case "cosmos.bank.v1beta1.Metadata.uri_hash": value := x.UriHash return protoreflect.ValueOfString(value) + case "cosmos.bank.v1beta1.Metadata.decimals": + value := x.Decimals + return protoreflect.ValueOfUint32(value) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.bank.v1beta1.Metadata")) @@ -3574,6 +3589,8 @@ func (x *fastReflection_Metadata) Set(fd protoreflect.FieldDescriptor, value pro x.Uri = value.Interface().(string) case "cosmos.bank.v1beta1.Metadata.uri_hash": x.UriHash = value.Interface().(string) + case "cosmos.bank.v1beta1.Metadata.decimals": + x.Decimals = uint32(value.Uint()) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.bank.v1beta1.Metadata")) @@ -3614,6 +3631,8 @@ func (x *fastReflection_Metadata) Mutable(fd protoreflect.FieldDescriptor) proto panic(fmt.Errorf("field uri of message cosmos.bank.v1beta1.Metadata is not mutable")) case "cosmos.bank.v1beta1.Metadata.uri_hash": panic(fmt.Errorf("field uri_hash of message cosmos.bank.v1beta1.Metadata is not mutable")) + case "cosmos.bank.v1beta1.Metadata.decimals": + panic(fmt.Errorf("field decimals of message cosmos.bank.v1beta1.Metadata is not mutable")) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.bank.v1beta1.Metadata")) @@ -3644,6 +3663,8 @@ func (x *fastReflection_Metadata) NewField(fd protoreflect.FieldDescriptor) prot return protoreflect.ValueOfString("") case "cosmos.bank.v1beta1.Metadata.uri_hash": return protoreflect.ValueOfString("") + case "cosmos.bank.v1beta1.Metadata.decimals": + return protoreflect.ValueOfUint32(uint32(0)) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.bank.v1beta1.Metadata")) @@ -3747,6 +3768,9 @@ func (x *fastReflection_Metadata) ProtoMethods() *protoiface.Methods { if l > 0 { n += 1 + l + runtime.Sov(uint64(l)) } + if x.Decimals != 0 { + n += 1 + runtime.Sov(uint64(x.Decimals)) + } if x.unknownFields != nil { n += len(x.unknownFields) } @@ -3776,6 +3800,11 @@ func (x *fastReflection_Metadata) ProtoMethods() *protoiface.Methods { i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } + if x.Decimals != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.Decimals)) + i-- + dAtA[i] = 0x48 + } if len(x.UriHash) > 0 { i -= len(x.UriHash) copy(dAtA[i:], x.UriHash) @@ -4148,6 +4177,25 @@ func (x *fastReflection_Metadata) ProtoMethods() *protoiface.Methods { } x.UriHash = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 9: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Decimals", wireType) + } + x.Decimals = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + x.Decimals |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := runtime.Skip(dAtA[iNdEx:]) @@ -4514,6 +4562,10 @@ type Metadata struct { // // Since: cosmos-sdk 0.46 UriHash string `protobuf:"bytes,8,opt,name=uri_hash,json=uriHash,proto3" json:"uri_hash,omitempty"` + // Decimals represent the number of decimals use to represent token amount on chain + // + // Since: cosmos-sdk 0.50 + Decimals uint32 `protobuf:"varint,9,opt,name=decimals,proto3" json:"decimals,omitempty"` } func (x *Metadata) Reset() { @@ -4592,6 +4644,13 @@ func (x *Metadata) GetUriHash() string { return "" } +func (x *Metadata) GetDecimals() uint32 { + if x != nil { + return x.Decimals + } + return 0 +} + var File_cosmos_bank_v1beta1_bank_proto protoreflect.FileDescriptor var file_cosmos_bank_v1beta1_bank_proto_rawDesc = []byte{ @@ -4662,7 +4721,7 @@ var file_cosmos_bank_v1beta1_bank_proto_rawDesc = []byte{ 0x08, 0x65, 0x78, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x65, 0x78, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x6c, 0x69, 0x61, 0x73, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x61, 0x6c, 0x69, 0x61, - 0x73, 0x65, 0x73, 0x22, 0x8a, 0x02, 0x0a, 0x08, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, + 0x73, 0x65, 0x73, 0x22, 0xa6, 0x02, 0x0a, 0x08, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3f, 0x0a, 0x0b, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x5f, 0x75, 0x6e, 0x69, 0x74, @@ -4679,19 +4738,21 @@ var file_cosmos_bank_v1beta1_bank_proto_rawDesc = []byte{ 0x55, 0x52, 0x49, 0x52, 0x03, 0x75, 0x72, 0x69, 0x12, 0x26, 0x0a, 0x08, 0x75, 0x72, 0x69, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0b, 0xe2, 0xde, 0x1f, 0x07, 0x55, 0x52, 0x49, 0x48, 0x61, 0x73, 0x68, 0x52, 0x07, 0x75, 0x72, 0x69, 0x48, 0x61, 0x73, 0x68, - 0x42, 0xc4, 0x01, 0x0a, 0x17, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, - 0x62, 0x61, 0x6e, 0x6b, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x42, 0x09, 0x42, 0x61, - 0x6e, 0x6b, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x30, 0x63, 0x6f, 0x73, 0x6d, 0x6f, - 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, - 0x6f, 0x73, 0x2f, 0x62, 0x61, 0x6e, 0x6b, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x3b, - 0x62, 0x61, 0x6e, 0x6b, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x42, - 0x58, 0xaa, 0x02, 0x13, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x42, 0x61, 0x6e, 0x6b, 0x2e, - 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xca, 0x02, 0x13, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x5c, 0x42, 0x61, 0x6e, 0x6b, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xe2, 0x02, 0x1f, - 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x42, 0x61, 0x6e, 0x6b, 0x5c, 0x56, 0x31, 0x62, 0x65, - 0x74, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, - 0x02, 0x15, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x42, 0x61, 0x6e, 0x6b, 0x3a, 0x3a, - 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x65, 0x63, 0x69, 0x6d, 0x61, 0x6c, 0x73, 0x18, 0x09, 0x20, 0x01, + 0x28, 0x0d, 0x52, 0x08, 0x64, 0x65, 0x63, 0x69, 0x6d, 0x61, 0x6c, 0x73, 0x42, 0xc4, 0x01, 0x0a, + 0x17, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x6e, 0x6b, + 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x42, 0x09, 0x42, 0x61, 0x6e, 0x6b, 0x50, 0x72, + 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x30, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, + 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, + 0x61, 0x6e, 0x6b, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x3b, 0x62, 0x61, 0x6e, 0x6b, + 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x42, 0x58, 0xaa, 0x02, 0x13, + 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x42, 0x61, 0x6e, 0x6b, 0x2e, 0x56, 0x31, 0x62, 0x65, + 0x74, 0x61, 0x31, 0xca, 0x02, 0x13, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x42, 0x61, 0x6e, + 0x6b, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xe2, 0x02, 0x1f, 0x43, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x5c, 0x42, 0x61, 0x6e, 0x6b, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x5c, + 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x15, 0x43, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x42, 0x61, 0x6e, 0x6b, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x65, + 0x74, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/proto/cosmos/bank/v1beta1/bank.proto b/proto/cosmos/bank/v1beta1/bank.proto index cbf6a41cf88b..fbf3c0099d6f 100644 --- a/proto/cosmos/bank/v1beta1/bank.proto +++ b/proto/cosmos/bank/v1beta1/bank.proto @@ -122,4 +122,8 @@ message Metadata { // // Since: cosmos-sdk 0.46 string uri_hash = 8 [(gogoproto.customname) = "URIHash"]; + // Decimals represent the number of decimals use to represent token amount on chain + // + // Since: cosmos-sdk 0.50 + uint32 decimals = 9; } diff --git a/simapp/go.mod b/simapp/go.mod index 3d63b0dc1a80..c5fd18c8513c 100644 --- a/simapp/go.mod +++ b/simapp/go.mod @@ -118,7 +118,7 @@ require ( github.com/hashicorp/go-safetemp v1.0.0 // indirect github.com/hashicorp/go-version v1.6.0 // indirect github.com/hashicorp/golang-lru v1.0.2 // indirect - github.com/hashicorp/hcl v1.0.0 // indirect + github.com/hashicorp/hcl v1.0.1-vault-5 // indirect github.com/hashicorp/yamux v0.1.1 // indirect github.com/hdevalence/ed25519consensus v0.1.0 // indirect github.com/huandu/skiplist v1.2.0 // indirect @@ -172,9 +172,9 @@ require ( go.opencensus.io v0.24.0 // indirect go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.47.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0 // indirect - go.opentelemetry.io/otel v1.22.0 // indirect - go.opentelemetry.io/otel/metric v1.22.0 // indirect - go.opentelemetry.io/otel/trace v1.22.0 // indirect + go.opentelemetry.io/otel v1.24.0 // indirect + go.opentelemetry.io/otel/metric v1.24.0 // indirect + go.opentelemetry.io/otel/trace v1.24.0 // indirect go.uber.org/multierr v1.10.0 // indirect golang.org/x/crypto v0.22.0 // indirect golang.org/x/exp v0.0.0-20240404231335-c0f41cb1a7a0 // indirect diff --git a/simapp/go.sum b/simapp/go.sum index f468cd6c5ae0..3161a3607230 100644 --- a/simapp/go.sum +++ b/simapp/go.sum @@ -690,6 +690,7 @@ github.com/hashicorp/golang-lru v1.0.2 h1:dV3g9Z/unq5DpblPpw+Oqcv4dU/1omnb4Ok8iP github.com/hashicorp/golang-lru v1.0.2/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/hashicorp/hcl v1.0.1-vault-5/go.mod h1:XYhtn6ijBSAj6n4YqAaf7RBPS4I06AItNorpy+MoQNM= github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= @@ -1063,12 +1064,15 @@ go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0 h1:sv9kVfa go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0/go.mod h1:SK2UL73Zy1quvRPonmOmRDiWk1KBV3LyIeeIxcEApWw= go.opentelemetry.io/otel v1.22.0 h1:xS7Ku+7yTFvDfDraDIJVpw7XPyuHlB9MCiqqX5mcJ6Y= go.opentelemetry.io/otel v1.22.0/go.mod h1:eoV4iAi3Ea8LkAEI9+GFT44O6T/D0GWAVFyZVCC6pMI= +go.opentelemetry.io/otel v1.24.0/go.mod h1:W7b9Ozg4nkF5tWI5zsXkaKKDjdVjpD4oAt9Qi/MArHo= go.opentelemetry.io/otel/metric v1.22.0 h1:lypMQnGyJYeuYPhOM/bgjbFM6WE44W1/T45er4d8Hhg= go.opentelemetry.io/otel/metric v1.22.0/go.mod h1:evJGjVpZv0mQ5QBRJoBF64yMuOf4xCWdXjK8pzFvliY= +go.opentelemetry.io/otel/metric v1.24.0/go.mod h1:VYhLe1rFfxuTXLgj4CBiyz+9WYBA8pNGJgDcSFRKBco= go.opentelemetry.io/otel/sdk v1.21.0 h1:FTt8qirL1EysG6sTQRZ5TokkU8d0ugCj8htOgThZXQ8= go.opentelemetry.io/otel/sdk v1.21.0/go.mod h1:Nna6Yv7PWTdgJHVRD9hIYywQBRx7pbox6nwBnZIxl/E= go.opentelemetry.io/otel/trace v1.22.0 h1:Hg6pPujv0XG9QaVbGOBVHunyuLcCC3jN7WEhPx83XD0= go.opentelemetry.io/otel/trace v1.22.0/go.mod h1:RbbHXVqKES9QhzZq/fE5UnOSILqRt40a21sPw2He1xo= +go.opentelemetry.io/otel/trace v1.24.0/go.mod h1:HPc3Xr/cOApsBI154IU0OI0HJexz+aw5uPdbs3UCjNU= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= diff --git a/tests/e2e/bank/grpc.go b/tests/e2e/bank/grpc.go index d60c6a203b39..e8eceeea3c1a 100644 --- a/tests/e2e/bank/grpc.go +++ b/tests/e2e/bank/grpc.go @@ -188,8 +188,9 @@ func (s *E2ETestSuite) TestDenomMetadataGRPCHandler() { Aliases: []string{"ATOM"}, }, }, - Base: "uatom", - Display: "atom", + Base: "uatom", + Display: "atom", + Decimals: 6, }, }, }, diff --git a/tests/go.mod b/tests/go.mod index adf979933955..08bde915692c 100644 --- a/tests/go.mod +++ b/tests/go.mod @@ -116,7 +116,7 @@ require ( github.com/hashicorp/go-safetemp v1.0.0 // indirect github.com/hashicorp/go-version v1.6.0 // indirect github.com/hashicorp/golang-lru v1.0.2 // indirect - github.com/hashicorp/hcl v1.0.0 // indirect + github.com/hashicorp/hcl v1.0.1-vault-5 // indirect github.com/hashicorp/yamux v0.1.1 // indirect github.com/hdevalence/ed25519consensus v0.1.0 // indirect github.com/huandu/skiplist v1.2.0 // indirect @@ -173,9 +173,9 @@ require ( go.opencensus.io v0.24.0 // indirect go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.47.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0 // indirect - go.opentelemetry.io/otel v1.22.0 // indirect - go.opentelemetry.io/otel/metric v1.22.0 // indirect - go.opentelemetry.io/otel/trace v1.22.0 // indirect + go.opentelemetry.io/otel v1.24.0 // indirect + go.opentelemetry.io/otel/metric v1.24.0 // indirect + go.opentelemetry.io/otel/trace v1.24.0 // indirect go.uber.org/multierr v1.10.0 // indirect golang.org/x/crypto v0.22.0 // indirect golang.org/x/exp v0.0.0-20240404231335-c0f41cb1a7a0 // indirect diff --git a/tests/go.sum b/tests/go.sum index 79f5dc85f654..187a43fded77 100644 --- a/tests/go.sum +++ b/tests/go.sum @@ -687,6 +687,7 @@ github.com/hashicorp/golang-lru v1.0.2 h1:dV3g9Z/unq5DpblPpw+Oqcv4dU/1omnb4Ok8iP github.com/hashicorp/golang-lru v1.0.2/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/hashicorp/hcl v1.0.1-vault-5/go.mod h1:XYhtn6ijBSAj6n4YqAaf7RBPS4I06AItNorpy+MoQNM= github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= @@ -1064,12 +1065,15 @@ go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0 h1:sv9kVfa go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0/go.mod h1:SK2UL73Zy1quvRPonmOmRDiWk1KBV3LyIeeIxcEApWw= go.opentelemetry.io/otel v1.22.0 h1:xS7Ku+7yTFvDfDraDIJVpw7XPyuHlB9MCiqqX5mcJ6Y= go.opentelemetry.io/otel v1.22.0/go.mod h1:eoV4iAi3Ea8LkAEI9+GFT44O6T/D0GWAVFyZVCC6pMI= +go.opentelemetry.io/otel v1.24.0/go.mod h1:W7b9Ozg4nkF5tWI5zsXkaKKDjdVjpD4oAt9Qi/MArHo= go.opentelemetry.io/otel/metric v1.22.0 h1:lypMQnGyJYeuYPhOM/bgjbFM6WE44W1/T45er4d8Hhg= go.opentelemetry.io/otel/metric v1.22.0/go.mod h1:evJGjVpZv0mQ5QBRJoBF64yMuOf4xCWdXjK8pzFvliY= +go.opentelemetry.io/otel/metric v1.24.0/go.mod h1:VYhLe1rFfxuTXLgj4CBiyz+9WYBA8pNGJgDcSFRKBco= go.opentelemetry.io/otel/sdk v1.21.0 h1:FTt8qirL1EysG6sTQRZ5TokkU8d0ugCj8htOgThZXQ8= go.opentelemetry.io/otel/sdk v1.21.0/go.mod h1:Nna6Yv7PWTdgJHVRD9hIYywQBRx7pbox6nwBnZIxl/E= go.opentelemetry.io/otel/trace v1.22.0 h1:Hg6pPujv0XG9QaVbGOBVHunyuLcCC3jN7WEhPx83XD0= go.opentelemetry.io/otel/trace v1.22.0/go.mod h1:RbbHXVqKES9QhzZq/fE5UnOSILqRt40a21sPw2He1xo= +go.opentelemetry.io/otel/trace v1.24.0/go.mod h1:HPc3Xr/cOApsBI154IU0OI0HJexz+aw5uPdbs3UCjNU= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= diff --git a/tests/integration/bank/keeper/deterministic_test.go b/tests/integration/bank/keeper/deterministic_test.go index 86bce291117c..ecb8798eec39 100644 --- a/tests/integration/bank/keeper/deterministic_test.go +++ b/tests/integration/bank/keeper/deterministic_test.go @@ -51,8 +51,9 @@ var ( Aliases: []string{"ATOM"}, }, }, - Base: "uatom", - Display: "atom", + Base: "uatom", + Display: "atom", + Decimals: 6, } ) diff --git a/x/bank/keeper/grpc_query_test.go b/x/bank/keeper/grpc_query_test.go index b17111db01b0..889f1bf4d2b3 100644 --- a/x/bank/keeper/grpc_query_test.go +++ b/x/bank/keeper/grpc_query_test.go @@ -376,8 +376,9 @@ func (suite *KeeperTestSuite) TestQueryDenomsMetadata() { Aliases: []string{"ATOM"}, }, }, - Base: "uatom", - Display: "atom", + Base: "uatom", + Display: "atom", + Decimals: 6, } metadataEth := types.Metadata{ @@ -393,8 +394,9 @@ func (suite *KeeperTestSuite) TestQueryDenomsMetadata() { Aliases: []string{"ETH", "ether"}, }, }, - Base: "wei", - Display: "eth", + Base: "wei", + Display: "eth", + Decimals: 18, } suite.bankKeeper.SetDenomMetaData(suite.ctx, metadataAtom) @@ -475,8 +477,9 @@ func (suite *KeeperTestSuite) TestQueryDenomMetadata() { Aliases: []string{"ATOM"}, }, }, - Base: "uatom", - Display: "atom", + Base: "uatom", + Display: "atom", + Decimals: 6, } suite.bankKeeper.SetDenomMetaData(suite.ctx, expMetadata) @@ -552,8 +555,9 @@ func (suite *KeeperTestSuite) TestQueryDenomMetadataByQueryStringRequest() { Aliases: []string{"ATOM"}, }, }, - Base: "uatom", - Display: "atom", + Base: "uatom", + Display: "atom", + Decimals: 6, } suite.bankKeeper.SetDenomMetaData(suite.ctx, expMetadata) diff --git a/x/bank/migrations/v3/store_test.go b/x/bank/migrations/v3/store_test.go index a8184f75b4a3..b82ac0ff305f 100644 --- a/x/bank/migrations/v3/store_test.go +++ b/x/bank/migrations/v3/store_test.go @@ -129,6 +129,7 @@ func assertMetaDataEqual(t *testing.T, expected, actual types.Metadata) { require.Equal(t, expected.GetBase(), actual.GetBase()) require.Equal(t, expected.GetDisplay(), actual.GetDisplay()) require.Equal(t, expected.GetDescription(), actual.GetDescription()) + require.Equal(t, expected.GetDecimals(), actual.GetDecimals()) require.Equal(t, expected.GetDenomUnits()[1].GetDenom(), actual.GetDenomUnits()[1].GetDenom()) require.Equal(t, expected.GetDenomUnits()[1].GetExponent(), actual.GetDenomUnits()[1].GetExponent()) require.Equal(t, expected.GetDenomUnits()[1].GetAliases(), actual.GetDenomUnits()[1].GetAliases()) diff --git a/x/bank/types/bank.pb.go b/x/bank/types/bank.pb.go index 19dd28219e85..af6b5b49c2f5 100644 --- a/x/bank/types/bank.pb.go +++ b/x/bank/types/bank.pb.go @@ -359,6 +359,10 @@ type Metadata struct { // // Since: cosmos-sdk 0.46 URIHash string `protobuf:"bytes,8,opt,name=uri_hash,json=uriHash,proto3" json:"uri_hash,omitempty"` + // Decimals represent the number of decimals use to represent token amount on chain + // + // Since: cosmos-sdk 0.50 + Decimals uint32 `protobuf:"varint,9,opt,name=decimals,proto3" json:"decimals,omitempty"` } func (m *Metadata) Reset() { *m = Metadata{} } @@ -450,6 +454,13 @@ func (m *Metadata) GetURIHash() string { return "" } +func (m *Metadata) GetDecimals() uint32 { + if m != nil { + return m.Decimals + } + return 0 +} + func init() { proto.RegisterType((*Params)(nil), "cosmos.bank.v1beta1.Params") proto.RegisterType((*SendEnabled)(nil), "cosmos.bank.v1beta1.SendEnabled") @@ -463,50 +474,51 @@ func init() { func init() { proto.RegisterFile("cosmos/bank/v1beta1/bank.proto", fileDescriptor_dd052eee12edf988) } var fileDescriptor_dd052eee12edf988 = []byte{ - // 677 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x54, 0xbd, 0x6f, 0xd3, 0x40, - 0x14, 0xcf, 0x25, 0xcd, 0x47, 0x2f, 0x65, 0xe0, 0x88, 0xe0, 0x5a, 0x84, 0x13, 0x65, 0x40, 0x69, - 0xa4, 0x26, 0xb4, 0x6c, 0x59, 0x10, 0x29, 0x5f, 0x19, 0x10, 0xc8, 0x55, 0x85, 0xc4, 0x12, 0x5d, - 0xe2, 0x23, 0x39, 0xd5, 0xbe, 0xb3, 0x7c, 0xe7, 0xd2, 0xac, 0x4c, 0xa8, 0x13, 0x33, 0x53, 0xc5, - 0x84, 0x10, 0x43, 0x86, 0xee, 0xac, 0x55, 0xa7, 0x8a, 0x89, 0xa9, 0xa0, 0x74, 0x48, 0xff, 0x0c, - 0xe4, 0x3b, 0x3b, 0x4d, 0xa5, 0xc2, 0x88, 0xc4, 0x92, 0xbc, 0xf7, 0x7e, 0x3f,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 0x33, 0x2b, - 0x75, 0x72, 0x66, 0xa5, 0x7e, 0x9c, 0x59, 0xa9, 0xd7, 0xab, 0x7f, 0xdd, 0x78, 0xfc, 0xb9, 0xd0, - 0x8b, 0xef, 0xe5, 0xf4, 0x97, 0xed, 0xfe, 0xef, 0x00, 0x00, 0x00, 0xff, 0xff, 0x9f, 0x47, 0xd8, - 0x49, 0x8d, 0x05, 0x00, 0x00, + // 693 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x54, 0x3d, 0x6f, 0x13, 0x4b, + 0x14, 0xf5, 0xd8, 0xf1, 0xd7, 0x38, 0xaf, 0x78, 0xf3, 0xac, 0xc7, 0x24, 0x88, 0xb5, 0xe5, 0x02, + 0x39, 0x96, 0x62, 0x93, 0xd0, 0xb9, 0x41, 0x38, 0x7c, 0xb9, 0x40, 0xa0, 0x8d, 0x22, 0x24, 0x1a, + 0x6b, 0xec, 0x1d, 0xec, 0x51, 0x76, 0x67, 0x56, 0x3b, 0xb3, 0x21, 0x6e, 0xa9, 0x10, 0x15, 0x35, + 0x55, 0x44, 0x81, 0x10, 0xa2, 0x70, 0x91, 0x9e, 0x36, 0x4a, 0x15, 0x51, 0x51, 0x05, 0xe4, 0x14, + 0xce, 0xcf, 0x40, 0x3b, 0xb3, 0xeb, 0x38, 0x52, 0xa0, 0x44, 0xa2, 0xb1, 0xef, 0xbd, 0xe7, 0xee, + 0xbd, 0x67, 0xce, 0x9e, 0x1d, 0x68, 0x0d, 0x84, 0xf4, 0x84, 0x6c, 0xf5, 0x09, 0xdf, 0x6d, 0xed, + 0x6d, 0xf4, 0xa9, 0x22, 0x1b, 0x3a, 0x69, 0xfa, 0x81, 0x50, 0x02, 0xfd, 0x67, 0xf0, 0xa6, 0x2e, + 0xc5, 0xf8, 0x6a, 0x79, 0x28, 0x86, 0x42, 0xe3, 0xad, 0x28, 0x32, 0xad, 0xab, 0x2b, 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xd4, 0xa9, 0x05, 0x00, 0x00, } func (this *SendEnabled) Equal(that interface{}) bool { @@ -841,6 +853,11 @@ func (m *Metadata) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.Decimals != 0 { + i = encodeVarintBank(dAtA, i, uint64(m.Decimals)) + i-- + dAtA[i] = 0x48 + } if len(m.URIHash) > 0 { i -= len(m.URIHash) copy(dAtA[i:], m.URIHash) @@ -1067,6 +1084,9 @@ func (m *Metadata) Size() (n int) { if l > 0 { n += 1 + l + sovBank(uint64(l)) } + if m.Decimals != 0 { + n += 1 + sovBank(uint64(m.Decimals)) + } return n } @@ -2018,6 +2038,25 @@ func (m *Metadata) Unmarshal(dAtA []byte) error { } m.URIHash = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 9: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Decimals", wireType) + } + m.Decimals = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBank + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Decimals |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipBank(dAtA[iNdEx:]) diff --git a/x/bank/types/metadata_test.go b/x/bank/types/metadata_test.go index 34ff32f6a0f1..7874f0766a36 100644 --- a/x/bank/types/metadata_test.go +++ b/x/bank/types/metadata_test.go @@ -26,8 +26,9 @@ func TestMetadataValidate(t *testing.T) { {"matom", uint32(3), []string{"milliatom"}}, {"atom", uint32(6), nil}, }, - Base: "uatom", - Display: "atom", + Base: "uatom", + Display: "atom", + Decimals: 6, }, false, }, @@ -147,8 +148,9 @@ func TestMetadataValidate(t *testing.T) { {"matom", uint32(3), []string{"milliatom"}}, {"atom", uint32(6), nil}, }, - Base: "uatom", - Display: "atom", + Base: "uatom", + Display: "atom", + Decimals: 6, }, true, }, @@ -163,8 +165,9 @@ func TestMetadataValidate(t *testing.T) { {"matom", uint32(3), []string{"milliatom"}}, {"atom", uint32(6), nil}, }, - Base: "uatom", - Display: "atom", + Base: "uatom", + Display: "atom", + Decimals: 6, }, true, },