diff --git a/ante/ante_feeabs_feemarket.go b/ante/ante_feeabs_feemarket.go index e770b7c84..35ab53bf2 100644 --- a/ante/ante_feeabs_feemarket.go +++ b/ante/ante_feeabs_feemarket.go @@ -1,8 +1,6 @@ package ante import ( - "fmt" - feeabskeeper "github.com/osmosis-labs/fee-abstraction/v7/x/feeabs/keeper" feeabstypes "github.com/osmosis-labs/fee-abstraction/v7/x/feeabs/types" feemarkettypes "github.com/skip-mev/feemarket/x/feemarket/types" @@ -24,7 +22,6 @@ var _ feemarkettypes.DenomResolver = &DenomResolverImpl{} // If the denom is not the bond denom, convert the `coin` to the given denom. return error if denom is not in the allowed list func (r *DenomResolverImpl) ConvertToDenom(ctx sdk.Context, coin sdk.DecCoin, denom string) (sdk.DecCoin, error) { bondDenom := r.StakingKeeper.BondDenom(ctx) - fmt.Println("Here>>>>>>>>>>>>>>>> ConvertToDenom and bondDenom and denom", bondDenom, denom, coin) if denom != bondDenom && coin.Denom != bondDenom { return sdk.DecCoin{}, ErrNeitherNativeDenom(coin.Denom, denom) } @@ -34,8 +31,6 @@ func (r *DenomResolverImpl) ConvertToDenom(ctx sdk.Context, coin sdk.DecCoin, de var err error if denom == bondDenom { - - fmt.Println("Here<<<<<<<<<<<<<<<<<<< in if statement") hostZoneConfig, found = r.FeeabsKeeper.GetHostZoneConfig(ctx, coin.Denom) if !found { return sdk.DecCoin{}, ErrDenomNotRegistered(coin.Denom) @@ -43,7 +38,6 @@ func (r *DenomResolverImpl) ConvertToDenom(ctx sdk.Context, coin sdk.DecCoin, de amount, err = r.getIBCCoinFromNative(ctx, sdk.NewCoins(sdk.NewCoin(coin. Denom, coin.Amount.TruncateInt())), hostZoneConfig) } else if coin.Denom == bondDenom { - fmt.Println("here in elseif>>>>>>>>>>", coin.Denom, bondDenom) hostZoneConfig, found := r.FeeabsKeeper.GetHostZoneConfig(ctx, denom) if !found { return sdk.DecCoin{}, ErrDenomNotRegistered(denom) @@ -54,7 +48,6 @@ func (r *DenomResolverImpl) ConvertToDenom(ctx sdk.Context, coin sdk.DecCoin, de if err != nil { return sdk.DecCoin{}, err } - fmt.Println(">>>>>>>>>>>>>>>>>>>", sdk.NewDecCoinFromDec(denom, amount[0].Amount.ToLegacyDec())) return sdk.NewDecCoinFromDec(denom, amount[0].Amount.ToLegacyDec()), nil } diff --git a/ante/fee_test.go b/ante/fee_test.go index 63e98bf57..af1594686 100644 --- a/ante/fee_test.go +++ b/ante/fee_test.go @@ -486,7 +486,7 @@ var _ = Describe("Fee abstraction", func() { It("should fail with empty fee", func() { feeAmount := sdk.Coins{} - minGasPrice := sdk.NewDecCoinsFromCoins(sdk.NewCoins(sdk.NewInt64Coin("ncheq", 100))...) + minGasPrice := sdk.NewDecCoinsFromCoins(sdk.NewCoins(sdk.NewInt64Coin(didtypes.BaseMinimalDenom, 100))...) suite.txBuilder.SetGasLimit(gasLimit) suite.txBuilder.SetFeeAmount(feeAmount) suite.ctx = suite.ctx.WithMinGasPrices(minGasPrice) @@ -504,8 +504,8 @@ var _ = Describe("Fee abstraction", func() { }) It("should fail with insufficient native fee", func() { - feeAmount := sdk.NewCoins(sdk.NewInt64Coin("ncheq", 100)) - minGasPrice := sdk.NewDecCoinsFromCoins(sdk.NewCoins(sdk.NewInt64Coin("ncheq", 1000))...) + feeAmount := sdk.NewCoins(sdk.NewInt64Coin(didtypes.BaseMinimalDenom, 100)) + minGasPrice := sdk.NewDecCoinsFromCoins(sdk.NewCoins(sdk.NewInt64Coin(didtypes.BaseMinimalDenom, 1000))...) suite.txBuilder.SetGasLimit(gasLimit) suite.txBuilder.SetFeeAmount(feeAmount) suite.ctx = suite.ctx.WithMinGasPrices(minGasPrice) @@ -523,8 +523,8 @@ var _ = Describe("Fee abstraction", func() { }) It("should pass with sufficient native fee", func() { - feeAmount := sdk.NewCoins(sdk.NewInt64Coin("ncheq", 1000*int64(gasLimit))) - minGasPrice := sdk.NewDecCoinsFromCoins(sdk.NewCoins(sdk.NewInt64Coin("ncheq", 1000))...) + feeAmount := sdk.NewCoins(sdk.NewInt64Coin(didtypes.BaseMinimalDenom, 1000*int64(gasLimit))) + minGasPrice := sdk.NewDecCoinsFromCoins(sdk.NewCoins(sdk.NewInt64Coin(didtypes.BaseMinimalDenom, 1000))...) suite.txBuilder.SetGasLimit(gasLimit) suite.txBuilder.SetFeeAmount(feeAmount) suite.ctx = suite.ctx.WithMinGasPrices(minGasPrice) @@ -542,7 +542,7 @@ var _ = Describe("Fee abstraction", func() { It("should fail with unknown ibc fee denom", func() { feeAmount := sdk.NewCoins(sdk.NewInt64Coin("ibcfee", 1000*int64(gasLimit))) - minGasPrice := sdk.NewDecCoinsFromCoins(sdk.NewCoins(sdk.NewInt64Coin("ncheq", 1000))...) + minGasPrice := sdk.NewDecCoinsFromCoins(sdk.NewCoins(sdk.NewInt64Coin(didtypes.BaseMinimalDenom, 1000))...) suite.txBuilder.SetGasLimit(gasLimit) suite.txBuilder.SetFeeAmount(feeAmount) suite.ctx = suite.ctx.WithMinGasPrices(minGasPrice) @@ -596,8 +596,8 @@ var _ = Describe("DeductFeeDecorator", func() { // Setup the common test data BeforeEach(func() { gasLimit = 200000 - minGasPrice = sdk.NewDecCoinsFromCoins(sdk.NewCoins(sdk.NewInt64Coin("ncheq", 1000))...) - feeAmount = sdk.NewCoins(sdk.NewInt64Coin("ncheq", 1000*int64(gasLimit))) + minGasPrice = sdk.NewDecCoinsFromCoins(sdk.NewCoins(sdk.NewInt64Coin(didtypes.BaseMinimalDenom, 1000))...) + feeAmount = sdk.NewCoins(sdk.NewInt64Coin(didtypes.BaseMinimalDenom, 1000*int64(gasLimit))) ibcFeeAmount = sdk.NewCoins(sdk.NewInt64Coin("ibcfee", 1000*int64(gasLimit))) mockHostZoneConfig = types.HostChainFeeAbsConfig{ @@ -624,7 +624,7 @@ var _ = Describe("DeductFeeDecorator", func() { // minFee, _ := minGasPrice.TruncateDecimal() params := suite.app.StakingKeeper.GetParams(suite.ctx) - params.BondDenom = "ncheq" + params.BondDenom = didtypes.BaseMinimalDenom err = suite.app.StakingKeeper.SetParams(suite.ctx, params) Expect(err).To(BeNil(), "Error setting the params") @@ -1144,7 +1144,7 @@ var _ = Describe("Fee abstraction along with fee market", func() { s := new(AnteTestSuite) gasLimit := 200000 ibcFeeAmount := sdk.NewCoins(sdk.NewInt64Coin("ibcfee", 1000*int64(gasLimit))) - feeAmount := sdk.NewCoins(sdk.NewInt64Coin("ncheq", 1000*int64(gasLimit))) + feeAmount := sdk.NewCoins(sdk.NewInt64Coin(didtypes.BaseMinimalDenom, 1000*int64(gasLimit))) mockHostZoneConfig := types.HostChainFeeAbsConfig{ IbcDenom: "ibcfee", @@ -1186,7 +1186,7 @@ var _ = Describe("Fee abstraction along with fee market", func() { s.app.AccountKeeper.SetModuleAccount(s.ctx, feeabsModAcc) params := s.app.StakingKeeper.GetParams(s.ctx) - params.BondDenom = "ncheq" + params.BondDenom = didtypes.BaseMinimalDenom err = s.app.StakingKeeper.SetParams(s.ctx, params) Expect(err).To(BeNil(), "Error setting the params") }) @@ -1221,7 +1221,7 @@ var _ = Describe("Fee abstraction along with fee market", func() { err := s.app.FeeabsKeeper.SetHostZoneConfig(s.ctx, mockHostZoneConfig) Expect(err).ToNot(HaveOccurred()) s.app.FeeabsKeeper.SetTwapRate(s.ctx, "ibcfee", sdk.NewDec(1)) - minGasPrice := sdk.NewDecCoinsFromCoins(sdk.NewCoins(sdk.NewInt64Coin("ncheq", 100))...) + minGasPrice := sdk.NewDecCoinsFromCoins(sdk.NewCoins(sdk.NewInt64Coin(didtypes.BaseMinimalDenom, 100))...) s.ctx = s.ctx.WithMinGasPrices(minGasPrice) anteHandler := sdk.ChainAnteDecorators(decorators...) @@ -1281,7 +1281,7 @@ var _ = Describe("Fee abstraction along with fee market", func() { err = testutil.FundAccount(s.app.BankKeeper, s.ctx, addr1, sdk.NewCoins(sdk.NewCoin(ibcDenom, amount))) Expect(err).To(BeNil()) - err = testutil.FundModuleAccount(s.app.BankKeeper, s.ctx, types.ModuleName, sdk.NewCoins(sdk.NewCoin("ncheq", amount))) + err = testutil.FundModuleAccount(s.app.BankKeeper, s.ctx, types.ModuleName, sdk.NewCoins(sdk.NewCoin(didtypes.BaseMinimalDenom, amount))) Expect(err).To(BeNil()) taxDecorator := cheqdpost.NewTaxDecorator(s.app.AccountKeeper, s.app.BankKeeper, s.app.FeeGrantKeeper, s.app.DidKeeper, s.app.ResourceKeeper, s.app.FeeMarketKeeper) @@ -1350,7 +1350,7 @@ var _ = Describe("Fee abstraction along with fee market", func() { err = testutil.FundAccount(s.app.BankKeeper, s.ctx, addr1, sdk.NewCoins(sdk.NewCoin(ibcDenom, amount))) Expect(err).To(BeNil()) - err = testutil.FundModuleAccount(s.app.BankKeeper, s.ctx, types.ModuleName, sdk.NewCoins(sdk.NewCoin("ncheq", amount))) + err = testutil.FundModuleAccount(s.app.BankKeeper, s.ctx, types.ModuleName, sdk.NewCoins(sdk.NewCoin(didtypes.BaseMinimalDenom, amount))) Expect(err).To(BeNil()) taxDecorator := cheqdpost.NewTaxDecorator(s.app.AccountKeeper, s.app.BankKeeper, s.app.FeeGrantKeeper, s.app.DidKeeper, s.app.ResourceKeeper, s.app.FeeMarketKeeper) diff --git a/ante/testutil_test.go b/ante/testutil_test.go index 1cad1c120..167165d27 100644 --- a/ante/testutil_test.go +++ b/ante/testutil_test.go @@ -155,7 +155,7 @@ func (s *AnteTestSuite) CreateTestAccounts(numAccs int) ([]TestAccount, error) { } s.app.AccountKeeper.SetAccount(s.ctx, acc) someCoins := sdk.Coins{ - sdk.NewInt64Coin("ncheq", 1000000*1e9), // 1mn CHEQ + sdk.NewInt64Coin(didtypes.BaseMinimalDenom, 1000000*1e9), // 1mn CHEQ } err = s.app.BankKeeper.MintCoins(s.ctx, minttypes.ModuleName, someCoins) if err != nil { diff --git a/api/cheqd/did/v2/tx.pulsar.go b/api/cheqd/did/v2/tx.pulsar.go index 3c9bfa0c0..7a0e4fbb3 100644 --- a/api/cheqd/did/v2/tx.pulsar.go +++ b/api/cheqd/did/v2/tx.pulsar.go @@ -8429,6 +8429,984 @@ func (x *fastReflection_MsgBurnResponse) ProtoMethods() *protoiface.Methods { } } +var _ protoreflect.List = (*_MsgMint_3_list)(nil) + +type _MsgMint_3_list struct { + list *[]*v1beta1.Coin +} + +func (x *_MsgMint_3_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_MsgMint_3_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) +} + +func (x *_MsgMint_3_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*v1beta1.Coin) + (*x.list)[i] = concreteValue +} + +func (x *_MsgMint_3_list) Append(value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*v1beta1.Coin) + *x.list = append(*x.list, concreteValue) +} + +func (x *_MsgMint_3_list) AppendMutable() protoreflect.Value { + v := new(v1beta1.Coin) + *x.list = append(*x.list, v) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_MsgMint_3_list) Truncate(n int) { + for i := n; i < len(*x.list); i++ { + (*x.list)[i] = nil + } + *x.list = (*x.list)[:n] +} + +func (x *_MsgMint_3_list) NewElement() protoreflect.Value { + v := new(v1beta1.Coin) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_MsgMint_3_list) IsValid() bool { + return x.list != nil +} + +var ( + md_MsgMint protoreflect.MessageDescriptor + fd_MsgMint_authority protoreflect.FieldDescriptor + fd_MsgMint_to_address protoreflect.FieldDescriptor + fd_MsgMint_amount protoreflect.FieldDescriptor +) + +func init() { + file_cheqd_did_v2_tx_proto_init() + md_MsgMint = File_cheqd_did_v2_tx_proto.Messages().ByName("MsgMint") + fd_MsgMint_authority = md_MsgMint.Fields().ByName("authority") + fd_MsgMint_to_address = md_MsgMint.Fields().ByName("to_address") + fd_MsgMint_amount = md_MsgMint.Fields().ByName("amount") +} + +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_cheqd_did_v2_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.Authority != "" { + value := protoreflect.ValueOfString(x.Authority) + if !f(fd_MsgMint_authority, value) { + return + } + } + if x.ToAddress != "" { + value := protoreflect.ValueOfString(x.ToAddress) + if !f(fd_MsgMint_to_address, value) { + return + } + } + if len(x.Amount) != 0 { + value := protoreflect.ValueOfList(&_MsgMint_3_list{list: &x.Amount}) + if !f(fd_MsgMint_amount, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgMint) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "cheqd.did.v2.MsgMint.authority": + return x.Authority != "" + case "cheqd.did.v2.MsgMint.to_address": + return x.ToAddress != "" + case "cheqd.did.v2.MsgMint.amount": + return len(x.Amount) != 0 + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cheqd.did.v2.MsgMint")) + } + panic(fmt.Errorf("message cheqd.did.v2.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 "cheqd.did.v2.MsgMint.authority": + x.Authority = "" + case "cheqd.did.v2.MsgMint.to_address": + x.ToAddress = "" + case "cheqd.did.v2.MsgMint.amount": + x.Amount = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cheqd.did.v2.MsgMint")) + } + panic(fmt.Errorf("message cheqd.did.v2.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 "cheqd.did.v2.MsgMint.authority": + value := x.Authority + return protoreflect.ValueOfString(value) + case "cheqd.did.v2.MsgMint.to_address": + value := x.ToAddress + return protoreflect.ValueOfString(value) + case "cheqd.did.v2.MsgMint.amount": + if len(x.Amount) == 0 { + return protoreflect.ValueOfList(&_MsgMint_3_list{}) + } + listValue := &_MsgMint_3_list{list: &x.Amount} + return protoreflect.ValueOfList(listValue) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cheqd.did.v2.MsgMint")) + } + panic(fmt.Errorf("message cheqd.did.v2.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 "cheqd.did.v2.MsgMint.authority": + x.Authority = value.Interface().(string) + case "cheqd.did.v2.MsgMint.to_address": + x.ToAddress = value.Interface().(string) + case "cheqd.did.v2.MsgMint.amount": + lv := value.List() + clv := lv.(*_MsgMint_3_list) + x.Amount = *clv.list + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cheqd.did.v2.MsgMint")) + } + panic(fmt.Errorf("message cheqd.did.v2.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 "cheqd.did.v2.MsgMint.amount": + if x.Amount == nil { + x.Amount = []*v1beta1.Coin{} + } + value := &_MsgMint_3_list{list: &x.Amount} + return protoreflect.ValueOfList(value) + case "cheqd.did.v2.MsgMint.authority": + panic(fmt.Errorf("field authority of message cheqd.did.v2.MsgMint is not mutable")) + case "cheqd.did.v2.MsgMint.to_address": + panic(fmt.Errorf("field to_address of message cheqd.did.v2.MsgMint is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cheqd.did.v2.MsgMint")) + } + panic(fmt.Errorf("message cheqd.did.v2.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 "cheqd.did.v2.MsgMint.authority": + return protoreflect.ValueOfString("") + case "cheqd.did.v2.MsgMint.to_address": + return protoreflect.ValueOfString("") + case "cheqd.did.v2.MsgMint.amount": + list := []*v1beta1.Coin{} + return protoreflect.ValueOfList(&_MsgMint_3_list{list: &list}) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cheqd.did.v2.MsgMint")) + } + panic(fmt.Errorf("message cheqd.did.v2.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 cheqd.did.v2.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.Authority) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.ToAddress) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if len(x.Amount) > 0 { + for _, e := range x.Amount { + l = options.Size(e) + n += 1 + l + runtime.Sov(uint64(l)) + } + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*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.Amount) > 0 { + for iNdEx := len(x.Amount) - 1; iNdEx >= 0; iNdEx-- { + encoded, err := options.Marshal(x.Amount[iNdEx]) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x1a + } + } + if len(x.ToAddress) > 0 { + i -= len(x.ToAddress) + copy(dAtA[i:], x.ToAddress) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.ToAddress))) + 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().(*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 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 ToAddress", 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.ToAddress = 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 Amount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Amount = append(x.Amount, &v1beta1.Coin{}) + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Amount[len(x.Amount)-1]); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_MsgMintResponse protoreflect.MessageDescriptor +) + +func init() { + file_cheqd_did_v2_tx_proto_init() + md_MsgMintResponse = File_cheqd_did_v2_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_cheqd_did_v2_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: cheqd.did.v2.MsgMintResponse")) + } + panic(fmt.Errorf("message cheqd.did.v2.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: cheqd.did.v2.MsgMintResponse")) + } + panic(fmt.Errorf("message cheqd.did.v2.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: cheqd.did.v2.MsgMintResponse")) + } + panic(fmt.Errorf("message cheqd.did.v2.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: cheqd.did.v2.MsgMintResponse")) + } + panic(fmt.Errorf("message cheqd.did.v2.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: cheqd.did.v2.MsgMintResponse")) + } + panic(fmt.Errorf("message cheqd.did.v2.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: cheqd.did.v2.MsgMintResponse")) + } + panic(fmt.Errorf("message cheqd.did.v2.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 cheqd.did.v2.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, + } +} + // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.0 @@ -9175,6 +10153,87 @@ func (*MsgBurnResponse) Descriptor() ([]byte, []int) { return file_cheqd_did_v2_tx_proto_rawDescGZIP(), []int{11} } +// MsgMint is the sdk.Msg type for allowing an admin account to mint +// more of a token. +// Only the admin of the token factory denom has permission to mint unless +// the denom does not have any admin. +type MsgMint struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + ToAddress string `protobuf:"bytes,2,opt,name=to_address,json=toAddress,proto3" json:"to_address,omitempty"` + Amount []*v1beta1.Coin `protobuf:"bytes,3,rep,name=amount,proto3" json:"amount,omitempty"` +} + +func (x *MsgMint) Reset() { + *x = MsgMint{} + if protoimpl.UnsafeEnabled { + mi := &file_cheqd_did_v2_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_cheqd_did_v2_tx_proto_rawDescGZIP(), []int{12} +} + +func (x *MsgMint) GetAuthority() string { + if x != nil { + return x.Authority + } + return "" +} + +func (x *MsgMint) GetToAddress() string { + if x != nil { + return x.ToAddress + } + return "" +} + +func (x *MsgMint) GetAmount() []*v1beta1.Coin { + if x != nil { + return x.Amount + } + return nil +} + +type MsgMintResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *MsgMintResponse) Reset() { + *x = MsgMintResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_cheqd_did_v2_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_cheqd_did_v2_tx_proto_rawDescGZIP(), []int{13} +} + var File_cheqd_did_v2_tx_proto protoreflect.FileDescriptor var file_cheqd_did_v2_tx_proto_rawDesc = []byte{ @@ -9323,39 +10382,59 @@ var file_cheqd_did_v2_tx_proto_rawDesc = []byte{ 0x6e, 0x74, 0x3a, 0x19, 0x88, 0xa0, 0x1f, 0x00, 0xe8, 0xa0, 0x1f, 0x00, 0x82, 0xe7, 0xb0, 0x2a, 0x0c, 0x66, 0x72, 0x6f, 0x6d, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x11, 0x0a, 0x0f, 0x4d, 0x73, 0x67, 0x42, 0x75, 0x72, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x32, 0xd1, 0x02, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x54, 0x0a, 0x0c, 0x43, 0x72, 0x65, 0x61, - 0x74, 0x65, 0x44, 0x69, 0x64, 0x44, 0x6f, 0x63, 0x12, 0x1d, 0x2e, 0x63, 0x68, 0x65, 0x71, 0x64, - 0x2e, 0x64, 0x69, 0x64, 0x2e, 0x76, 0x32, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, - 0x65, 0x44, 0x69, 0x64, 0x44, 0x6f, 0x63, 0x1a, 0x25, 0x2e, 0x63, 0x68, 0x65, 0x71, 0x64, 0x2e, - 0x64, 0x69, 0x64, 0x2e, 0x76, 0x32, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, - 0x44, 0x69, 0x64, 0x44, 0x6f, 0x63, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x54, - 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x44, 0x69, 0x64, 0x44, 0x6f, 0x63, 0x12, 0x1d, + 0x22, 0xf0, 0x01, 0x0a, 0x07, 0x4d, 0x73, 0x67, 0x4d, 0x69, 0x6e, 0x74, 0x12, 0x32, 0x0a, 0x09, + 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, + 0x14, 0xf2, 0xde, 0x1f, 0x10, 0x79, 0x61, 0x6d, 0x6c, 0x3a, 0x22, 0x61, 0x75, 0x74, 0x68, 0x6f, + 0x72, 0x69, 0x74, 0x79, 0x22, 0x52, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, + 0x12, 0x37, 0x0a, 0x0a, 0x74, 0x6f, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, + 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, + 0x74, 0x6f, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x68, 0x0a, 0x06, 0x61, 0x6d, 0x6f, + 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, + 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x35, 0xc8, 0xde, 0x1f, 0x00, 0xaa, 0xdf, 0x1f, 0x28, 0x67, 0x69, + 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, + 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, + 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x73, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x06, 0x61, 0x6d, 0x6f, + 0x75, 0x6e, 0x74, 0x3a, 0x0e, 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, + 0x69, 0x74, 0x79, 0x22, 0x11, 0x0a, 0x0f, 0x4d, 0x73, 0x67, 0x4d, 0x69, 0x6e, 0x74, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0x8f, 0x03, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x54, + 0x0a, 0x0c, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x44, 0x69, 0x64, 0x44, 0x6f, 0x63, 0x12, 0x1d, 0x2e, 0x63, 0x68, 0x65, 0x71, 0x64, 0x2e, 0x64, 0x69, 0x64, 0x2e, 0x76, 0x32, 0x2e, 0x4d, 0x73, - 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x44, 0x69, 0x64, 0x44, 0x6f, 0x63, 0x1a, 0x25, 0x2e, + 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x44, 0x69, 0x64, 0x44, 0x6f, 0x63, 0x1a, 0x25, 0x2e, 0x63, 0x68, 0x65, 0x71, 0x64, 0x2e, 0x64, 0x69, 0x64, 0x2e, 0x76, 0x32, 0x2e, 0x4d, 0x73, 0x67, - 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x44, 0x69, 0x64, 0x44, 0x6f, 0x63, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x60, 0x0a, 0x10, 0x44, 0x65, 0x61, 0x63, 0x74, 0x69, 0x76, 0x61, - 0x74, 0x65, 0x44, 0x69, 0x64, 0x44, 0x6f, 0x63, 0x12, 0x21, 0x2e, 0x63, 0x68, 0x65, 0x71, 0x64, - 0x2e, 0x64, 0x69, 0x64, 0x2e, 0x76, 0x32, 0x2e, 0x4d, 0x73, 0x67, 0x44, 0x65, 0x61, 0x63, 0x74, - 0x69, 0x76, 0x61, 0x74, 0x65, 0x44, 0x69, 0x64, 0x44, 0x6f, 0x63, 0x1a, 0x29, 0x2e, 0x63, 0x68, - 0x65, 0x71, 0x64, 0x2e, 0x64, 0x69, 0x64, 0x2e, 0x76, 0x32, 0x2e, 0x4d, 0x73, 0x67, 0x44, 0x65, - 0x61, 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x65, 0x44, 0x69, 0x64, 0x44, 0x6f, 0x63, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3c, 0x0a, 0x04, 0x42, 0x75, 0x72, 0x6e, 0x12, 0x15, + 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x44, 0x69, 0x64, 0x44, 0x6f, 0x63, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x54, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x44, 0x69, + 0x64, 0x44, 0x6f, 0x63, 0x12, 0x1d, 0x2e, 0x63, 0x68, 0x65, 0x71, 0x64, 0x2e, 0x64, 0x69, 0x64, + 0x2e, 0x76, 0x32, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x44, 0x69, 0x64, + 0x44, 0x6f, 0x63, 0x1a, 0x25, 0x2e, 0x63, 0x68, 0x65, 0x71, 0x64, 0x2e, 0x64, 0x69, 0x64, 0x2e, + 0x76, 0x32, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x44, 0x69, 0x64, 0x44, + 0x6f, 0x63, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x60, 0x0a, 0x10, 0x44, 0x65, + 0x61, 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x65, 0x44, 0x69, 0x64, 0x44, 0x6f, 0x63, 0x12, 0x21, 0x2e, 0x63, 0x68, 0x65, 0x71, 0x64, 0x2e, 0x64, 0x69, 0x64, 0x2e, 0x76, 0x32, 0x2e, 0x4d, 0x73, - 0x67, 0x42, 0x75, 0x72, 0x6e, 0x1a, 0x1d, 0x2e, 0x63, 0x68, 0x65, 0x71, 0x64, 0x2e, 0x64, 0x69, - 0x64, 0x2e, 0x76, 0x32, 0x2e, 0x4d, 0x73, 0x67, 0x42, 0x75, 0x72, 0x6e, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x42, 0xa4, 0x01, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x68, 0x65, - 0x71, 0x64, 0x2e, 0x64, 0x69, 0x64, 0x2e, 0x76, 0x32, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, - 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x35, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, - 0x2f, 0x63, 0x68, 0x65, 0x71, 0x64, 0x2f, 0x63, 0x68, 0x65, 0x71, 0x64, 0x2d, 0x6e, 0x6f, 0x64, - 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x2f, 0x63, 0x68, 0x65, 0x71, 0x64, 0x2f, 0x64, - 0x69, 0x64, 0x2f, 0x76, 0x32, 0x3b, 0x64, 0x69, 0x64, 0x76, 0x32, 0xa2, 0x02, 0x03, 0x43, 0x44, - 0x58, 0xaa, 0x02, 0x0c, 0x43, 0x68, 0x65, 0x71, 0x64, 0x2e, 0x44, 0x69, 0x64, 0x2e, 0x56, 0x32, - 0xca, 0x02, 0x0c, 0x43, 0x68, 0x65, 0x71, 0x64, 0x5c, 0x44, 0x69, 0x64, 0x5c, 0x56, 0x32, 0xe2, - 0x02, 0x18, 0x43, 0x68, 0x65, 0x71, 0x64, 0x5c, 0x44, 0x69, 0x64, 0x5c, 0x56, 0x32, 0x5c, 0x47, - 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0e, 0x43, 0x68, 0x65, - 0x71, 0x64, 0x3a, 0x3a, 0x44, 0x69, 0x64, 0x3a, 0x3a, 0x56, 0x32, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, + 0x67, 0x44, 0x65, 0x61, 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x65, 0x44, 0x69, 0x64, 0x44, 0x6f, + 0x63, 0x1a, 0x29, 0x2e, 0x63, 0x68, 0x65, 0x71, 0x64, 0x2e, 0x64, 0x69, 0x64, 0x2e, 0x76, 0x32, + 0x2e, 0x4d, 0x73, 0x67, 0x44, 0x65, 0x61, 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x65, 0x44, 0x69, + 0x64, 0x44, 0x6f, 0x63, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3c, 0x0a, 0x04, + 0x42, 0x75, 0x72, 0x6e, 0x12, 0x15, 0x2e, 0x63, 0x68, 0x65, 0x71, 0x64, 0x2e, 0x64, 0x69, 0x64, + 0x2e, 0x76, 0x32, 0x2e, 0x4d, 0x73, 0x67, 0x42, 0x75, 0x72, 0x6e, 0x1a, 0x1d, 0x2e, 0x63, 0x68, + 0x65, 0x71, 0x64, 0x2e, 0x64, 0x69, 0x64, 0x2e, 0x76, 0x32, 0x2e, 0x4d, 0x73, 0x67, 0x42, 0x75, + 0x72, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3c, 0x0a, 0x04, 0x4d, 0x69, + 0x6e, 0x74, 0x12, 0x15, 0x2e, 0x63, 0x68, 0x65, 0x71, 0x64, 0x2e, 0x64, 0x69, 0x64, 0x2e, 0x76, + 0x32, 0x2e, 0x4d, 0x73, 0x67, 0x4d, 0x69, 0x6e, 0x74, 0x1a, 0x1d, 0x2e, 0x63, 0x68, 0x65, 0x71, + 0x64, 0x2e, 0x64, 0x69, 0x64, 0x2e, 0x76, 0x32, 0x2e, 0x4d, 0x73, 0x67, 0x4d, 0x69, 0x6e, 0x74, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0xa4, 0x01, 0x0a, 0x10, 0x63, 0x6f, 0x6d, + 0x2e, 0x63, 0x68, 0x65, 0x71, 0x64, 0x2e, 0x64, 0x69, 0x64, 0x2e, 0x76, 0x32, 0x42, 0x07, 0x54, + 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x35, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, + 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x68, 0x65, 0x71, 0x64, 0x2f, 0x63, 0x68, 0x65, 0x71, 0x64, + 0x2d, 0x6e, 0x6f, 0x64, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x2f, 0x63, 0x68, 0x65, + 0x71, 0x64, 0x2f, 0x64, 0x69, 0x64, 0x2f, 0x76, 0x32, 0x3b, 0x64, 0x69, 0x64, 0x76, 0x32, 0xa2, + 0x02, 0x03, 0x43, 0x44, 0x58, 0xaa, 0x02, 0x0c, 0x43, 0x68, 0x65, 0x71, 0x64, 0x2e, 0x44, 0x69, + 0x64, 0x2e, 0x56, 0x32, 0xca, 0x02, 0x0c, 0x43, 0x68, 0x65, 0x71, 0x64, 0x5c, 0x44, 0x69, 0x64, + 0x5c, 0x56, 0x32, 0xe2, 0x02, 0x18, 0x43, 0x68, 0x65, 0x71, 0x64, 0x5c, 0x44, 0x69, 0x64, 0x5c, + 0x56, 0x32, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, + 0x0e, 0x43, 0x68, 0x65, 0x71, 0x64, 0x3a, 0x3a, 0x44, 0x69, 0x64, 0x3a, 0x3a, 0x56, 0x32, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -9370,7 +10449,7 @@ func file_cheqd_did_v2_tx_proto_rawDescGZIP() []byte { return file_cheqd_did_v2_tx_proto_rawDescData } -var file_cheqd_did_v2_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 12) +var file_cheqd_did_v2_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 14) var file_cheqd_did_v2_tx_proto_goTypes = []interface{}{ (*MsgCreateDidDoc)(nil), // 0: cheqd.did.v2.MsgCreateDidDoc (*MsgUpdateDidDoc)(nil), // 1: cheqd.did.v2.MsgUpdateDidDoc @@ -9384,10 +10463,12 @@ var file_cheqd_did_v2_tx_proto_goTypes = []interface{}{ (*MsgDeactivateDidDocResponse)(nil), // 9: cheqd.did.v2.MsgDeactivateDidDocResponse (*MsgBurn)(nil), // 10: cheqd.did.v2.MsgBurn (*MsgBurnResponse)(nil), // 11: cheqd.did.v2.MsgBurnResponse - (*VerificationMethod)(nil), // 12: cheqd.did.v2.VerificationMethod - (*Service)(nil), // 13: cheqd.did.v2.Service - (*DidDocWithMetadata)(nil), // 14: cheqd.did.v2.DidDocWithMetadata - (*v1beta1.Coin)(nil), // 15: cosmos.base.v1beta1.Coin + (*MsgMint)(nil), // 12: cheqd.did.v2.MsgMint + (*MsgMintResponse)(nil), // 13: cheqd.did.v2.MsgMintResponse + (*VerificationMethod)(nil), // 14: cheqd.did.v2.VerificationMethod + (*Service)(nil), // 15: cheqd.did.v2.Service + (*DidDocWithMetadata)(nil), // 16: cheqd.did.v2.DidDocWithMetadata + (*v1beta1.Coin)(nil), // 17: cosmos.base.v1beta1.Coin } var file_cheqd_did_v2_tx_proto_depIdxs = []int32{ 4, // 0: cheqd.did.v2.MsgCreateDidDoc.payload:type_name -> cheqd.did.v2.MsgCreateDidDocPayload @@ -9396,27 +10477,30 @@ var file_cheqd_did_v2_tx_proto_depIdxs = []int32{ 3, // 3: cheqd.did.v2.MsgUpdateDidDoc.signatures:type_name -> cheqd.did.v2.SignInfo 8, // 4: cheqd.did.v2.MsgDeactivateDidDoc.payload:type_name -> cheqd.did.v2.MsgDeactivateDidDocPayload 3, // 5: cheqd.did.v2.MsgDeactivateDidDoc.signatures:type_name -> cheqd.did.v2.SignInfo - 12, // 6: cheqd.did.v2.MsgCreateDidDocPayload.verification_method:type_name -> cheqd.did.v2.VerificationMethod - 13, // 7: cheqd.did.v2.MsgCreateDidDocPayload.service:type_name -> cheqd.did.v2.Service - 14, // 8: cheqd.did.v2.MsgCreateDidDocResponse.value:type_name -> cheqd.did.v2.DidDocWithMetadata - 12, // 9: cheqd.did.v2.MsgUpdateDidDocPayload.verification_method:type_name -> cheqd.did.v2.VerificationMethod - 13, // 10: cheqd.did.v2.MsgUpdateDidDocPayload.service:type_name -> cheqd.did.v2.Service - 14, // 11: cheqd.did.v2.MsgUpdateDidDocResponse.value:type_name -> cheqd.did.v2.DidDocWithMetadata - 14, // 12: cheqd.did.v2.MsgDeactivateDidDocResponse.value:type_name -> cheqd.did.v2.DidDocWithMetadata - 15, // 13: cheqd.did.v2.MsgBurn.amount:type_name -> cosmos.base.v1beta1.Coin - 0, // 14: cheqd.did.v2.Msg.CreateDidDoc:input_type -> cheqd.did.v2.MsgCreateDidDoc - 1, // 15: cheqd.did.v2.Msg.UpdateDidDoc:input_type -> cheqd.did.v2.MsgUpdateDidDoc - 2, // 16: cheqd.did.v2.Msg.DeactivateDidDoc:input_type -> cheqd.did.v2.MsgDeactivateDidDoc - 10, // 17: cheqd.did.v2.Msg.Burn:input_type -> cheqd.did.v2.MsgBurn - 5, // 18: cheqd.did.v2.Msg.CreateDidDoc:output_type -> cheqd.did.v2.MsgCreateDidDocResponse - 7, // 19: cheqd.did.v2.Msg.UpdateDidDoc:output_type -> cheqd.did.v2.MsgUpdateDidDocResponse - 9, // 20: cheqd.did.v2.Msg.DeactivateDidDoc:output_type -> cheqd.did.v2.MsgDeactivateDidDocResponse - 11, // 21: cheqd.did.v2.Msg.Burn:output_type -> cheqd.did.v2.MsgBurnResponse - 18, // [18:22] is the sub-list for method output_type - 14, // [14:18] is the sub-list for method input_type - 14, // [14:14] is the sub-list for extension type_name - 14, // [14:14] is the sub-list for extension extendee - 0, // [0:14] is the sub-list for field type_name + 14, // 6: cheqd.did.v2.MsgCreateDidDocPayload.verification_method:type_name -> cheqd.did.v2.VerificationMethod + 15, // 7: cheqd.did.v2.MsgCreateDidDocPayload.service:type_name -> cheqd.did.v2.Service + 16, // 8: cheqd.did.v2.MsgCreateDidDocResponse.value:type_name -> cheqd.did.v2.DidDocWithMetadata + 14, // 9: cheqd.did.v2.MsgUpdateDidDocPayload.verification_method:type_name -> cheqd.did.v2.VerificationMethod + 15, // 10: cheqd.did.v2.MsgUpdateDidDocPayload.service:type_name -> cheqd.did.v2.Service + 16, // 11: cheqd.did.v2.MsgUpdateDidDocResponse.value:type_name -> cheqd.did.v2.DidDocWithMetadata + 16, // 12: cheqd.did.v2.MsgDeactivateDidDocResponse.value:type_name -> cheqd.did.v2.DidDocWithMetadata + 17, // 13: cheqd.did.v2.MsgBurn.amount:type_name -> cosmos.base.v1beta1.Coin + 17, // 14: cheqd.did.v2.MsgMint.amount:type_name -> cosmos.base.v1beta1.Coin + 0, // 15: cheqd.did.v2.Msg.CreateDidDoc:input_type -> cheqd.did.v2.MsgCreateDidDoc + 1, // 16: cheqd.did.v2.Msg.UpdateDidDoc:input_type -> cheqd.did.v2.MsgUpdateDidDoc + 2, // 17: cheqd.did.v2.Msg.DeactivateDidDoc:input_type -> cheqd.did.v2.MsgDeactivateDidDoc + 10, // 18: cheqd.did.v2.Msg.Burn:input_type -> cheqd.did.v2.MsgBurn + 12, // 19: cheqd.did.v2.Msg.Mint:input_type -> cheqd.did.v2.MsgMint + 5, // 20: cheqd.did.v2.Msg.CreateDidDoc:output_type -> cheqd.did.v2.MsgCreateDidDocResponse + 7, // 21: cheqd.did.v2.Msg.UpdateDidDoc:output_type -> cheqd.did.v2.MsgUpdateDidDocResponse + 9, // 22: cheqd.did.v2.Msg.DeactivateDidDoc:output_type -> cheqd.did.v2.MsgDeactivateDidDocResponse + 11, // 23: cheqd.did.v2.Msg.Burn:output_type -> cheqd.did.v2.MsgBurnResponse + 13, // 24: cheqd.did.v2.Msg.Mint:output_type -> cheqd.did.v2.MsgMintResponse + 20, // [20:25] is the sub-list for method output_type + 15, // [15:20] is the sub-list for method input_type + 15, // [15:15] is the sub-list for extension type_name + 15, // [15:15] is the sub-list for extension extendee + 0, // [0:15] is the sub-list for field type_name } func init() { file_cheqd_did_v2_tx_proto_init() } @@ -9570,6 +10654,30 @@ func file_cheqd_did_v2_tx_proto_init() { return nil } } + file_cheqd_did_v2_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_cheqd_did_v2_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 + } + } } type x struct{} out := protoimpl.TypeBuilder{ @@ -9577,7 +10685,7 @@ func file_cheqd_did_v2_tx_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_cheqd_did_v2_tx_proto_rawDesc, NumEnums: 0, - NumMessages: 12, + NumMessages: 14, NumExtensions: 0, NumServices: 1, }, diff --git a/api/cheqd/did/v2/tx_grpc.pb.go b/api/cheqd/did/v2/tx_grpc.pb.go index bad1490e0..5ab3b5c06 100644 --- a/api/cheqd/did/v2/tx_grpc.pb.go +++ b/api/cheqd/did/v2/tx_grpc.pb.go @@ -23,6 +23,7 @@ const ( Msg_UpdateDidDoc_FullMethodName = "/cheqd.did.v2.Msg/UpdateDidDoc" Msg_DeactivateDidDoc_FullMethodName = "/cheqd.did.v2.Msg/DeactivateDidDoc" Msg_Burn_FullMethodName = "/cheqd.did.v2.Msg/Burn" + Msg_Mint_FullMethodName = "/cheqd.did.v2.Msg/Mint" ) // MsgClient is the client API for Msg service. @@ -38,6 +39,8 @@ type MsgClient interface { // DeactivateDidDoc defines a method for deactivating an existing DID document DeactivateDidDoc(ctx context.Context, in *MsgDeactivateDidDoc, opts ...grpc.CallOption) (*MsgDeactivateDidDocResponse, error) Burn(ctx context.Context, in *MsgBurn, opts ...grpc.CallOption) (*MsgBurnResponse, error) + // Mint defines a method to mint tokens to the given address. + Mint(ctx context.Context, in *MsgMint, opts ...grpc.CallOption) (*MsgMintResponse, error) } type msgClient struct { @@ -88,6 +91,16 @@ func (c *msgClient) Burn(ctx context.Context, in *MsgBurn, opts ...grpc.CallOpti return out, nil } +func (c *msgClient) Mint(ctx context.Context, in *MsgMint, opts ...grpc.CallOption) (*MsgMintResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(MsgMintResponse) + err := c.cc.Invoke(ctx, Msg_Mint_FullMethodName, in, out, cOpts...) + 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. @@ -101,6 +114,8 @@ type MsgServer interface { // DeactivateDidDoc defines a method for deactivating an existing DID document DeactivateDidDoc(context.Context, *MsgDeactivateDidDoc) (*MsgDeactivateDidDocResponse, error) Burn(context.Context, *MsgBurn) (*MsgBurnResponse, error) + // Mint defines a method to mint tokens to the given address. + Mint(context.Context, *MsgMint) (*MsgMintResponse, error) mustEmbedUnimplementedMsgServer() } @@ -123,6 +138,9 @@ func (UnimplementedMsgServer) DeactivateDidDoc(context.Context, *MsgDeactivateDi func (UnimplementedMsgServer) Burn(context.Context, *MsgBurn) (*MsgBurnResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Burn not implemented") } +func (UnimplementedMsgServer) Mint(context.Context, *MsgMint) (*MsgMintResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Mint not implemented") +} func (UnimplementedMsgServer) mustEmbedUnimplementedMsgServer() {} func (UnimplementedMsgServer) testEmbeddedByValue() {} @@ -216,6 +234,24 @@ func _Msg_Burn_Handler(srv interface{}, ctx context.Context, dec func(interface{ 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) +} + // 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) @@ -239,6 +275,10 @@ var Msg_ServiceDesc = grpc.ServiceDesc{ MethodName: "Burn", Handler: _Msg_Burn_Handler, }, + { + MethodName: "Mint", + Handler: _Msg_Mint_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "cheqd/did/v2/tx.proto", diff --git a/app/app.go b/app/app.go index 0391f3b6f..45f28c833 100644 --- a/app/app.go +++ b/app/app.go @@ -198,7 +198,7 @@ var ( stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking}, govtypes.ModuleName: {authtypes.Burner}, ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner}, - didtypes.ModuleName: {authtypes.Burner}, + didtypes.ModuleName: {authtypes.Minter, authtypes.Burner}, feemarkettypes.ModuleName: {authtypes.Burner}, feemarkettypes.FeeCollectorName: {authtypes.Burner}, feeabstypes.ModuleName: nil, @@ -651,7 +651,7 @@ func New( appCodec, keys[didtypes.StoreKey], app.GetSubspace(didtypes.ModuleName), app.AccountKeeper, app.BankKeeper, - app.StakingKeeper, + app.StakingKeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) // NOTE: we may consider parsing `appOpts` inside module constructors. For the moment diff --git a/docker/localnet/docker-compose.yml b/docker/localnet/docker-compose.yml index eba74877f..255b52dce 100644 --- a/docker/localnet/docker-compose.yml +++ b/docker/localnet/docker-compose.yml @@ -1,5 +1,3 @@ -version: '3.8' - services: validator-0: image: ${BUILD_IMAGE} diff --git a/docker/localnet/gen-network-config.sh b/docker/localnet/gen-network-config.sh index 8bb51683c..6b7467524 100644 --- a/docker/localnet/gen-network-config.sh +++ b/docker/localnet/gen-network-config.sh @@ -185,6 +185,12 @@ configure_genesis "${TMP_NODE_HOME}" "${TMP_NODE_MONIKER}" mkdir "${TMP_NODE_HOME}/config/gentx" +mnemonics=( + "mix around destroy web fever address comfort vendor tank sudden abstract cabin acoustic attitude peasant hospital vendor harsh void current shield couple barrel suspect" + "useful case library girl narrow plate knee side supreme base horror fence tent glass leaf okay budget chalk patch forum coil crunch employ need" + "slight oblige answer vault project symbol dismiss match match honey forum wood resist exotic inner close foil notice onion acquire sausage boost acquire produce" + "prefer spring subject mimic shadow biology connect option east dirt security surge thrive kiwi nothing pulse holiday license hub pitch motion sunny pelican birth" +) # Adding genesis validators for ((i=0 ; i= height { + fmt.Printf("Container %s reached height %d after %d seconds of waiting.\n", container, height, *waited) + *waited = period + 1 + return + } + + if *waited == period { + fmt.Printf("Container %s did not reach height %d after %d seconds of waiting.\n", container, height, *waited) + return + } + + fmt.Printf("Container %s is at height %d after %d seconds of waiting, with a max waiting period of %d.\n", container, status.SyncInfo.LatestBlockHeight, *waited, period) +} + +func waitCaughtUpCallback(container string, binary string, period int64, waited *int64, waitInterval *int64, wg *sync.WaitGroup) { + defer wg.Done() + + time.Sleep(time.Duration(*waitInterval) * time.Second) + *waited += *waitInterval + + status, err := GetNodeStatus(container, binary) + if err != nil { + panic(err) + } + + if !status.SyncInfo.CatchingUp { + fmt.Printf("Container %s is caught up after %d seconds of waiting.\n", container, *waited) + *waited = period + 1 + return + } + + if *waited == period { + fmt.Printf("Container %s is not caught up after %d seconds of waiting.\n", container, *waited) + return + } + + fmt.Printf("Container %s is still catching up after %d seconds of waiting, with a max waiting period of %d.\n", container, *waited, period) +} + +func TrimExtraLineOffset(input string, offset int) string { + return strings.Join(strings.Split(input, "\n")[offset:], "") +} + +func MakeCodecWithExtendedRegistry() codec.Codec { + interfaceRegistry := types.NewInterfaceRegistry() + + // TODO: Remove nolint after cheqd-node release v1.x is successful + // Register the interfaces from the cosmos-sdk codebase. + interfaceRegistry.RegisterImplementations( + (*govtypesv1beta1.Content)(nil), + //nolint: staticcheck + &upgradetypes.SoftwareUpgradeProposal{}, + ¶mproposal.ParameterChangeProposal{}, + ) + + interfaceRegistry.RegisterImplementations( + (*sdk.Msg)(nil), + &upgradetypes.MsgSoftwareUpgrade{}, + &govtypesv1.MsgExecLegacyContent{}, + &didv2.MsgBurn{}, + &didv2.MsgMint{}, + ) + + return codec.NewProtoCodec(interfaceRegistry) +} diff --git a/tests/integration/cli/query.go b/tests/integration/cli/query.go index bb067784a..cdcc9f795 100644 --- a/tests/integration/cli/query.go +++ b/tests/integration/cli/query.go @@ -1,12 +1,15 @@ package cli import ( + "fmt" + "github.com/cheqd/cheqd-node/tests/integration/helpers" "github.com/cheqd/cheqd-node/tests/integration/network" didtypes "github.com/cheqd/cheqd-node/x/did/types" resourcetypes "github.com/cheqd/cheqd-node/x/resource/types" sdk "github.com/cosmos/cosmos-sdk/types" + govtypesv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" paramproposal "github.com/cosmos/cosmos-sdk/x/params/types/proposal" ) @@ -131,3 +134,26 @@ func QueryTxn(hash string) (sdk.TxResponse, error) { return resp, nil } + +func QueryProposal(container, id string) (govtypesv1.Proposal, error) { + fmt.Println("Querying proposal from", container) + args := append([]string{ + CliBinaryName, + "query", "gov", "proposal", id, + }, QueryParamsConst...) + + out, err := LocalnetExecExec(container, args...) + if err != nil { + return govtypesv1.Proposal{}, err + } + + fmt.Println("Proposal", out) + + var resp govtypesv1.Proposal + + err = MakeCodecWithExtendedRegistry().UnmarshalJSON([]byte(out), &resp) + if err != nil { + return govtypesv1.Proposal{}, err + } + return resp, nil +} diff --git a/tests/integration/cli/tx.go b/tests/integration/cli/tx.go index e53dfe9ed..842957903 100644 --- a/tests/integration/cli/tx.go +++ b/tests/integration/cli/tx.go @@ -2,6 +2,8 @@ package cli import ( "encoding/json" + "fmt" + "path/filepath" "github.com/cheqd/cheqd-node/tests/integration/helpers" "github.com/cheqd/cheqd-node/tests/integration/network" @@ -168,3 +170,75 @@ func CreateResource(tmpDir string, payload resourcetypes.MsgCreateResourcePayloa func BurnMsg(from string, coins string, feeParams []string) (sdk.TxResponse, error) { return Tx("cheqd", "burn", from, feeParams, coins) } + +func SubmitProposal(container string, feeParams []string, pathToDir ...string) (sdk.TxResponse, error) { + args := append([]string{ + CliBinaryName, + "tx", "gov", "submit-proposal", filepath.Join(pathToDir...), + "--from", OperatorAccounts[container], + }, TXParams...) + + args = append(args, GasParams...) + + out, err := LocalnetExecExec(container, args...) + if err != nil { + fmt.Println("Error on submitting ParamChangeProposal", err) + fmt.Println("Output:", out) + return sdk.TxResponse{}, err + } + // Skip 'gas estimate: xxx' string, trim 'Successfully migrated key' string + out = helpers.TrimImportedStdout(out) + + fmt.Println("Output:", out) + + out = helpers.TrimImportedStdout(out) + + var resp sdk.TxResponse + + err = helpers.Codec.UnmarshalJSON([]byte(out), &resp) + if err != nil { + fmt.Println("JSON unmarshal error: output:", out) + return sdk.TxResponse{}, err + } + return resp, nil +} + +func SubmitProposalTx(from, pathToDir string, feeParams []string) (sdk.TxResponse, error) { + return Tx("gov", "submit-proposal", from, feeParams, pathToDir) +} + +func VoteProposalTx(from, option, id string, feeParams []string) (sdk.TxResponse, error) { + return Tx("gov", "vote", from, feeParams, option, id) +} + +func VoteProposal(container, id, option string, feeParams []string) (sdk.TxResponse, error) { + args := append([]string{ + CliBinaryName, + "tx", "gov", "vote", id, option, + "--from", OperatorAccounts[container], + }, TXParams...) + + args = append(args, GasParams...) + + out, err := LocalnetExecExec(container, args...) + if err != nil { + fmt.Println("Error on submitting proposal", err) + fmt.Println("Output:", out) + return sdk.TxResponse{}, err + } + // Skip 'gas estimate: xxx' string, trim 'Successfully migrated key' string + out = helpers.TrimImportedStdout(out) + + fmt.Println("Output:", out) + + out = helpers.TrimImportedStdout(out) + + var resp sdk.TxResponse + + err = helpers.Codec.UnmarshalJSON([]byte(out), &resp) + if err != nil { + fmt.Println("JSON unmarshal error: output:", out) + return sdk.TxResponse{}, err + } + return resp, nil +} diff --git a/tests/integration/cli_defi_test.go b/tests/integration/cli_defi_test.go index 8db1b3712..32471db69 100644 --- a/tests/integration/cli_defi_test.go +++ b/tests/integration/cli_defi_test.go @@ -1,4 +1,4 @@ -//go:build upgrade_integration +//go:build integration package integration @@ -7,6 +7,7 @@ import ( helpers "github.com/cheqd/cheqd-node/tests/integration/helpers" "github.com/cheqd/cheqd-node/tests/integration/testdata" + didtypes "github.com/cheqd/cheqd-node/x/did/types" sdk "github.com/cosmos/cosmos-sdk/types" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" @@ -15,16 +16,16 @@ import ( var _ = Describe("Upgrade - Burn coins from relevant message signer", func() { It("should burn the coins from the given address", func() { // define the coins to burn, in which case 1,000,000 ncheq or 0.01 cheq - burnCoins := sdk.NewCoin("ncheq", sdk.NewInt(1_000_000)) + burnCoins := sdk.NewCoin(didtypes.BaseMinimalDenom, sdk.NewInt(1_000_000)) // get the balance of the account before burning the coins - balanceBefore, err := cli.QueryBalance(testdata.BASE_ACCOUNT_1_ADDR, "ncheq") + balanceBefore, err := cli.QueryBalance(testdata.BASE_ACCOUNT_1_ADDR, didtypes.BaseMinimalDenom) // assert no error Expect(err).To(BeNil()) - // generate fixed fees, in which case 1,000,000 ncheq or 0.01 cheq - fees := helpers.GenerateFees("1000000ncheq") + // generate fixed fees, in which case 500,000,000 ncheq or 0.5 cheq + fees := helpers.GenerateFees("500000000ncheq") // burn the coins res, err := cli.BurnMsg(testdata.BASE_ACCOUNT_1, burnCoins.String(), fees) @@ -36,7 +37,7 @@ var _ = Describe("Upgrade - Burn coins from relevant message signer", func() { Expect(res.Code).To(BeEquivalentTo(0)) // get the balance of the account after burning the coins - balanceAfter, err := cli.QueryBalance(testdata.BASE_ACCOUNT_1_ADDR, "ncheq") + balanceAfter, err := cli.QueryBalance(testdata.BASE_ACCOUNT_1_ADDR, didtypes.BaseMinimalDenom) // assert no error Expect(err).To(BeNil()) @@ -45,7 +46,7 @@ var _ = Describe("Upgrade - Burn coins from relevant message signer", func() { diff := balanceBefore.Sub(balanceAfter) // assert the difference is equal to the coins burnt - total := burnCoins.Add(sdk.NewCoin("ncheq", sdk.NewInt(1_000_000))) + total := burnCoins.Add(sdk.NewCoin(didtypes.BaseMinimalDenom, sdk.NewInt(500_000_000))) // assert the difference is equal to the coins burnt Expect(diff).To(Equal(total)) @@ -53,16 +54,16 @@ var _ = Describe("Upgrade - Burn coins from relevant message signer", func() { It("shouldn't burn as their are insufficient funds in the sender", func() { // define the coins to burn, in which case 1,000,000 ncheq or 0.01 cheq - coins := sdk.NewCoin("ncheq", sdk.NewInt(1_000_000)) + coins := sdk.NewCoin(didtypes.BaseMinimalDenom, sdk.NewInt(1_000_000)) // get the balance of the account before burning the coins - balanceBefore, err := cli.QueryBalance(testdata.BASE_ACCOUNT_3_ADDR, "ncheq") + balanceBefore, err := cli.QueryBalance(testdata.BASE_ACCOUNT_3_ADDR, didtypes.BaseMinimalDenom) // assert no error Expect(err).To(BeNil()) - // generate fixed fees, in which case 1,000,000 ncheq or 0.01 cheq - fees := helpers.GenerateFees("1000000ncheq") + // generate fixed fees, in which case 500,000,000 ncheq or 0.5 cheq + fees := helpers.GenerateFees("500000000ncheq") // burn the coins res, err := cli.BurnMsg(testdata.BASE_ACCOUNT_3, coins.String(), fees) @@ -74,7 +75,7 @@ var _ = Describe("Upgrade - Burn coins from relevant message signer", func() { Expect(res.Code).To(BeEquivalentTo(0)) // get the balance of the account after burning the coins - balanceAfter, err := cli.QueryBalance(testdata.BASE_ACCOUNT_3_ADDR, "ncheq") + balanceAfter, err := cli.QueryBalance(testdata.BASE_ACCOUNT_3_ADDR, didtypes.BaseMinimalDenom) // assert no error Expect(err).To(BeNil()) diff --git a/tests/integration/cli_mint_proposal_test.go b/tests/integration/cli_mint_proposal_test.go new file mode 100644 index 000000000..a712fdbce --- /dev/null +++ b/tests/integration/cli_mint_proposal_test.go @@ -0,0 +1,87 @@ +//go:build integration + +package integration + +import ( + "path/filepath" + + cli "github.com/cheqd/cheqd-node/tests/integration/cli" + didtypes "github.com/cheqd/cheqd-node/x/did/types" + govtypesv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" + + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" +) + +var _ = Describe("Integration - Mint coins to given address", func() { + It("should wait for node catching up", func() { + By("pinging the node status until catching up is flagged as false ") + err := cli.WaitForCaughtUp(cli.Validator0, cli.CliBinaryName, cli.VotingPeriod*6) + Expect(err).To(BeNil()) + }) + It("should submit a mint proposal ", func() { + By("passing the proposal file to the container") + _, err := cli.LocalnetExecCopyAbsoluteWithPermissions(filepath.Join("proposal.json"), cli.DockerHome, cli.Validator0) + Expect(err).To(BeNil()) + + By("sending a SubmitProposal transaction from `validator0` container") + res, err := cli.SubmitProposalTx(cli.Operator0, "proposal.json", cli.CliGasParams) + Expect(err).To(BeNil()) + Expect(res.Code).To(BeEquivalentTo(0)) + }) + + It("should wait for the proposal submission to be included in a block", func() { + By("getting the current block height") + currentHeight, err := cli.GetCurrentBlockHeight(cli.Validator0, cli.CliBinaryName) + Expect(err).To(BeNil()) + + By("waiting for the proposal to be included in a block") + err = cli.WaitForChainHeight(cli.Validator0, cli.CliBinaryName, currentHeight+1, 2) + Expect(err).To(BeNil()) + }) + + It("should vote for the mint proposal from `validator1` container", func() { + By("sending a VoteProposal transaction from `validator1` container") + res, err := cli.VoteProposalTx(cli.Operator1, "1", "yes", cli.CliGasParams) + Expect(err).To(BeNil()) + Expect(res.Code).To(BeEquivalentTo(0)) + }) + + It("should vote for the mint proposal from `validator2` container", func() { + By("sending a VoteProposal transaction from `validator2` container") + res, err := cli.VoteProposalTx(cli.Operator2, "1", "yes", cli.CliGasParams) + Expect(err).To(BeNil()) + Expect(res.Code).To(BeEquivalentTo(0)) + }) + + It("should vote for the mint proposal from `validator0` container", func() { + By("sending a VoteProposal transaction from `validator0` container") + res, err := cli.VoteProposalTx(cli.Operator0, "1", "yes", cli.CliGasParams) + Expect(err).To(BeNil()) + Expect(res.Code).To(BeEquivalentTo(0)) + }) + + It("should wait for the proposal to pass", func() { + By("getting the current block height") + currentHeight, err := cli.GetCurrentBlockHeight(cli.Validator0, cli.CliBinaryName) + Expect(err).To(BeNil()) + + By("waiting for the proposal to pass") + err = cli.WaitForChainHeight(cli.Validator0, cli.CliBinaryName, currentHeight+20, 25) + Expect(err).To(BeNil()) + }) + + It("should check the proposal status to ensure it has passed", func() { + By("sending a QueryProposal query from `validator0` container") + proposal, err := cli.QueryProposal(cli.Validator0, "1") + Expect(err).To(BeNil()) + Expect(proposal.Status).To(BeEquivalentTo(govtypesv1.StatusPassed)) + }) + + It("should have the correct balance after minting", func() { + By("querying the balance of the given address") + bal, err := cli.QueryBalance("cheqd1lhl9g4rgldadgtz7v6rt50u45uhhj8hhv8d8uf", didtypes.BaseMinimalDenom) + Expect(err).To(BeNil()) + Expect(bal.Amount.Int64()).To(Equal(int64(9000))) + }) +}) diff --git a/tests/integration/helpers/codec.go b/tests/integration/helpers/codec.go index 977eb56b0..645f27130 100644 --- a/tests/integration/helpers/codec.go +++ b/tests/integration/helpers/codec.go @@ -7,6 +7,7 @@ import ( "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/std" + govtypesv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" ) var ( @@ -20,6 +21,7 @@ func init() { std.RegisterInterfaces(encodingConfig.InterfaceRegistry) resourcetypes.RegisterInterfaces(encodingConfig.InterfaceRegistry) didtypes.RegisterInterfaces(encodingConfig.InterfaceRegistry) + govtypesv1.RegisterInterfaces(encodingConfig.InterfaceRegistry) Codec = encodingConfig.Codec Registry = encodingConfig.InterfaceRegistry } diff --git a/tests/integration/proposal.json b/tests/integration/proposal.json new file mode 100644 index 000000000..1ce2ba328 --- /dev/null +++ b/tests/integration/proposal.json @@ -0,0 +1,14 @@ +{ + "messages": [ + { + "@type": "/cheqd.did.v2.MsgMint", + "authority": "cheqd10d07y265gmmuvt4z0w9aw880jnsr700j5ql9az", + "to_address": "cheqd1lhl9g4rgldadgtz7v6rt50u45uhhj8hhv8d8uf", + "amount": [{ "denom": "ncheq", "amount": "9000" }] + } + ], + + "deposit": "10000000000ncheq", + "title": "Mint proposal", + "summary": "Proposal to mint the coins using gov authority address" +} diff --git a/tests/integration/testdata/proposal.json b/tests/integration/testdata/proposal.json new file mode 100644 index 000000000..1ce2ba328 --- /dev/null +++ b/tests/integration/testdata/proposal.json @@ -0,0 +1,14 @@ +{ + "messages": [ + { + "@type": "/cheqd.did.v2.MsgMint", + "authority": "cheqd10d07y265gmmuvt4z0w9aw880jnsr700j5ql9az", + "to_address": "cheqd1lhl9g4rgldadgtz7v6rt50u45uhhj8hhv8d8uf", + "amount": [{ "denom": "ncheq", "amount": "9000" }] + } + ], + + "deposit": "10000000000ncheq", + "title": "Mint proposal", + "summary": "Proposal to mint the coins using gov authority address" +} diff --git a/tests/upgrade/integration/scripts/setup.sh b/tests/upgrade/integration/scripts/setup.sh index 9ae003a44..b8ac907b5 100644 --- a/tests/upgrade/integration/scripts/setup.sh +++ b/tests/upgrade/integration/scripts/setup.sh @@ -8,7 +8,7 @@ pushd "$DIR/../../../../docker/localnet" # Generate configs (make sure old binary is installed locally) bash gen-network-config.sh -sudo chown -R 1000:1000 network-config +# sudo chown -R 1000:1000 network-config # Import keys bash import-keys.sh @@ -19,16 +19,20 @@ docker compose --env-file mainnet-latest.env up --detach --no-build # TODO: Get rid of this sleep. sleep 5 -# Copy keys -sudo docker compose --env-file mainnet-latest.env cp network-config/validator-0/keyring-test validator-0:/home/cheqd/.cheqdnode -sudo docker compose --env-file mainnet-latest.env cp network-config/validator-1/keyring-test validator-1:/home/cheqd/.cheqdnode -sudo docker compose --env-file mainnet-latest.env cp network-config/validator-2/keyring-test validator-2:/home/cheqd/.cheqdnode -sudo docker compose --env-file mainnet-latest.env cp network-config/validator-3/keyring-test validator-3:/home/cheqd/.cheqdnode - -# Restore permissions -sudo docker compose --env-file mainnet-latest.env exec --user root validator-0 chown -R cheqd:cheqd /home/cheqd -sudo docker compose --env-file mainnet-latest.env exec --user root validator-1 chown -R cheqd:cheqd /home/cheqd -sudo docker compose --env-file mainnet-latest.env exec --user root validator-2 chown -R cheqd:cheqd /home/cheqd -sudo docker compose --env-file mainnet-latest.env exec --user root validator-3 chown -R cheqd:cheqd /home/cheqd +sudo docker compose --env-file mainnet-latest.env cp network-config/validator-0/keyring-test validator-0:/home/keyring-test +sudo docker compose --env-file mainnet-latest.env cp network-config/validator-1/keyring-test validator-1:/home/keyring-test +sudo docker compose --env-file mainnet-latest.env cp network-config/validator-2/keyring-test validator-2:/home/keyring-test +sudo docker compose --env-file mainnet-latest.env cp network-config/validator-3/keyring-test validator-3:/home/keyring-test + +# # Restore permissions +sudo docker compose --env-file mainnet-latest.env exec --user root validator-0 chown -R cheqd:cheqd /home +sudo docker compose --env-file mainnet-latest.env exec --user root validator-1 chown -R cheqd:cheqd /home +sudo docker compose --env-file mainnet-latest.env exec --user root validator-2 chown -R cheqd:cheqd /home +sudo docker compose --env-file mainnet-latest.env exec --user root validator-3 chown -R cheqd:cheqd /home + +sudo docker compose --env-file mainnet-latest.env exec validator-0 bash -c 'cp -r "/home/keyring-test" "$HOME/.cheqdnode/"' +sudo docker compose --env-file mainnet-latest.env exec validator-1 bash -c 'cp -r "/home/keyring-test" "$HOME/.cheqdnode/"' +sudo docker compose --env-file mainnet-latest.env exec validator-2 bash -c 'cp -r "/home/keyring-test" "$HOME/.cheqdnode/"' +sudo docker compose --env-file mainnet-latest.env exec validator-3 bash -c 'cp -r "/home/keyring-test" "$HOME/.cheqdnode/"' popd diff --git a/tests/upgrade/integration/v2/cli/helpers.go b/tests/upgrade/integration/v2/cli/helpers.go index 180a6fef0..9ebed2a2b 100644 --- a/tests/upgrade/integration/v2/cli/helpers.go +++ b/tests/upgrade/integration/v2/cli/helpers.go @@ -7,6 +7,7 @@ import ( "sync" "time" + didv2 "github.com/cheqd/cheqd-node/x/did/types" tmbytes "github.com/cometbft/cometbft/libs/bytes" "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec/types" @@ -216,6 +217,7 @@ func MakeCodecWithExtendedRegistry() codec.Codec { (*sdk.Msg)(nil), &upgradetypes.MsgSoftwareUpgrade{}, &govtypesv1.MsgExecLegacyContent{}, + &didv2.MsgMint{}, ) return codec.NewProtoCodec(interfaceRegistry) diff --git a/tests/upgrade/integration/v3/burn_test.go b/tests/upgrade/integration/v3/burn_test.go index d9994cbc5..2e5d2d80b 100644 --- a/tests/upgrade/integration/v3/burn_test.go +++ b/tests/upgrade/integration/v3/burn_test.go @@ -5,6 +5,7 @@ package integration import ( cli "github.com/cheqd/cheqd-node/tests/upgrade/integration/v3/cli" + didtypes "github.com/cheqd/cheqd-node/x/did/types" sdk "github.com/cosmos/cosmos-sdk/types" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" @@ -16,8 +17,9 @@ var _ = Describe("Upgrade - Burn coins from relevant message signer", func() { err := cli.WaitForCaughtUp(cli.Validator0, cli.CliBinaryName, cli.VotingPeriod*6) Expect(err).To(BeNil()) }) + It("should burn the coins from the given address (here container/validator)", func() { - coins := sdk.NewCoins(sdk.Coin{Denom: "ncheq", Amount: sdk.NewInt(1000)}) + coins := sdk.NewCoins(sdk.Coin{Denom: didtypes.BaseMinimalDenom, Amount: sdk.NewInt(1000)}) res, err := cli.BurnMsg(cli.Validator0, coins.String()) Expect(err).To(BeNil()) Expect(res.Code).To(BeEquivalentTo(0)) diff --git a/tests/upgrade/integration/v3/cli/helpers.go b/tests/upgrade/integration/v3/cli/helpers.go index 3df422678..55aa19978 100644 --- a/tests/upgrade/integration/v3/cli/helpers.go +++ b/tests/upgrade/integration/v3/cli/helpers.go @@ -7,7 +7,7 @@ import ( "sync" "time" - cheqdtypes "github.com/cheqd/cheqd-node/x/did/types" + didv2 "github.com/cheqd/cheqd-node/x/did/types" tmbytes "github.com/cometbft/cometbft/libs/bytes" "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec/types" @@ -217,7 +217,8 @@ func MakeCodecWithExtendedRegistry() codec.Codec { (*sdk.Msg)(nil), &upgradetypes.MsgSoftwareUpgrade{}, &govtypesv1.MsgExecLegacyContent{}, - &cheqdtypes.MsgBurn{}, + &didv2.MsgBurn{}, + &didv2.MsgMint{}, ) return codec.NewProtoCodec(interfaceRegistry) diff --git a/tests/upgrade/integration/v3/cli/tx.go b/tests/upgrade/integration/v3/cli/tx.go index f42599a15..3784460a4 100644 --- a/tests/upgrade/integration/v3/cli/tx.go +++ b/tests/upgrade/integration/v3/cli/tx.go @@ -183,3 +183,34 @@ func BurnMsg(container string, coins string) (sdk.TxResponse, error) { } return resp, nil } + +func SubmitProposal(container string, pathToDir ...string) (sdk.TxResponse, error) { + fmt.Println("Submitting proposal from", container) + args := append([]string{ + CliBinaryName, + "tx", "gov", "submit-proposal", filepath.Join(pathToDir...), + "--from", OperatorAccounts[container], + }, TXParams...) + + args = append(args, GasParams...) + + out, err := LocalnetExecExec(container, args...) + if err != nil { + fmt.Println("Error on submitting proposal", err) + fmt.Println("Output:", out) + return sdk.TxResponse{}, err + } + + // Skip 'gas estimate: xxx' string, trim 'Successfully migrated key' string + out = integrationhelpers.TrimImportedStdout(out) + + fmt.Println("Output:", out) + + var resp sdk.TxResponse + + err = integrationhelpers.Codec.UnmarshalJSON([]byte(out), &resp) + if err != nil { + return sdk.TxResponse{}, err + } + return resp, nil +} diff --git a/tests/upgrade/integration/v3/config.go b/tests/upgrade/integration/v3/config.go new file mode 100644 index 000000000..6e873ef75 --- /dev/null +++ b/tests/upgrade/integration/v3/config.go @@ -0,0 +1,6 @@ +package integration + +const ( + GeneratedJSONDir = "generated" + ProposalJSONDir = "mint" +) diff --git a/tests/upgrade/integration/v3/generated/mint/proposal.json b/tests/upgrade/integration/v3/generated/mint/proposal.json new file mode 100644 index 000000000..1ce2ba328 --- /dev/null +++ b/tests/upgrade/integration/v3/generated/mint/proposal.json @@ -0,0 +1,14 @@ +{ + "messages": [ + { + "@type": "/cheqd.did.v2.MsgMint", + "authority": "cheqd10d07y265gmmuvt4z0w9aw880jnsr700j5ql9az", + "to_address": "cheqd1lhl9g4rgldadgtz7v6rt50u45uhhj8hhv8d8uf", + "amount": [{ "denom": "ncheq", "amount": "9000" }] + } + ], + + "deposit": "10000000000ncheq", + "title": "Mint proposal", + "summary": "Proposal to mint the coins using gov authority address" +} diff --git a/tests/upgrade/integration/v3/mint_proposal.go b/tests/upgrade/integration/v3/mint_proposal.go new file mode 100644 index 000000000..1270730b5 --- /dev/null +++ b/tests/upgrade/integration/v3/mint_proposal.go @@ -0,0 +1,84 @@ +//go:build integration + +package integration + +import ( + "path/filepath" + + cli "github.com/cheqd/cheqd-node/tests/upgrade/integration/v3/cli" + govtypesv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" + + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" +) + +var _ = Describe("Upgrade - Fee parameter change proposal", func() { + It("should wait for node catching up", func() { + By("pinging the node status until catching up is flagged as false") + err := cli.WaitForCaughtUp(cli.Validator0, cli.CliBinaryName, cli.VotingPeriod*6) + Expect(err).To(BeNil()) + }) + It("should submit a parameter change proposal for did module (optimistic)", func() { + By("passing the proposal file to the container") + _, err := cli.LocalnetExecCopyAbsoluteWithPermissions(filepath.Join(GeneratedJSONDir, ProposalJSONDir, "proposal.json"), cli.DockerHome, cli.Validator0) + Expect(err).To(BeNil()) + + By("sending a SubmitParamChangeProposal transaction from `validator0` container") + res, err := cli.SubmitProposal(cli.Validator0, "proposal.json") + Expect(err).To(BeNil()) + Expect(res.Code).To(BeEquivalentTo(0)) + }) + + It("should wait for the proposal submission to be included in a block", func() { + By("getting the current block height") + currentHeight, err := cli.GetCurrentBlockHeight(cli.Validator0, cli.CliBinaryName) + Expect(err).To(BeNil()) + + By("waiting for the proposal to be included in a block") + err = cli.WaitForChainHeight(cli.Validator0, cli.CliBinaryName, currentHeight+10, cli.VotingPeriod*3) + Expect(err).To(BeNil()) + }) + + It("should vote for the parameter change proposal from `validator1` container", func() { + By("sending a VoteProposal transaction from `validator1` container") + res, err := cli.VoteProposal(cli.Validator1, "1", "yes") + Expect(err).To(BeNil()) + Expect(res.Code).To(BeEquivalentTo(0)) + }) + + It("should vote for the parameter change proposal from `validator2` container", func() { + By("sending a VoteProposal transaction from `validator2` container") + res, err := cli.VoteProposal(cli.Validator2, "1", "yes") + Expect(err).To(BeNil()) + Expect(res.Code).To(BeEquivalentTo(0)) + }) + + It("should vote for the parameter change proposal from `validator3` container", func() { + By("sending a VoteProposal transaction from `validator3` container") + res, err := cli.VoteProposal(cli.Validator3, "1", "yes") + Expect(err).To(BeNil()) + Expect(res.Code).To(BeEquivalentTo(0)) + }) + It("should vote for the parameter change proposal from `validator3` container", func() { + By("sending a VoteProposal transaction from `validator3` container") + res, err := cli.VoteProposal(cli.Validator0, "1", "yes") + Expect(err).To(BeNil()) + Expect(res.Code).To(BeEquivalentTo(0)) + }) + It("should wait for the proposal to pass", func() { + By("getting the current block height") + currentHeight, err := cli.GetCurrentBlockHeight(cli.Validator0, cli.CliBinaryName) + Expect(err).To(BeNil()) + + By("waiting for the proposal to pass") + err = cli.WaitForChainHeight(cli.Validator0, cli.CliBinaryName, currentHeight+20, cli.VotingPeriod*3) + Expect(err).To(BeNil()) + }) + + It("should check the proposal status to ensure it has passed", func() { + By("sending a QueryProposal query from `validator0` container") + proposal, err := cli.QueryProposal(cli.Validator0, "1") + Expect(err).To(BeNil()) + Expect(proposal.Status).To(BeEquivalentTo(govtypesv1.StatusPassed)) + }) +}) diff --git a/tests/upgrade/integration/v3/upgrade_suite_test.go b/tests/upgrade/integration/v3/upgrade_suite_test.go index 49d51c2b8..2c37bf5b1 100644 --- a/tests/upgrade/integration/v3/upgrade_suite_test.go +++ b/tests/upgrade/integration/v3/upgrade_suite_test.go @@ -1,4 +1,4 @@ -//go:build upgrade_integration +//go:build integration package integration @@ -11,5 +11,5 @@ import ( func TestUpgrade(t *testing.T) { RegisterFailHandler(Fail) - RunSpecs(t, "Upgrade v2 Integration Suite") + RunSpecs(t, "Upgrade v3 Integration Suite") } diff --git a/x/did/keeper/expected_keepers.go b/x/did/keeper/expected_keepers.go new file mode 100644 index 000000000..5ee4c71d3 --- /dev/null +++ b/x/did/keeper/expected_keepers.go @@ -0,0 +1,10 @@ +package keeper + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" +) + +type BankKeeper interface { + SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error + MintCoins(ctx sdk.Context, moduleName string, amounts sdk.Coins) error +} diff --git a/x/did/keeper/keeper.go b/x/did/keeper/keeper.go index c34bd44cf..955dc2378 100644 --- a/x/did/keeper/keeper.go +++ b/x/did/keeper/keeper.go @@ -18,10 +18,11 @@ type ( accountKeeper types.AccountKeeper bankkeeper types.BankKeeper stakingKeeper types.StakingKeeper + authority string } ) -func NewKeeper(cdc codec.BinaryCodec, storeKey storetypes.StoreKey, paramSpace types.ParamSubspace, ak types.AccountKeeper, bk types.BankKeeper, sk types.StakingKeeper) *Keeper { +func NewKeeper(cdc codec.BinaryCodec, storeKey storetypes.StoreKey, paramSpace types.ParamSubspace, ak types.AccountKeeper, bk types.BankKeeper, sk types.StakingKeeper, authority string) *Keeper { return &Keeper{ cdc: cdc, storeKey: storeKey, @@ -29,6 +30,7 @@ func NewKeeper(cdc codec.BinaryCodec, storeKey storetypes.StoreKey, paramSpace t accountKeeper: ak, bankkeeper: bk, stakingKeeper: sk, + authority: authority, } } diff --git a/x/did/keeper/msg_mint.go b/x/did/keeper/msg_mint.go new file mode 100644 index 000000000..2696dc6aa --- /dev/null +++ b/x/did/keeper/msg_mint.go @@ -0,0 +1,34 @@ +package keeper + +import ( + "context" + + "cosmossdk.io/errors" + "github.com/cheqd/cheqd-node/x/did/types" + sdk "github.com/cosmos/cosmos-sdk/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" +) + +func (k MsgServer) Mint(goCtx context.Context, req *types.MsgMint) (res *types.MsgMintResponse, err error) { + if k.authority != req.Authority { + return nil, errors.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", k.authority, req.Authority) + } + + ctx := sdk.UnwrapSDKContext(goCtx) + err = k.bankkeeper.MintCoins(ctx, types.ModuleName, req.Amount) + if err != nil { + return nil, err + } + + addr, err := sdk.AccAddressFromBech32(req.ToAddress) + if err != nil { + return nil, err + } + + err = k.bankkeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, addr, req.Amount) + if err != nil { + return nil, err + } + + return +} diff --git a/x/did/tests/burn_test.go b/x/did/tests/burn_test.go index e80350e06..952cf5a5f 100644 --- a/x/did/tests/burn_test.go +++ b/x/did/tests/burn_test.go @@ -21,7 +21,7 @@ var _ = Describe("MsgBurn tests", func() { pk1 := ed25519.GenPrivKey().PubKey() addr1 := sdk.AccAddress(pk1.Address()) someCoins := sdk.Coins{ - sdk.NewInt64Coin("ncheq", 1000000*1e9), // 1mn CHEQ + sdk.NewInt64Coin(types.BaseMinimalDenom, 1000000*1e9), // 1mn CHEQ } // mint coins to the moduleAccount @@ -34,7 +34,7 @@ var _ = Describe("MsgBurn tests", func() { balanceBefore := setup.BankKeeper.GetAllBalances(setup.SdkCtx, addr1) // make a proper burn message - burnAmount := sdk.NewCoins(sdk.NewCoin("ncheq", sdk.NewInt(100000))) + burnAmount := sdk.NewCoins(sdk.NewCoin(types.BaseMinimalDenom, sdk.NewInt(100000))) baseMsg := types.NewMsgBurn( addr1.String(), burnAmount, @@ -52,7 +52,7 @@ var _ = Describe("MsgBurn tests", func() { pk1 := ed25519.GenPrivKey().PubKey() addr1 := sdk.AccAddress(pk1.Address()) someCoins := sdk.Coins{ - sdk.NewInt64Coin("ncheq", 1000000*1e9), // 1mn CHEQ + sdk.NewInt64Coin(types.BaseMinimalDenom, 1000000*1e9), // 1mn CHEQ } // mint coins to the moduleAccount @@ -77,7 +77,7 @@ var _ = Describe("MsgBurn tests", func() { pk1 := ed25519.GenPrivKey().PubKey() addr1 := sdk.AccAddress(pk1.Address()) someCoins := sdk.Coins{ - sdk.NewInt64Coin("ncheq", 1000000*1e9), // 1mn CHEQ + sdk.NewInt64Coin(types.BaseMinimalDenom, 1000000*1e9), // 1mn CHEQ } // mint coins to the moduleAccount @@ -91,7 +91,7 @@ var _ = Describe("MsgBurn tests", func() { // make a proper burn message baseMsg := types.NewMsgBurn( addr1.String(), - sdk.NewCoins(sdk.NewCoin("ncheq", sdk.ZeroInt())), + sdk.NewCoins(sdk.NewCoin(types.BaseMinimalDenom, sdk.ZeroInt())), ) // burn the coins @@ -102,7 +102,7 @@ var _ = Describe("MsgBurn tests", func() { pk1 := ed25519.GenPrivKey().PubKey() addr1 := sdk.AccAddress(pk1.Address()) someCoins := sdk.Coins{ - sdk.NewInt64Coin("ncheq", 1000000*1e9), // 1mn CHEQ + sdk.NewInt64Coin(types.BaseMinimalDenom, 1000000*1e9), // 1mn CHEQ } // mint coins to the moduleAccount diff --git a/x/did/tests/mint_test.go b/x/did/tests/mint_test.go new file mode 100644 index 000000000..579e3bfd8 --- /dev/null +++ b/x/did/tests/mint_test.go @@ -0,0 +1,50 @@ +package tests + +import ( + testsetup "github.com/cheqd/cheqd-node/x/did/tests/setup" + "github.com/cheqd/cheqd-node/x/did/types" + "github.com/cometbft/cometbft/crypto/ed25519" + sdk "github.com/cosmos/cosmos-sdk/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" +) + +var _ = Describe("MsgBurn tests", func() { + var setup testsetup.TestSetup + + BeforeEach(func() { + setup = testsetup.Setup() + }) + + It("Valid message format", func() { + pk1 := ed25519.GenPrivKey().PubKey() + addr1 := sdk.AccAddress(pk1.Address()) + mintAmount := sdk.NewCoins(sdk.NewCoin(types.BaseMinimalDenom, sdk.NewInt(100000))) + governanceAddress := setup.AccountKeeper.GetModuleAccount(setup.SdkCtx, govtypes.ModuleName).GetAddress().String() + + baseMsg := types.NewMsgMint( + governanceAddress, + addr1.String(), + mintAmount, + ) + _, err := setup.MsgServer.Mint(setup.SdkCtx, baseMsg) + Expect(err).To(BeNil()) + }) + + It("Not the expected authority address", func() { + pk1 := ed25519.GenPrivKey().PubKey() + addr1 := sdk.AccAddress(pk1.Address()) + pk2 := ed25519.GenPrivKey().PubKey() + add2 := sdk.AccAddress(pk2.Address()) + mintAmount := sdk.NewCoins(sdk.NewCoin(types.BaseMinimalDenom, sdk.NewInt(100000))) + + baseMsg := types.NewMsgMint( + add2.String(), + addr1.String(), + mintAmount, + ) + _, err := setup.MsgServer.Mint(setup.SdkCtx, baseMsg) + Expect(err).NotTo(BeNil()) + }) +}) diff --git a/x/did/tests/setup/setup.go b/x/did/tests/setup/setup.go index 21d28d2ec..c33d03fab 100644 --- a/x/did/tests/setup/setup.go +++ b/x/did/tests/setup/setup.go @@ -71,16 +71,17 @@ func Setup() TestSetup { maccPerms := map[string][]string{ minttypes.ModuleName: {authtypes.Minter}, - types.ModuleName: {authtypes.Burner}, stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking}, stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking}, + authtypes.FeeCollectorName: nil, + types.ModuleName: {authtypes.Minter, authtypes.Burner}, + govtypes.ModuleName: {authtypes.Burner, authtypes.Minter}, } // Init ParamsKeeper KVStore paramsStoreKey := sdk.NewKVStoreKey(paramstypes.StoreKey) paramsTStoreKey := sdk.NewTransientStoreKey(paramstypes.TStoreKey) - // Init Keepers paramsKeeper := initParamsKeeper(Cdc, aminoCdc, paramsStoreKey, paramsTStoreKey) accountKeeper := authkeeper.NewAccountKeeper(Cdc, keys[authtypes.StoreKey], authtypes.ProtoBaseAccount, maccPerms, "cheqd", authtypes.NewModuleAddress(govtypes.ModuleName).String()) bankKeeper := bankkeeper.NewBaseKeeper( @@ -91,7 +92,7 @@ func Setup() TestSetup { authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) stakingKeeper := stakingkeeper.NewKeeper(Cdc, keys[stakingtypes.StoreKey], accountKeeper, bankKeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String()) - newKeeper := keeper.NewKeeper(Cdc, keys[types.StoreKey], getSubspace(types.ModuleName, paramsKeeper), accountKeeper, bankKeeper, stakingKeeper) + newKeeper := keeper.NewKeeper(Cdc, keys[types.StoreKey], getSubspace(types.ModuleName, paramsKeeper), accountKeeper, bankKeeper, stakingKeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String()) // Create Tx txBytes := make([]byte, 28) diff --git a/x/did/types/codec.go b/x/did/types/codec.go index ff0a0b090..5ffe0b058 100644 --- a/x/did/types/codec.go +++ b/x/did/types/codec.go @@ -13,6 +13,7 @@ func RegisterCodec(cdc *codec.LegacyAmino) { cdc.RegisterConcrete(&MsgUpdateDidDoc{}, "did/UpdateDidDoc", nil) cdc.RegisterConcrete(&MsgDeactivateDidDoc{}, "did/DeleteDidDoc", nil) cdc.RegisterConcrete(&MsgBurn{}, "did/MsgBurn", nil) + cdc.RegisterConcrete(&MsgMint{}, "did/MsgMint", nil) } func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { @@ -22,6 +23,7 @@ func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { &MsgUpdateDidDoc{}, &MsgDeactivateDidDoc{}, &MsgBurn{}, + &MsgMint{}, ) msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) diff --git a/x/did/types/tx.pb.go b/x/did/types/tx.pb.go index 2de175694..17b917b28 100644 --- a/x/did/types/tx.pb.go +++ b/x/did/types/tx.pb.go @@ -861,6 +861,106 @@ func (m *MsgBurnResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgBurnResponse proto.InternalMessageInfo +// MsgMint is the sdk.Msg type for allowing an admin account to mint +// more of a token. +// Only the admin of the token factory denom has permission to mint unless +// the denom does not have any admin. +type MsgMint struct { + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty" yaml:"authority"` + ToAddress string `protobuf:"bytes,2,opt,name=to_address,json=toAddress,proto3" json:"to_address,omitempty"` + Amount github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,3,rep,name=amount,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"amount"` +} + +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_0e353aae8dd04717, []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) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" +} + +func (m *MsgMint) GetToAddress() string { + if m != nil { + return m.ToAddress + } + return "" +} + +func (m *MsgMint) GetAmount() github_com_cosmos_cosmos_sdk_types.Coins { + if m != nil { + return m.Amount + } + return nil +} + +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_0e353aae8dd04717, []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 + func init() { proto.RegisterType((*MsgCreateDidDoc)(nil), "cheqd.did.v2.MsgCreateDidDoc") proto.RegisterType((*MsgUpdateDidDoc)(nil), "cheqd.did.v2.MsgUpdateDidDoc") @@ -874,69 +974,76 @@ func init() { proto.RegisterType((*MsgDeactivateDidDocResponse)(nil), "cheqd.did.v2.MsgDeactivateDidDocResponse") proto.RegisterType((*MsgBurn)(nil), "cheqd.did.v2.MsgBurn") proto.RegisterType((*MsgBurnResponse)(nil), "cheqd.did.v2.MsgBurnResponse") + proto.RegisterType((*MsgMint)(nil), "cheqd.did.v2.MsgMint") + proto.RegisterType((*MsgMintResponse)(nil), "cheqd.did.v2.MsgMintResponse") } func init() { proto.RegisterFile("cheqd/did/v2/tx.proto", fileDescriptor_0e353aae8dd04717) } var fileDescriptor_0e353aae8dd04717 = []byte{ - // 899 bytes of a gzipped FileDescriptorProto + // 977 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0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0x9a, 0xd3, 0xd5, 0x75, 0xdb, 0xe3, 0x84, 0x5a, 0x47, 0x6a, 0x68, 0x57, 0x56, 0xe8, 0xae, 0xa8, + 0xa1, 0xf9, 0xc6, 0x5f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x96, 0x54, 0x8f, 0x4f, 0xf3, 0x0b, 0x00, + 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -958,6 +1065,8 @@ type MsgClient interface { // DeactivateDidDoc defines a method for deactivating an existing DID document DeactivateDidDoc(ctx context.Context, in *MsgDeactivateDidDoc, opts ...grpc.CallOption) (*MsgDeactivateDidDocResponse, error) Burn(ctx context.Context, in *MsgBurn, opts ...grpc.CallOption) (*MsgBurnResponse, error) + // Mint defines a method to mint tokens to the given address. + Mint(ctx context.Context, in *MsgMint, opts ...grpc.CallOption) (*MsgMintResponse, error) } type msgClient struct { @@ -1004,6 +1113,15 @@ func (c *msgClient) Burn(ctx context.Context, in *MsgBurn, opts ...grpc.CallOpti 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, "/cheqd.did.v2.Msg/Mint", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { // CreateDidDoc defines a method for creating a new DID document @@ -1013,6 +1131,8 @@ type MsgServer interface { // DeactivateDidDoc defines a method for deactivating an existing DID document DeactivateDidDoc(context.Context, *MsgDeactivateDidDoc) (*MsgDeactivateDidDocResponse, error) Burn(context.Context, *MsgBurn) (*MsgBurnResponse, error) + // Mint defines a method to mint tokens to the given address. + Mint(context.Context, *MsgMint) (*MsgMintResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -1031,6 +1151,9 @@ func (*UnimplementedMsgServer) DeactivateDidDoc(ctx context.Context, req *MsgDea func (*UnimplementedMsgServer) Burn(ctx context.Context, req *MsgBurn) (*MsgBurnResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Burn not implemented") } +func (*UnimplementedMsgServer) Mint(ctx context.Context, req *MsgMint) (*MsgMintResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Mint not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -1108,6 +1231,24 @@ func _Msg_Burn_Handler(srv interface{}, ctx context.Context, dec func(interface{ 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: "/cheqd.did.v2.Msg/Mint", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).Mint(ctx, req.(*MsgMint)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "cheqd.did.v2.Msg", HandlerType: (*MsgServer)(nil), @@ -1128,6 +1269,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "Burn", Handler: _Msg_Burn_Handler, }, + { + MethodName: "Mint", + Handler: _Msg_Mint_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "cheqd/did/v2/tx.proto", @@ -1800,6 +1945,80 @@ func (m *MsgBurnResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { 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.Amount) > 0 { + for iNdEx := len(m.Amount) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Amount[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + if len(m.ToAddress) > 0 { + i -= len(m.ToAddress) + copy(dAtA[i:], m.ToAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.ToAddress))) + 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 *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 encodeVarintTx(dAtA []byte, offset int, v uint64) int { offset -= sovTx(v) base := offset @@ -2123,6 +2342,38 @@ func (m *MsgBurnResponse) Size() (n int) { return n } +func (m *MsgMint) 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.ToAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if len(m.Amount) > 0 { + for _, e := range m.Amount { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } + return n +} + +func (m *MsgMintResponse) 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 } @@ -4019,6 +4270,204 @@ func (m *MsgBurnResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgMint) 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: MsgMint: wiretype end group for non-group") + } + if fieldNum <= 0 { + 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 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 ToAddress", 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.ToAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Amount = append(m.Amount, types.Coin{}) + if err := m.Amount[len(m.Amount)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgMintResponse) 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: MsgMintResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgMintResponse: 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 diff --git a/x/did/types/tx_msg_mint.go b/x/did/types/tx_msg_mint.go new file mode 100644 index 000000000..673e99f55 --- /dev/null +++ b/x/did/types/tx_msg_mint.go @@ -0,0 +1,54 @@ +package types + +import ( + errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" +) + +var _ sdk.Msg = &MsgMint{} + +func NewMsgMint(authority string, toAddr string, coins sdk.Coins) *MsgMint { + return &MsgMint{ + Authority: authority, + ToAddress: toAddr, + Amount: coins, + } +} + +func (msg *MsgMint) Route() string { + return RouterKey +} + +func (msg *MsgMint) Type() string { + return "MsgMint" +} + +func (msg *MsgMint) GetSigners() []sdk.AccAddress { + authority, _ := sdk.AccAddressFromBech32(msg.Authority) + return []sdk.AccAddress{authority} +} + +func (msg *MsgMint) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(msg) + return sdk.MustSortJSON(bz) +} + +func (msg *MsgMint) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(msg.Authority); err != nil { + return errorsmod.Wrap(err, "invalid authority address") + } + + // Check if the 'toAddress' is a valid Bech32 address + _, err := sdk.AccAddressFromBech32(msg.ToAddress) + if err != nil { + return errorsmod.Wrap(sdkerrors.ErrInvalidAddress, "invalid recipient address") + } + + // Validate that the 'amount' is a valid coin denomination and positive value + if !msg.Amount.IsValid() { + return errorsmod.Wrap(sdkerrors.ErrInvalidCoins, "invalid coin denomination or amount") + } + + return nil +} diff --git a/x/resource/tests/setup/setup.go b/x/resource/tests/setup/setup.go index 07175a3c0..c3a5a51a4 100644 --- a/x/resource/tests/setup/setup.go +++ b/x/resource/tests/setup/setup.go @@ -4,6 +4,7 @@ import ( "crypto/rand" "time" + "github.com/cheqd/cheqd-node/app" didkeeper "github.com/cheqd/cheqd-node/x/did/keeper" didsetup "github.com/cheqd/cheqd-node/x/did/tests/setup" didtypes "github.com/cheqd/cheqd-node/x/did/types" @@ -52,6 +53,8 @@ func Setup() TestSetup { authtypes.RegisterInterfaces(ir) banktypes.RegisterInterfaces(ir) didtypes.RegisterInterfaces(ir) + banktypes.RegisterInterfaces(ir) + authtypes.RegisterInterfaces(ir) cdc := codec.NewProtoCodec(ir) aminoCdc := codec.NewLegacyAmino() @@ -69,7 +72,7 @@ func Setup() TestSetup { maccPerms := map[string][]string{ minttypes.ModuleName: {authtypes.Minter}, - types.ModuleName: {authtypes.Burner}, + types.ModuleName: {authtypes.Minter, authtypes.Burner}, stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking}, stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking}, } @@ -99,8 +102,15 @@ func Setup() TestSetup { _ = dbStore.LoadLatestVersion() - // Init Keepers - accountKeeper := authkeeper.NewAccountKeeper(cdc, keys[authtypes.StoreKey], authtypes.ProtoBaseAccount, maccPerms, "cheqd", string(authtypes.NewModuleAddress(govtypes.ModuleName))) + accountKeeper := authkeeper.NewAccountKeeper( + cdc, + keys[authtypes.StoreKey], + authtypes.ProtoBaseAccount, + maccPerms, + app.AccountAddressPrefix, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + ) + bankKeeper := bankkeeper.NewBaseKeeper( cdc, keys[banktypes.StoreKey], @@ -111,7 +121,8 @@ func Setup() TestSetup { stakingKeeper := stakingkeeper.NewKeeper(cdc, keys[stakingtypes.StoreKey], accountKeeper, bankKeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String()) paramsKeeper := initParamsKeeper(cdc, aminoCdc, paramsStoreKey, paramsTStoreKey) - didKeeper := didkeeper.NewKeeper(cdc, didStoreKey, getSubspace(didtypes.ModuleName, paramsKeeper), accountKeeper, bankKeeper, stakingKeeper) + + didKeeper := didkeeper.NewKeeper(cdc, didStoreKey, getSubspace(didtypes.ModuleName, paramsKeeper), accountKeeper, bankKeeper, stakingKeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String()) capabilityKeeper := capabilitykeeper.NewKeeper(cdc, capabilityStoreKey, memStoreKeys[capabilitytypes.MemStoreKey]) scopedIBCKeeper := capabilityKeeper.ScopeToModule(ibcexported.ModuleName) @@ -140,7 +151,7 @@ func Setup() TestSetup { queryServer := keeper.NewQueryServer(*resourceKeeper, *didKeeper) params := stakingtypes.DefaultParams() - params.BondDenom = "ncheq" + params.BondDenom = didtypes.BaseMinimalDenom err := stakingKeeper.SetParams(ctx, params) if err != nil { panic("error while setting up the params")