From cafad4960e2d1bba7f32da5101826ea282e5f89e Mon Sep 17 00:00:00 2001 From: KIMURA Yu <33382781+KimuraYu45z@users.noreply.github.com> Date: Wed, 9 Aug 2023 14:05:07 +0800 Subject: [PATCH 01/20] feat: wip nftfactory --- proto/ununifi/nft/nft.proto | 4 + proto/ununifi/nftfactory/event.proto | 42 +- proto/ununifi/nftfactory/genesis.proto | 16 +- proto/ununifi/nftfactory/nftfactory.proto | 46 +- proto/ununifi/nftfactory/query.proto | 61 +- proto/ununifi/nftfactory/tx.proto | 61 +- x/derivatives/keeper/keeper_test.go | 15 +- x/ecosystemincentive/types/event.pb.go | 650 +--------- x/nft/keeper/keeper.go | 74 +- x/nft/keeper/msg_server.go | 30 +- x/nft/types/data.go | 16 +- x/nft/types/nft.pb.go | 203 ++- x/nftfactory/genesis.go | 6 +- x/nftfactory/types/class.go | 26 +- x/nftfactory/types/codec.go | 5 +- x/nftfactory/types/event.pb.go | 1105 +++++----------- x/nftfactory/types/genesis.go | 2 +- x/nftfactory/types/genesis.pb.go | 303 ++++- x/nftfactory/types/nftfactory.pb.go | 1030 ++------------- x/nftfactory/types/query.pb.go | 1333 ++++--------------- x/nftfactory/types/query.pb.gw.go | 306 +---- x/nftfactory/types/tx.pb.go | 1429 ++++++++++----------- 22 files changed, 2179 insertions(+), 4584 deletions(-) diff --git a/proto/ununifi/nft/nft.proto b/proto/ununifi/nft/nft.proto index 058d7466c..f58f75168 100644 --- a/proto/ununifi/nft/nft.proto +++ b/proto/ununifi/nft/nft.proto @@ -7,6 +7,10 @@ import "google/protobuf/any.proto"; option go_package = "github.com/UnUniFi/chain/x/nft/types"; +message ClassData { + string send_prehook_contract = 1; +} + message NftData { bool send_disabled = 1; } diff --git a/proto/ununifi/nftfactory/event.proto b/proto/ununifi/nftfactory/event.proto index e837ea7bc..184d3303a 100644 --- a/proto/ununifi/nftfactory/event.proto +++ b/proto/ununifi/nftfactory/event.proto @@ -7,40 +7,30 @@ import "ununifi/nftfactory/nftfactory.proto"; option go_package = "github.com/UnUniFi/chain/x/nftfactory/types"; message EventCreateClass { - string owner = 1; - string class_id = 2; - string base_token_uri = 3; - string token_supply_cap = 4; - MintingPermission minting_permission = 5; -} - -message EventSendClassOwnership { - string sender = 1; - string receiver = 2; - string class_id = 3; -} - -message EventUpdateBaseTokenUri { - string owner = 1; - string class_id = 2; - string base_token_uri = 3; + string owner = 1; + string class_id = 2; } -message EventUpdateTokenSupplyCap { - string owner = 1; - string class_id = 2; - string token_supply_cap = 3; +message EventUpdateClass { + string owner = 1; + string class_id = 2; } message EventMintNFT { - string class_id = 1; - string nft_id = 2; - string owner = 3; - string minter = 4; + string owner = 1; + string class_id = 2; + string nft_id = 3; + string recipient = 4; } message EventBurnNFT { - string burner = 1; + string owner = 1; string class_id = 2; string nft_id = 3; } + +message EventChangeAdmin { + string admin = 1; + string class_id = 3; + string new_admin = 2; +} diff --git a/proto/ununifi/nftfactory/genesis.proto b/proto/ununifi/nftfactory/genesis.proto index cb25f04cc..0d6c86088 100644 --- a/proto/ununifi/nftfactory/genesis.proto +++ b/proto/ununifi/nftfactory/genesis.proto @@ -8,7 +8,17 @@ option go_package = "github.com/UnUniFi/chain/x/nftfactory/types"; // GenesisState defines the nftfactory module's genesis state. message GenesisState { - Params params = 1 [(gogoproto.moretags) = "yaml:\"params\"", (gogoproto.nullable) = false]; - repeated ClassAttributes class_attributes_list = 2 - [(gogoproto.moretags) = "yaml:\"class_attributes_list\"", (gogoproto.nullable) = false]; + Params params = 1 [(gogoproto.moretags) = "yaml:\"params\"", (gogoproto.nullable) = false]; + repeated GenesisClass classes = 2 + [(gogoproto.moretags) = "yaml:\"class_ownerships\"", (gogoproto.nullable) = false]; } + +message GenesisClass { + option (gogoproto.equal) = true; + + string class_id = 1 [ (gogoproto.moretags) = "yaml:\"class_id\"" ]; + ClassAuthorityMetadata authority_metadata = 2 [ + (gogoproto.moretags) = "yaml:\"authority_metadata\"", + (gogoproto.nullable) = false + ]; +} \ No newline at end of file diff --git a/proto/ununifi/nftfactory/nftfactory.proto b/proto/ununifi/nftfactory/nftfactory.proto index 3f786c51a..d11e1fe9e 100644 --- a/proto/ununifi/nftfactory/nftfactory.proto +++ b/proto/ununifi/nftfactory/nftfactory.proto @@ -2,40 +2,28 @@ syntax = "proto3"; package ununifi.nftfactory; import "gogoproto/gogo.proto"; -import "google/protobuf/timestamp.proto"; +import "cosmos/base/v1beta1/coin.proto"; option go_package = "github.com/UnUniFi/chain/x/nftfactory/types"; -enum MintingPermission { - OnlyOwner = 0; - Anyone = 1; - // WhiteList = 2; -} - -message ClassAttributes { - string class_id = 1; - string owner = 2; - string base_token_uri = 3; - MintingPermission minting_permission = 4; - uint64 token_supply_cap = 5; -} +// ClassAuthorityMetadata specifies metadata for addresses that have specific +// capabilities over a nft factory class. Right now there is only one Admin +// permission, but is planned to be extended to the future. +message ClassAuthorityMetadata { + option (gogoproto.equal) = true; -message OwningClassIdList { - string owner = 1; - repeated string class_id = 2; -} - -message ClassNameIdList { - string class_name = 1; - repeated string class_id = 2; + // Can be empty for no admin, or a valid osmosis address + string Admin = 1 [ (gogoproto.moretags) = "yaml:\"admin\"" ]; } message Params { - uint64 MaxNFTSupplyCap = 1; - uint64 MinClassNameLen = 2; - uint64 MaxClassNameLen = 3; - uint64 MinUriLen = 4; - uint64 MaxUriLen = 5; - uint64 MaxSymbolLen = 6; - uint64 MaxDescriptionLen = 7; + // ClassCreationFee is the fee required to create a new denom using the nftfactory module + repeated cosmos.base.v1beta1.Coin class_creation_fee = 1 [ + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", + (gogoproto.moretags) = "yaml:\"denom_creation_fee\"", + (gogoproto.nullable) = false + ]; + + // FeeCollectorAddress is the address where fees collected from denom creation are sent to + string fee_collector_address = 2; } diff --git a/proto/ununifi/nftfactory/query.proto b/proto/ununifi/nftfactory/query.proto index 057e2b5bb..12a1ee81a 100644 --- a/proto/ununifi/nftfactory/query.proto +++ b/proto/ununifi/nftfactory/query.proto @@ -11,50 +11,41 @@ service Query { rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { option (google.api.http).get = "/ununifi/nftfactory/params"; } - rpc ClassAttributes(QueryClassAttributesRequest) returns (QueryClassAttributesResponse) { - option (google.api.http).get = "/ununifi/nftfactory/class_owner/{class_id}"; + rpc ClassAuthorityMetadata(QueryClassAuthorityMetadataRequest) + returns (QueryClassAuthorityMetadataResponse) { + option (google.api.http).get = + "/ununifi/nftfactory/class/factory/{creator}/{subclass}/authority-metadata"; } - rpc NFTMinter(QueryNFTMinterRequest) returns (QueryNFTMinterResponse) { - option (google.api.http).get = "/ununifi/nftfactory/nft_minter/{class_id}/{nft_id}"; - } - rpc ClassIdsByName(QueryClassIdsByNameRequest) returns (QueryClassIdsByNameResponse) { - option (google.api.http).get = "/ununifi/nftfactory/class_ids_by_name/{class_name}"; - } - rpc ClassIdsByOwner(QueryClassIdsByOwnerRequest) returns (QueryClassIdsByOwnerResponse) { - option (google.api.http).get = "/ununifi/nftfactory/class_ids_by_owner/{owner}"; + rpc ClassesFromCreator(QueryClassesFromCreatorRequest) + returns (QueryClassesFromCreatorResponse) { + option (google.api.http).get = + "/ununifi/nftfactory/classes-from-creator/{creator}"; } } +// QueryParamsRequest is the request type for the Query/Params RPC method. message QueryParamsRequest {} -message QueryParamsResponse { - Params params = 1 [(gogoproto.nullable) = false]; -} - -message QueryClassAttributesRequest { - string class_id = 1; -} -message QueryClassAttributesResponse { - ClassAttributes class_attributes = 1; -} -message QueryNFTMinterRequest { - string class_id = 1; - string nft_id = 2; -} -message QueryNFTMinterResponse { - string minter = 1; +// QueryParamsResponse is the response type for the Query/Params RPC method. +message QueryParamsResponse { + // params defines the parameters of the module. + Params params = 1 [ (gogoproto.nullable) = false ]; } -message QueryClassIdsByNameRequest { - string class_name = 1; +message QueryClassAuthorityMetadataRequest { + string creator = 1 [ (gogoproto.moretags) = "yaml:\"creator\"" ]; + string subclass = 2 [ (gogoproto.moretags) = "yaml:\"subclass\"" ]; } -message QueryClassIdsByNameResponse { - ClassNameIdList class_name_id_list = 1; +message QueryClassAuthorityMetadataResponse { + ClassAuthorityMetadata authority_metadata = 1 [ + (gogoproto.moretags) = "yaml:\"authority_metadata\"", + (gogoproto.nullable) = false + ]; } -message QueryClassIdsByOwnerRequest { - string owner = 1; -} -message QueryClassIdsByOwnerResponse { - OwningClassIdList owning_class_id_list = 1; +message QueryClassesFromCreatorRequest { + string creator = 1 [ (gogoproto.moretags) = "yaml:\"creator\"" ]; } +message QueryClassesFromCreatorResponse { + repeated string classes = 1 [ (gogoproto.moretags) = "yaml:\"classes\"" ]; +} \ No newline at end of file diff --git a/proto/ununifi/nftfactory/tx.proto b/proto/ununifi/nftfactory/tx.proto index 6b2423b1a..ba12c4251 100644 --- a/proto/ununifi/nftfactory/tx.proto +++ b/proto/ununifi/nftfactory/tx.proto @@ -2,51 +2,42 @@ syntax = "proto3"; package ununifi.nftfactory; import "gogoproto/gogo.proto"; +import "ununifi/nft/nft.proto"; import "ununifi/nftfactory/nftfactory.proto"; option go_package = "github.com/UnUniFi/chain/x/nftfactory/types"; service Msg { rpc CreateClass(MsgCreateClass) returns (MsgCreateClassResponse); - rpc SendClassOwnership(MsgSendClassOwnership) returns (MsgSendClassOwnershipResponse); - rpc UpdateBaseTokenUri(MsgUpdateBaseTokenUri) returns (MsgUpdateBaseTokenUriResponse); - rpc UpdateTokenSupplyCap(MsgUpdateTokenSupplyCap) returns (MsgUpdateTokenSupplyCapResponse); + rpc UpdateClass(MsgUpdateClass) returns (MsgUpdateClassResponse); rpc MintNFT(MsgMintNFT) returns (MsgMintNFTResponse); rpc BurnNFT(MsgBurnNFT) returns (MsgBurnNFTResponse); + rpc ChangeAdmin(MsgChangeAdmin) returns (MsgChangeAdminResponse); } message MsgCreateClass { - string sender = 1; - string name = 2; - string base_token_uri = 3; - uint64 token_supply_cap = 4; - MintingPermission minting_permission = 5; - string symbol = 7; - string description = 8; - string class_uri = 9; + string sender = 1; + string id = 2; + string name = 3; + string symbol = 4; + string description = 5; + string uri = 6; + string uri_hash = 7; + ununifi.nft.ClassData data = 8; } message MsgCreateClassResponse {} -message MsgSendClassOwnership { - string sender = 1; - string class_id = 2; - string recipient = 3; +message MsgUpdateClass { + string sender = 1; + string class_id = 2; + string name = 3; + string symbol = 4; + string description = 5; + string uri = 6; + string uri_hash = 7; + ununifi.nft.ClassData data = 8; } -message MsgSendClassOwnershipResponse {} - -message MsgUpdateBaseTokenUri { - string sender = 1; - string class_id = 2; - string base_token_uri = 3; -} -message MsgUpdateBaseTokenUriResponse {} - -message MsgUpdateTokenSupplyCap { - string sender = 1; - string class_id = 2; - uint64 token_supply_cap = 3; -} -message MsgUpdateTokenSupplyCapResponse {} +message MsgUpdateClassResponse {} message MsgMintNFT { string sender = 1; @@ -62,3 +53,13 @@ message MsgBurnNFT { string nft_id = 3; } message MsgBurnNFTResponse {} + +// MsgChangeAdmin is the sdk.Msg type for allowing an admin account to reassign +// adminship of a class to a new account +message MsgChangeAdmin { + string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ]; + string class_id = 2 [ (gogoproto.moretags) = "yaml:\"class_id\"" ]; + string new_admin = 3 [ (gogoproto.moretags) = "yaml:\"new_admin\"" ]; +} + +message MsgChangeAdminResponse {} \ No newline at end of file diff --git a/x/derivatives/keeper/keeper_test.go b/x/derivatives/keeper/keeper_test.go index ec061a28e..de965e2c5 100644 --- a/x/derivatives/keeper/keeper_test.go +++ b/x/derivatives/keeper/keeper_test.go @@ -108,14 +108,13 @@ func (suite *KeeperTestSuite) SetupTest() { derivativesAddr := app.DerivativesKeeper.GetModuleAddress() _ = app.NftfactoryKeeper.CreateClass(suite.ctx, "derivatives/perpetual_futures/positions", &nftfactorytypes.MsgCreateClass{ - Sender: derivativesAddr.String(), - Name: "derivatives/perpetual_futures/positions", - BaseTokenUri: "ipfs://testcid/", - TokenSupplyCap: 100000, - MintingPermission: 0, - Symbol: "", - Description: "", - ClassUri: "", + Sender: derivativesAddr.String(), + Name: "derivatives/perpetual_futures/positions", + Symbol: "", + Description: "", + Uri: "", + UriHash: "", + Data: nil, }) } diff --git a/x/ecosystemincentive/types/event.pb.go b/x/ecosystemincentive/types/event.pb.go index 068989aa6..70e533a5b 100644 --- a/x/ecosystemincentive/types/event.pb.go +++ b/x/ecosystemincentive/types/event.pb.go @@ -129,66 +129,6 @@ func (m *EventWithdrawReward) GetWithdrawnReward() types.Coin { return types.Coin{} } -type EventFailedParsingTxMemoData struct { - ClassId string `protobuf:"bytes,1,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty" yaml:"class_id"` - NftId string `protobuf:"bytes,2,opt,name=nft_id,json=nftId,proto3" json:"nft_id,omitempty" yaml:"nft_id"` - Memo string `protobuf:"bytes,3,opt,name=memo,proto3" json:"memo,omitempty" yaml:"memo"` -} - -func (m *EventFailedParsingTxMemoData) Reset() { *m = EventFailedParsingTxMemoData{} } -func (m *EventFailedParsingTxMemoData) String() string { return proto.CompactTextString(m) } -func (*EventFailedParsingTxMemoData) ProtoMessage() {} -func (*EventFailedParsingTxMemoData) Descriptor() ([]byte, []int) { - return fileDescriptor_4bc2d07e5e7a71a2, []int{2} -} -func (m *EventFailedParsingTxMemoData) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *EventFailedParsingTxMemoData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_EventFailedParsingTxMemoData.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 *EventFailedParsingTxMemoData) XXX_Merge(src proto.Message) { - xxx_messageInfo_EventFailedParsingTxMemoData.Merge(m, src) -} -func (m *EventFailedParsingTxMemoData) XXX_Size() int { - return m.Size() -} -func (m *EventFailedParsingTxMemoData) XXX_DiscardUnknown() { - xxx_messageInfo_EventFailedParsingTxMemoData.DiscardUnknown(m) -} - -var xxx_messageInfo_EventFailedParsingTxMemoData proto.InternalMessageInfo - -func (m *EventFailedParsingTxMemoData) GetClassId() string { - if m != nil { - return m.ClassId - } - return "" -} - -func (m *EventFailedParsingTxMemoData) GetNftId() string { - if m != nil { - return m.NftId - } - return "" -} - -func (m *EventFailedParsingTxMemoData) GetMemo() string { - if m != nil { - return m.Memo - } - return "" -} - type EventDeletedNftIdRecordedForFrontendReward struct { RecipientContainerId string `protobuf:"bytes,1,opt,name=recipient_container_id,json=recipientContainerId,proto3" json:"recipient_container_id,omitempty" yaml:"recipient_container_id"` ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty" yaml:"class_id"` @@ -203,7 +143,7 @@ func (m *EventDeletedNftIdRecordedForFrontendReward) String() string { } func (*EventDeletedNftIdRecordedForFrontendReward) ProtoMessage() {} func (*EventDeletedNftIdRecordedForFrontendReward) Descriptor() ([]byte, []int) { - return fileDescriptor_4bc2d07e5e7a71a2, []int{3} + return fileDescriptor_4bc2d07e5e7a71a2, []int{2} } func (m *EventDeletedNftIdRecordedForFrontendReward) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -253,68 +193,6 @@ func (m *EventDeletedNftIdRecordedForFrontendReward) GetNftId() string { return "" } -type EventNotRegisteredRecipientContainerId struct { - RecipientContainerId string `protobuf:"bytes,1,opt,name=recipient_container_id,json=recipientContainerId,proto3" json:"recipient_container_id,omitempty" yaml:"recipient_container_id"` - ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty" yaml:"class_id"` - NftId string `protobuf:"bytes,3,opt,name=nft_id,json=nftId,proto3" json:"nft_id,omitempty" yaml:"nft_id"` -} - -func (m *EventNotRegisteredRecipientContainerId) Reset() { - *m = EventNotRegisteredRecipientContainerId{} -} -func (m *EventNotRegisteredRecipientContainerId) String() string { return proto.CompactTextString(m) } -func (*EventNotRegisteredRecipientContainerId) ProtoMessage() {} -func (*EventNotRegisteredRecipientContainerId) Descriptor() ([]byte, []int) { - return fileDescriptor_4bc2d07e5e7a71a2, []int{4} -} -func (m *EventNotRegisteredRecipientContainerId) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *EventNotRegisteredRecipientContainerId) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_EventNotRegisteredRecipientContainerId.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 *EventNotRegisteredRecipientContainerId) XXX_Merge(src proto.Message) { - xxx_messageInfo_EventNotRegisteredRecipientContainerId.Merge(m, src) -} -func (m *EventNotRegisteredRecipientContainerId) XXX_Size() int { - return m.Size() -} -func (m *EventNotRegisteredRecipientContainerId) XXX_DiscardUnknown() { - xxx_messageInfo_EventNotRegisteredRecipientContainerId.DiscardUnknown(m) -} - -var xxx_messageInfo_EventNotRegisteredRecipientContainerId proto.InternalMessageInfo - -func (m *EventNotRegisteredRecipientContainerId) GetRecipientContainerId() string { - if m != nil { - return m.RecipientContainerId - } - return "" -} - -func (m *EventNotRegisteredRecipientContainerId) GetClassId() string { - if m != nil { - return m.ClassId - } - return "" -} - -func (m *EventNotRegisteredRecipientContainerId) GetNftId() string { - if m != nil { - return m.NftId - } - return "" -} - type EventNotRecordedNftId struct { ClassId string `protobuf:"bytes,1,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty" yaml:"class_id"` NftId string `protobuf:"bytes,2,opt,name=nft_id,json=nftId,proto3" json:"nft_id,omitempty" yaml:"nft_id"` @@ -324,7 +202,7 @@ func (m *EventNotRecordedNftId) Reset() { *m = EventNotRecordedNftId{} } func (m *EventNotRecordedNftId) String() string { return proto.CompactTextString(m) } func (*EventNotRecordedNftId) ProtoMessage() {} func (*EventNotRecordedNftId) Descriptor() ([]byte, []int) { - return fileDescriptor_4bc2d07e5e7a71a2, []int{5} + return fileDescriptor_4bc2d07e5e7a71a2, []int{3} } func (m *EventNotRecordedNftId) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -376,7 +254,7 @@ func (m *EventUpdatedReward) Reset() { *m = EventUpdatedReward{} } func (m *EventUpdatedReward) String() string { return proto.CompactTextString(m) } func (*EventUpdatedReward) ProtoMessage() {} func (*EventUpdatedReward) Descriptor() ([]byte, []int) { - return fileDescriptor_4bc2d07e5e7a71a2, []int{6} + return fileDescriptor_4bc2d07e5e7a71a2, []int{4} } func (m *EventUpdatedReward) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -428,7 +306,7 @@ func (m *EventDistributionForStakers) Reset() { *m = EventDistributionFo func (m *EventDistributionForStakers) String() string { return proto.CompactTextString(m) } func (*EventDistributionForStakers) ProtoMessage() {} func (*EventDistributionForStakers) Descriptor() ([]byte, []int) { - return fileDescriptor_4bc2d07e5e7a71a2, []int{7} + return fileDescriptor_4bc2d07e5e7a71a2, []int{5} } func (m *EventDistributionForStakers) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -481,7 +359,7 @@ func (m *EventVersionUnmatched) Reset() { *m = EventVersionUnmatched{} } func (m *EventVersionUnmatched) String() string { return proto.CompactTextString(m) } func (*EventVersionUnmatched) ProtoMessage() {} func (*EventVersionUnmatched) Descriptor() ([]byte, []int) { - return fileDescriptor_4bc2d07e5e7a71a2, []int{8} + return fileDescriptor_4bc2d07e5e7a71a2, []int{6} } func (m *EventVersionUnmatched) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -534,9 +412,7 @@ func (m *EventVersionUnmatched) GetNftId() string { func init() { proto.RegisterType((*EventWithdrawAllRewards)(nil), "ununifi.ecosystemincentive.EventWithdrawAllRewards") proto.RegisterType((*EventWithdrawReward)(nil), "ununifi.ecosystemincentive.EventWithdrawReward") - proto.RegisterType((*EventFailedParsingTxMemoData)(nil), "ununifi.ecosystemincentive.EventFailedParsingTxMemoData") proto.RegisterType((*EventDeletedNftIdRecordedForFrontendReward)(nil), "ununifi.ecosystemincentive.EventDeletedNftIdRecordedForFrontendReward") - proto.RegisterType((*EventNotRegisteredRecipientContainerId)(nil), "ununifi.ecosystemincentive.EventNotRegisteredRecipientContainerId") proto.RegisterType((*EventNotRecordedNftId)(nil), "ununifi.ecosystemincentive.EventNotRecordedNftId") proto.RegisterType((*EventUpdatedReward)(nil), "ununifi.ecosystemincentive.EventUpdatedReward") proto.RegisterType((*EventDistributionForStakers)(nil), "ununifi.ecosystemincentive.EventDistributionForStakers") @@ -548,55 +424,51 @@ func init() { } var fileDescriptor_4bc2d07e5e7a71a2 = []byte{ - // 768 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x55, 0x41, 0x6f, 0x1b, 0x45, - 0x14, 0xf6, 0xd8, 0x10, 0x60, 0xd2, 0x28, 0xcd, 0x3a, 0x25, 0x6e, 0x08, 0xde, 0xb0, 0x48, 0xc5, - 0x20, 0xb1, 0xab, 0x92, 0x5b, 0x6f, 0x75, 0x8b, 0xc1, 0x88, 0x56, 0xd5, 0x82, 0xa9, 0xc4, 0xc5, - 0x1a, 0xef, 0xbc, 0xd8, 0xa3, 0xec, 0xce, 0x98, 0x99, 0xb1, 0xdd, 0xfc, 0x02, 0xae, 0x3d, 0x71, - 0x43, 0xdc, 0xf9, 0x0d, 0xfc, 0x80, 0x1c, 0x23, 0x71, 0x41, 0x42, 0xda, 0xa0, 0x44, 0xe2, 0x07, - 0xec, 0x85, 0x2b, 0xda, 0x99, 0x75, 0x12, 0xc7, 0x91, 0x15, 0x1f, 0x72, 0xe8, 0x69, 0x67, 0xde, - 0xfb, 0xde, 0x37, 0xdf, 0xf7, 0x66, 0x9e, 0x16, 0x3f, 0x18, 0xf1, 0x11, 0x67, 0xfb, 0x2c, 0x80, - 0x48, 0xa8, 0x43, 0xa5, 0x21, 0x61, 0x3c, 0x02, 0xae, 0xd9, 0x18, 0x02, 0x18, 0x03, 0xd7, 0xfe, - 0x50, 0x0a, 0x2d, 0x9c, 0xed, 0x02, 0xe7, 0xcf, 0xe3, 0xb6, 0xf7, 0x16, 0x71, 0xcc, 0x85, 0x2c, - 0xe1, 0xf6, 0x66, 0x5f, 0xf4, 0x85, 0x59, 0x06, 0xf9, 0xaa, 0x88, 0xd6, 0x23, 0xa1, 0x12, 0xa1, - 0x82, 0x1e, 0x51, 0x10, 0x8c, 0x1f, 0xf6, 0x40, 0x93, 0x87, 0x41, 0x24, 0x18, 0xb7, 0x79, 0xef, - 0x5f, 0x84, 0xb7, 0xbe, 0xcc, 0x65, 0xbd, 0x64, 0x7a, 0x40, 0x25, 0x99, 0x3c, 0x8e, 0xe3, 0x10, - 0x26, 0x44, 0x52, 0xe5, 0x7c, 0x8a, 0x57, 0x14, 0x70, 0x0a, 0xb2, 0x86, 0x76, 0x51, 0xe3, 0xbd, - 0xe6, 0x46, 0x96, 0xba, 0x6b, 0x87, 0x24, 0x89, 0x1f, 0x79, 0x36, 0xee, 0x85, 0x05, 0xc0, 0xf9, - 0x0d, 0xe1, 0x7b, 0x24, 0x8e, 0xbb, 0x93, 0x82, 0x85, 0x77, 0xa5, 0x25, 0xa9, 0x95, 0x77, 0x2b, - 0x8d, 0xd5, 0x2f, 0xee, 0xfb, 0x56, 0x87, 0x9f, 0xeb, 0xf0, 0x0b, 0x1d, 0xfe, 0x13, 0xc1, 0x78, - 0xf3, 0xc5, 0x51, 0xea, 0x96, 0xb2, 0xd4, 0xdd, 0xb1, 0xcc, 0xd7, 0xb2, 0x78, 0xbf, 0x9f, 0xb8, - 0x8d, 0x3e, 0xd3, 0x83, 0x51, 0xcf, 0x8f, 0x44, 0x12, 0x14, 0xa6, 0xec, 0xe7, 0x73, 0x45, 0x0f, - 0x02, 0x7d, 0x38, 0x04, 0x65, 0x08, 0x55, 0x58, 0x25, 0x71, 0x3c, 0xb5, 0xc3, 0x0b, 0x33, 0xde, - 0x9f, 0x08, 0x57, 0x67, 0x8c, 0xda, 0xc4, 0x32, 0x26, 0x5f, 0x23, 0x7c, 0xf7, 0xaa, 0xb4, 0x5a, - 0x79, 0x17, 0x2d, 0xf6, 0xf7, 0x4d, 0xe1, 0x6f, 0xcb, 0x92, 0x5e, 0x25, 0xc8, 0xad, 0x7d, 0x72, - 0x43, 0x6b, 0xe1, 0xfa, 0x64, 0xd6, 0x96, 0xf7, 0x2b, 0xc2, 0x3b, 0xc6, 0x55, 0x8b, 0xb0, 0x18, - 0xe8, 0x0b, 0x22, 0x15, 0xe3, 0xfd, 0xef, 0x5f, 0x3d, 0x83, 0x44, 0x3c, 0x25, 0x9a, 0x38, 0x3e, - 0x7e, 0x37, 0x8a, 0x89, 0x52, 0x5d, 0x46, 0x0b, 0x83, 0xd5, 0x2c, 0x75, 0xd7, 0xad, 0x96, 0x69, - 0xc6, 0x0b, 0xdf, 0x31, 0xcb, 0x36, 0x75, 0x1a, 0x78, 0x85, 0xef, 0xeb, 0x1c, 0x5d, 0xbe, 0xda, - 0x0e, 0x1b, 0xf7, 0xc2, 0xb7, 0xf9, 0xbe, 0x6e, 0x53, 0xe7, 0x63, 0xfc, 0x56, 0x02, 0x89, 0xa8, - 0x55, 0x0c, 0x6e, 0x3d, 0x4b, 0xdd, 0x55, 0x8b, 0xcb, 0xa3, 0x5e, 0x68, 0x92, 0xde, 0x09, 0xc2, - 0x9f, 0x19, 0x7d, 0x4f, 0x21, 0x06, 0x0d, 0xf4, 0x79, 0x5e, 0x1a, 0x42, 0x24, 0x24, 0x05, 0xda, - 0x12, 0xb2, 0x25, 0x05, 0xd7, 0xc0, 0x69, 0x71, 0x19, 0x2f, 0xf1, 0xfb, 0x12, 0x22, 0x36, 0x64, - 0xc0, 0x75, 0x37, 0x12, 0x5c, 0x13, 0xc6, 0x41, 0x5e, 0x68, 0xff, 0x28, 0x4b, 0xdd, 0x0f, 0xed, - 0x29, 0xd7, 0xe3, 0xbc, 0x70, 0xf3, 0x3c, 0xf1, 0x64, 0x1a, 0x6f, 0xd3, 0x99, 0x36, 0x94, 0x97, - 0x6a, 0x43, 0x65, 0x71, 0x1b, 0xbc, 0xbf, 0x11, 0x7e, 0x60, 0x1c, 0x3e, 0x17, 0x3a, 0x84, 0x3e, - 0x53, 0x1a, 0x24, 0xe4, 0x16, 0xe7, 0x45, 0xbc, 0x81, 0xee, 0x7e, 0xc2, 0xf7, 0x2e, 0xcc, 0xd9, - 0x5b, 0x33, 0x57, 0x78, 0x7b, 0xef, 0xca, 0xfb, 0x0f, 0x61, 0xc7, 0x9c, 0xd9, 0x19, 0x52, 0xa2, - 0xe1, 0xd6, 0x9f, 0xc6, 0xcf, 0x08, 0xaf, 0x01, 0x91, 0x1c, 0xe8, 0x8d, 0x47, 0xfa, 0xab, 0x62, - 0xa4, 0x37, 0xed, 0x79, 0x33, 0xd5, 0x4b, 0xcd, 0xf3, 0x1d, 0x5b, 0x5a, 0x0c, 0x73, 0x86, 0xf0, - 0x07, 0x76, 0x58, 0x98, 0xd2, 0x92, 0xf5, 0x46, 0x9a, 0x09, 0xde, 0x12, 0xf2, 0x3b, 0x4d, 0x0e, - 0x40, 0x2a, 0xe7, 0x17, 0x84, 0x1d, 0x3a, 0x4d, 0x01, 0xed, 0x92, 0x44, 0x8c, 0xb8, 0x36, 0xfe, - 0x17, 0xca, 0xfd, 0xb6, 0x90, 0x7b, 0xdf, 0xca, 0x9d, 0xa7, 0x58, 0x4a, 0xf3, 0xc6, 0xa5, 0xfa, - 0xc7, 0xa6, 0xdc, 0x79, 0x84, 0xef, 0xf4, 0x62, 0x11, 0x1d, 0x74, 0x07, 0xc0, 0xfa, 0x03, 0x6d, - 0x1a, 0x58, 0x69, 0x6e, 0x65, 0xa9, 0x5b, 0xb5, 0x47, 0x5e, 0xce, 0x7a, 0xe1, 0xaa, 0xd9, 0x7e, - 0x6d, 0x77, 0x7f, 0xa0, 0xe2, 0x89, 0xfd, 0x00, 0x52, 0x31, 0xc1, 0x3b, 0x3c, 0x21, 0x3a, 0x1a, - 0x00, 0x75, 0xda, 0x78, 0x63, 0x34, 0xdd, 0x74, 0xc7, 0x36, 0x6b, 0xcc, 0xae, 0x35, 0x77, 0xb2, - 0xd4, 0xad, 0x59, 0xea, 0x39, 0x88, 0x17, 0xde, 0x3d, 0x8f, 0x15, 0x9c, 0xb7, 0x37, 0x20, 0xcd, - 0x67, 0x47, 0xa7, 0x75, 0x74, 0x7c, 0x5a, 0x47, 0xff, 0x9c, 0xd6, 0xd1, 0xeb, 0xb3, 0x7a, 0xe9, - 0xf8, 0xac, 0x5e, 0xfa, 0xeb, 0xac, 0x5e, 0xfa, 0x71, 0xef, 0x52, 0x43, 0x3b, 0xbc, 0xc3, 0x59, - 0x8b, 0x05, 0xd1, 0x80, 0x30, 0x1e, 0xbc, 0xba, 0xee, 0xbf, 0x6e, 0x3a, 0xdc, 0x5b, 0x31, 0x7f, - 0xe5, 0xbd, 0xff, 0x03, 0x00, 0x00, 0xff, 0xff, 0xe0, 0x62, 0x2e, 0xa7, 0x46, 0x08, 0x00, 0x00, + // 695 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x95, 0x41, 0x4f, 0x53, 0x4b, + 0x14, 0xc7, 0x3b, 0x25, 0x8f, 0xf7, 0xde, 0x00, 0x01, 0x6e, 0xe1, 0x51, 0x78, 0xd8, 0x8b, 0x77, + 0xa1, 0xd5, 0xc4, 0x7b, 0x83, 0xec, 0xd8, 0x51, 0xb4, 0x5a, 0xa3, 0xc4, 0x5c, 0x53, 0x49, 0xdc, + 0x34, 0xb7, 0x77, 0x0e, 0xed, 0x84, 0xdb, 0x99, 0x3a, 0x33, 0x6d, 0xe5, 0x13, 0xb8, 0x65, 0xe5, + 0xd6, 0xbd, 0x9f, 0xc1, 0x0f, 0xc0, 0x92, 0xc4, 0x8d, 0xab, 0x62, 0x20, 0xf1, 0x03, 0x74, 0xe3, + 0xd6, 0x74, 0x66, 0x4a, 0x28, 0x25, 0x48, 0x17, 0xac, 0x3a, 0x73, 0xce, 0x99, 0xff, 0xf9, 0xff, + 0x4e, 0x4e, 0x73, 0xf1, 0xbd, 0x16, 0x6b, 0x31, 0xba, 0x47, 0x03, 0x88, 0xb9, 0x3c, 0x90, 0x0a, + 0x1a, 0x94, 0xc5, 0xc0, 0x14, 0x6d, 0x43, 0x00, 0x6d, 0x60, 0xca, 0x6f, 0x0a, 0xae, 0xb8, 0xb3, + 0x62, 0xeb, 0xfc, 0xd1, 0xba, 0x95, 0x8d, 0xeb, 0x34, 0x46, 0x42, 0x46, 0x70, 0x65, 0xa1, 0xc6, + 0x6b, 0x5c, 0x1f, 0x83, 0xfe, 0xc9, 0x46, 0x73, 0x31, 0x97, 0x0d, 0x2e, 0x83, 0x6a, 0x24, 0x21, + 0x68, 0xaf, 0x57, 0x41, 0x45, 0xeb, 0x41, 0xcc, 0x29, 0x33, 0x79, 0xef, 0x27, 0xc2, 0x4b, 0x4f, + 0xfb, 0xb6, 0x76, 0xa9, 0xaa, 0x13, 0x11, 0x75, 0xb6, 0x92, 0x24, 0x84, 0x4e, 0x24, 0x88, 0x74, + 0x1e, 0xe0, 0x49, 0x09, 0x8c, 0x80, 0xc8, 0xa2, 0x35, 0x94, 0xff, 0xb7, 0x30, 0xdf, 0xeb, 0xba, + 0x33, 0x07, 0x51, 0x23, 0xd9, 0xf4, 0x4c, 0xdc, 0x0b, 0x6d, 0x81, 0xf3, 0x19, 0xe1, 0xc5, 0x28, + 0x49, 0x2a, 0x1d, 0xab, 0xc2, 0x2a, 0xc2, 0x88, 0x64, 0xd3, 0x6b, 0x13, 0xf9, 0xa9, 0xc7, 0xcb, + 0xbe, 0xf1, 0xe1, 0xf7, 0x7d, 0xf8, 0xd6, 0x87, 0xbf, 0xcd, 0x29, 0x2b, 0xbc, 0x3e, 0xea, 0xba, + 0xa9, 0x5e, 0xd7, 0x5d, 0x35, 0xca, 0x57, 0xaa, 0x78, 0x5f, 0x4e, 0xdc, 0x7c, 0x8d, 0xaa, 0x7a, + 0xab, 0xea, 0xc7, 0xbc, 0x11, 0x58, 0x28, 0xf3, 0xf3, 0x48, 0x92, 0xfd, 0x40, 0x1d, 0x34, 0x41, + 0x6a, 0x41, 0x19, 0x66, 0xa2, 0x24, 0x19, 0xe0, 0x30, 0x0b, 0xe3, 0x7d, 0x43, 0x38, 0x33, 0x04, + 0x6a, 0x12, 0xe3, 0x40, 0x1e, 0x22, 0x3c, 0x77, 0xd9, 0x5a, 0x36, 0xbd, 0x86, 0xae, 0xe7, 0x7b, + 0x61, 0xf9, 0x96, 0x8c, 0xe8, 0x65, 0x81, 0x3e, 0xda, 0xfd, 0x1b, 0xa2, 0x85, 0xb3, 0x9d, 0x61, + 0x2c, 0xef, 0x04, 0xe1, 0x87, 0x9a, 0xea, 0x09, 0x24, 0xa0, 0x80, 0xec, 0xec, 0xa9, 0x12, 0x09, + 0x21, 0xe6, 0x82, 0x00, 0x29, 0x72, 0x51, 0x14, 0x9c, 0x29, 0x60, 0xc4, 0xc2, 0xee, 0xe2, 0xff, + 0x04, 0xc4, 0xb4, 0x49, 0x81, 0xa9, 0x4a, 0xcc, 0x99, 0x8a, 0x28, 0x03, 0x51, 0xa1, 0xc4, 0xc2, + 0xdf, 0xed, 0x75, 0xdd, 0x3b, 0xc6, 0xe7, 0xd5, 0x75, 0x5e, 0xb8, 0x70, 0x9e, 0xd8, 0x1e, 0xc4, + 0x4b, 0xc4, 0xf1, 0xf1, 0x3f, 0x71, 0x12, 0x49, 0xd9, 0x97, 0x4a, 0x6b, 0xa9, 0x4c, 0xaf, 0xeb, + 0xce, 0x1a, 0xa9, 0x41, 0xc6, 0x0b, 0xff, 0xd6, 0xc7, 0x12, 0x71, 0xf2, 0x78, 0x92, 0xed, 0xa9, + 0x7e, 0xf5, 0xc4, 0xe5, 0xa9, 0x9b, 0xb8, 0x17, 0xfe, 0xc5, 0xfa, 0x2c, 0xde, 0x7b, 0xbc, 0xa8, + 0x01, 0x77, 0xb8, 0x1a, 0x70, 0x69, 0xc8, 0xa1, 0x96, 0x68, 0xac, 0x96, 0xe9, 0x3f, 0xb4, 0xfc, + 0x85, 0xb0, 0xa3, 0x7b, 0x96, 0x9b, 0x24, 0x52, 0x70, 0xeb, 0xc3, 0xfb, 0x88, 0xf0, 0x0c, 0x44, + 0x82, 0x01, 0xb9, 0xf1, 0x52, 0x3d, 0xb3, 0x4b, 0xb5, 0x60, 0xfa, 0x0d, 0xbd, 0x1e, 0x6b, 0xa3, + 0xa6, 0xcd, 0x53, 0xbb, 0x4e, 0x3d, 0x84, 0xff, 0x37, 0xeb, 0x44, 0xa5, 0x12, 0xb4, 0xda, 0x52, + 0x94, 0xb3, 0x22, 0x17, 0x6f, 0x54, 0xb4, 0x0f, 0x42, 0x3a, 0x9f, 0x10, 0x76, 0xc8, 0x20, 0x05, + 0xa4, 0x12, 0x35, 0x78, 0x8b, 0x29, 0xcd, 0x7f, 0xad, 0xdd, 0x97, 0xd6, 0xee, 0xb2, 0xb1, 0x3b, + 0x2a, 0x31, 0x96, 0xe7, 0xf9, 0x0b, 0xef, 0xb7, 0xf4, 0x73, 0x67, 0x13, 0x4f, 0x57, 0x13, 0x1e, + 0xef, 0x57, 0xea, 0x40, 0x6b, 0x75, 0xa5, 0x07, 0x38, 0x51, 0x58, 0xea, 0x75, 0xdd, 0x8c, 0x69, + 0x79, 0x31, 0xeb, 0x85, 0x53, 0xfa, 0xfa, 0xdc, 0xdc, 0xbe, 0x22, 0xbb, 0x62, 0x6f, 0x41, 0x48, + 0xca, 0x59, 0x99, 0x35, 0x22, 0x15, 0xd7, 0x81, 0x38, 0x25, 0x3c, 0xdf, 0x1a, 0x5c, 0x2a, 0x6d, + 0x93, 0xd5, 0xb0, 0x33, 0x85, 0xd5, 0x5e, 0xd7, 0xcd, 0x1a, 0xe9, 0x91, 0x12, 0x2f, 0x9c, 0x3b, + 0x8f, 0x59, 0xcd, 0xdb, 0xfb, 0x83, 0x14, 0x5e, 0x1d, 0x9d, 0xe6, 0xd0, 0xf1, 0x69, 0x0e, 0xfd, + 0x38, 0xcd, 0xa1, 0xc3, 0xb3, 0x5c, 0xea, 0xf8, 0x2c, 0x97, 0xfa, 0x7e, 0x96, 0x4b, 0xbd, 0xdb, + 0xb8, 0x30, 0xd0, 0x32, 0x2b, 0x33, 0x5a, 0xa4, 0x41, 0x5c, 0x8f, 0x28, 0x0b, 0x3e, 0x5c, 0xf5, + 0x65, 0xd1, 0x13, 0xae, 0x4e, 0xea, 0xef, 0xc2, 0xc6, 0xef, 0x00, 0x00, 0x00, 0xff, 0xff, 0xa0, + 0xa9, 0x91, 0x9d, 0xc8, 0x06, 0x00, 0x00, } func (m *EventWithdrawAllRewards) Marshal() (dAtA []byte, err error) { @@ -683,50 +555,6 @@ func (m *EventWithdrawReward) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *EventFailedParsingTxMemoData) 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 *EventFailedParsingTxMemoData) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *EventFailedParsingTxMemoData) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Memo) > 0 { - i -= len(m.Memo) - copy(dAtA[i:], m.Memo) - i = encodeVarintEvent(dAtA, i, uint64(len(m.Memo))) - i-- - dAtA[i] = 0x1a - } - if len(m.NftId) > 0 { - i -= len(m.NftId) - copy(dAtA[i:], m.NftId) - i = encodeVarintEvent(dAtA, i, uint64(len(m.NftId))) - i-- - dAtA[i] = 0x12 - } - if len(m.ClassId) > 0 { - i -= len(m.ClassId) - copy(dAtA[i:], m.ClassId) - i = encodeVarintEvent(dAtA, i, uint64(len(m.ClassId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - func (m *EventDeletedNftIdRecordedForFrontendReward) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -771,50 +599,6 @@ func (m *EventDeletedNftIdRecordedForFrontendReward) MarshalToSizedBuffer(dAtA [ return len(dAtA) - i, nil } -func (m *EventNotRegisteredRecipientContainerId) 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 *EventNotRegisteredRecipientContainerId) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *EventNotRegisteredRecipientContainerId) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.NftId) > 0 { - i -= len(m.NftId) - copy(dAtA[i:], m.NftId) - i = encodeVarintEvent(dAtA, i, uint64(len(m.NftId))) - i-- - dAtA[i] = 0x1a - } - if len(m.ClassId) > 0 { - i -= len(m.ClassId) - copy(dAtA[i:], m.ClassId) - i = encodeVarintEvent(dAtA, i, uint64(len(m.ClassId))) - i-- - dAtA[i] = 0x12 - } - if len(m.RecipientContainerId) > 0 { - i -= len(m.RecipientContainerId) - copy(dAtA[i:], m.RecipientContainerId) - i = encodeVarintEvent(dAtA, i, uint64(len(m.RecipientContainerId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - func (m *EventNotRecordedNftId) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1017,27 +801,6 @@ func (m *EventWithdrawReward) Size() (n int) { return n } -func (m *EventFailedParsingTxMemoData) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ClassId) - if l > 0 { - n += 1 + l + sovEvent(uint64(l)) - } - l = len(m.NftId) - if l > 0 { - n += 1 + l + sovEvent(uint64(l)) - } - l = len(m.Memo) - if l > 0 { - n += 1 + l + sovEvent(uint64(l)) - } - return n -} - func (m *EventDeletedNftIdRecordedForFrontendReward) Size() (n int) { if m == nil { return 0 @@ -1059,27 +822,6 @@ func (m *EventDeletedNftIdRecordedForFrontendReward) Size() (n int) { return n } -func (m *EventNotRegisteredRecipientContainerId) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.RecipientContainerId) - if l > 0 { - n += 1 + l + sovEvent(uint64(l)) - } - l = len(m.ClassId) - if l > 0 { - n += 1 + l + sovEvent(uint64(l)) - } - l = len(m.NftId) - if l > 0 { - n += 1 + l + sovEvent(uint64(l)) - } - return n -} - func (m *EventNotRecordedNftId) Size() (n int) { if m == nil { return 0 @@ -1383,152 +1125,6 @@ func (m *EventWithdrawReward) Unmarshal(dAtA []byte) error { } return nil } -func (m *EventFailedParsingTxMemoData) 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 ErrIntOverflowEvent - } - 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: EventFailedParsingTxMemoData: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: EventFailedParsingTxMemoData: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvent - } - 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 ErrInvalidLengthEvent - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthEvent - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ClassId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvent - } - 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 ErrInvalidLengthEvent - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthEvent - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.NftId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Memo", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvent - } - 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 ErrInvalidLengthEvent - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthEvent - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Memo = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipEvent(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthEvent - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func (m *EventDeletedNftIdRecordedForFrontendReward) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1675,152 +1271,6 @@ func (m *EventDeletedNftIdRecordedForFrontendReward) Unmarshal(dAtA []byte) erro } return nil } -func (m *EventNotRegisteredRecipientContainerId) 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 ErrIntOverflowEvent - } - 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: EventNotRegisteredRecipientContainerId: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: EventNotRegisteredRecipientContainerId: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RecipientContainerId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvent - } - 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 ErrInvalidLengthEvent - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthEvent - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.RecipientContainerId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvent - } - 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 ErrInvalidLengthEvent - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthEvent - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ClassId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvent - } - 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 ErrInvalidLengthEvent - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthEvent - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.NftId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipEvent(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthEvent - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func (m *EventNotRecordedNftId) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/x/nft/keeper/keeper.go b/x/nft/keeper/keeper.go index 3b45e87a6..da3d895fb 100644 --- a/x/nft/keeper/keeper.go +++ b/x/nft/keeper/keeper.go @@ -4,22 +4,72 @@ import ( "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + + "github.com/cosmos/cosmos-sdk/x/nft" "github.com/cosmos/cosmos-sdk/x/nft/keeper" + wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" "github.com/UnUniFi/chain/x/nft/types" ) type Keeper struct { keeper.Keeper cdc codec.BinaryCodec + + wasmKeeper wasmtypes.ContractOpsKeeper + authority string } -func NewKeeper(k keeper.Keeper, cdc codec.BinaryCodec) Keeper { +func NewKeeper(k keeper.Keeper, cdc codec.BinaryCodec, wasmKeeper wasmtypes.ContractOpsKeeper, authority string) Keeper { return Keeper{ - Keeper: k, - cdc: cdc, + Keeper: k, + cdc: cdc, + wasmKeeper: wasmKeeper, + authority: authority, + } +} + +func (k Keeper) GetClassData(ctx sdk.Context, classId string) (types.ClassData, bool) { + token, found := k.Keeper.GetClass(ctx, classId) + if !found { + return types.ClassData{}, false + } + + var classDataI types.ClassDataI + if err := k.cdc.UnpackAny(token.Data, classDataI); err != nil { + return types.ClassData{}, true + } + + if token.Data == nil { + return types.ClassData{}, true + } + + switch classData := classDataI.(type) { + case *types.ClassData: + return *classData, true + default: + return types.ClassData{}, true + } +} + +func (k Keeper) SetClassData(ctx sdk.Context, classId string, data types.ClassData) error { + class, found := k.Keeper.GetClass(ctx, classId) + if !found { + return nft.ErrClassNotExists + } + + dataAny, err := codectypes.NewAnyWithValue(&data) + if err != nil { + return err + } + + class.Data = dataAny + err = k.Keeper.UpdateClass(ctx, class) + if err != nil { + return err } + + return nil } func (k Keeper) GetNftData(ctx sdk.Context, classId string, id string) (types.NftData, bool) { @@ -28,23 +78,19 @@ func (k Keeper) GetNftData(ctx sdk.Context, classId string, id string) (types.Nf return types.NftData{}, false } - // todo: after register the interface - // var nftDataI types.NftDataI - // if err := k.cdc.UnpackAny(token.Data, nftDataI); err != nil { - // return types.NftData{}, false - // } - - // switch nftData := nftDataI.(type) { + var nftDataI types.NftDataI + if err := k.cdc.UnpackAny(token.Data, nftDataI); err != nil { + return types.NftData{}, true + } if token.Data == nil { return types.NftData{}, true } - switch nftData := types.UnpackNftData(*token.Data).(type) { + switch nftData := nftDataI.(type) { case *types.NftData: return *nftData, true default: - // if the type is not *types.NftData, return an empty NftData return types.NftData{}, true } } @@ -52,7 +98,7 @@ func (k Keeper) GetNftData(ctx sdk.Context, classId string, id string) (types.Nf func (k Keeper) SetNftData(ctx sdk.Context, classId string, id string, data types.NftData) error { token, found := k.Keeper.GetNFT(ctx, classId, id) if !found { - return sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "unknown NFT %s", id) + return nft.ErrNFTNotExists } dataAny, err := codectypes.NewAnyWithValue(&data) diff --git a/x/nft/keeper/msg_server.go b/x/nft/keeper/msg_server.go index 2267efe52..9a54eaf7a 100644 --- a/x/nft/keeper/msg_server.go +++ b/x/nft/keeper/msg_server.go @@ -2,10 +2,13 @@ package keeper import ( "context" + "encoding/json" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/x/nft" + + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) var _ nft.MsgServer = Keeper{} @@ -28,20 +31,43 @@ func (k Keeper) Send(goCtx context.Context, msg *nft.MsgSend) (*nft.MsgSendRespo return nil, err } + // Check NftData nftData, found := k.GetNftData(ctx, msg.ClassId, msg.Id) if !found { - return nil, sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "unknown NFT %s", msg.Id) + return nil, nft.ErrNFTNotExists } if nftData.SendDisabled { return nil, sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "Sending NFT %s of class %s is disabled", msg.Id, msg.ClassId) } + // Check ClassData + class, found := k.GetClassData(ctx, msg.ClassId) + if !found { + return nil, nft.ErrClassNotExists + } + if class.SendPrehookContract != "" { + contractAddr, err := sdk.AccAddressFromBech32(class.SendPrehookContract) + if err != nil { + return nil, err + } + address := authtypes.NewModuleAddress(nft.ModuleName) + wasmMsg, err := json.Marshal(struct{}{}) + if err != nil { + return nil, err + } + + _, err = k.wasmKeeper.Execute(ctx, contractAddr, address, []byte(wasmMsg), sdk.Coins{}) + if err != nil { + return nil, err + } + } + if err := k.Transfer(ctx, msg.ClassId, msg.Id, receiver); err != nil { return nil, err } - ctx.EventManager().EmitTypedEvent(&nft.EventSend{ + _ = ctx.EventManager().EmitTypedEvent(&nft.EventSend{ ClassId: msg.ClassId, Id: msg.Id, Sender: msg.Sender, diff --git a/x/nft/types/data.go b/x/nft/types/data.go index 7039d6585..0e6d3f8f1 100644 --- a/x/nft/types/data.go +++ b/x/nft/types/data.go @@ -1,23 +1,13 @@ package types import ( - "github.com/cosmos/cosmos-sdk/codec/types" proto "github.com/cosmos/gogoproto/proto" ) -type NftDataI interface { +type ClassDataI interface { proto.Message } -func UnpackNftData(dataAny types.Any) NftDataI { - if dataAny.TypeUrl == "/"+proto.MessageName(&NftData{}) { - var nftData NftData - err := nftData.Unmarshal(dataAny.Value) - if err != nil { - return nil - } - return &nftData - } - - return nil +type NftDataI interface { + proto.Message } diff --git a/x/nft/types/nft.pb.go b/x/nft/types/nft.pb.go index 5396b2a6c..521957b32 100644 --- a/x/nft/types/nft.pb.go +++ b/x/nft/types/nft.pb.go @@ -25,6 +25,50 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +type ClassData struct { + SendPrehookContract string `protobuf:"bytes,1,opt,name=send_prehook_contract,json=sendPrehookContract,proto3" json:"send_prehook_contract,omitempty"` +} + +func (m *ClassData) Reset() { *m = ClassData{} } +func (m *ClassData) String() string { return proto.CompactTextString(m) } +func (*ClassData) ProtoMessage() {} +func (*ClassData) Descriptor() ([]byte, []int) { + return fileDescriptor_e3328dbf8ea3b159, []int{0} +} +func (m *ClassData) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ClassData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ClassData.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 *ClassData) XXX_Merge(src proto.Message) { + xxx_messageInfo_ClassData.Merge(m, src) +} +func (m *ClassData) XXX_Size() int { + return m.Size() +} +func (m *ClassData) XXX_DiscardUnknown() { + xxx_messageInfo_ClassData.DiscardUnknown(m) +} + +var xxx_messageInfo_ClassData proto.InternalMessageInfo + +func (m *ClassData) GetSendPrehookContract() string { + if m != nil { + return m.SendPrehookContract + } + return "" +} + type NftData struct { SendDisabled bool `protobuf:"varint,1,opt,name=send_disabled,json=sendDisabled,proto3" json:"send_disabled,omitempty"` } @@ -33,7 +77,7 @@ func (m *NftData) Reset() { *m = NftData{} } func (m *NftData) String() string { return proto.CompactTextString(m) } func (*NftData) ProtoMessage() {} func (*NftData) Descriptor() ([]byte, []int) { - return fileDescriptor_e3328dbf8ea3b159, []int{0} + return fileDescriptor_e3328dbf8ea3b159, []int{1} } func (m *NftData) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -70,26 +114,60 @@ func (m *NftData) GetSendDisabled() bool { } func init() { + proto.RegisterType((*ClassData)(nil), "ununifi.nft.ClassData") proto.RegisterType((*NftData)(nil), "ununifi.nft.NftData") } func init() { proto.RegisterFile("ununifi/nft/nft.proto", fileDescriptor_e3328dbf8ea3b159) } var fileDescriptor_e3328dbf8ea3b159 = []byte{ - // 206 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x2d, 0xcd, 0x2b, 0xcd, - 0xcb, 0x4c, 0xcb, 0xd4, 0xcf, 0x4b, 0x2b, 0x01, 0x61, 0xbd, 0x82, 0xa2, 0xfc, 0x92, 0x7c, 0x21, - 0x6e, 0xa8, 0xb0, 0x5e, 0x5e, 0x5a, 0x89, 0x94, 0x48, 0x7a, 0x7e, 0x7a, 0x3e, 0x58, 0x5c, 0x1f, - 0xc4, 0x82, 0x28, 0x91, 0x92, 0x4c, 0xce, 0x2f, 0xce, 0xcd, 0x2f, 0x8e, 0x87, 0x48, 0x40, 0x38, - 0x30, 0xa9, 0xf4, 0xfc, 0xfc, 0xf4, 0x9c, 0x54, 0x7d, 0x30, 0x2f, 0xa9, 0x34, 0x4d, 0x3f, 0x31, - 0xaf, 0x12, 0x22, 0xa5, 0xa4, 0xc7, 0xc5, 0xee, 0x97, 0x56, 0xe2, 0x92, 0x58, 0x92, 0x28, 0xa4, - 0xcc, 0xc5, 0x5b, 0x9c, 0x9a, 0x97, 0x12, 0x9f, 0x92, 0x59, 0x9c, 0x98, 0x94, 0x93, 0x9a, 0x22, - 0xc1, 0xa8, 0xc0, 0xa8, 0xc1, 0x11, 0xc4, 0x03, 0x12, 0x74, 0x81, 0x8a, 0x39, 0xd9, 0x9d, 0x78, - 0x24, 0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x13, 0x1e, 0xcb, 0x31, 0x5c, - 0x78, 0x2c, 0xc7, 0x70, 0xe3, 0xb1, 0x1c, 0x43, 0x94, 0x4a, 0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, - 0x5e, 0x72, 0x7e, 0xae, 0x7e, 0x68, 0x5e, 0x68, 0x5e, 0xa6, 0x5b, 0xa6, 0x7e, 0x72, 0x46, 0x62, - 0x66, 0x9e, 0x7e, 0x05, 0xd8, 0x33, 0x25, 0x95, 0x05, 0xa9, 0xc5, 0x49, 0x6c, 0x60, 0x6b, 0x8d, - 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x8c, 0x27, 0xdc, 0x02, 0xe8, 0x00, 0x00, 0x00, + // 249 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x34, 0x90, 0x31, 0x4b, 0xc4, 0x30, + 0x14, 0xc7, 0x9b, 0x45, 0xbd, 0xa8, 0xcb, 0xe9, 0x81, 0xde, 0x10, 0xe4, 0x74, 0x70, 0x6a, 0x40, + 0x77, 0x05, 0xef, 0x70, 0x14, 0x39, 0xb8, 0xc5, 0xa5, 0xa4, 0x69, 0x92, 0x06, 0x7b, 0xef, 0x95, + 0x26, 0x05, 0xef, 0x5b, 0xf8, 0xb1, 0x1c, 0x6f, 0x74, 0x94, 0xf6, 0x8b, 0x48, 0x93, 0xde, 0x10, + 0xc8, 0xff, 0xf7, 0x7b, 0x7f, 0x78, 0x3c, 0x3a, 0x6b, 0xa1, 0x05, 0xab, 0x2d, 0x07, 0xed, 0x87, + 0x97, 0xd6, 0x0d, 0x7a, 0x9c, 0x9e, 0x8e, 0x38, 0x05, 0xed, 0xe7, 0x97, 0x06, 0x0d, 0x06, 0xce, + 0x87, 0x5f, 0x1c, 0x99, 0x5f, 0x4b, 0x74, 0x5b, 0x74, 0x59, 0x14, 0x31, 0x1c, 0x94, 0x41, 0x34, + 0x95, 0xe2, 0x21, 0xe5, 0xad, 0xe6, 0x02, 0x76, 0x51, 0x2d, 0x9e, 0xe9, 0x64, 0x59, 0x09, 0xe7, + 0x56, 0xc2, 0x8b, 0xe9, 0x03, 0x9d, 0x39, 0x05, 0x45, 0x56, 0x37, 0xaa, 0x44, 0xfc, 0xcc, 0x24, + 0x82, 0x6f, 0x84, 0xf4, 0x57, 0xe4, 0x86, 0xdc, 0x4f, 0xd6, 0x17, 0x83, 0x7c, 0x8f, 0x6e, 0x39, + 0xaa, 0x45, 0x4a, 0x8f, 0xdf, 0xb4, 0x0f, 0xf5, 0x5b, 0x7a, 0x1e, 0xea, 0x85, 0x75, 0x22, 0xaf, + 0x54, 0x11, 0x6a, 0x27, 0xeb, 0xb3, 0x01, 0xae, 0x46, 0xf6, 0xf2, 0xf4, 0xd3, 0x31, 0xb2, 0xef, + 0x18, 0xf9, 0xeb, 0x18, 0xf9, 0xee, 0x59, 0xb2, 0xef, 0x59, 0xf2, 0xdb, 0xb3, 0xe4, 0xe3, 0xce, + 0x58, 0x5f, 0xb6, 0x79, 0x2a, 0x71, 0xcb, 0x37, 0xb0, 0x01, 0xfb, 0x6a, 0xb9, 0x2c, 0x85, 0x05, + 0xfe, 0x15, 0xae, 0xe1, 0x77, 0xb5, 0x72, 0xf9, 0x51, 0xd8, 0xfb, 0xf1, 0x3f, 0x00, 0x00, 0xff, + 0xff, 0x08, 0xe6, 0x4a, 0x2f, 0x29, 0x01, 0x00, 0x00, +} + +func (m *ClassData) 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 *ClassData) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ClassData) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.SendPrehookContract) > 0 { + i -= len(m.SendPrehookContract) + copy(dAtA[i:], m.SendPrehookContract) + i = encodeVarintNft(dAtA, i, uint64(len(m.SendPrehookContract))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } func (m *NftData) Marshal() (dAtA []byte, err error) { @@ -136,6 +214,19 @@ func encodeVarintNft(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } +func (m *ClassData) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.SendPrehookContract) + if l > 0 { + n += 1 + l + sovNft(uint64(l)) + } + return n +} + func (m *NftData) Size() (n int) { if m == nil { return 0 @@ -154,6 +245,88 @@ func sovNft(x uint64) (n int) { func sozNft(x uint64) (n int) { return sovNft(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } +func (m *ClassData) 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 ErrIntOverflowNft + } + 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: ClassData: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ClassData: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SendPrehookContract", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNft + } + 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 ErrInvalidLengthNft + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNft + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SendPrehookContract = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipNft(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthNft + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *NftData) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/x/nftfactory/genesis.go b/x/nftfactory/genesis.go index bd91fa605..3a5034121 100644 --- a/x/nftfactory/genesis.go +++ b/x/nftfactory/genesis.go @@ -13,8 +13,8 @@ import ( func InitGenesis(ctx sdk.Context, k keeper.Keeper, nftKeeper types.NftKeeper, gs types.GenesisState) { k.SetParamSet(ctx, gs.Params) - for _, classAttributes := range gs.ClassAttributesList { - if err := InitClassRelatingData(ctx, k, nftKeeper, classAttributes); err != nil { + for _, classOwnership := range gs.ClassOwnerships { + if err := InitClassRelatingData(ctx, k, nftKeeper, classOwnership); err != nil { panic(err) } } @@ -30,7 +30,7 @@ func ExportGenesis(ctx sdk.Context, k keeper.Keeper) types.GenesisState { } } -func InitClassRelatingData(ctx sdk.Context, k keeper.Keeper, nftKeeper types.NftKeeper, classAttributes types.ClassAttributes) error { +func InitClassRelatingData(ctx sdk.Context, k keeper.Keeper, nftKeeper types.NftKeeper, classAttributes types.ClassOwnership) error { class, exists := nftKeeper.GetClass(ctx, classAttributes.ClassId) if !exists { return sdkerrors.Wrap(nfttypes.ErrClassNotExists, classAttributes.ClassId) diff --git a/x/nftfactory/types/class.go b/x/nftfactory/types/class.go index dd2860a5e..2019140a7 100644 --- a/x/nftfactory/types/class.go +++ b/x/nftfactory/types/class.go @@ -15,28 +15,12 @@ func NewClass(classID, name, symbol, description, classUri string) nfttypes.Clas } } -func NewClassAttributes( +func NewClassOwnership( classID string, owner sdk.AccAddress, - baseTokenUri string, - mintingpermission MintingPermission, - tokenSupplyCap uint64, -) ClassAttributes { - return ClassAttributes{ - ClassId: classID, - Owner: owner.String(), - BaseTokenUri: baseTokenUri, - MintingPermission: mintingpermission, - TokenSupplyCap: tokenSupplyCap, +) ClassOwnership { + return ClassOwnership{ + ClassId: classID, + Owner: owner.String(), } } - -func NewOwningClassIdList(owner sdk.AccAddress) OwningClassIdList { - var classIDList []string - return OwningClassIdList{Owner: owner.String(), ClassId: classIDList} -} - -func NewClassNameIdList(className string) ClassNameIdList { - var classIDList []string - return ClassNameIdList{ClassName: className, ClassId: classIDList} -} diff --git a/x/nftfactory/types/codec.go b/x/nftfactory/types/codec.go index 103891af7..7f26d9bab 100644 --- a/x/nftfactory/types/codec.go +++ b/x/nftfactory/types/codec.go @@ -13,10 +13,9 @@ func RegisterCodec(cdc *codec.LegacyAmino) { func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { registry.RegisterImplementations((*sdk.Msg)(nil), &MsgCreateClass{}, - &MsgMintNFT{}, + &MsgUpdateClass{}, &MsgSendClassOwnership{}, - &MsgUpdateBaseTokenUri{}, - &MsgUpdateTokenSupplyCap{}, + &MsgMintNFT{}, &MsgBurnNFT{}, ) diff --git a/x/nftfactory/types/event.pb.go b/x/nftfactory/types/event.pb.go index 95dd35ff0..b177934d7 100644 --- a/x/nftfactory/types/event.pb.go +++ b/x/nftfactory/types/event.pb.go @@ -24,11 +24,8 @@ var _ = math.Inf const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type EventCreateClass struct { - Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` - ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` - BaseTokenUri string `protobuf:"bytes,3,opt,name=base_token_uri,json=baseTokenUri,proto3" json:"base_token_uri,omitempty"` - TokenSupplyCap string `protobuf:"bytes,4,opt,name=token_supply_cap,json=tokenSupplyCap,proto3" json:"token_supply_cap,omitempty"` - MintingPermission MintingPermission `protobuf:"varint,5,opt,name=minting_permission,json=mintingPermission,proto3,enum=ununifi.nftfactory.MintingPermission" json:"minting_permission,omitempty"` + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` + ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` } func (m *EventCreateClass) Reset() { *m = EventCreateClass{} } @@ -78,45 +75,23 @@ func (m *EventCreateClass) GetClassId() string { return "" } -func (m *EventCreateClass) GetBaseTokenUri() string { - if m != nil { - return m.BaseTokenUri - } - return "" -} - -func (m *EventCreateClass) GetTokenSupplyCap() string { - if m != nil { - return m.TokenSupplyCap - } - return "" -} - -func (m *EventCreateClass) GetMintingPermission() MintingPermission { - if m != nil { - return m.MintingPermission - } - return MintingPermission_OnlyOwner -} - -type EventSendClassOwnership struct { - Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` - Receiver string `protobuf:"bytes,2,opt,name=receiver,proto3" json:"receiver,omitempty"` - ClassId string `protobuf:"bytes,3,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` +type EventUpdateClass struct { + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` + ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` } -func (m *EventSendClassOwnership) Reset() { *m = EventSendClassOwnership{} } -func (m *EventSendClassOwnership) String() string { return proto.CompactTextString(m) } -func (*EventSendClassOwnership) ProtoMessage() {} -func (*EventSendClassOwnership) Descriptor() ([]byte, []int) { +func (m *EventUpdateClass) Reset() { *m = EventUpdateClass{} } +func (m *EventUpdateClass) String() string { return proto.CompactTextString(m) } +func (*EventUpdateClass) ProtoMessage() {} +func (*EventUpdateClass) Descriptor() ([]byte, []int) { return fileDescriptor_8d5133c6cc79979f, []int{1} } -func (m *EventSendClassOwnership) XXX_Unmarshal(b []byte) error { +func (m *EventUpdateClass) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *EventSendClassOwnership) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *EventUpdateClass) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_EventSendClassOwnership.Marshal(b, m, deterministic) + return xxx_messageInfo_EventUpdateClass.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -126,57 +101,51 @@ func (m *EventSendClassOwnership) XXX_Marshal(b []byte, deterministic bool) ([]b return b[:n], nil } } -func (m *EventSendClassOwnership) XXX_Merge(src proto.Message) { - xxx_messageInfo_EventSendClassOwnership.Merge(m, src) +func (m *EventUpdateClass) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventUpdateClass.Merge(m, src) } -func (m *EventSendClassOwnership) XXX_Size() int { +func (m *EventUpdateClass) XXX_Size() int { return m.Size() } -func (m *EventSendClassOwnership) XXX_DiscardUnknown() { - xxx_messageInfo_EventSendClassOwnership.DiscardUnknown(m) +func (m *EventUpdateClass) XXX_DiscardUnknown() { + xxx_messageInfo_EventUpdateClass.DiscardUnknown(m) } -var xxx_messageInfo_EventSendClassOwnership proto.InternalMessageInfo - -func (m *EventSendClassOwnership) GetSender() string { - if m != nil { - return m.Sender - } - return "" -} +var xxx_messageInfo_EventUpdateClass proto.InternalMessageInfo -func (m *EventSendClassOwnership) GetReceiver() string { +func (m *EventUpdateClass) GetOwner() string { if m != nil { - return m.Receiver + return m.Owner } return "" } -func (m *EventSendClassOwnership) GetClassId() string { +func (m *EventUpdateClass) GetClassId() string { if m != nil { return m.ClassId } return "" } -type EventUpdateBaseTokenUri struct { - Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` - ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` - BaseTokenUri string `protobuf:"bytes,3,opt,name=base_token_uri,json=baseTokenUri,proto3" json:"base_token_uri,omitempty"` +type EventMintNFT struct { + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` + ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` + NftId string `protobuf:"bytes,3,opt,name=nft_id,json=nftId,proto3" json:"nft_id,omitempty"` + Recipient string `protobuf:"bytes,4,opt,name=recipient,proto3" json:"recipient,omitempty"` } -func (m *EventUpdateBaseTokenUri) Reset() { *m = EventUpdateBaseTokenUri{} } -func (m *EventUpdateBaseTokenUri) String() string { return proto.CompactTextString(m) } -func (*EventUpdateBaseTokenUri) ProtoMessage() {} -func (*EventUpdateBaseTokenUri) Descriptor() ([]byte, []int) { +func (m *EventMintNFT) Reset() { *m = EventMintNFT{} } +func (m *EventMintNFT) String() string { return proto.CompactTextString(m) } +func (*EventMintNFT) ProtoMessage() {} +func (*EventMintNFT) Descriptor() ([]byte, []int) { return fileDescriptor_8d5133c6cc79979f, []int{2} } -func (m *EventUpdateBaseTokenUri) XXX_Unmarshal(b []byte) error { +func (m *EventMintNFT) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *EventUpdateBaseTokenUri) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *EventMintNFT) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_EventUpdateBaseTokenUri.Marshal(b, m, deterministic) + return xxx_messageInfo_EventMintNFT.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -186,118 +155,64 @@ func (m *EventUpdateBaseTokenUri) XXX_Marshal(b []byte, deterministic bool) ([]b return b[:n], nil } } -func (m *EventUpdateBaseTokenUri) XXX_Merge(src proto.Message) { - xxx_messageInfo_EventUpdateBaseTokenUri.Merge(m, src) +func (m *EventMintNFT) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventMintNFT.Merge(m, src) } -func (m *EventUpdateBaseTokenUri) XXX_Size() int { +func (m *EventMintNFT) XXX_Size() int { return m.Size() } -func (m *EventUpdateBaseTokenUri) XXX_DiscardUnknown() { - xxx_messageInfo_EventUpdateBaseTokenUri.DiscardUnknown(m) +func (m *EventMintNFT) XXX_DiscardUnknown() { + xxx_messageInfo_EventMintNFT.DiscardUnknown(m) } -var xxx_messageInfo_EventUpdateBaseTokenUri proto.InternalMessageInfo +var xxx_messageInfo_EventMintNFT proto.InternalMessageInfo -func (m *EventUpdateBaseTokenUri) GetOwner() string { +func (m *EventMintNFT) GetOwner() string { if m != nil { return m.Owner } return "" } -func (m *EventUpdateBaseTokenUri) GetClassId() string { +func (m *EventMintNFT) GetClassId() string { if m != nil { return m.ClassId } return "" } -func (m *EventUpdateBaseTokenUri) GetBaseTokenUri() string { - if m != nil { - return m.BaseTokenUri - } - return "" -} - -type EventUpdateTokenSupplyCap struct { - Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` - ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` - TokenSupplyCap string `protobuf:"bytes,3,opt,name=token_supply_cap,json=tokenSupplyCap,proto3" json:"token_supply_cap,omitempty"` -} - -func (m *EventUpdateTokenSupplyCap) Reset() { *m = EventUpdateTokenSupplyCap{} } -func (m *EventUpdateTokenSupplyCap) String() string { return proto.CompactTextString(m) } -func (*EventUpdateTokenSupplyCap) ProtoMessage() {} -func (*EventUpdateTokenSupplyCap) Descriptor() ([]byte, []int) { - return fileDescriptor_8d5133c6cc79979f, []int{3} -} -func (m *EventUpdateTokenSupplyCap) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *EventUpdateTokenSupplyCap) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_EventUpdateTokenSupplyCap.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 *EventUpdateTokenSupplyCap) XXX_Merge(src proto.Message) { - xxx_messageInfo_EventUpdateTokenSupplyCap.Merge(m, src) -} -func (m *EventUpdateTokenSupplyCap) XXX_Size() int { - return m.Size() -} -func (m *EventUpdateTokenSupplyCap) XXX_DiscardUnknown() { - xxx_messageInfo_EventUpdateTokenSupplyCap.DiscardUnknown(m) -} - -var xxx_messageInfo_EventUpdateTokenSupplyCap proto.InternalMessageInfo - -func (m *EventUpdateTokenSupplyCap) GetOwner() string { - if m != nil { - return m.Owner - } - return "" -} - -func (m *EventUpdateTokenSupplyCap) GetClassId() string { +func (m *EventMintNFT) GetNftId() string { if m != nil { - return m.ClassId + return m.NftId } return "" } -func (m *EventUpdateTokenSupplyCap) GetTokenSupplyCap() string { +func (m *EventMintNFT) GetRecipient() string { if m != nil { - return m.TokenSupplyCap + return m.Recipient } return "" } -type EventMintNFT struct { - ClassId string `protobuf:"bytes,1,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` - NftId string `protobuf:"bytes,2,opt,name=nft_id,json=nftId,proto3" json:"nft_id,omitempty"` - Owner string `protobuf:"bytes,3,opt,name=owner,proto3" json:"owner,omitempty"` - Minter string `protobuf:"bytes,4,opt,name=minter,proto3" json:"minter,omitempty"` +type EventBurnNFT struct { + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` + ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` + NftId string `protobuf:"bytes,3,opt,name=nft_id,json=nftId,proto3" json:"nft_id,omitempty"` } -func (m *EventMintNFT) Reset() { *m = EventMintNFT{} } -func (m *EventMintNFT) String() string { return proto.CompactTextString(m) } -func (*EventMintNFT) ProtoMessage() {} -func (*EventMintNFT) Descriptor() ([]byte, []int) { - return fileDescriptor_8d5133c6cc79979f, []int{4} +func (m *EventBurnNFT) Reset() { *m = EventBurnNFT{} } +func (m *EventBurnNFT) String() string { return proto.CompactTextString(m) } +func (*EventBurnNFT) ProtoMessage() {} +func (*EventBurnNFT) Descriptor() ([]byte, []int) { + return fileDescriptor_8d5133c6cc79979f, []int{3} } -func (m *EventMintNFT) XXX_Unmarshal(b []byte) error { +func (m *EventBurnNFT) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *EventMintNFT) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *EventBurnNFT) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_EventMintNFT.Marshal(b, m, deterministic) + return xxx_messageInfo_EventBurnNFT.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -307,64 +222,57 @@ func (m *EventMintNFT) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) return b[:n], nil } } -func (m *EventMintNFT) XXX_Merge(src proto.Message) { - xxx_messageInfo_EventMintNFT.Merge(m, src) +func (m *EventBurnNFT) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventBurnNFT.Merge(m, src) } -func (m *EventMintNFT) XXX_Size() int { +func (m *EventBurnNFT) XXX_Size() int { return m.Size() } -func (m *EventMintNFT) XXX_DiscardUnknown() { - xxx_messageInfo_EventMintNFT.DiscardUnknown(m) +func (m *EventBurnNFT) XXX_DiscardUnknown() { + xxx_messageInfo_EventBurnNFT.DiscardUnknown(m) } -var xxx_messageInfo_EventMintNFT proto.InternalMessageInfo - -func (m *EventMintNFT) GetClassId() string { - if m != nil { - return m.ClassId - } - return "" -} +var xxx_messageInfo_EventBurnNFT proto.InternalMessageInfo -func (m *EventMintNFT) GetNftId() string { +func (m *EventBurnNFT) GetOwner() string { if m != nil { - return m.NftId + return m.Owner } return "" } -func (m *EventMintNFT) GetOwner() string { +func (m *EventBurnNFT) GetClassId() string { if m != nil { - return m.Owner + return m.ClassId } return "" } -func (m *EventMintNFT) GetMinter() string { +func (m *EventBurnNFT) GetNftId() string { if m != nil { - return m.Minter + return m.NftId } return "" } -type EventBurnNFT struct { - Burner string `protobuf:"bytes,1,opt,name=burner,proto3" json:"burner,omitempty"` - ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` - NftId string `protobuf:"bytes,3,opt,name=nft_id,json=nftId,proto3" json:"nft_id,omitempty"` +type EventChangeAdmin struct { + Admin string `protobuf:"bytes,1,opt,name=admin,proto3" json:"admin,omitempty"` + ClassId string `protobuf:"bytes,3,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` + NewAdmin string `protobuf:"bytes,2,opt,name=new_admin,json=newAdmin,proto3" json:"new_admin,omitempty"` } -func (m *EventBurnNFT) Reset() { *m = EventBurnNFT{} } -func (m *EventBurnNFT) String() string { return proto.CompactTextString(m) } -func (*EventBurnNFT) ProtoMessage() {} -func (*EventBurnNFT) Descriptor() ([]byte, []int) { - return fileDescriptor_8d5133c6cc79979f, []int{5} +func (m *EventChangeAdmin) Reset() { *m = EventChangeAdmin{} } +func (m *EventChangeAdmin) String() string { return proto.CompactTextString(m) } +func (*EventChangeAdmin) ProtoMessage() {} +func (*EventChangeAdmin) Descriptor() ([]byte, []int) { + return fileDescriptor_8d5133c6cc79979f, []int{4} } -func (m *EventBurnNFT) XXX_Unmarshal(b []byte) error { +func (m *EventChangeAdmin) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *EventBurnNFT) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *EventChangeAdmin) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_EventBurnNFT.Marshal(b, m, deterministic) + return xxx_messageInfo_EventChangeAdmin.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -374,81 +282,71 @@ func (m *EventBurnNFT) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) return b[:n], nil } } -func (m *EventBurnNFT) XXX_Merge(src proto.Message) { - xxx_messageInfo_EventBurnNFT.Merge(m, src) +func (m *EventChangeAdmin) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventChangeAdmin.Merge(m, src) } -func (m *EventBurnNFT) XXX_Size() int { +func (m *EventChangeAdmin) XXX_Size() int { return m.Size() } -func (m *EventBurnNFT) XXX_DiscardUnknown() { - xxx_messageInfo_EventBurnNFT.DiscardUnknown(m) +func (m *EventChangeAdmin) XXX_DiscardUnknown() { + xxx_messageInfo_EventChangeAdmin.DiscardUnknown(m) } -var xxx_messageInfo_EventBurnNFT proto.InternalMessageInfo +var xxx_messageInfo_EventChangeAdmin proto.InternalMessageInfo -func (m *EventBurnNFT) GetBurner() string { +func (m *EventChangeAdmin) GetAdmin() string { if m != nil { - return m.Burner + return m.Admin } return "" } -func (m *EventBurnNFT) GetClassId() string { +func (m *EventChangeAdmin) GetClassId() string { if m != nil { return m.ClassId } return "" } -func (m *EventBurnNFT) GetNftId() string { +func (m *EventChangeAdmin) GetNewAdmin() string { if m != nil { - return m.NftId + return m.NewAdmin } return "" } func init() { proto.RegisterType((*EventCreateClass)(nil), "ununifi.nftfactory.EventCreateClass") - proto.RegisterType((*EventSendClassOwnership)(nil), "ununifi.nftfactory.EventSendClassOwnership") - proto.RegisterType((*EventUpdateBaseTokenUri)(nil), "ununifi.nftfactory.EventUpdateBaseTokenUri") - proto.RegisterType((*EventUpdateTokenSupplyCap)(nil), "ununifi.nftfactory.EventUpdateTokenSupplyCap") + proto.RegisterType((*EventUpdateClass)(nil), "ununifi.nftfactory.EventUpdateClass") proto.RegisterType((*EventMintNFT)(nil), "ununifi.nftfactory.EventMintNFT") proto.RegisterType((*EventBurnNFT)(nil), "ununifi.nftfactory.EventBurnNFT") + proto.RegisterType((*EventChangeAdmin)(nil), "ununifi.nftfactory.EventChangeAdmin") } func init() { proto.RegisterFile("ununifi/nftfactory/event.proto", fileDescriptor_8d5133c6cc79979f) } var fileDescriptor_8d5133c6cc79979f = []byte{ - // 456 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x53, 0x5d, 0x8b, 0xd3, 0x40, - 0x14, 0x6d, 0x8c, 0x8d, 0xeb, 0xb0, 0x94, 0x75, 0x58, 0x6b, 0xb6, 0x0f, 0x61, 0x89, 0x0a, 0x05, - 0x21, 0x01, 0xfd, 0x07, 0x2d, 0xbb, 0xb0, 0x0f, 0x7e, 0xb0, 0xdb, 0x82, 0xf8, 0x12, 0xd2, 0x64, - 0xd2, 0x0e, 0x6e, 0xee, 0x0c, 0x33, 0x93, 0x6a, 0xff, 0x85, 0x3f, 0xcb, 0xc7, 0x7d, 0xf4, 0x51, - 0xda, 0x27, 0xff, 0x85, 0xcc, 0x64, 0x68, 0x12, 0x2d, 0x82, 0x0f, 0xfb, 0x96, 0x73, 0xef, 0xe1, - 0x9e, 0x7b, 0xce, 0xcd, 0xa0, 0xa0, 0x82, 0x0a, 0x68, 0x41, 0x63, 0x28, 0x54, 0x91, 0x66, 0x8a, - 0x89, 0x4d, 0x4c, 0xd6, 0x04, 0x54, 0xc4, 0x05, 0x53, 0x0c, 0x63, 0xdb, 0x8f, 0x9a, 0xfe, 0xe8, - 0x74, 0xc9, 0x96, 0xcc, 0xb4, 0x63, 0xfd, 0x55, 0x33, 0x47, 0xcf, 0x0f, 0x4c, 0x6a, 0x3e, 0x6b, - 0x52, 0xf8, 0xcb, 0x41, 0x27, 0x17, 0x7a, 0xfc, 0x54, 0x90, 0x54, 0x91, 0xe9, 0x6d, 0x2a, 0x25, - 0x3e, 0x45, 0x7d, 0xf6, 0x05, 0x88, 0xf0, 0x9d, 0x73, 0x67, 0xfc, 0xf8, 0xba, 0x06, 0xf8, 0x0c, - 0x1d, 0x65, 0xba, 0x9d, 0xd0, 0xdc, 0x7f, 0x60, 0x1a, 0x8f, 0x0c, 0xbe, 0xca, 0xf1, 0x0b, 0x34, - 0x58, 0xa4, 0x92, 0x24, 0x8a, 0x7d, 0x26, 0x90, 0x54, 0x82, 0xfa, 0xae, 0x21, 0x1c, 0xeb, 0xea, - 0x4c, 0x17, 0xe7, 0x82, 0xe2, 0x31, 0x3a, 0xa9, 0x09, 0xb2, 0xe2, 0xfc, 0x76, 0x93, 0x64, 0x29, - 0xf7, 0x1f, 0x1a, 0xde, 0xc0, 0xd4, 0x6f, 0x4c, 0x79, 0x9a, 0x72, 0x3c, 0x43, 0xb8, 0xa4, 0xa0, - 0x28, 0x2c, 0x13, 0x4e, 0x44, 0x49, 0xa5, 0xa4, 0x0c, 0xfc, 0xfe, 0xb9, 0x33, 0x1e, 0xbc, 0x7e, - 0x19, 0xfd, 0x9d, 0x40, 0xf4, 0xb6, 0x66, 0x7f, 0xd8, 0x93, 0xaf, 0x9f, 0x94, 0x7f, 0x96, 0xc2, - 0x15, 0x7a, 0x66, 0xac, 0xde, 0x10, 0xc8, 0x8d, 0xd1, 0xf7, 0xda, 0x97, 0x5c, 0x51, 0x8e, 0x87, - 0xc8, 0x93, 0x04, 0xf2, 0xbd, 0x65, 0x8b, 0xf0, 0x08, 0x1d, 0x09, 0x92, 0x11, 0xba, 0x26, 0xc2, - 0x7a, 0xde, 0xe3, 0x4e, 0x1e, 0x6e, 0x27, 0x8f, 0x90, 0x5b, 0xa5, 0x39, 0xcf, 0x53, 0x45, 0x26, - 0xed, 0x10, 0xee, 0x27, 0xdb, 0x70, 0x8d, 0xce, 0x5a, 0x8a, 0xb3, 0x6e, 0x9c, 0xff, 0xad, 0x79, - 0xe8, 0x52, 0xee, 0xa1, 0x4b, 0x85, 0x80, 0x8e, 0x8d, 0xae, 0x3e, 0xc0, 0xbb, 0xcb, 0x59, 0x67, - 0xa8, 0xd3, 0x1d, 0xfa, 0x14, 0x79, 0x50, 0xa8, 0x46, 0xad, 0x0f, 0x85, 0xba, 0xca, 0x9b, 0xe5, - 0xdc, 0xf6, 0x72, 0x43, 0xe4, 0xe9, 0x03, 0x12, 0x61, 0xff, 0x10, 0x8b, 0xc2, 0x8f, 0x56, 0x6f, - 0x52, 0x09, 0xd0, 0x7a, 0x43, 0xe4, 0x2d, 0x2a, 0xd1, 0x78, 0xb3, 0xe8, 0x5f, 0xe6, 0x9a, 0x3d, - 0xdc, 0xd6, 0x1e, 0x93, 0x8b, 0xef, 0xdb, 0xc0, 0xb9, 0xdb, 0x06, 0xce, 0xcf, 0x6d, 0xe0, 0x7c, - 0xdb, 0x05, 0xbd, 0xbb, 0x5d, 0xd0, 0xfb, 0xb1, 0x0b, 0x7a, 0x9f, 0x5e, 0x2d, 0xa9, 0x5a, 0x55, - 0x8b, 0x28, 0x63, 0x65, 0x3c, 0x87, 0x39, 0xd0, 0x4b, 0x1a, 0x67, 0xab, 0x94, 0x42, 0xfc, 0xb5, - 0xfd, 0xb6, 0xd4, 0x86, 0x13, 0xb9, 0xf0, 0xcc, 0xbb, 0x7a, 0xf3, 0x3b, 0x00, 0x00, 0xff, 0xff, - 0xbc, 0xbf, 0x5d, 0xef, 0xc8, 0x03, 0x00, 0x00, + // 317 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x92, 0xc1, 0x4e, 0x32, 0x31, + 0x10, 0xc7, 0xd9, 0x8f, 0x4f, 0x84, 0xc6, 0x83, 0x69, 0x30, 0x41, 0x34, 0x8d, 0xc1, 0x8b, 0x89, + 0x09, 0x3d, 0xf8, 0x04, 0x42, 0x20, 0xe1, 0xa0, 0x07, 0x23, 0x1e, 0xbc, 0x60, 0xd9, 0xed, 0x2e, + 0x4d, 0x64, 0xba, 0x29, 0xb3, 0x22, 0x6f, 0xe1, 0x63, 0x79, 0xe4, 0xe8, 0xd1, 0xb0, 0x2f, 0x62, + 0xda, 0x82, 0x2b, 0x89, 0x17, 0x8d, 0xb7, 0x99, 0xfe, 0x66, 0x7e, 0xff, 0xa4, 0x19, 0xc2, 0x32, + 0xc8, 0x40, 0xc5, 0x8a, 0x43, 0x8c, 0xb1, 0x08, 0x51, 0x9b, 0x05, 0x97, 0x4f, 0x12, 0xb0, 0x9d, + 0x1a, 0x8d, 0x9a, 0xd2, 0x35, 0x6f, 0x17, 0xbc, 0x59, 0x4f, 0x74, 0xa2, 0x1d, 0xe6, 0xb6, 0xf2, + 0x93, 0xcd, 0xd3, 0x6f, 0x4c, 0x45, 0xe9, 0x87, 0x5a, 0x5d, 0xb2, 0xdf, 0xb3, 0xf6, 0xae, 0x91, + 0x02, 0x65, 0xf7, 0x51, 0xcc, 0x66, 0xb4, 0x4e, 0x76, 0xf4, 0x1c, 0xa4, 0x69, 0x04, 0x27, 0xc1, + 0x59, 0xed, 0xc6, 0x37, 0xf4, 0x90, 0x54, 0x43, 0x8b, 0x47, 0x2a, 0x6a, 0xfc, 0x73, 0x60, 0xd7, + 0xf5, 0x83, 0xe8, 0x53, 0x32, 0x4c, 0xa3, 0xdf, 0x4b, 0x90, 0xec, 0x39, 0xc9, 0x95, 0x02, 0xbc, + 0xee, 0xdf, 0xfe, 0x58, 0x40, 0x0f, 0x48, 0x05, 0x62, 0xb4, 0xa0, 0xec, 0x37, 0x20, 0xc6, 0x41, + 0x44, 0x8f, 0x49, 0xcd, 0xc8, 0x50, 0xa5, 0x4a, 0x02, 0x36, 0xfe, 0x3b, 0x52, 0x3c, 0xb4, 0xee, + 0xd6, 0xa9, 0x9d, 0xcc, 0xc0, 0x1f, 0xa6, 0xb6, 0x1e, 0x36, 0xff, 0x3a, 0x11, 0x90, 0xc8, 0xcb, + 0x68, 0xaa, 0xc0, 0xba, 0x85, 0x2d, 0x36, 0x6e, 0xd7, 0x6c, 0xb9, 0xcb, 0xdb, 0xee, 0x23, 0x52, + 0x03, 0x39, 0x1f, 0xf9, 0x25, 0x9f, 0x5b, 0x05, 0x39, 0x77, 0xb6, 0x4e, 0xef, 0x75, 0xc5, 0x82, + 0xe5, 0x8a, 0x05, 0xef, 0x2b, 0x16, 0xbc, 0xe4, 0xac, 0xb4, 0xcc, 0x59, 0xe9, 0x2d, 0x67, 0xa5, + 0xfb, 0xf3, 0x44, 0xe1, 0x24, 0x1b, 0xb7, 0x43, 0x3d, 0xe5, 0x43, 0x18, 0x82, 0xea, 0x2b, 0x1e, + 0x4e, 0x84, 0x02, 0xfe, 0xfc, 0xf5, 0x16, 0x70, 0x91, 0xca, 0xd9, 0xb8, 0xe2, 0xee, 0xe0, 0xe2, + 0x23, 0x00, 0x00, 0xff, 0xff, 0x41, 0x06, 0xe6, 0xc0, 0x78, 0x02, 0x00, 0x00, } func (m *EventCreateClass) Marshal() (dAtA []byte, err error) { @@ -471,25 +369,6 @@ func (m *EventCreateClass) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.MintingPermission != 0 { - i = encodeVarintEvent(dAtA, i, uint64(m.MintingPermission)) - i-- - dAtA[i] = 0x28 - } - if len(m.TokenSupplyCap) > 0 { - i -= len(m.TokenSupplyCap) - copy(dAtA[i:], m.TokenSupplyCap) - i = encodeVarintEvent(dAtA, i, uint64(len(m.TokenSupplyCap))) - i-- - dAtA[i] = 0x22 - } - if len(m.BaseTokenUri) > 0 { - i -= len(m.BaseTokenUri) - copy(dAtA[i:], m.BaseTokenUri) - i = encodeVarintEvent(dAtA, i, uint64(len(m.BaseTokenUri))) - i-- - dAtA[i] = 0x1a - } if len(m.ClassId) > 0 { i -= len(m.ClassId) copy(dAtA[i:], m.ClassId) @@ -507,7 +386,7 @@ func (m *EventCreateClass) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *EventSendClassOwnership) Marshal() (dAtA []byte, err error) { +func (m *EventUpdateClass) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -517,12 +396,12 @@ func (m *EventSendClassOwnership) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *EventSendClassOwnership) MarshalTo(dAtA []byte) (int, error) { +func (m *EventUpdateClass) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *EventSendClassOwnership) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *EventUpdateClass) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -532,26 +411,19 @@ func (m *EventSendClassOwnership) MarshalToSizedBuffer(dAtA []byte) (int, error) copy(dAtA[i:], m.ClassId) i = encodeVarintEvent(dAtA, i, uint64(len(m.ClassId))) i-- - dAtA[i] = 0x1a - } - if len(m.Receiver) > 0 { - i -= len(m.Receiver) - copy(dAtA[i:], m.Receiver) - i = encodeVarintEvent(dAtA, i, uint64(len(m.Receiver))) - i-- dAtA[i] = 0x12 } - if len(m.Sender) > 0 { - i -= len(m.Sender) - copy(dAtA[i:], m.Sender) - i = encodeVarintEvent(dAtA, i, uint64(len(m.Sender))) + if len(m.Owner) > 0 { + i -= len(m.Owner) + copy(dAtA[i:], m.Owner) + i = encodeVarintEvent(dAtA, i, uint64(len(m.Owner))) i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } -func (m *EventUpdateBaseTokenUri) Marshal() (dAtA []byte, err error) { +func (m *EventMintNFT) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -561,20 +433,27 @@ func (m *EventUpdateBaseTokenUri) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *EventUpdateBaseTokenUri) MarshalTo(dAtA []byte) (int, error) { +func (m *EventMintNFT) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *EventUpdateBaseTokenUri) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *EventMintNFT) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.BaseTokenUri) > 0 { - i -= len(m.BaseTokenUri) - copy(dAtA[i:], m.BaseTokenUri) - i = encodeVarintEvent(dAtA, i, uint64(len(m.BaseTokenUri))) + if len(m.Recipient) > 0 { + i -= len(m.Recipient) + copy(dAtA[i:], m.Recipient) + i = encodeVarintEvent(dAtA, i, uint64(len(m.Recipient))) + i-- + dAtA[i] = 0x22 + } + if len(m.NftId) > 0 { + i -= len(m.NftId) + copy(dAtA[i:], m.NftId) + i = encodeVarintEvent(dAtA, i, uint64(len(m.NftId))) i-- dAtA[i] = 0x1a } @@ -595,7 +474,7 @@ func (m *EventUpdateBaseTokenUri) MarshalToSizedBuffer(dAtA []byte) (int, error) return len(dAtA) - i, nil } -func (m *EventUpdateTokenSupplyCap) Marshal() (dAtA []byte, err error) { +func (m *EventBurnNFT) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -605,20 +484,20 @@ func (m *EventUpdateTokenSupplyCap) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *EventUpdateTokenSupplyCap) MarshalTo(dAtA []byte) (int, error) { +func (m *EventBurnNFT) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *EventUpdateTokenSupplyCap) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *EventBurnNFT) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.TokenSupplyCap) > 0 { - i -= len(m.TokenSupplyCap) - copy(dAtA[i:], m.TokenSupplyCap) - i = encodeVarintEvent(dAtA, i, uint64(len(m.TokenSupplyCap))) + if len(m.NftId) > 0 { + i -= len(m.NftId) + copy(dAtA[i:], m.NftId) + i = encodeVarintEvent(dAtA, i, uint64(len(m.NftId))) i-- dAtA[i] = 0x1a } @@ -639,7 +518,7 @@ func (m *EventUpdateTokenSupplyCap) MarshalToSizedBuffer(dAtA []byte) (int, erro return len(dAtA) - i, nil } -func (m *EventMintNFT) Marshal() (dAtA []byte, err error) { +func (m *EventChangeAdmin) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -649,85 +528,34 @@ func (m *EventMintNFT) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *EventMintNFT) MarshalTo(dAtA []byte) (int, error) { +func (m *EventChangeAdmin) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *EventMintNFT) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *EventChangeAdmin) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.Minter) > 0 { - i -= len(m.Minter) - copy(dAtA[i:], m.Minter) - i = encodeVarintEvent(dAtA, i, uint64(len(m.Minter))) - i-- - dAtA[i] = 0x22 - } - if len(m.Owner) > 0 { - i -= len(m.Owner) - copy(dAtA[i:], m.Owner) - i = encodeVarintEvent(dAtA, i, uint64(len(m.Owner))) - i-- - dAtA[i] = 0x1a - } - if len(m.NftId) > 0 { - i -= len(m.NftId) - copy(dAtA[i:], m.NftId) - i = encodeVarintEvent(dAtA, i, uint64(len(m.NftId))) - i-- - dAtA[i] = 0x12 - } if len(m.ClassId) > 0 { i -= len(m.ClassId) copy(dAtA[i:], m.ClassId) i = encodeVarintEvent(dAtA, i, uint64(len(m.ClassId))) i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *EventBurnNFT) 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 *EventBurnNFT) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *EventBurnNFT) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.NftId) > 0 { - i -= len(m.NftId) - copy(dAtA[i:], m.NftId) - i = encodeVarintEvent(dAtA, i, uint64(len(m.NftId))) - i-- dAtA[i] = 0x1a } - if len(m.ClassId) > 0 { - i -= len(m.ClassId) - copy(dAtA[i:], m.ClassId) - i = encodeVarintEvent(dAtA, i, uint64(len(m.ClassId))) + if len(m.NewAdmin) > 0 { + i -= len(m.NewAdmin) + copy(dAtA[i:], m.NewAdmin) + i = encodeVarintEvent(dAtA, i, uint64(len(m.NewAdmin))) i-- dAtA[i] = 0x12 } - if len(m.Burner) > 0 { - i -= len(m.Burner) - copy(dAtA[i:], m.Burner) - i = encodeVarintEvent(dAtA, i, uint64(len(m.Burner))) + if len(m.Admin) > 0 { + i -= len(m.Admin) + copy(dAtA[i:], m.Admin) + i = encodeVarintEvent(dAtA, i, uint64(len(m.Admin))) i-- dAtA[i] = 0xa } @@ -747,345 +575,112 @@ func encodeVarintEvent(dAtA []byte, offset int, v uint64) int { } func (m *EventCreateClass) Size() (n int) { if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Owner) - if l > 0 { - n += 1 + l + sovEvent(uint64(l)) - } - l = len(m.ClassId) - if l > 0 { - n += 1 + l + sovEvent(uint64(l)) - } - l = len(m.BaseTokenUri) - if l > 0 { - n += 1 + l + sovEvent(uint64(l)) - } - l = len(m.TokenSupplyCap) - if l > 0 { - n += 1 + l + sovEvent(uint64(l)) - } - if m.MintingPermission != 0 { - n += 1 + sovEvent(uint64(m.MintingPermission)) - } - return n -} - -func (m *EventSendClassOwnership) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Sender) - if l > 0 { - n += 1 + l + sovEvent(uint64(l)) - } - l = len(m.Receiver) - if l > 0 { - n += 1 + l + sovEvent(uint64(l)) - } - l = len(m.ClassId) - if l > 0 { - n += 1 + l + sovEvent(uint64(l)) - } - return n -} - -func (m *EventUpdateBaseTokenUri) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Owner) - if l > 0 { - n += 1 + l + sovEvent(uint64(l)) - } - l = len(m.ClassId) - if l > 0 { - n += 1 + l + sovEvent(uint64(l)) - } - l = len(m.BaseTokenUri) - if l > 0 { - n += 1 + l + sovEvent(uint64(l)) - } - return n -} - -func (m *EventUpdateTokenSupplyCap) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Owner) - if l > 0 { - n += 1 + l + sovEvent(uint64(l)) - } - l = len(m.ClassId) - if l > 0 { - n += 1 + l + sovEvent(uint64(l)) - } - l = len(m.TokenSupplyCap) - if l > 0 { - n += 1 + l + sovEvent(uint64(l)) - } - return n -} - -func (m *EventMintNFT) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ClassId) - if l > 0 { - n += 1 + l + sovEvent(uint64(l)) - } - l = len(m.NftId) - if l > 0 { - n += 1 + l + sovEvent(uint64(l)) - } - l = len(m.Owner) - if l > 0 { - n += 1 + l + sovEvent(uint64(l)) - } - l = len(m.Minter) - if l > 0 { - n += 1 + l + sovEvent(uint64(l)) - } - return n -} - -func (m *EventBurnNFT) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Burner) - if l > 0 { - n += 1 + l + sovEvent(uint64(l)) - } - l = len(m.ClassId) - if l > 0 { - n += 1 + l + sovEvent(uint64(l)) - } - l = len(m.NftId) - if l > 0 { - n += 1 + l + sovEvent(uint64(l)) - } - return n -} - -func sovEvent(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozEvent(x uint64) (n int) { - return sovEvent(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *EventCreateClass) 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 ErrIntOverflowEvent - } - 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: EventCreateClass: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: EventCreateClass: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvent - } - 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 ErrInvalidLengthEvent - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthEvent - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Owner = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvent - } - 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 ErrInvalidLengthEvent - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthEvent - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ClassId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BaseTokenUri", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvent - } - 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 ErrInvalidLengthEvent - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthEvent - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.BaseTokenUri = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TokenSupplyCap", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvent - } - 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 ErrInvalidLengthEvent - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthEvent - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.TokenSupplyCap = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MintingPermission", wireType) - } - m.MintingPermission = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvent - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MintingPermission |= MintingPermission(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipEvent(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthEvent - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } + return 0 + } + var l int + _ = l + l = len(m.Owner) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + l = len(m.ClassId) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) } + return n +} - if iNdEx > l { - return io.ErrUnexpectedEOF +func (m *EventUpdateClass) Size() (n int) { + if m == nil { + return 0 } - return nil + var l int + _ = l + l = len(m.Owner) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + l = len(m.ClassId) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + return n +} + +func (m *EventMintNFT) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Owner) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + l = len(m.ClassId) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + l = len(m.NftId) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + l = len(m.Recipient) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + return n +} + +func (m *EventBurnNFT) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Owner) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + l = len(m.ClassId) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + l = len(m.NftId) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + return n +} + +func (m *EventChangeAdmin) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Admin) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + l = len(m.NewAdmin) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + l = len(m.ClassId) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + return n +} + +func sovEvent(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 } -func (m *EventSendClassOwnership) Unmarshal(dAtA []byte) error { +func sozEvent(x uint64) (n int) { + return sovEvent(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *EventCreateClass) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1108,15 +703,15 @@ func (m *EventSendClassOwnership) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: EventSendClassOwnership: wiretype end group for non-group") + return fmt.Errorf("proto: EventCreateClass: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: EventSendClassOwnership: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: EventCreateClass: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1144,41 +739,9 @@ func (m *EventSendClassOwnership) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Sender = string(dAtA[iNdEx:postIndex]) + m.Owner = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Receiver", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvent - } - 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 ErrInvalidLengthEvent - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthEvent - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Receiver = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) } @@ -1231,7 +794,7 @@ func (m *EventSendClassOwnership) Unmarshal(dAtA []byte) error { } return nil } -func (m *EventUpdateBaseTokenUri) Unmarshal(dAtA []byte) error { +func (m *EventUpdateClass) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1254,10 +817,10 @@ func (m *EventUpdateBaseTokenUri) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: EventUpdateBaseTokenUri: wiretype end group for non-group") + return fmt.Errorf("proto: EventUpdateClass: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: EventUpdateBaseTokenUri: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: EventUpdateClass: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1324,38 +887,6 @@ func (m *EventUpdateBaseTokenUri) Unmarshal(dAtA []byte) error { } m.ClassId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BaseTokenUri", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvent - } - 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 ErrInvalidLengthEvent - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthEvent - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.BaseTokenUri = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipEvent(dAtA[iNdEx:]) @@ -1377,7 +908,7 @@ func (m *EventUpdateBaseTokenUri) Unmarshal(dAtA []byte) error { } return nil } -func (m *EventUpdateTokenSupplyCap) Unmarshal(dAtA []byte) error { +func (m *EventMintNFT) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1400,10 +931,10 @@ func (m *EventUpdateTokenSupplyCap) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: EventUpdateTokenSupplyCap: wiretype end group for non-group") + return fmt.Errorf("proto: EventMintNFT: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: EventUpdateTokenSupplyCap: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: EventMintNFT: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1472,7 +1003,39 @@ func (m *EventUpdateTokenSupplyCap) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TokenSupplyCap", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + 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 ErrInvalidLengthEvent + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NftId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Recipient", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1500,7 +1063,7 @@ func (m *EventUpdateTokenSupplyCap) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.TokenSupplyCap = string(dAtA[iNdEx:postIndex]) + m.Recipient = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -1523,7 +1086,7 @@ func (m *EventUpdateTokenSupplyCap) Unmarshal(dAtA []byte) error { } return nil } -func (m *EventMintNFT) Unmarshal(dAtA []byte) error { +func (m *EventBurnNFT) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1546,15 +1109,15 @@ func (m *EventMintNFT) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: EventMintNFT: wiretype end group for non-group") + return fmt.Errorf("proto: EventBurnNFT: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: EventMintNFT: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: EventBurnNFT: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1582,11 +1145,11 @@ func (m *EventMintNFT) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ClassId = string(dAtA[iNdEx:postIndex]) + m.Owner = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1614,43 +1177,11 @@ func (m *EventMintNFT) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.NftId = string(dAtA[iNdEx:postIndex]) + m.ClassId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvent - } - 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 ErrInvalidLengthEvent - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthEvent - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Owner = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Minter", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1678,7 +1209,7 @@ func (m *EventMintNFT) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Minter = string(dAtA[iNdEx:postIndex]) + m.NftId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -1701,7 +1232,7 @@ func (m *EventMintNFT) Unmarshal(dAtA []byte) error { } return nil } -func (m *EventBurnNFT) Unmarshal(dAtA []byte) error { +func (m *EventChangeAdmin) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1724,15 +1255,15 @@ func (m *EventBurnNFT) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: EventBurnNFT: wiretype end group for non-group") + return fmt.Errorf("proto: EventChangeAdmin: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: EventBurnNFT: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: EventChangeAdmin: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Burner", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Admin", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1760,11 +1291,11 @@ func (m *EventBurnNFT) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Burner = string(dAtA[iNdEx:postIndex]) + m.Admin = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field NewAdmin", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1792,11 +1323,11 @@ func (m *EventBurnNFT) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ClassId = string(dAtA[iNdEx:postIndex]) + m.NewAdmin = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1824,7 +1355,7 @@ func (m *EventBurnNFT) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.NftId = string(dAtA[iNdEx:postIndex]) + m.ClassId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex diff --git a/x/nftfactory/types/genesis.go b/x/nftfactory/types/genesis.go index 42e6e17a9..08693623e 100644 --- a/x/nftfactory/types/genesis.go +++ b/x/nftfactory/types/genesis.go @@ -19,7 +19,7 @@ func (gs GenesisState) Validate() error { return err } - for _, classAttributes := range gs.ClassAttributesList { + for _, classAttributes := range gs.ClassOwnerships { if err := ValidateClassAttributes(classAttributes, gs.Params); err != nil { return err } diff --git a/x/nftfactory/types/genesis.pb.go b/x/nftfactory/types/genesis.pb.go index cb382d8cb..9fb8f16d6 100644 --- a/x/nftfactory/types/genesis.pb.go +++ b/x/nftfactory/types/genesis.pb.go @@ -25,8 +25,8 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // GenesisState defines the nftfactory module's genesis state. type GenesisState struct { - Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params" yaml:"params"` - ClassAttributesList []ClassAttributes `protobuf:"bytes,2,rep,name=class_attributes_list,json=classAttributesList,proto3" json:"class_attributes_list" yaml:"class_attributes_list"` + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params" yaml:"params"` + Classes []GenesisClass `protobuf:"bytes,2,rep,name=classes,proto3" json:"classes" yaml:"class_ownerships"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -69,41 +69,126 @@ func (m *GenesisState) GetParams() Params { return Params{} } -func (m *GenesisState) GetClassAttributesList() []ClassAttributes { +func (m *GenesisState) GetClasses() []GenesisClass { if m != nil { - return m.ClassAttributesList + return m.Classes } return nil } +type GenesisClass struct { + ClassId string `protobuf:"bytes,1,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty" yaml:"class_id"` + AuthorityMetadata ClassAuthorityMetadata `protobuf:"bytes,2,opt,name=authority_metadata,json=authorityMetadata,proto3" json:"authority_metadata" yaml:"authority_metadata"` +} + +func (m *GenesisClass) Reset() { *m = GenesisClass{} } +func (m *GenesisClass) String() string { return proto.CompactTextString(m) } +func (*GenesisClass) ProtoMessage() {} +func (*GenesisClass) Descriptor() ([]byte, []int) { + return fileDescriptor_d707804010bac885, []int{1} +} +func (m *GenesisClass) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GenesisClass) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GenesisClass.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 *GenesisClass) XXX_Merge(src proto.Message) { + xxx_messageInfo_GenesisClass.Merge(m, src) +} +func (m *GenesisClass) XXX_Size() int { + return m.Size() +} +func (m *GenesisClass) XXX_DiscardUnknown() { + xxx_messageInfo_GenesisClass.DiscardUnknown(m) +} + +var xxx_messageInfo_GenesisClass proto.InternalMessageInfo + +func (m *GenesisClass) GetClassId() string { + if m != nil { + return m.ClassId + } + return "" +} + +func (m *GenesisClass) GetAuthorityMetadata() ClassAuthorityMetadata { + if m != nil { + return m.AuthorityMetadata + } + return ClassAuthorityMetadata{} +} + func init() { proto.RegisterType((*GenesisState)(nil), "ununifi.nftfactory.GenesisState") + proto.RegisterType((*GenesisClass)(nil), "ununifi.nftfactory.GenesisClass") } func init() { proto.RegisterFile("ununifi/nftfactory/genesis.proto", fileDescriptor_d707804010bac885) } var fileDescriptor_d707804010bac885 = []byte{ - // 276 bytes of a gzipped FileDescriptorProto + // 358 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x28, 0xcd, 0x2b, 0xcd, 0xcb, 0x4c, 0xcb, 0xd4, 0xcf, 0x4b, 0x2b, 0x49, 0x4b, 0x4c, 0x2e, 0xc9, 0x2f, 0xaa, 0xd4, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x82, 0xaa, 0xd0, 0x43, 0xa8, 0x90, 0x12, 0x49, 0xcf, 0x4f, 0xcf, 0x07, 0x4b, 0xeb, 0x83, 0x58, 0x10, 0x95, - 0x52, 0xca, 0x58, 0xcc, 0x42, 0x30, 0x21, 0x8a, 0x94, 0x6e, 0x30, 0x72, 0xf1, 0xb8, 0x43, 0x2c, + 0x52, 0xca, 0x58, 0xcc, 0x42, 0x30, 0x21, 0x8a, 0x94, 0xb6, 0x31, 0x72, 0xf1, 0xb8, 0x43, 0x2c, 0x08, 0x2e, 0x49, 0x2c, 0x49, 0x15, 0xf2, 0xe4, 0x62, 0x2b, 0x48, 0x2c, 0x4a, 0xcc, 0x2d, 0x96, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x36, 0x92, 0xd2, 0xc3, 0xb4, 0x50, 0x2f, 0x00, 0xac, 0xc2, 0x49, 0xf4, 0xc4, 0x3d, 0x79, 0x86, 0x4f, 0xf7, 0xe4, 0x79, 0x2b, 0x13, 0x73, 0x73, 0xac, 0x94, 0x20, - 0xfa, 0x94, 0x82, 0xa0, 0x06, 0x08, 0xd5, 0x72, 0x89, 0x26, 0xe7, 0x24, 0x16, 0x17, 0xc7, 0x27, - 0x96, 0x94, 0x14, 0x65, 0x26, 0x95, 0x96, 0xa4, 0x16, 0xc7, 0xe7, 0x64, 0x16, 0x97, 0x48, 0x30, - 0x29, 0x30, 0x6b, 0x70, 0x1b, 0x29, 0x63, 0x33, 0xd9, 0x19, 0xa4, 0xc1, 0x11, 0xae, 0xde, 0x49, - 0x05, 0x6a, 0x85, 0x0c, 0xc4, 0x0a, 0xac, 0xe6, 0x29, 0x05, 0x09, 0x27, 0xa3, 0x6a, 0xf3, 0xc9, - 0x2c, 0x2e, 0x71, 0x72, 0x3d, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, 0x07, 0x8f, 0xe4, - 0x18, 0x27, 0x3c, 0x96, 0x63, 0xb8, 0xf0, 0x58, 0x8e, 0xe1, 0xc6, 0x63, 0x39, 0x86, 0x28, 0xed, - 0xf4, 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, 0x5c, 0xfd, 0xd0, 0xbc, 0xd0, 0xbc, 0x4c, - 0xb7, 0x4c, 0xfd, 0xe4, 0x8c, 0xc4, 0xcc, 0x3c, 0xfd, 0x0a, 0xe4, 0xc0, 0x2a, 0xa9, 0x2c, 0x48, - 0x2d, 0x4e, 0x62, 0x03, 0x07, 0x94, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0xe7, 0x5e, 0x79, 0x36, - 0x9b, 0x01, 0x00, 0x00, + 0xfa, 0x94, 0x82, 0xa0, 0x06, 0x08, 0x45, 0x73, 0xb1, 0x27, 0xe7, 0x24, 0x16, 0x17, 0xa7, 0x16, + 0x4b, 0x30, 0x29, 0x30, 0x6b, 0x70, 0x1b, 0x29, 0x60, 0x33, 0x0b, 0x6a, 0xbb, 0x33, 0x48, 0xa5, + 0x93, 0x3c, 0xd4, 0x44, 0x71, 0x88, 0x89, 0x60, 0xed, 0xf1, 0xf9, 0xe5, 0x79, 0xa9, 0x45, 0xc5, + 0x19, 0x99, 0x05, 0xc5, 0x4a, 0x41, 0x30, 0x13, 0x95, 0x0e, 0x21, 0x1c, 0x0e, 0xd6, 0x2a, 0xa4, + 0xc7, 0xc5, 0x01, 0x51, 0x9e, 0x99, 0x02, 0x76, 0x3a, 0xa7, 0x93, 0xf0, 0xa7, 0x7b, 0xf2, 0xfc, + 0xc8, 0x06, 0x65, 0xa6, 0xc0, 0x0c, 0xf0, 0x4c, 0x11, 0xaa, 0xe1, 0x12, 0x4a, 0x2c, 0x2d, 0xc9, + 0xc8, 0x2f, 0xca, 0x2c, 0xa9, 0x8c, 0xcf, 0x4d, 0x2d, 0x49, 0x4c, 0x49, 0x2c, 0x49, 0x94, 0x60, + 0x02, 0x7b, 0x5a, 0x0b, 0x9b, 0x43, 0xc1, 0xd6, 0x38, 0xc2, 0xb4, 0xf8, 0x42, 0x75, 0x38, 0x29, + 0x42, 0x9d, 0x2c, 0x09, 0xb1, 0x09, 0xd3, 0x4c, 0xa5, 0x20, 0xc1, 0x44, 0x74, 0x5d, 0x56, 0x2c, + 0x2f, 0x16, 0xc8, 0x33, 0x3a, 0xb9, 0x9e, 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, + 0x47, 0x72, 0x8c, 0x13, 0x1e, 0xcb, 0x31, 0x5c, 0x78, 0x2c, 0xc7, 0x70, 0xe3, 0xb1, 0x1c, 0x43, + 0x94, 0x76, 0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, 0x72, 0x7e, 0xae, 0x7e, 0x68, 0x5e, 0x68, + 0x5e, 0xa6, 0x5b, 0xa6, 0x7e, 0x72, 0x46, 0x62, 0x66, 0x9e, 0x7e, 0x05, 0x72, 0x7c, 0x96, 0x54, + 0x16, 0xa4, 0x16, 0x27, 0xb1, 0x81, 0xe3, 0xd2, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0x7c, 0x40, + 0xc5, 0x8b, 0x3e, 0x02, 0x00, 0x00, } +func (this *GenesisClass) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*GenesisClass) + if !ok { + that2, ok := that.(GenesisClass) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.ClassId != that1.ClassId { + return false + } + if !this.AuthorityMetadata.Equal(&that1.AuthorityMetadata) { + return false + } + return true +} func (m *GenesisState) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -124,10 +209,10 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.ClassAttributesList) > 0 { - for iNdEx := len(m.ClassAttributesList) - 1; iNdEx >= 0; iNdEx-- { + if len(m.Classes) > 0 { + for iNdEx := len(m.Classes) - 1; iNdEx >= 0; iNdEx-- { { - size, err := m.ClassAttributesList[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Classes[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -151,6 +236,46 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *GenesisClass) 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 *GenesisClass) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GenesisClass) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.AuthorityMetadata.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.ClassId) > 0 { + i -= len(m.ClassId) + copy(dAtA[i:], m.ClassId) + i = encodeVarintGenesis(dAtA, i, uint64(len(m.ClassId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { offset -= sovGenesis(v) base := offset @@ -170,8 +295,8 @@ func (m *GenesisState) Size() (n int) { _ = l l = m.Params.Size() n += 1 + l + sovGenesis(uint64(l)) - if len(m.ClassAttributesList) > 0 { - for _, e := range m.ClassAttributesList { + if len(m.Classes) > 0 { + for _, e := range m.Classes { l = e.Size() n += 1 + l + sovGenesis(uint64(l)) } @@ -179,6 +304,21 @@ func (m *GenesisState) Size() (n int) { return n } +func (m *GenesisClass) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ClassId) + if l > 0 { + n += 1 + l + sovGenesis(uint64(l)) + } + l = m.AuthorityMetadata.Size() + n += 1 + l + sovGenesis(uint64(l)) + return n +} + func sovGenesis(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -249,7 +389,123 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClassAttributesList", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Classes", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Classes = append(m.Classes, GenesisClass{}) + if err := m.Classes[len(m.Classes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GenesisClass) 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 ErrIntOverflowGenesis + } + 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: GenesisClass: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GenesisClass: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + 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 ErrInvalidLengthGenesis + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ClassId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AuthorityMetadata", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -276,8 +532,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ClassAttributesList = append(m.ClassAttributesList, ClassAttributes{}) - if err := m.ClassAttributesList[len(m.ClassAttributesList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.AuthorityMetadata.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/x/nftfactory/types/nftfactory.pb.go b/x/nftfactory/types/nftfactory.pb.go index 98389cd61..f1662446f 100644 --- a/x/nftfactory/types/nftfactory.pb.go +++ b/x/nftfactory/types/nftfactory.pb.go @@ -5,9 +5,10 @@ package types import ( fmt "fmt" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" - _ "google.golang.org/protobuf/types/known/timestamppb" io "io" math "math" math_bits "math/bits" @@ -24,176 +25,26 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -type MintingPermission int32 - -const ( - MintingPermission_OnlyOwner MintingPermission = 0 - MintingPermission_Anyone MintingPermission = 1 -) - -var MintingPermission_name = map[int32]string{ - 0: "OnlyOwner", - 1: "Anyone", -} - -var MintingPermission_value = map[string]int32{ - "OnlyOwner": 0, - "Anyone": 1, -} - -func (x MintingPermission) String() string { - return proto.EnumName(MintingPermission_name, int32(x)) -} - -func (MintingPermission) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_19bd2cd86ea9a985, []int{0} -} - -type ClassAttributes struct { - ClassId string `protobuf:"bytes,1,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` - Owner string `protobuf:"bytes,2,opt,name=owner,proto3" json:"owner,omitempty"` - BaseTokenUri string `protobuf:"bytes,3,opt,name=base_token_uri,json=baseTokenUri,proto3" json:"base_token_uri,omitempty"` - MintingPermission MintingPermission `protobuf:"varint,4,opt,name=minting_permission,json=mintingPermission,proto3,enum=ununifi.nftfactory.MintingPermission" json:"minting_permission,omitempty"` - TokenSupplyCap uint64 `protobuf:"varint,5,opt,name=token_supply_cap,json=tokenSupplyCap,proto3" json:"token_supply_cap,omitempty"` +// ClassAuthorityMetadata specifies metadata for addresses that have specific +// capabilities over a nft factory class. Right now there is only one Admin +// permission, but is planned to be extended to the future. +type ClassAuthorityMetadata struct { + // Can be empty for no admin, or a valid osmosis address + Admin string `protobuf:"bytes,1,opt,name=Admin,proto3" json:"Admin,omitempty" yaml:"admin"` } -func (m *ClassAttributes) Reset() { *m = ClassAttributes{} } -func (m *ClassAttributes) String() string { return proto.CompactTextString(m) } -func (*ClassAttributes) ProtoMessage() {} -func (*ClassAttributes) Descriptor() ([]byte, []int) { +func (m *ClassAuthorityMetadata) Reset() { *m = ClassAuthorityMetadata{} } +func (m *ClassAuthorityMetadata) String() string { return proto.CompactTextString(m) } +func (*ClassAuthorityMetadata) ProtoMessage() {} +func (*ClassAuthorityMetadata) Descriptor() ([]byte, []int) { return fileDescriptor_19bd2cd86ea9a985, []int{0} } -func (m *ClassAttributes) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ClassAttributes) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ClassAttributes.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 *ClassAttributes) XXX_Merge(src proto.Message) { - xxx_messageInfo_ClassAttributes.Merge(m, src) -} -func (m *ClassAttributes) XXX_Size() int { - return m.Size() -} -func (m *ClassAttributes) XXX_DiscardUnknown() { - xxx_messageInfo_ClassAttributes.DiscardUnknown(m) -} - -var xxx_messageInfo_ClassAttributes proto.InternalMessageInfo - -func (m *ClassAttributes) GetClassId() string { - if m != nil { - return m.ClassId - } - return "" -} - -func (m *ClassAttributes) GetOwner() string { - if m != nil { - return m.Owner - } - return "" -} - -func (m *ClassAttributes) GetBaseTokenUri() string { - if m != nil { - return m.BaseTokenUri - } - return "" -} - -func (m *ClassAttributes) GetMintingPermission() MintingPermission { - if m != nil { - return m.MintingPermission - } - return MintingPermission_OnlyOwner -} - -func (m *ClassAttributes) GetTokenSupplyCap() uint64 { - if m != nil { - return m.TokenSupplyCap - } - return 0 -} - -type OwningClassIdList struct { - Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` - ClassId []string `protobuf:"bytes,2,rep,name=class_id,json=classId,proto3" json:"class_id,omitempty"` -} - -func (m *OwningClassIdList) Reset() { *m = OwningClassIdList{} } -func (m *OwningClassIdList) String() string { return proto.CompactTextString(m) } -func (*OwningClassIdList) ProtoMessage() {} -func (*OwningClassIdList) Descriptor() ([]byte, []int) { - return fileDescriptor_19bd2cd86ea9a985, []int{1} -} -func (m *OwningClassIdList) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *OwningClassIdList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_OwningClassIdList.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 *OwningClassIdList) XXX_Merge(src proto.Message) { - xxx_messageInfo_OwningClassIdList.Merge(m, src) -} -func (m *OwningClassIdList) XXX_Size() int { - return m.Size() -} -func (m *OwningClassIdList) XXX_DiscardUnknown() { - xxx_messageInfo_OwningClassIdList.DiscardUnknown(m) -} - -var xxx_messageInfo_OwningClassIdList proto.InternalMessageInfo - -func (m *OwningClassIdList) GetOwner() string { - if m != nil { - return m.Owner - } - return "" -} - -func (m *OwningClassIdList) GetClassId() []string { - if m != nil { - return m.ClassId - } - return nil -} - -type ClassNameIdList struct { - ClassName string `protobuf:"bytes,1,opt,name=class_name,json=className,proto3" json:"class_name,omitempty"` - ClassId []string `protobuf:"bytes,2,rep,name=class_id,json=classId,proto3" json:"class_id,omitempty"` -} - -func (m *ClassNameIdList) Reset() { *m = ClassNameIdList{} } -func (m *ClassNameIdList) String() string { return proto.CompactTextString(m) } -func (*ClassNameIdList) ProtoMessage() {} -func (*ClassNameIdList) Descriptor() ([]byte, []int) { - return fileDescriptor_19bd2cd86ea9a985, []int{2} -} -func (m *ClassNameIdList) XXX_Unmarshal(b []byte) error { +func (m *ClassAuthorityMetadata) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *ClassNameIdList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *ClassAuthorityMetadata) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_ClassNameIdList.Marshal(b, m, deterministic) + return xxx_messageInfo_ClassAuthorityMetadata.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -203,47 +54,37 @@ func (m *ClassNameIdList) XXX_Marshal(b []byte, deterministic bool) ([]byte, err return b[:n], nil } } -func (m *ClassNameIdList) XXX_Merge(src proto.Message) { - xxx_messageInfo_ClassNameIdList.Merge(m, src) +func (m *ClassAuthorityMetadata) XXX_Merge(src proto.Message) { + xxx_messageInfo_ClassAuthorityMetadata.Merge(m, src) } -func (m *ClassNameIdList) XXX_Size() int { +func (m *ClassAuthorityMetadata) XXX_Size() int { return m.Size() } -func (m *ClassNameIdList) XXX_DiscardUnknown() { - xxx_messageInfo_ClassNameIdList.DiscardUnknown(m) +func (m *ClassAuthorityMetadata) XXX_DiscardUnknown() { + xxx_messageInfo_ClassAuthorityMetadata.DiscardUnknown(m) } -var xxx_messageInfo_ClassNameIdList proto.InternalMessageInfo +var xxx_messageInfo_ClassAuthorityMetadata proto.InternalMessageInfo -func (m *ClassNameIdList) GetClassName() string { +func (m *ClassAuthorityMetadata) GetAdmin() string { if m != nil { - return m.ClassName + return m.Admin } return "" } -func (m *ClassNameIdList) GetClassId() []string { - if m != nil { - return m.ClassId - } - return nil -} - type Params struct { - MaxNFTSupplyCap uint64 `protobuf:"varint,1,opt,name=MaxNFTSupplyCap,proto3" json:"MaxNFTSupplyCap,omitempty"` - MinClassNameLen uint64 `protobuf:"varint,2,opt,name=MinClassNameLen,proto3" json:"MinClassNameLen,omitempty"` - MaxClassNameLen uint64 `protobuf:"varint,3,opt,name=MaxClassNameLen,proto3" json:"MaxClassNameLen,omitempty"` - MinUriLen uint64 `protobuf:"varint,4,opt,name=MinUriLen,proto3" json:"MinUriLen,omitempty"` - MaxUriLen uint64 `protobuf:"varint,5,opt,name=MaxUriLen,proto3" json:"MaxUriLen,omitempty"` - MaxSymbolLen uint64 `protobuf:"varint,6,opt,name=MaxSymbolLen,proto3" json:"MaxSymbolLen,omitempty"` - MaxDescriptionLen uint64 `protobuf:"varint,7,opt,name=MaxDescriptionLen,proto3" json:"MaxDescriptionLen,omitempty"` + // ClassCreationFee is the fee required to create a new denom using the nftfactory module + ClassCreationFee github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,1,rep,name=class_creation_fee,json=classCreationFee,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"class_creation_fee" yaml:"denom_creation_fee"` + // FeeCollectorAddress is the address where fees collected from denom creation are sent to + FeeCollectorAddress string `protobuf:"bytes,2,opt,name=fee_collector_address,json=feeCollectorAddress,proto3" json:"fee_collector_address,omitempty"` } func (m *Params) Reset() { *m = Params{} } func (m *Params) String() string { return proto.CompactTextString(m) } func (*Params) ProtoMessage() {} func (*Params) Descriptor() ([]byte, []int) { - return fileDescriptor_19bd2cd86ea9a985, []int{3} + return fileDescriptor_19bd2cd86ea9a985, []int{1} } func (m *Params) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -272,60 +113,22 @@ func (m *Params) XXX_DiscardUnknown() { var xxx_messageInfo_Params proto.InternalMessageInfo -func (m *Params) GetMaxNFTSupplyCap() uint64 { - if m != nil { - return m.MaxNFTSupplyCap - } - return 0 -} - -func (m *Params) GetMinClassNameLen() uint64 { - if m != nil { - return m.MinClassNameLen - } - return 0 -} - -func (m *Params) GetMaxClassNameLen() uint64 { - if m != nil { - return m.MaxClassNameLen - } - return 0 -} - -func (m *Params) GetMinUriLen() uint64 { - if m != nil { - return m.MinUriLen - } - return 0 -} - -func (m *Params) GetMaxUriLen() uint64 { - if m != nil { - return m.MaxUriLen - } - return 0 -} - -func (m *Params) GetMaxSymbolLen() uint64 { +func (m *Params) GetClassCreationFee() github_com_cosmos_cosmos_sdk_types.Coins { if m != nil { - return m.MaxSymbolLen + return m.ClassCreationFee } - return 0 + return nil } -func (m *Params) GetMaxDescriptionLen() uint64 { +func (m *Params) GetFeeCollectorAddress() string { if m != nil { - return m.MaxDescriptionLen + return m.FeeCollectorAddress } - return 0 + return "" } func init() { - proto.RegisterEnum("ununifi.nftfactory.MintingPermission", MintingPermission_name, MintingPermission_value) - proto.RegisterType((*ClassAttributes)(nil), "ununifi.nftfactory.ClassAttributes") - proto.RegisterType((*OwningClassIdList)(nil), "ununifi.nftfactory.OwningClassIdList") - proto.RegisterType((*ClassNameIdList)(nil), "ununifi.nftfactory.ClassNameIdList") + proto.RegisterType((*ClassAuthorityMetadata)(nil), "ununifi.nftfactory.ClassAuthorityMetadata") proto.RegisterType((*Params)(nil), "ununifi.nftfactory.Params") } @@ -334,135 +137,57 @@ func init() { } var fileDescriptor_19bd2cd86ea9a985 = []byte{ - // 504 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x93, 0xcf, 0x6e, 0xd3, 0x40, - 0x10, 0x87, 0xe3, 0xfc, 0x2b, 0x59, 0x95, 0x34, 0x59, 0xf5, 0x10, 0x2a, 0x30, 0x51, 0x00, 0x29, - 0x02, 0x64, 0x4b, 0xf0, 0x04, 0x25, 0xa5, 0x12, 0xa2, 0x69, 0xaa, 0x34, 0xb9, 0x70, 0x89, 0xd6, - 0xee, 0xc6, 0x1d, 0x11, 0xcf, 0x5a, 0xde, 0xb5, 0x1a, 0xbf, 0x05, 0x07, 0x1e, 0x8a, 0x63, 0x8f, - 0x1c, 0x51, 0x72, 0xe1, 0x31, 0xd0, 0xae, 0xdd, 0xc4, 0x69, 0x24, 0x6e, 0xde, 0xef, 0xf7, 0x69, - 0xbc, 0x33, 0xa3, 0x25, 0xaf, 0x12, 0x4c, 0x10, 0xe6, 0xe0, 0xe2, 0x5c, 0xcd, 0x99, 0xaf, 0x44, - 0x9c, 0x16, 0x3e, 0x9d, 0x28, 0x16, 0x4a, 0x50, 0x9a, 0x4b, 0xce, 0x36, 0x39, 0x39, 0x0e, 0x44, - 0x20, 0x4c, 0xec, 0xea, 0xaf, 0xcc, 0x3c, 0x79, 0x19, 0x08, 0x11, 0x2c, 0xb8, 0x6b, 0x4e, 0x5e, - 0x32, 0x77, 0x15, 0x84, 0x5c, 0x2a, 0x16, 0x46, 0x99, 0xd0, 0xfb, 0x6b, 0x91, 0xa3, 0xc1, 0x82, - 0x49, 0x79, 0xaa, 0x54, 0x0c, 0x5e, 0xa2, 0xb8, 0xa4, 0xcf, 0xc8, 0x13, 0x5f, 0xa3, 0x19, 0xdc, - 0x74, 0xac, 0xae, 0xd5, 0x6f, 0x8c, 0x0f, 0xcc, 0xf9, 0xcb, 0x0d, 0x3d, 0x26, 0x35, 0x71, 0x87, - 0x3c, 0xee, 0x94, 0x0d, 0xcf, 0x0e, 0xf4, 0x35, 0x69, 0x7a, 0x4c, 0xf2, 0x99, 0x12, 0xdf, 0x39, - 0xce, 0x92, 0x18, 0x3a, 0x15, 0x13, 0x1f, 0x6a, 0x3a, 0xd1, 0x70, 0x1a, 0x03, 0x9d, 0x10, 0x1a, - 0x02, 0x2a, 0xc0, 0x60, 0x16, 0xf1, 0x38, 0x04, 0x29, 0x41, 0x60, 0xa7, 0xda, 0xb5, 0xfa, 0xcd, - 0x0f, 0x6f, 0x9c, 0xfd, 0x96, 0x9c, 0x61, 0x66, 0x5f, 0x6d, 0xe4, 0x71, 0x3b, 0x7c, 0x8c, 0x68, - 0x9f, 0xb4, 0xb2, 0xdf, 0xca, 0x24, 0x8a, 0x16, 0xe9, 0xcc, 0x67, 0x51, 0xa7, 0xd6, 0xb5, 0xfa, - 0xd5, 0x71, 0xd3, 0xf0, 0x6b, 0x83, 0x07, 0x2c, 0xea, 0x9d, 0x91, 0xf6, 0xe8, 0x0e, 0x01, 0x83, - 0x41, 0xd6, 0xcc, 0x05, 0x48, 0xb5, 0x6d, 0xc8, 0x2a, 0x36, 0x54, 0x9c, 0x40, 0xb9, 0x5b, 0x29, - 0x4c, 0xa0, 0xf7, 0x35, 0x9f, 0xd7, 0x25, 0x0b, 0x79, 0x5e, 0xe3, 0x05, 0x21, 0x99, 0x8d, 0x2c, - 0xe4, 0x79, 0xa1, 0x86, 0xff, 0x20, 0xfd, 0xaf, 0xd8, 0xcf, 0x32, 0xa9, 0x5f, 0xb1, 0x98, 0x85, - 0x92, 0xf6, 0xc9, 0xd1, 0x90, 0x2d, 0x2f, 0xcf, 0x27, 0x9b, 0x0b, 0x9b, 0x4a, 0xd5, 0xf1, 0x63, - 0x6c, 0x4c, 0xc0, 0xcd, 0x25, 0x2e, 0x38, 0x9a, 0x6d, 0x68, 0x73, 0x17, 0xe7, 0x35, 0x77, 0xcc, - 0xca, 0xa6, 0xe6, 0x8e, 0xf9, 0x9c, 0x34, 0x86, 0xa0, 0xb7, 0xa4, 0x9d, 0xaa, 0x71, 0xb6, 0xc0, - 0xa4, 0x6c, 0x99, 0xa7, 0xb5, 0x3c, 0x7d, 0x00, 0xb4, 0x47, 0x0e, 0x87, 0x6c, 0x79, 0x9d, 0x86, - 0x9e, 0x58, 0x68, 0xa1, 0x6e, 0x84, 0x1d, 0x46, 0xdf, 0x93, 0xf6, 0x90, 0x2d, 0xcf, 0xb8, 0xf4, - 0x63, 0x88, 0x14, 0x08, 0xd4, 0xe2, 0x81, 0x11, 0xf7, 0x83, 0xb7, 0x0e, 0x69, 0xef, 0xed, 0x9e, - 0x3e, 0x25, 0x8d, 0x11, 0x2e, 0xd2, 0x91, 0x5e, 0x50, 0xab, 0x44, 0x09, 0xa9, 0x9f, 0x62, 0x2a, - 0x90, 0xb7, 0xac, 0x4f, 0x9f, 0x7f, 0xad, 0x6c, 0xeb, 0x7e, 0x65, 0x5b, 0x7f, 0x56, 0xb6, 0xf5, - 0x63, 0x6d, 0x97, 0xee, 0xd7, 0x76, 0xe9, 0xf7, 0xda, 0x2e, 0x7d, 0x7b, 0x17, 0x80, 0xba, 0x4d, - 0x3c, 0xc7, 0x17, 0xa1, 0x3b, 0xc5, 0x29, 0xc2, 0x39, 0xb8, 0xfe, 0x2d, 0x03, 0x74, 0x97, 0xc5, - 0x17, 0xa6, 0xd2, 0x88, 0x4b, 0xaf, 0x6e, 0x9e, 0xc4, 0xc7, 0x7f, 0x01, 0x00, 0x00, 0xff, 0xff, - 0x60, 0x5f, 0x00, 0x47, 0x84, 0x03, 0x00, 0x00, -} - -func (m *ClassAttributes) 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 *ClassAttributes) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ClassAttributes) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.TokenSupplyCap != 0 { - i = encodeVarintNftfactory(dAtA, i, uint64(m.TokenSupplyCap)) - i-- - dAtA[i] = 0x28 - } - if m.MintingPermission != 0 { - i = encodeVarintNftfactory(dAtA, i, uint64(m.MintingPermission)) - i-- - dAtA[i] = 0x20 - } - if len(m.BaseTokenUri) > 0 { - i -= len(m.BaseTokenUri) - copy(dAtA[i:], m.BaseTokenUri) - i = encodeVarintNftfactory(dAtA, i, uint64(len(m.BaseTokenUri))) - i-- - dAtA[i] = 0x1a - } - if len(m.Owner) > 0 { - i -= len(m.Owner) - copy(dAtA[i:], m.Owner) - i = encodeVarintNftfactory(dAtA, i, uint64(len(m.Owner))) - i-- - dAtA[i] = 0x12 - } - if len(m.ClassId) > 0 { - i -= len(m.ClassId) - copy(dAtA[i:], m.ClassId) - i = encodeVarintNftfactory(dAtA, i, uint64(len(m.ClassId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *OwningClassIdList) 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 *OwningClassIdList) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *OwningClassIdList) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.ClassId) > 0 { - for iNdEx := len(m.ClassId) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.ClassId[iNdEx]) - copy(dAtA[i:], m.ClassId[iNdEx]) - i = encodeVarintNftfactory(dAtA, i, uint64(len(m.ClassId[iNdEx]))) - i-- - dAtA[i] = 0x12 + // 368 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x54, 0x91, 0xbb, 0x6a, 0xf3, 0x30, + 0x14, 0xc7, 0xad, 0xef, 0x12, 0xf8, 0xfc, 0x75, 0x08, 0xee, 0x85, 0x24, 0x83, 0x1d, 0x5c, 0x28, + 0x81, 0x52, 0x8b, 0xa4, 0x5b, 0xb6, 0xc4, 0x34, 0x5b, 0xa0, 0x04, 0xb2, 0x74, 0x31, 0xb2, 0x7c, + 0x9c, 0x88, 0xda, 0x52, 0xb0, 0xe4, 0x52, 0xbf, 0x45, 0xa7, 0xce, 0x9d, 0xfb, 0x24, 0x19, 0xb3, + 0x14, 0x3a, 0xa5, 0x25, 0x59, 0x3a, 0xe7, 0x09, 0x8a, 0x2f, 0xa5, 0xe9, 0xe4, 0x83, 0x7f, 0x47, + 0x7f, 0xfd, 0xce, 0x91, 0x7e, 0x9a, 0xf2, 0x94, 0xb3, 0x90, 0x61, 0x1e, 0xaa, 0x90, 0x50, 0x25, + 0x92, 0x6c, 0xaf, 0x74, 0x16, 0x89, 0x50, 0xc2, 0x30, 0xaa, 0x26, 0xe7, 0x9b, 0xb4, 0x8e, 0x66, + 0x62, 0x26, 0x0a, 0x8c, 0xf3, 0xaa, 0xec, 0x6c, 0x99, 0x54, 0xc8, 0x58, 0x48, 0xec, 0x13, 0x09, + 0xf8, 0xae, 0xeb, 0x83, 0x22, 0x5d, 0x4c, 0x05, 0xe3, 0x25, 0xb7, 0x47, 0xfa, 0x89, 0x1b, 0x11, + 0x29, 0x07, 0xa9, 0x9a, 0x8b, 0x84, 0xa9, 0x6c, 0x0c, 0x8a, 0x04, 0x44, 0x11, 0xe3, 0x4c, 0xff, + 0x3b, 0x08, 0x62, 0xc6, 0x1b, 0xa8, 0x8d, 0x3a, 0xff, 0x86, 0xf5, 0xdd, 0xda, 0x3a, 0xc8, 0x48, + 0x1c, 0xf5, 0x6d, 0x92, 0xff, 0xb6, 0x27, 0x25, 0xee, 0xff, 0xf9, 0x78, 0xb2, 0x90, 0xfd, 0x82, + 0xf4, 0xda, 0x35, 0x49, 0x48, 0x2c, 0x8d, 0x47, 0xa4, 0x1b, 0x34, 0xcf, 0xf4, 0x68, 0x02, 0x44, + 0x31, 0xc1, 0xbd, 0x10, 0xa0, 0x81, 0xda, 0xbf, 0x3b, 0xff, 0x7b, 0x4d, 0xa7, 0x14, 0x72, 0x72, + 0x21, 0xa7, 0x12, 0x72, 0x5c, 0xc1, 0xf8, 0x70, 0xbc, 0x5c, 0x5b, 0xda, 0x6e, 0x6d, 0x35, 0xcb, + 0x5b, 0x02, 0xe0, 0x22, 0xfe, 0x11, 0x61, 0x3f, 0xbf, 0x59, 0x9d, 0x19, 0x53, 0xf3, 0xd4, 0x77, + 0xa8, 0x88, 0x71, 0x35, 0x5a, 0xf9, 0xb9, 0x90, 0xc1, 0x2d, 0x56, 0xd9, 0x02, 0x64, 0x91, 0x26, + 0x27, 0xf5, 0xc2, 0xc1, 0xad, 0xce, 0x8f, 0x00, 0x8c, 0x9e, 0x7e, 0x1c, 0x02, 0x78, 0x54, 0x44, + 0x11, 0xe4, 0x3b, 0xf3, 0x48, 0x10, 0x24, 0x20, 0x65, 0xe3, 0x57, 0x3e, 0xe1, 0xe4, 0x30, 0x04, + 0x70, 0xbf, 0xd8, 0xa0, 0x44, 0xc3, 0xab, 0xe5, 0xc6, 0x44, 0xab, 0x8d, 0x89, 0xde, 0x37, 0x26, + 0x7a, 0xd8, 0x9a, 0xda, 0x6a, 0x6b, 0x6a, 0xaf, 0x5b, 0x53, 0xbb, 0x39, 0xdf, 0x33, 0x99, 0xf2, + 0x29, 0x67, 0x23, 0x86, 0xe9, 0x9c, 0x30, 0x8e, 0xef, 0xf7, 0xdf, 0xae, 0x50, 0xf2, 0x6b, 0xc5, + 0xb6, 0x2f, 0x3f, 0x03, 0x00, 0x00, 0xff, 0xff, 0x03, 0x84, 0xc4, 0x47, 0xde, 0x01, 0x00, 0x00, +} + +func (this *ClassAuthorityMetadata) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*ClassAuthorityMetadata) + if !ok { + that2, ok := that.(ClassAuthorityMetadata) + if ok { + that1 = &that2 + } else { + return false } } - if len(m.Owner) > 0 { - i -= len(m.Owner) - copy(dAtA[i:], m.Owner) - i = encodeVarintNftfactory(dAtA, i, uint64(len(m.Owner))) - i-- - dAtA[i] = 0xa + if that1 == nil { + return this == nil + } else if this == nil { + return false } - return len(dAtA) - i, nil + if this.Admin != that1.Admin { + return false + } + return true } - -func (m *ClassNameIdList) Marshal() (dAtA []byte, err error) { +func (m *ClassAuthorityMetadata) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -472,29 +197,20 @@ func (m *ClassNameIdList) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *ClassNameIdList) MarshalTo(dAtA []byte) (int, error) { +func (m *ClassAuthorityMetadata) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *ClassNameIdList) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *ClassAuthorityMetadata) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.ClassId) > 0 { - for iNdEx := len(m.ClassId) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.ClassId[iNdEx]) - copy(dAtA[i:], m.ClassId[iNdEx]) - i = encodeVarintNftfactory(dAtA, i, uint64(len(m.ClassId[iNdEx]))) - i-- - dAtA[i] = 0x12 - } - } - if len(m.ClassName) > 0 { - i -= len(m.ClassName) - copy(dAtA[i:], m.ClassName) - i = encodeVarintNftfactory(dAtA, i, uint64(len(m.ClassName))) + if len(m.Admin) > 0 { + i -= len(m.Admin) + copy(dAtA[i:], m.Admin) + i = encodeVarintNftfactory(dAtA, i, uint64(len(m.Admin))) i-- dAtA[i] = 0xa } @@ -521,40 +237,26 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.MaxDescriptionLen != 0 { - i = encodeVarintNftfactory(dAtA, i, uint64(m.MaxDescriptionLen)) + if len(m.FeeCollectorAddress) > 0 { + i -= len(m.FeeCollectorAddress) + copy(dAtA[i:], m.FeeCollectorAddress) + i = encodeVarintNftfactory(dAtA, i, uint64(len(m.FeeCollectorAddress))) i-- - dAtA[i] = 0x38 - } - if m.MaxSymbolLen != 0 { - i = encodeVarintNftfactory(dAtA, i, uint64(m.MaxSymbolLen)) - i-- - dAtA[i] = 0x30 - } - if m.MaxUriLen != 0 { - i = encodeVarintNftfactory(dAtA, i, uint64(m.MaxUriLen)) - i-- - dAtA[i] = 0x28 - } - if m.MinUriLen != 0 { - i = encodeVarintNftfactory(dAtA, i, uint64(m.MinUriLen)) - i-- - dAtA[i] = 0x20 - } - if m.MaxClassNameLen != 0 { - i = encodeVarintNftfactory(dAtA, i, uint64(m.MaxClassNameLen)) - i-- - dAtA[i] = 0x18 - } - if m.MinClassNameLen != 0 { - i = encodeVarintNftfactory(dAtA, i, uint64(m.MinClassNameLen)) - i-- - dAtA[i] = 0x10 + dAtA[i] = 0x12 } - if m.MaxNFTSupplyCap != 0 { - i = encodeVarintNftfactory(dAtA, i, uint64(m.MaxNFTSupplyCap)) - i-- - dAtA[i] = 0x8 + if len(m.ClassCreationFee) > 0 { + for iNdEx := len(m.ClassCreationFee) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.ClassCreationFee[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintNftfactory(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } } return len(dAtA) - i, nil } @@ -570,98 +272,35 @@ func encodeVarintNftfactory(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } -func (m *ClassAttributes) Size() (n int) { +func (m *ClassAuthorityMetadata) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = len(m.ClassId) + l = len(m.Admin) if l > 0 { n += 1 + l + sovNftfactory(uint64(l)) } - l = len(m.Owner) - if l > 0 { - n += 1 + l + sovNftfactory(uint64(l)) - } - l = len(m.BaseTokenUri) - if l > 0 { - n += 1 + l + sovNftfactory(uint64(l)) - } - if m.MintingPermission != 0 { - n += 1 + sovNftfactory(uint64(m.MintingPermission)) - } - if m.TokenSupplyCap != 0 { - n += 1 + sovNftfactory(uint64(m.TokenSupplyCap)) - } return n } -func (m *OwningClassIdList) Size() (n int) { +func (m *Params) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = len(m.Owner) - if l > 0 { - n += 1 + l + sovNftfactory(uint64(l)) - } - if len(m.ClassId) > 0 { - for _, s := range m.ClassId { - l = len(s) + if len(m.ClassCreationFee) > 0 { + for _, e := range m.ClassCreationFee { + l = e.Size() n += 1 + l + sovNftfactory(uint64(l)) } } - return n -} - -func (m *ClassNameIdList) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ClassName) + l = len(m.FeeCollectorAddress) if l > 0 { n += 1 + l + sovNftfactory(uint64(l)) } - if len(m.ClassId) > 0 { - for _, s := range m.ClassId { - l = len(s) - n += 1 + l + sovNftfactory(uint64(l)) - } - } - return n -} - -func (m *Params) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.MaxNFTSupplyCap != 0 { - n += 1 + sovNftfactory(uint64(m.MaxNFTSupplyCap)) - } - if m.MinClassNameLen != 0 { - n += 1 + sovNftfactory(uint64(m.MinClassNameLen)) - } - if m.MaxClassNameLen != 0 { - n += 1 + sovNftfactory(uint64(m.MaxClassNameLen)) - } - if m.MinUriLen != 0 { - n += 1 + sovNftfactory(uint64(m.MinUriLen)) - } - if m.MaxUriLen != 0 { - n += 1 + sovNftfactory(uint64(m.MaxUriLen)) - } - if m.MaxSymbolLen != 0 { - n += 1 + sovNftfactory(uint64(m.MaxSymbolLen)) - } - if m.MaxDescriptionLen != 0 { - n += 1 + sovNftfactory(uint64(m.MaxDescriptionLen)) - } return n } @@ -671,7 +310,7 @@ func sovNftfactory(x uint64) (n int) { func sozNftfactory(x uint64) (n int) { return sovNftfactory(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (m *ClassAttributes) Unmarshal(dAtA []byte) error { +func (m *ClassAuthorityMetadata) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -694,15 +333,15 @@ func (m *ClassAttributes) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: ClassAttributes: wiretype end group for non-group") + return fmt.Errorf("proto: ClassAuthorityMetadata: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: ClassAttributes: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: ClassAuthorityMetadata: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Admin", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -730,117 +369,15 @@ func (m *ClassAttributes) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ClassId = string(dAtA[iNdEx:postIndex]) + m.Admin = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftfactory - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } + default: + iNdEx = preIndex + skippy, err := skipNftfactory(dAtA[iNdEx:]) + if err != nil { + return err } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNftfactory - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNftfactory - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Owner = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BaseTokenUri", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftfactory - } - 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 ErrInvalidLengthNftfactory - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNftfactory - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.BaseTokenUri = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MintingPermission", wireType) - } - m.MintingPermission = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftfactory - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MintingPermission |= MintingPermission(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TokenSupplyCap", wireType) - } - m.TokenSupplyCap = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftfactory - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.TokenSupplyCap |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipNftfactory(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthNftfactory } if (iNdEx + skippy) > l { @@ -855,7 +392,7 @@ func (m *ClassAttributes) Unmarshal(dAtA []byte) error { } return nil } -func (m *OwningClassIdList) Unmarshal(dAtA []byte) error { +func (m *Params) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -878,49 +415,17 @@ func (m *OwningClassIdList) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: OwningClassIdList: wiretype end group for non-group") + return fmt.Errorf("proto: Params: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: OwningClassIdList: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftfactory - } - 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 ErrInvalidLengthNftfactory - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNftfactory - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Owner = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ClassCreationFee", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowNftfactory @@ -930,109 +435,29 @@ func (m *OwningClassIdList) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthNftfactory } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthNftfactory } if postIndex > l { return io.ErrUnexpectedEOF } - m.ClassId = append(m.ClassId, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipNftfactory(dAtA[iNdEx:]) - if err != nil { + m.ClassCreationFee = append(m.ClassCreationFee, types.Coin{}) + if err := m.ClassCreationFee[len(m.ClassCreationFee)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthNftfactory - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ClassNameIdList) 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 ErrIntOverflowNftfactory - } - 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: ClassNameIdList: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ClassNameIdList: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClassName", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftfactory - } - 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 ErrInvalidLengthNftfactory - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNftfactory - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ClassName = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field FeeCollectorAddress", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1060,7 +485,7 @@ func (m *ClassNameIdList) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ClassId = append(m.ClassId, string(dAtA[iNdEx:postIndex])) + m.FeeCollectorAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -1083,189 +508,6 @@ func (m *ClassNameIdList) Unmarshal(dAtA []byte) error { } return nil } -func (m *Params) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftfactory - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Params: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxNFTSupplyCap", wireType) - } - m.MaxNFTSupplyCap = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftfactory - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MaxNFTSupplyCap |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MinClassNameLen", wireType) - } - m.MinClassNameLen = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftfactory - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MinClassNameLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxClassNameLen", wireType) - } - m.MaxClassNameLen = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftfactory - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MaxClassNameLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MinUriLen", wireType) - } - m.MinUriLen = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftfactory - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MinUriLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxUriLen", wireType) - } - m.MaxUriLen = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftfactory - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MaxUriLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxSymbolLen", wireType) - } - m.MaxSymbolLen = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftfactory - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MaxSymbolLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 7: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxDescriptionLen", wireType) - } - m.MaxDescriptionLen = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftfactory - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MaxDescriptionLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipNftfactory(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthNftfactory - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func skipNftfactory(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/nftfactory/types/query.pb.go b/x/nftfactory/types/query.pb.go index 4c2a375e1..39b2b908e 100644 --- a/x/nftfactory/types/query.pb.go +++ b/x/nftfactory/types/query.pb.go @@ -29,6 +29,7 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// QueryParamsRequest is the request type for the Query/Params RPC method. type QueryParamsRequest struct { } @@ -65,7 +66,9 @@ func (m *QueryParamsRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryParamsRequest proto.InternalMessageInfo +// QueryParamsResponse is the response type for the Query/Params RPC method. type QueryParamsResponse struct { + // params defines the parameters of the module. Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` } @@ -109,22 +112,23 @@ func (m *QueryParamsResponse) GetParams() Params { return Params{} } -type QueryClassAttributesRequest struct { - ClassId string `protobuf:"bytes,1,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` +type QueryClassAuthorityMetadataRequest struct { + Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty" yaml:"creator"` + Subclass string `protobuf:"bytes,2,opt,name=subclass,proto3" json:"subclass,omitempty" yaml:"subclass"` } -func (m *QueryClassAttributesRequest) Reset() { *m = QueryClassAttributesRequest{} } -func (m *QueryClassAttributesRequest) String() string { return proto.CompactTextString(m) } -func (*QueryClassAttributesRequest) ProtoMessage() {} -func (*QueryClassAttributesRequest) Descriptor() ([]byte, []int) { +func (m *QueryClassAuthorityMetadataRequest) Reset() { *m = QueryClassAuthorityMetadataRequest{} } +func (m *QueryClassAuthorityMetadataRequest) String() string { return proto.CompactTextString(m) } +func (*QueryClassAuthorityMetadataRequest) ProtoMessage() {} +func (*QueryClassAuthorityMetadataRequest) Descriptor() ([]byte, []int) { return fileDescriptor_ce869c90a3ee4b0a, []int{2} } -func (m *QueryClassAttributesRequest) XXX_Unmarshal(b []byte) error { +func (m *QueryClassAuthorityMetadataRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryClassAttributesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryClassAuthorityMetadataRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryClassAttributesRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryClassAuthorityMetadataRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -134,225 +138,48 @@ func (m *QueryClassAttributesRequest) XXX_Marshal(b []byte, deterministic bool) return b[:n], nil } } -func (m *QueryClassAttributesRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryClassAttributesRequest.Merge(m, src) +func (m *QueryClassAuthorityMetadataRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryClassAuthorityMetadataRequest.Merge(m, src) } -func (m *QueryClassAttributesRequest) XXX_Size() int { +func (m *QueryClassAuthorityMetadataRequest) XXX_Size() int { return m.Size() } -func (m *QueryClassAttributesRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryClassAttributesRequest.DiscardUnknown(m) +func (m *QueryClassAuthorityMetadataRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryClassAuthorityMetadataRequest.DiscardUnknown(m) } -var xxx_messageInfo_QueryClassAttributesRequest proto.InternalMessageInfo +var xxx_messageInfo_QueryClassAuthorityMetadataRequest proto.InternalMessageInfo -func (m *QueryClassAttributesRequest) GetClassId() string { +func (m *QueryClassAuthorityMetadataRequest) GetCreator() string { if m != nil { - return m.ClassId + return m.Creator } return "" } -type QueryClassAttributesResponse struct { - ClassAttributes *ClassAttributes `protobuf:"bytes,1,opt,name=class_attributes,json=classAttributes,proto3" json:"class_attributes,omitempty"` -} - -func (m *QueryClassAttributesResponse) Reset() { *m = QueryClassAttributesResponse{} } -func (m *QueryClassAttributesResponse) String() string { return proto.CompactTextString(m) } -func (*QueryClassAttributesResponse) ProtoMessage() {} -func (*QueryClassAttributesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_ce869c90a3ee4b0a, []int{3} -} -func (m *QueryClassAttributesResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryClassAttributesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryClassAttributesResponse.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 *QueryClassAttributesResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryClassAttributesResponse.Merge(m, src) -} -func (m *QueryClassAttributesResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryClassAttributesResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryClassAttributesResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryClassAttributesResponse proto.InternalMessageInfo - -func (m *QueryClassAttributesResponse) GetClassAttributes() *ClassAttributes { - if m != nil { - return m.ClassAttributes - } - return nil -} - -type QueryNFTMinterRequest struct { - ClassId string `protobuf:"bytes,1,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` - NftId string `protobuf:"bytes,2,opt,name=nft_id,json=nftId,proto3" json:"nft_id,omitempty"` -} - -func (m *QueryNFTMinterRequest) Reset() { *m = QueryNFTMinterRequest{} } -func (m *QueryNFTMinterRequest) String() string { return proto.CompactTextString(m) } -func (*QueryNFTMinterRequest) ProtoMessage() {} -func (*QueryNFTMinterRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_ce869c90a3ee4b0a, []int{4} -} -func (m *QueryNFTMinterRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryNFTMinterRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryNFTMinterRequest.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 *QueryNFTMinterRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryNFTMinterRequest.Merge(m, src) -} -func (m *QueryNFTMinterRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryNFTMinterRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryNFTMinterRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryNFTMinterRequest proto.InternalMessageInfo - -func (m *QueryNFTMinterRequest) GetClassId() string { - if m != nil { - return m.ClassId - } - return "" -} - -func (m *QueryNFTMinterRequest) GetNftId() string { +func (m *QueryClassAuthorityMetadataRequest) GetSubclass() string { if m != nil { - return m.NftId + return m.Subclass } return "" } -type QueryNFTMinterResponse struct { - Minter string `protobuf:"bytes,1,opt,name=minter,proto3" json:"minter,omitempty"` +type QueryClassAuthorityMetadataResponse struct { + AuthorityMetadata ClassAuthorityMetadata `protobuf:"bytes,1,opt,name=authority_metadata,json=authorityMetadata,proto3" json:"authority_metadata" yaml:"authority_metadata"` } -func (m *QueryNFTMinterResponse) Reset() { *m = QueryNFTMinterResponse{} } -func (m *QueryNFTMinterResponse) String() string { return proto.CompactTextString(m) } -func (*QueryNFTMinterResponse) ProtoMessage() {} -func (*QueryNFTMinterResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_ce869c90a3ee4b0a, []int{5} -} -func (m *QueryNFTMinterResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryNFTMinterResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryNFTMinterResponse.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 *QueryNFTMinterResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryNFTMinterResponse.Merge(m, src) -} -func (m *QueryNFTMinterResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryNFTMinterResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryNFTMinterResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryNFTMinterResponse proto.InternalMessageInfo - -func (m *QueryNFTMinterResponse) GetMinter() string { - if m != nil { - return m.Minter - } - return "" -} - -type QueryClassIdsByNameRequest struct { - ClassName string `protobuf:"bytes,1,opt,name=class_name,json=className,proto3" json:"class_name,omitempty"` -} - -func (m *QueryClassIdsByNameRequest) Reset() { *m = QueryClassIdsByNameRequest{} } -func (m *QueryClassIdsByNameRequest) String() string { return proto.CompactTextString(m) } -func (*QueryClassIdsByNameRequest) ProtoMessage() {} -func (*QueryClassIdsByNameRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_ce869c90a3ee4b0a, []int{6} -} -func (m *QueryClassIdsByNameRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryClassIdsByNameRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryClassIdsByNameRequest.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 *QueryClassIdsByNameRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryClassIdsByNameRequest.Merge(m, src) -} -func (m *QueryClassIdsByNameRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryClassIdsByNameRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryClassIdsByNameRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryClassIdsByNameRequest proto.InternalMessageInfo - -func (m *QueryClassIdsByNameRequest) GetClassName() string { - if m != nil { - return m.ClassName - } - return "" -} - -type QueryClassIdsByNameResponse struct { - ClassNameIdList *ClassNameIdList `protobuf:"bytes,1,opt,name=class_name_id_list,json=classNameIdList,proto3" json:"class_name_id_list,omitempty"` -} - -func (m *QueryClassIdsByNameResponse) Reset() { *m = QueryClassIdsByNameResponse{} } -func (m *QueryClassIdsByNameResponse) String() string { return proto.CompactTextString(m) } -func (*QueryClassIdsByNameResponse) ProtoMessage() {} -func (*QueryClassIdsByNameResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_ce869c90a3ee4b0a, []int{7} +func (m *QueryClassAuthorityMetadataResponse) Reset() { *m = QueryClassAuthorityMetadataResponse{} } +func (m *QueryClassAuthorityMetadataResponse) String() string { return proto.CompactTextString(m) } +func (*QueryClassAuthorityMetadataResponse) ProtoMessage() {} +func (*QueryClassAuthorityMetadataResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_ce869c90a3ee4b0a, []int{3} } -func (m *QueryClassIdsByNameResponse) XXX_Unmarshal(b []byte) error { +func (m *QueryClassAuthorityMetadataResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryClassIdsByNameResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryClassAuthorityMetadataResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryClassIdsByNameResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryClassAuthorityMetadataResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -362,41 +189,41 @@ func (m *QueryClassIdsByNameResponse) XXX_Marshal(b []byte, deterministic bool) return b[:n], nil } } -func (m *QueryClassIdsByNameResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryClassIdsByNameResponse.Merge(m, src) +func (m *QueryClassAuthorityMetadataResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryClassAuthorityMetadataResponse.Merge(m, src) } -func (m *QueryClassIdsByNameResponse) XXX_Size() int { +func (m *QueryClassAuthorityMetadataResponse) XXX_Size() int { return m.Size() } -func (m *QueryClassIdsByNameResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryClassIdsByNameResponse.DiscardUnknown(m) +func (m *QueryClassAuthorityMetadataResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryClassAuthorityMetadataResponse.DiscardUnknown(m) } -var xxx_messageInfo_QueryClassIdsByNameResponse proto.InternalMessageInfo +var xxx_messageInfo_QueryClassAuthorityMetadataResponse proto.InternalMessageInfo -func (m *QueryClassIdsByNameResponse) GetClassNameIdList() *ClassNameIdList { +func (m *QueryClassAuthorityMetadataResponse) GetAuthorityMetadata() ClassAuthorityMetadata { if m != nil { - return m.ClassNameIdList + return m.AuthorityMetadata } - return nil + return ClassAuthorityMetadata{} } -type QueryClassIdsByOwnerRequest struct { - Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` +type QueryClassesFromCreatorRequest struct { + Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty" yaml:"creator"` } -func (m *QueryClassIdsByOwnerRequest) Reset() { *m = QueryClassIdsByOwnerRequest{} } -func (m *QueryClassIdsByOwnerRequest) String() string { return proto.CompactTextString(m) } -func (*QueryClassIdsByOwnerRequest) ProtoMessage() {} -func (*QueryClassIdsByOwnerRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_ce869c90a3ee4b0a, []int{8} +func (m *QueryClassesFromCreatorRequest) Reset() { *m = QueryClassesFromCreatorRequest{} } +func (m *QueryClassesFromCreatorRequest) String() string { return proto.CompactTextString(m) } +func (*QueryClassesFromCreatorRequest) ProtoMessage() {} +func (*QueryClassesFromCreatorRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_ce869c90a3ee4b0a, []int{4} } -func (m *QueryClassIdsByOwnerRequest) XXX_Unmarshal(b []byte) error { +func (m *QueryClassesFromCreatorRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryClassIdsByOwnerRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryClassesFromCreatorRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryClassIdsByOwnerRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryClassesFromCreatorRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -406,41 +233,41 @@ func (m *QueryClassIdsByOwnerRequest) XXX_Marshal(b []byte, deterministic bool) return b[:n], nil } } -func (m *QueryClassIdsByOwnerRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryClassIdsByOwnerRequest.Merge(m, src) +func (m *QueryClassesFromCreatorRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryClassesFromCreatorRequest.Merge(m, src) } -func (m *QueryClassIdsByOwnerRequest) XXX_Size() int { +func (m *QueryClassesFromCreatorRequest) XXX_Size() int { return m.Size() } -func (m *QueryClassIdsByOwnerRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryClassIdsByOwnerRequest.DiscardUnknown(m) +func (m *QueryClassesFromCreatorRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryClassesFromCreatorRequest.DiscardUnknown(m) } -var xxx_messageInfo_QueryClassIdsByOwnerRequest proto.InternalMessageInfo +var xxx_messageInfo_QueryClassesFromCreatorRequest proto.InternalMessageInfo -func (m *QueryClassIdsByOwnerRequest) GetOwner() string { +func (m *QueryClassesFromCreatorRequest) GetCreator() string { if m != nil { - return m.Owner + return m.Creator } return "" } -type QueryClassIdsByOwnerResponse struct { - OwningClassIdList *OwningClassIdList `protobuf:"bytes,1,opt,name=owning_class_id_list,json=owningClassIdList,proto3" json:"owning_class_id_list,omitempty"` +type QueryClassesFromCreatorResponse struct { + Classes []string `protobuf:"bytes,1,rep,name=classes,proto3" json:"classes,omitempty" yaml:"classes"` } -func (m *QueryClassIdsByOwnerResponse) Reset() { *m = QueryClassIdsByOwnerResponse{} } -func (m *QueryClassIdsByOwnerResponse) String() string { return proto.CompactTextString(m) } -func (*QueryClassIdsByOwnerResponse) ProtoMessage() {} -func (*QueryClassIdsByOwnerResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_ce869c90a3ee4b0a, []int{9} +func (m *QueryClassesFromCreatorResponse) Reset() { *m = QueryClassesFromCreatorResponse{} } +func (m *QueryClassesFromCreatorResponse) String() string { return proto.CompactTextString(m) } +func (*QueryClassesFromCreatorResponse) ProtoMessage() {} +func (*QueryClassesFromCreatorResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_ce869c90a3ee4b0a, []int{5} } -func (m *QueryClassIdsByOwnerResponse) XXX_Unmarshal(b []byte) error { +func (m *QueryClassesFromCreatorResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryClassIdsByOwnerResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryClassesFromCreatorResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryClassIdsByOwnerResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryClassesFromCreatorResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -450,21 +277,21 @@ func (m *QueryClassIdsByOwnerResponse) XXX_Marshal(b []byte, deterministic bool) return b[:n], nil } } -func (m *QueryClassIdsByOwnerResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryClassIdsByOwnerResponse.Merge(m, src) +func (m *QueryClassesFromCreatorResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryClassesFromCreatorResponse.Merge(m, src) } -func (m *QueryClassIdsByOwnerResponse) XXX_Size() int { +func (m *QueryClassesFromCreatorResponse) XXX_Size() int { return m.Size() } -func (m *QueryClassIdsByOwnerResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryClassIdsByOwnerResponse.DiscardUnknown(m) +func (m *QueryClassesFromCreatorResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryClassesFromCreatorResponse.DiscardUnknown(m) } -var xxx_messageInfo_QueryClassIdsByOwnerResponse proto.InternalMessageInfo +var xxx_messageInfo_QueryClassesFromCreatorResponse proto.InternalMessageInfo -func (m *QueryClassIdsByOwnerResponse) GetOwningClassIdList() *OwningClassIdList { +func (m *QueryClassesFromCreatorResponse) GetClasses() []string { if m != nil { - return m.OwningClassIdList + return m.Classes } return nil } @@ -472,61 +299,50 @@ func (m *QueryClassIdsByOwnerResponse) GetOwningClassIdList() *OwningClassIdList func init() { proto.RegisterType((*QueryParamsRequest)(nil), "ununifi.nftfactory.QueryParamsRequest") proto.RegisterType((*QueryParamsResponse)(nil), "ununifi.nftfactory.QueryParamsResponse") - proto.RegisterType((*QueryClassAttributesRequest)(nil), "ununifi.nftfactory.QueryClassAttributesRequest") - proto.RegisterType((*QueryClassAttributesResponse)(nil), "ununifi.nftfactory.QueryClassAttributesResponse") - proto.RegisterType((*QueryNFTMinterRequest)(nil), "ununifi.nftfactory.QueryNFTMinterRequest") - proto.RegisterType((*QueryNFTMinterResponse)(nil), "ununifi.nftfactory.QueryNFTMinterResponse") - proto.RegisterType((*QueryClassIdsByNameRequest)(nil), "ununifi.nftfactory.QueryClassIdsByNameRequest") - proto.RegisterType((*QueryClassIdsByNameResponse)(nil), "ununifi.nftfactory.QueryClassIdsByNameResponse") - proto.RegisterType((*QueryClassIdsByOwnerRequest)(nil), "ununifi.nftfactory.QueryClassIdsByOwnerRequest") - proto.RegisterType((*QueryClassIdsByOwnerResponse)(nil), "ununifi.nftfactory.QueryClassIdsByOwnerResponse") + proto.RegisterType((*QueryClassAuthorityMetadataRequest)(nil), "ununifi.nftfactory.QueryClassAuthorityMetadataRequest") + proto.RegisterType((*QueryClassAuthorityMetadataResponse)(nil), "ununifi.nftfactory.QueryClassAuthorityMetadataResponse") + proto.RegisterType((*QueryClassesFromCreatorRequest)(nil), "ununifi.nftfactory.QueryClassesFromCreatorRequest") + proto.RegisterType((*QueryClassesFromCreatorResponse)(nil), "ununifi.nftfactory.QueryClassesFromCreatorResponse") } func init() { proto.RegisterFile("ununifi/nftfactory/query.proto", fileDescriptor_ce869c90a3ee4b0a) } var fileDescriptor_ce869c90a3ee4b0a = []byte{ - // 654 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x95, 0x4f, 0x6f, 0xd3, 0x3e, - 0x18, 0xc7, 0x9b, 0xe9, 0xb7, 0xfc, 0x98, 0x91, 0x18, 0x98, 0x6e, 0x82, 0x30, 0x02, 0xf2, 0xc4, - 0xbf, 0x81, 0xe2, 0xa9, 0x43, 0x68, 0x82, 0x13, 0x43, 0x4c, 0xaa, 0x04, 0xdb, 0x98, 0x18, 0x07, - 0x2e, 0x51, 0xda, 0xa4, 0x99, 0xa5, 0xd6, 0xee, 0x62, 0x87, 0x51, 0x4d, 0xbd, 0xf0, 0x0a, 0x90, - 0xb8, 0x73, 0xe6, 0x00, 0x07, 0xde, 0xc5, 0x8e, 0x93, 0xb8, 0x70, 0x42, 0xa8, 0xe5, 0x85, 0xa0, - 0xd8, 0xce, 0x92, 0xa6, 0x19, 0xed, 0xa9, 0xf6, 0xf3, 0xf7, 0xd3, 0xc7, 0xcf, 0xb7, 0x05, 0x76, - 0x4c, 0x63, 0x4a, 0x5a, 0x04, 0xd3, 0x96, 0x68, 0x79, 0x4d, 0xc1, 0xa2, 0x1e, 0x3e, 0x88, 0x83, - 0xa8, 0xe7, 0x74, 0x23, 0x26, 0x18, 0x84, 0xda, 0xef, 0x64, 0x7e, 0xab, 0x1a, 0xb2, 0x90, 0x49, - 0x37, 0x4e, 0x4e, 0x2a, 0xd2, 0x5a, 0x0a, 0x19, 0x0b, 0xdb, 0x01, 0xf6, 0xba, 0x04, 0x7b, 0x94, - 0x32, 0xe1, 0x09, 0xc2, 0x28, 0xd7, 0xde, 0xe5, 0x92, 0x3e, 0xd9, 0x51, 0x05, 0xa1, 0x2a, 0x80, - 0xaf, 0x92, 0xde, 0x3b, 0x5e, 0xe4, 0x75, 0xf8, 0x6e, 0x70, 0x10, 0x07, 0x5c, 0xa0, 0x6d, 0x70, - 0x79, 0xc4, 0xca, 0xbb, 0x8c, 0xf2, 0x00, 0xae, 0x03, 0xb3, 0x2b, 0x2d, 0x57, 0x8c, 0x9b, 0xc6, - 0xdd, 0xf3, 0x35, 0xcb, 0x19, 0x47, 0x75, 0x54, 0xce, 0xc6, 0x7f, 0xc7, 0xbf, 0x6e, 0x54, 0x76, - 0x75, 0x3c, 0x5a, 0x07, 0xd7, 0x64, 0xc1, 0x67, 0x6d, 0x8f, 0xf3, 0xa7, 0x42, 0x44, 0xa4, 0x11, - 0x8b, 0x20, 0xed, 0x07, 0xaf, 0x82, 0x73, 0xcd, 0xc4, 0xe3, 0x12, 0x5f, 0x96, 0x9e, 0xdb, 0xfd, - 0x5f, 0xde, 0xeb, 0x3e, 0xa2, 0x60, 0xa9, 0x3c, 0x53, 0x33, 0x6d, 0x81, 0x8b, 0x2a, 0xd5, 0x3b, - 0xf5, 0x69, 0xba, 0xe5, 0x32, 0xba, 0x62, 0x99, 0xf9, 0xe6, 0xa8, 0x01, 0xd5, 0xc1, 0x82, 0xec, - 0xb7, 0xb5, 0xf9, 0xfa, 0x25, 0xa1, 0x22, 0x88, 0x26, 0x33, 0xc2, 0x05, 0x60, 0xd2, 0x96, 0x48, - 0x1c, 0x33, 0xd2, 0x31, 0x4b, 0x5b, 0xa2, 0xee, 0xa3, 0x55, 0xb0, 0x58, 0x2c, 0xa5, 0xa1, 0x17, - 0x81, 0xd9, 0x91, 0x16, 0x5d, 0x49, 0xdf, 0xd0, 0x13, 0x60, 0x65, 0x5f, 0xb6, 0xee, 0xf3, 0x8d, - 0xde, 0x96, 0xd7, 0x09, 0x52, 0x82, 0xeb, 0x00, 0x28, 0x02, 0xea, 0x75, 0x02, 0x9d, 0x39, 0x27, - 0x2d, 0x49, 0x14, 0x62, 0xf9, 0x19, 0xe7, 0x92, 0x75, 0xcf, 0x1d, 0x00, 0xb3, 0x6c, 0x97, 0xf8, - 0x6e, 0x9b, 0x70, 0x31, 0x71, 0x54, 0x49, 0x89, 0xba, 0xff, 0x82, 0x70, 0xa1, 0x47, 0x95, 0x19, - 0xd0, 0xda, 0x58, 0xc3, 0xed, 0x43, 0x9a, 0x0d, 0xac, 0x0a, 0x66, 0x59, 0x72, 0xd7, 0xa4, 0xea, - 0x82, 0xde, 0xe5, 0xdf, 0x33, 0x9f, 0xa4, 0x31, 0xdf, 0x80, 0x2a, 0x3b, 0xa4, 0x84, 0x86, 0x6e, - 0x3a, 0xed, 0x3c, 0xe8, 0xad, 0x32, 0xd0, 0x6d, 0x19, 0xaf, 0x0b, 0x4a, 0xd4, 0x4b, 0xac, 0x68, - 0xaa, 0x7d, 0x37, 0xc1, 0xac, 0x6c, 0x0c, 0xfb, 0xc0, 0x54, 0x3b, 0x0a, 0x6f, 0x97, 0x55, 0x1b, - 0x97, 0x83, 0x75, 0x67, 0x62, 0x9c, 0x82, 0x47, 0xe8, 0xc3, 0x8f, 0x3f, 0x9f, 0x66, 0x96, 0xa0, - 0x85, 0x4b, 0xb4, 0xa7, 0xa4, 0x00, 0xbf, 0x18, 0x60, 0xbe, 0xb0, 0x85, 0x10, 0x9f, 0xd9, 0xa0, - 0x5c, 0x30, 0xd6, 0xea, 0xf4, 0x09, 0x1a, 0xad, 0x26, 0xd1, 0x1e, 0xc0, 0x95, 0x32, 0x34, 0x35, - 0x6a, 0xf9, 0x40, 0xf8, 0x28, 0x9d, 0x7b, 0x1f, 0x7e, 0x36, 0xc0, 0xdc, 0xe9, 0xf2, 0xc2, 0x7b, - 0x67, 0xf6, 0x2c, 0x6a, 0xc5, 0x5a, 0x99, 0x26, 0x54, 0x83, 0x3d, 0x96, 0x60, 0x0f, 0x61, 0x0d, - 0x97, 0xff, 0x5e, 0xb9, 0x4a, 0x1b, 0x39, 0x2e, 0x7c, 0xa4, 0xd4, 0xd6, 0x87, 0xdf, 0x0c, 0x70, - 0x61, 0x74, 0xdd, 0xa1, 0xf3, 0xef, 0xc9, 0x14, 0x45, 0x65, 0xe1, 0xa9, 0xe3, 0xa7, 0xe1, 0x4d, - 0x19, 0xb9, 0xdb, 0xe8, 0x49, 0xa1, 0xa5, 0xd8, 0xc9, 0xb9, 0x0f, 0xbf, 0xa6, 0x6f, 0x9f, 0x2d, - 0x3e, 0x9c, 0x06, 0x20, 0xaf, 0xab, 0x49, 0x6f, 0x3f, 0xae, 0x29, 0xf4, 0x48, 0x22, 0xaf, 0x42, - 0x67, 0x22, 0xb2, 0x5e, 0x01, 0xf9, 0xd1, 0xdf, 0x78, 0x7e, 0x3c, 0xb0, 0x8d, 0x93, 0x81, 0x6d, - 0xfc, 0x1e, 0xd8, 0xc6, 0xc7, 0xa1, 0x5d, 0x39, 0x19, 0xda, 0x95, 0x9f, 0x43, 0xbb, 0xf2, 0xf6, - 0x7e, 0x48, 0xc4, 0x7e, 0xdc, 0x70, 0x9a, 0xac, 0x83, 0xf7, 0xe8, 0x1e, 0x25, 0x9b, 0x04, 0x37, - 0xf7, 0x3d, 0x42, 0xf1, 0xfb, 0x7c, 0x6d, 0xd1, 0xeb, 0x06, 0xbc, 0x61, 0xca, 0xbf, 0x9a, 0xb5, - 0xbf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x33, 0x6d, 0xb4, 0x4d, 0xf9, 0x06, 0x00, 0x00, + // 544 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0xd1, 0x6a, 0x13, 0x4d, + 0x18, 0xcd, 0xf4, 0xef, 0x1f, 0x75, 0x04, 0xc5, 0x69, 0x91, 0xb8, 0x94, 0x4d, 0x9d, 0x82, 0x8a, + 0x9a, 0x0c, 0xa4, 0xa2, 0xd2, 0x3b, 0x53, 0x2c, 0x88, 0x68, 0xed, 0x42, 0x6f, 0xbc, 0x91, 0xc9, + 0x3a, 0xd9, 0x2c, 0x64, 0x67, 0xb6, 0x3b, 0xb3, 0xe0, 0x52, 0x73, 0xa3, 0x2f, 0x20, 0xf8, 0x04, + 0xe2, 0x53, 0xf8, 0x06, 0xbd, 0x2c, 0x78, 0xe3, 0x85, 0x04, 0x49, 0x7c, 0x82, 0x3c, 0x81, 0xec, + 0xcc, 0x6c, 0xa3, 0xcd, 0x26, 0x52, 0xef, 0x26, 0x7b, 0xce, 0x9c, 0xef, 0x9c, 0x6f, 0x0e, 0x81, + 0x6e, 0xca, 0x53, 0x1e, 0x76, 0x43, 0xc2, 0xbb, 0xaa, 0x4b, 0x7d, 0x25, 0x92, 0x8c, 0x1c, 0xa4, + 0x2c, 0xc9, 0x9a, 0x71, 0x22, 0x94, 0x40, 0xc8, 0xe2, 0xcd, 0x29, 0xee, 0xac, 0x06, 0x22, 0x10, + 0x1a, 0x26, 0xf9, 0xc9, 0x30, 0x9d, 0xb5, 0x40, 0x88, 0xa0, 0xcf, 0x08, 0x8d, 0x43, 0x42, 0x39, + 0x17, 0x8a, 0xaa, 0x50, 0x70, 0x69, 0xd1, 0x8d, 0x92, 0x39, 0xd3, 0xa3, 0x21, 0xe1, 0x55, 0x88, + 0xf6, 0xf2, 0xd9, 0x2f, 0x68, 0x42, 0x23, 0xe9, 0xb1, 0x83, 0x94, 0x49, 0x85, 0x77, 0xe1, 0xca, + 0x1f, 0x5f, 0x65, 0x2c, 0xb8, 0x64, 0xe8, 0x21, 0xac, 0xc6, 0xfa, 0x4b, 0x0d, 0xac, 0x83, 0x5b, + 0x17, 0x5b, 0x4e, 0x73, 0xd6, 0x6a, 0xd3, 0xdc, 0x69, 0x2f, 0x1f, 0x0d, 0xeb, 0x15, 0xcf, 0xf2, + 0xf1, 0x7b, 0x00, 0xb1, 0x56, 0xdc, 0xee, 0x53, 0x29, 0x1f, 0xa5, 0xaa, 0x27, 0x92, 0x50, 0x65, + 0xcf, 0x98, 0xa2, 0xaf, 0xa9, 0xa2, 0x76, 0x2e, 0xba, 0x0b, 0xcf, 0xf9, 0x09, 0xa3, 0x4a, 0x24, + 0x7a, 0xc2, 0x85, 0x36, 0x9a, 0x0c, 0xeb, 0x97, 0x32, 0x1a, 0xf5, 0xb7, 0xb0, 0x05, 0xb0, 0x57, + 0x50, 0x10, 0x81, 0xe7, 0x65, 0xda, 0xf1, 0x73, 0xc5, 0xda, 0x92, 0xa6, 0xaf, 0x4c, 0x86, 0xf5, + 0xcb, 0x86, 0x5e, 0x20, 0xd8, 0x3b, 0x21, 0xe1, 0xcf, 0x00, 0x6e, 0x2c, 0x74, 0x61, 0x73, 0xbe, + 0x85, 0x88, 0x16, 0xe0, 0xab, 0xc8, 0xa2, 0x36, 0xf3, 0xed, 0xb2, 0xcc, 0xe5, 0x7a, 0xed, 0xeb, + 0xf9, 0x0e, 0x26, 0xc3, 0xfa, 0x35, 0x63, 0x69, 0x56, 0x13, 0x7b, 0x57, 0xe8, 0xe9, 0x5b, 0xf8, + 0x39, 0x74, 0xa7, 0x26, 0x99, 0xdc, 0x49, 0x44, 0xb4, 0x6d, 0x12, 0xff, 0xd3, 0x9a, 0xf0, 0x2e, + 0xac, 0xcf, 0xd5, 0xb3, 0x81, 0x73, 0x41, 0x83, 0xd6, 0xc0, 0xfa, 0x7f, 0xa7, 0x04, 0x0d, 0x90, + 0x0b, 0x9a, 0x53, 0xeb, 0xd3, 0x32, 0xfc, 0x5f, 0x2b, 0xa2, 0x01, 0xac, 0x9a, 0xe7, 0x46, 0x37, + 0xca, 0xd6, 0x32, 0xdb, 0x2c, 0xe7, 0xe6, 0x5f, 0x79, 0xc6, 0x12, 0xc6, 0xef, 0xbe, 0xfe, 0xfc, + 0xb8, 0xb4, 0x86, 0x1c, 0x52, 0x52, 0x63, 0xd3, 0x2a, 0xf4, 0x1d, 0xc0, 0xab, 0xe5, 0xab, 0x47, + 0xf7, 0xe7, 0xce, 0x59, 0xd8, 0x40, 0xe7, 0xc1, 0x99, 0xef, 0x59, 0xbf, 0x7b, 0xda, 0xef, 0x53, + 0xf4, 0xa4, 0xcc, 0xaf, 0xde, 0x1c, 0x29, 0x7e, 0x1d, 0xda, 0x97, 0x19, 0x90, 0xc3, 0xa2, 0x9a, + 0x03, 0x72, 0xd2, 0x83, 0x46, 0x51, 0x0e, 0xf4, 0x05, 0x40, 0x34, 0xfb, 0x68, 0xa8, 0xb5, 0xd8, + 0x62, 0x59, 0x63, 0x9c, 0xcd, 0x33, 0xdd, 0xb1, 0x91, 0xb6, 0x74, 0xa4, 0x7b, 0xa8, 0x35, 0x37, + 0x12, 0x93, 0x8d, 0x6e, 0x22, 0xa2, 0x86, 0x0d, 0x34, 0x4d, 0xd6, 0x7e, 0x7c, 0x34, 0x72, 0xc1, + 0xf1, 0xc8, 0x05, 0x3f, 0x46, 0x2e, 0xf8, 0x30, 0x76, 0x2b, 0xc7, 0x63, 0xb7, 0xf2, 0x6d, 0xec, + 0x56, 0x5e, 0xde, 0x09, 0x42, 0xd5, 0x4b, 0x3b, 0x4d, 0x5f, 0x44, 0x64, 0x9f, 0xef, 0xf3, 0x70, + 0x27, 0x24, 0x7e, 0x8f, 0x86, 0x9c, 0xbc, 0xf9, 0x5d, 0x5f, 0x65, 0x31, 0x93, 0x9d, 0xaa, 0xfe, + 0x97, 0xda, 0xfc, 0x15, 0x00, 0x00, 0xff, 0xff, 0xdc, 0x0a, 0xef, 0x26, 0x34, 0x05, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -542,10 +358,8 @@ const _ = grpc.SupportPackageIsVersion4 // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type QueryClient interface { Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) - ClassAttributes(ctx context.Context, in *QueryClassAttributesRequest, opts ...grpc.CallOption) (*QueryClassAttributesResponse, error) - NFTMinter(ctx context.Context, in *QueryNFTMinterRequest, opts ...grpc.CallOption) (*QueryNFTMinterResponse, error) - ClassIdsByName(ctx context.Context, in *QueryClassIdsByNameRequest, opts ...grpc.CallOption) (*QueryClassIdsByNameResponse, error) - ClassIdsByOwner(ctx context.Context, in *QueryClassIdsByOwnerRequest, opts ...grpc.CallOption) (*QueryClassIdsByOwnerResponse, error) + ClassAuthorityMetadata(ctx context.Context, in *QueryClassAuthorityMetadataRequest, opts ...grpc.CallOption) (*QueryClassAuthorityMetadataResponse, error) + ClassesFromCreator(ctx context.Context, in *QueryClassesFromCreatorRequest, opts ...grpc.CallOption) (*QueryClassesFromCreatorResponse, error) } type queryClient struct { @@ -565,36 +379,18 @@ func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts . return out, nil } -func (c *queryClient) ClassAttributes(ctx context.Context, in *QueryClassAttributesRequest, opts ...grpc.CallOption) (*QueryClassAttributesResponse, error) { - out := new(QueryClassAttributesResponse) - err := c.cc.Invoke(ctx, "/ununifi.nftfactory.Query/ClassAttributes", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) NFTMinter(ctx context.Context, in *QueryNFTMinterRequest, opts ...grpc.CallOption) (*QueryNFTMinterResponse, error) { - out := new(QueryNFTMinterResponse) - err := c.cc.Invoke(ctx, "/ununifi.nftfactory.Query/NFTMinter", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) ClassIdsByName(ctx context.Context, in *QueryClassIdsByNameRequest, opts ...grpc.CallOption) (*QueryClassIdsByNameResponse, error) { - out := new(QueryClassIdsByNameResponse) - err := c.cc.Invoke(ctx, "/ununifi.nftfactory.Query/ClassIdsByName", in, out, opts...) +func (c *queryClient) ClassAuthorityMetadata(ctx context.Context, in *QueryClassAuthorityMetadataRequest, opts ...grpc.CallOption) (*QueryClassAuthorityMetadataResponse, error) { + out := new(QueryClassAuthorityMetadataResponse) + err := c.cc.Invoke(ctx, "/ununifi.nftfactory.Query/ClassAuthorityMetadata", in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *queryClient) ClassIdsByOwner(ctx context.Context, in *QueryClassIdsByOwnerRequest, opts ...grpc.CallOption) (*QueryClassIdsByOwnerResponse, error) { - out := new(QueryClassIdsByOwnerResponse) - err := c.cc.Invoke(ctx, "/ununifi.nftfactory.Query/ClassIdsByOwner", in, out, opts...) +func (c *queryClient) ClassesFromCreator(ctx context.Context, in *QueryClassesFromCreatorRequest, opts ...grpc.CallOption) (*QueryClassesFromCreatorResponse, error) { + out := new(QueryClassesFromCreatorResponse) + err := c.cc.Invoke(ctx, "/ununifi.nftfactory.Query/ClassesFromCreator", in, out, opts...) if err != nil { return nil, err } @@ -604,10 +400,8 @@ func (c *queryClient) ClassIdsByOwner(ctx context.Context, in *QueryClassIdsByOw // QueryServer is the server API for Query service. type QueryServer interface { Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) - ClassAttributes(context.Context, *QueryClassAttributesRequest) (*QueryClassAttributesResponse, error) - NFTMinter(context.Context, *QueryNFTMinterRequest) (*QueryNFTMinterResponse, error) - ClassIdsByName(context.Context, *QueryClassIdsByNameRequest) (*QueryClassIdsByNameResponse, error) - ClassIdsByOwner(context.Context, *QueryClassIdsByOwnerRequest) (*QueryClassIdsByOwnerResponse, error) + ClassAuthorityMetadata(context.Context, *QueryClassAuthorityMetadataRequest) (*QueryClassAuthorityMetadataResponse, error) + ClassesFromCreator(context.Context, *QueryClassesFromCreatorRequest) (*QueryClassesFromCreatorResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -617,17 +411,11 @@ type UnimplementedQueryServer struct { func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") } -func (*UnimplementedQueryServer) ClassAttributes(ctx context.Context, req *QueryClassAttributesRequest) (*QueryClassAttributesResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ClassAttributes not implemented") +func (*UnimplementedQueryServer) ClassAuthorityMetadata(ctx context.Context, req *QueryClassAuthorityMetadataRequest) (*QueryClassAuthorityMetadataResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ClassAuthorityMetadata not implemented") } -func (*UnimplementedQueryServer) NFTMinter(ctx context.Context, req *QueryNFTMinterRequest) (*QueryNFTMinterResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method NFTMinter not implemented") -} -func (*UnimplementedQueryServer) ClassIdsByName(ctx context.Context, req *QueryClassIdsByNameRequest) (*QueryClassIdsByNameResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ClassIdsByName not implemented") -} -func (*UnimplementedQueryServer) ClassIdsByOwner(ctx context.Context, req *QueryClassIdsByOwnerRequest) (*QueryClassIdsByOwnerResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ClassIdsByOwner not implemented") +func (*UnimplementedQueryServer) ClassesFromCreator(ctx context.Context, req *QueryClassesFromCreatorRequest) (*QueryClassesFromCreatorResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ClassesFromCreator not implemented") } func RegisterQueryServer(s grpc1.Server, srv QueryServer) { @@ -652,74 +440,38 @@ func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interf return interceptor(ctx, in, info, handler) } -func _Query_ClassAttributes_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryClassAttributesRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).ClassAttributes(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ununifi.nftfactory.Query/ClassAttributes", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).ClassAttributes(ctx, req.(*QueryClassAttributesRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_NFTMinter_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryNFTMinterRequest) +func _Query_ClassAuthorityMetadata_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryClassAuthorityMetadataRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(QueryServer).NFTMinter(ctx, in) + return srv.(QueryServer).ClassAuthorityMetadata(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/ununifi.nftfactory.Query/NFTMinter", + FullMethod: "/ununifi.nftfactory.Query/ClassAuthorityMetadata", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).NFTMinter(ctx, req.(*QueryNFTMinterRequest)) + return srv.(QueryServer).ClassAuthorityMetadata(ctx, req.(*QueryClassAuthorityMetadataRequest)) } return interceptor(ctx, in, info, handler) } -func _Query_ClassIdsByName_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryClassIdsByNameRequest) +func _Query_ClassesFromCreator_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryClassesFromCreatorRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(QueryServer).ClassIdsByName(ctx, in) + return srv.(QueryServer).ClassesFromCreator(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/ununifi.nftfactory.Query/ClassIdsByName", + FullMethod: "/ununifi.nftfactory.Query/ClassesFromCreator", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).ClassIdsByName(ctx, req.(*QueryClassIdsByNameRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_ClassIdsByOwner_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryClassIdsByOwnerRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).ClassIdsByOwner(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ununifi.nftfactory.Query/ClassIdsByOwner", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).ClassIdsByOwner(ctx, req.(*QueryClassIdsByOwnerRequest)) + return srv.(QueryServer).ClassesFromCreator(ctx, req.(*QueryClassesFromCreatorRequest)) } return interceptor(ctx, in, info, handler) } @@ -733,20 +485,12 @@ var _Query_serviceDesc = grpc.ServiceDesc{ Handler: _Query_Params_Handler, }, { - MethodName: "ClassAttributes", - Handler: _Query_ClassAttributes_Handler, + MethodName: "ClassAuthorityMetadata", + Handler: _Query_ClassAuthorityMetadata_Handler, }, { - MethodName: "NFTMinter", - Handler: _Query_NFTMinter_Handler, - }, - { - MethodName: "ClassIdsByName", - Handler: _Query_ClassIdsByName_Handler, - }, - { - MethodName: "ClassIdsByOwner", - Handler: _Query_ClassIdsByOwner_Handler, + MethodName: "ClassesFromCreator", + Handler: _Query_ClassesFromCreator_Handler, }, }, Streams: []grpc.StreamDesc{}, @@ -809,72 +553,7 @@ func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *QueryClassAttributesRequest) 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 *QueryClassAttributesRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryClassAttributesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.ClassId) > 0 { - i -= len(m.ClassId) - copy(dAtA[i:], m.ClassId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ClassId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryClassAttributesResponse) 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 *QueryClassAttributesResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryClassAttributesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.ClassAttributes != nil { - { - size, err := m.ClassAttributes.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryNFTMinterRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryClassAuthorityMetadataRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -884,34 +563,34 @@ func (m *QueryNFTMinterRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryNFTMinterRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryClassAuthorityMetadataRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryNFTMinterRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryClassAuthorityMetadataRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.NftId) > 0 { - i -= len(m.NftId) - copy(dAtA[i:], m.NftId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.NftId))) + if len(m.Subclass) > 0 { + i -= len(m.Subclass) + copy(dAtA[i:], m.Subclass) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Subclass))) i-- dAtA[i] = 0x12 } - if len(m.ClassId) > 0 { - i -= len(m.ClassId) - copy(dAtA[i:], m.ClassId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ClassId))) + if len(m.Creator) > 0 { + i -= len(m.Creator) + copy(dAtA[i:], m.Creator) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Creator))) i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } -func (m *QueryNFTMinterResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryClassAuthorityMetadataResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -921,92 +600,30 @@ func (m *QueryNFTMinterResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryNFTMinterResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryClassAuthorityMetadataResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryNFTMinterResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryClassAuthorityMetadataResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.Minter) > 0 { - i -= len(m.Minter) - copy(dAtA[i:], m.Minter) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Minter))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryClassIdsByNameRequest) 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 *QueryClassIdsByNameRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryClassIdsByNameRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.ClassName) > 0 { - i -= len(m.ClassName) - copy(dAtA[i:], m.ClassName) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ClassName))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryClassIdsByNameResponse) 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 *QueryClassIdsByNameResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryClassIdsByNameResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.ClassNameIdList != nil { - { - size, err := m.ClassNameIdList.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) + { + size, err := m.AuthorityMetadata.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err } - i-- - dAtA[i] = 0xa + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0xa return len(dAtA) - i, nil } -func (m *QueryClassIdsByOwnerRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryClassesFromCreatorRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1016,27 +633,27 @@ func (m *QueryClassIdsByOwnerRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryClassIdsByOwnerRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryClassesFromCreatorRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryClassIdsByOwnerRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryClassesFromCreatorRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.Owner) > 0 { - i -= len(m.Owner) - copy(dAtA[i:], m.Owner) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Owner))) + if len(m.Creator) > 0 { + i -= len(m.Creator) + copy(dAtA[i:], m.Creator) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Creator))) i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } -func (m *QueryClassIdsByOwnerResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryClassesFromCreatorResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1046,27 +663,24 @@ func (m *QueryClassIdsByOwnerResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryClassIdsByOwnerResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryClassesFromCreatorResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryClassIdsByOwnerResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryClassesFromCreatorResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.OwningClassIdList != nil { - { - size, err := m.OwningClassIdList.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) + if len(m.Classes) > 0 { + for iNdEx := len(m.Classes) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Classes[iNdEx]) + copy(dAtA[i:], m.Classes[iNdEx]) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Classes[iNdEx]))) + i-- + dAtA[i] = 0xa } - i-- - dAtA[i] = 0xa } return len(dAtA) - i, nil } @@ -1101,255 +715,70 @@ func (m *QueryParamsResponse) Size() (n int) { n += 1 + l + sovQuery(uint64(l)) return n } - -func (m *QueryClassAttributesRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ClassId) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryClassAttributesResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ClassAttributes != nil { - l = m.ClassAttributes.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryNFTMinterRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ClassId) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.NftId) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryNFTMinterResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Minter) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryClassIdsByNameRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ClassName) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryClassIdsByNameResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ClassNameIdList != nil { - l = m.ClassNameIdList.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryClassIdsByOwnerRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Owner) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryClassIdsByOwnerResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.OwningClassIdList != nil { - l = m.OwningClassIdList.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func sovQuery(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozQuery(x uint64) (n int) { - return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryParamsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryParamsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } + +func (m *QueryClassAuthorityMetadataRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Creator) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) } + l = len(m.Subclass) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} - if iNdEx > l { - return io.ErrUnexpectedEOF +func (m *QueryClassAuthorityMetadataResponse) Size() (n int) { + if m == nil { + return 0 } - return nil + var l int + _ = l + l = m.AuthorityMetadata.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryClassesFromCreatorRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Creator) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryClassesFromCreatorResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Classes) > 0 { + for _, s := range m.Classes { + l = len(s) + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func sovQuery(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozQuery(x uint64) (n int) { + return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (m *QueryClassAttributesRequest) Unmarshal(dAtA []byte) error { +func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1372,44 +801,12 @@ func (m *QueryClassAttributesRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryClassAttributesRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryParamsRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryClassAttributesRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ClassId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -1431,7 +828,7 @@ func (m *QueryClassAttributesRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryClassAttributesResponse) Unmarshal(dAtA []byte) error { +func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1454,15 +851,15 @@ func (m *QueryClassAttributesResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryClassAttributesResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryParamsResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryClassAttributesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClassAttributes", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -1489,10 +886,7 @@ func (m *QueryClassAttributesResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.ClassAttributes == nil { - m.ClassAttributes = &ClassAttributes{} - } - if err := m.ClassAttributes.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -1517,7 +911,7 @@ func (m *QueryClassAttributesResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryNFTMinterRequest) Unmarshal(dAtA []byte) error { +func (m *QueryClassAuthorityMetadataRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1540,15 +934,15 @@ func (m *QueryNFTMinterRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryNFTMinterRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryClassAuthorityMetadataRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryNFTMinterRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryClassAuthorityMetadataRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1576,175 +970,11 @@ func (m *QueryNFTMinterRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ClassId = string(dAtA[iNdEx:postIndex]) + m.Creator = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.NftId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryNFTMinterResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryNFTMinterResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryNFTMinterResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Minter", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Minter = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryClassIdsByNameRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryClassIdsByNameRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryClassIdsByNameRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClassName", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Subclass", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1772,7 +1002,7 @@ func (m *QueryClassIdsByNameRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ClassName = string(dAtA[iNdEx:postIndex]) + m.Subclass = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -1795,7 +1025,7 @@ func (m *QueryClassIdsByNameRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryClassIdsByNameResponse) Unmarshal(dAtA []byte) error { +func (m *QueryClassAuthorityMetadataResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1818,15 +1048,15 @@ func (m *QueryClassIdsByNameResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryClassIdsByNameResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryClassAuthorityMetadataResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryClassIdsByNameResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryClassAuthorityMetadataResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClassNameIdList", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field AuthorityMetadata", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -1853,10 +1083,7 @@ func (m *QueryClassIdsByNameResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.ClassNameIdList == nil { - m.ClassNameIdList = &ClassNameIdList{} - } - if err := m.ClassNameIdList.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.AuthorityMetadata.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -1881,7 +1108,7 @@ func (m *QueryClassIdsByNameResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryClassIdsByOwnerRequest) Unmarshal(dAtA []byte) error { +func (m *QueryClassesFromCreatorRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1904,15 +1131,15 @@ func (m *QueryClassIdsByOwnerRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryClassIdsByOwnerRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryClassesFromCreatorRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryClassIdsByOwnerRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryClassesFromCreatorRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1940,7 +1167,7 @@ func (m *QueryClassIdsByOwnerRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Owner = string(dAtA[iNdEx:postIndex]) + m.Creator = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -1963,7 +1190,7 @@ func (m *QueryClassIdsByOwnerRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryClassIdsByOwnerResponse) Unmarshal(dAtA []byte) error { +func (m *QueryClassesFromCreatorResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1986,17 +1213,17 @@ func (m *QueryClassIdsByOwnerResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryClassIdsByOwnerResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryClassesFromCreatorResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryClassIdsByOwnerResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryClassesFromCreatorResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OwningClassIdList", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Classes", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -2006,27 +1233,23 @@ func (m *QueryClassIdsByOwnerResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - if m.OwningClassIdList == nil { - m.OwningClassIdList = &OwningClassIdList{} - } - if err := m.OwningClassIdList.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.Classes = append(m.Classes, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex default: iNdEx = preIndex diff --git a/x/nftfactory/types/query.pb.gw.go b/x/nftfactory/types/query.pb.gw.go index 0e0dfcd2a..07254967e 100644 --- a/x/nftfactory/types/query.pb.gw.go +++ b/x/nftfactory/types/query.pb.gw.go @@ -51,8 +51,8 @@ func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshal } -func request_Query_ClassAttributes_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryClassAttributesRequest +func request_Query_ClassAuthorityMetadata_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryClassAuthorityMetadataRequest var metadata runtime.ServerMetadata var ( @@ -62,89 +62,35 @@ func request_Query_ClassAttributes_0(ctx context.Context, marshaler runtime.Mars _ = err ) - val, ok = pathParams["class_id"] + val, ok = pathParams["creator"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "class_id") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "creator") } - protoReq.ClassId, err = runtime.String(val) + protoReq.Creator, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "class_id", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "creator", err) } - msg, err := client.ClassAttributes(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_ClassAttributes_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryClassAttributesRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["class_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "class_id") - } - - protoReq.ClassId, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "class_id", err) - } - - msg, err := server.ClassAttributes(ctx, &protoReq) - return msg, metadata, err - -} - -func request_Query_NFTMinter_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryNFTMinterRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["class_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "class_id") - } - - protoReq.ClassId, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "class_id", err) - } - - val, ok = pathParams["nft_id"] + val, ok = pathParams["subclass"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "nft_id") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "subclass") } - protoReq.NftId, err = runtime.String(val) + protoReq.Subclass, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "nft_id", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "subclass", err) } - msg, err := client.NFTMinter(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.ClassAuthorityMetadata(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Query_NFTMinter_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryNFTMinterRequest +func local_request_Query_ClassAuthorityMetadata_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryClassAuthorityMetadataRequest var metadata runtime.ServerMetadata var ( @@ -154,89 +100,35 @@ func local_request_Query_NFTMinter_0(ctx context.Context, marshaler runtime.Mars _ = err ) - val, ok = pathParams["class_id"] + val, ok = pathParams["creator"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "class_id") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "creator") } - protoReq.ClassId, err = runtime.String(val) + protoReq.Creator, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "class_id", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "creator", err) } - val, ok = pathParams["nft_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "nft_id") - } - - protoReq.NftId, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "nft_id", err) - } - - msg, err := server.NFTMinter(ctx, &protoReq) - return msg, metadata, err - -} - -func request_Query_ClassIdsByName_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryClassIdsByNameRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["class_name"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "class_name") - } - - protoReq.ClassName, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "class_name", err) - } - - msg, err := client.ClassIdsByName(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_ClassIdsByName_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryClassIdsByNameRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["class_name"] + val, ok = pathParams["subclass"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "class_name") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "subclass") } - protoReq.ClassName, err = runtime.String(val) + protoReq.Subclass, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "class_name", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "subclass", err) } - msg, err := server.ClassIdsByName(ctx, &protoReq) + msg, err := server.ClassAuthorityMetadata(ctx, &protoReq) return msg, metadata, err } -func request_Query_ClassIdsByOwner_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryClassIdsByOwnerRequest +func request_Query_ClassesFromCreator_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryClassesFromCreatorRequest var metadata runtime.ServerMetadata var ( @@ -246,24 +138,24 @@ func request_Query_ClassIdsByOwner_0(ctx context.Context, marshaler runtime.Mars _ = err ) - val, ok = pathParams["owner"] + val, ok = pathParams["creator"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "owner") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "creator") } - protoReq.Owner, err = runtime.String(val) + protoReq.Creator, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "owner", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "creator", err) } - msg, err := client.ClassIdsByOwner(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.ClassesFromCreator(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Query_ClassIdsByOwner_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryClassIdsByOwnerRequest +func local_request_Query_ClassesFromCreator_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryClassesFromCreatorRequest var metadata runtime.ServerMetadata var ( @@ -273,18 +165,18 @@ func local_request_Query_ClassIdsByOwner_0(ctx context.Context, marshaler runtim _ = err ) - val, ok = pathParams["owner"] + val, ok = pathParams["creator"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "owner") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "creator") } - protoReq.Owner, err = runtime.String(val) + protoReq.Creator, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "owner", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "creator", err) } - msg, err := server.ClassIdsByOwner(ctx, &protoReq) + msg, err := server.ClassesFromCreator(ctx, &protoReq) return msg, metadata, err } @@ -318,30 +210,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) - mux.Handle("GET", pattern_Query_ClassAttributes_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_ClassAttributes_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_ClassAttributes_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_NFTMinter_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_ClassAuthorityMetadata_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -352,7 +221,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_NFTMinter_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_ClassAuthorityMetadata_0(rctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -360,11 +229,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_NFTMinter_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_ClassAuthorityMetadata_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_ClassIdsByName_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_ClassesFromCreator_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -375,7 +244,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_ClassIdsByName_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_ClassesFromCreator_0(rctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -383,30 +252,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_ClassIdsByName_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_ClassIdsByOwner_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_ClassIdsByOwner_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_ClassIdsByOwner_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_ClassesFromCreator_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -471,27 +317,7 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) - mux.Handle("GET", pattern_Query_ClassAttributes_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_ClassAttributes_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_ClassAttributes_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_NFTMinter_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_ClassAuthorityMetadata_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) @@ -500,18 +326,18 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_NFTMinter_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_ClassAuthorityMetadata_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Query_NFTMinter_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_ClassAuthorityMetadata_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_ClassIdsByName_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_ClassesFromCreator_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) @@ -520,34 +346,14 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_ClassIdsByName_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_ClassesFromCreator_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Query_ClassIdsByName_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_ClassIdsByOwner_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_ClassIdsByOwner_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_ClassIdsByOwner_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_ClassesFromCreator_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -557,23 +363,15 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie var ( pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"ununifi", "nftfactory", "params"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_ClassAttributes_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"ununifi", "nftfactory", "class_owner", "class_id"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_ClassAuthorityMetadata_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 1, 0, 4, 1, 5, 5, 2, 6}, []string{"ununifi", "nftfactory", "class", "factory", "creator", "subclass", "authority-metadata"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_NFTMinter_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4}, []string{"ununifi", "nftfactory", "nft_minter", "class_id", "nft_id"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_ClassIdsByName_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"ununifi", "nftfactory", "class_ids_by_name", "class_name"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_ClassIdsByOwner_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"ununifi", "nftfactory", "class_ids_by_owner", "owner"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_ClassesFromCreator_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"ununifi", "nftfactory", "classes-from-creator", "creator"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( forward_Query_Params_0 = runtime.ForwardResponseMessage - forward_Query_ClassAttributes_0 = runtime.ForwardResponseMessage - - forward_Query_NFTMinter_0 = runtime.ForwardResponseMessage - - forward_Query_ClassIdsByName_0 = runtime.ForwardResponseMessage + forward_Query_ClassAuthorityMetadata_0 = runtime.ForwardResponseMessage - forward_Query_ClassIdsByOwner_0 = runtime.ForwardResponseMessage + forward_Query_ClassesFromCreator_0 = runtime.ForwardResponseMessage ) diff --git a/x/nftfactory/types/tx.pb.go b/x/nftfactory/types/tx.pb.go index cb16420cb..fa0be7441 100644 --- a/x/nftfactory/types/tx.pb.go +++ b/x/nftfactory/types/tx.pb.go @@ -6,6 +6,7 @@ package types import ( context "context" fmt "fmt" + types "github.com/UnUniFi/chain/x/nft/types" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" @@ -29,14 +30,14 @@ var _ = math.Inf const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type MsgCreateClass struct { - Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` - BaseTokenUri string `protobuf:"bytes,3,opt,name=base_token_uri,json=baseTokenUri,proto3" json:"base_token_uri,omitempty"` - TokenSupplyCap uint64 `protobuf:"varint,4,opt,name=token_supply_cap,json=tokenSupplyCap,proto3" json:"token_supply_cap,omitempty"` - MintingPermission MintingPermission `protobuf:"varint,5,opt,name=minting_permission,json=mintingPermission,proto3,enum=ununifi.nftfactory.MintingPermission" json:"minting_permission,omitempty"` - Symbol string `protobuf:"bytes,7,opt,name=symbol,proto3" json:"symbol,omitempty"` - Description string `protobuf:"bytes,8,opt,name=description,proto3" json:"description,omitempty"` - ClassUri string `protobuf:"bytes,9,opt,name=class_uri,json=classUri,proto3" json:"class_uri,omitempty"` + Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` + Id string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"` + Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` + Symbol string `protobuf:"bytes,4,opt,name=symbol,proto3" json:"symbol,omitempty"` + Description string `protobuf:"bytes,5,opt,name=description,proto3" json:"description,omitempty"` + Uri string `protobuf:"bytes,6,opt,name=uri,proto3" json:"uri,omitempty"` + UriHash string `protobuf:"bytes,7,opt,name=uri_hash,json=uriHash,proto3" json:"uri_hash,omitempty"` + Data *types.ClassData `protobuf:"bytes,8,opt,name=data,proto3" json:"data,omitempty"` } func (m *MsgCreateClass) Reset() { *m = MsgCreateClass{} } @@ -79,53 +80,53 @@ func (m *MsgCreateClass) GetSender() string { return "" } -func (m *MsgCreateClass) GetName() string { +func (m *MsgCreateClass) GetId() string { if m != nil { - return m.Name + return m.Id } return "" } -func (m *MsgCreateClass) GetBaseTokenUri() string { +func (m *MsgCreateClass) GetName() string { if m != nil { - return m.BaseTokenUri + return m.Name } return "" } -func (m *MsgCreateClass) GetTokenSupplyCap() uint64 { +func (m *MsgCreateClass) GetSymbol() string { if m != nil { - return m.TokenSupplyCap + return m.Symbol } - return 0 + return "" } -func (m *MsgCreateClass) GetMintingPermission() MintingPermission { +func (m *MsgCreateClass) GetDescription() string { if m != nil { - return m.MintingPermission + return m.Description } - return MintingPermission_OnlyOwner + return "" } -func (m *MsgCreateClass) GetSymbol() string { +func (m *MsgCreateClass) GetUri() string { if m != nil { - return m.Symbol + return m.Uri } return "" } -func (m *MsgCreateClass) GetDescription() string { +func (m *MsgCreateClass) GetUriHash() string { if m != nil { - return m.Description + return m.UriHash } return "" } -func (m *MsgCreateClass) GetClassUri() string { +func (m *MsgCreateClass) GetData() *types.ClassData { if m != nil { - return m.ClassUri + return m.Data } - return "" + return nil } type MsgCreateClassResponse struct { @@ -164,24 +165,29 @@ func (m *MsgCreateClassResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgCreateClassResponse proto.InternalMessageInfo -type MsgSendClassOwnership struct { - Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` - ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` - Recipient string `protobuf:"bytes,3,opt,name=recipient,proto3" json:"recipient,omitempty"` -} - -func (m *MsgSendClassOwnership) Reset() { *m = MsgSendClassOwnership{} } -func (m *MsgSendClassOwnership) String() string { return proto.CompactTextString(m) } -func (*MsgSendClassOwnership) ProtoMessage() {} -func (*MsgSendClassOwnership) Descriptor() ([]byte, []int) { +type MsgUpdateClass struct { + Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` + ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` + Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` + Symbol string `protobuf:"bytes,4,opt,name=symbol,proto3" json:"symbol,omitempty"` + Description string `protobuf:"bytes,5,opt,name=description,proto3" json:"description,omitempty"` + Uri string `protobuf:"bytes,6,opt,name=uri,proto3" json:"uri,omitempty"` + UriHash string `protobuf:"bytes,7,opt,name=uri_hash,json=uriHash,proto3" json:"uri_hash,omitempty"` + Data *types.ClassData `protobuf:"bytes,8,opt,name=data,proto3" json:"data,omitempty"` +} + +func (m *MsgUpdateClass) Reset() { *m = MsgUpdateClass{} } +func (m *MsgUpdateClass) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateClass) ProtoMessage() {} +func (*MsgUpdateClass) Descriptor() ([]byte, []int) { return fileDescriptor_47805922275bdc64, []int{2} } -func (m *MsgSendClassOwnership) XXX_Unmarshal(b []byte) error { +func (m *MsgUpdateClass) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgSendClassOwnership) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgUpdateClass) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgSendClassOwnership.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgUpdateClass.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -191,246 +197,89 @@ func (m *MsgSendClassOwnership) XXX_Marshal(b []byte, deterministic bool) ([]byt return b[:n], nil } } -func (m *MsgSendClassOwnership) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgSendClassOwnership.Merge(m, src) +func (m *MsgUpdateClass) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateClass.Merge(m, src) } -func (m *MsgSendClassOwnership) XXX_Size() int { +func (m *MsgUpdateClass) XXX_Size() int { return m.Size() } -func (m *MsgSendClassOwnership) XXX_DiscardUnknown() { - xxx_messageInfo_MsgSendClassOwnership.DiscardUnknown(m) +func (m *MsgUpdateClass) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateClass.DiscardUnknown(m) } -var xxx_messageInfo_MsgSendClassOwnership proto.InternalMessageInfo +var xxx_messageInfo_MsgUpdateClass proto.InternalMessageInfo -func (m *MsgSendClassOwnership) GetSender() string { +func (m *MsgUpdateClass) GetSender() string { if m != nil { return m.Sender } return "" } -func (m *MsgSendClassOwnership) GetClassId() string { +func (m *MsgUpdateClass) GetClassId() string { if m != nil { return m.ClassId } return "" } -func (m *MsgSendClassOwnership) GetRecipient() string { - if m != nil { - return m.Recipient - } - return "" -} - -type MsgSendClassOwnershipResponse struct { -} - -func (m *MsgSendClassOwnershipResponse) Reset() { *m = MsgSendClassOwnershipResponse{} } -func (m *MsgSendClassOwnershipResponse) String() string { return proto.CompactTextString(m) } -func (*MsgSendClassOwnershipResponse) ProtoMessage() {} -func (*MsgSendClassOwnershipResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_47805922275bdc64, []int{3} -} -func (m *MsgSendClassOwnershipResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgSendClassOwnershipResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgSendClassOwnershipResponse.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 *MsgSendClassOwnershipResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgSendClassOwnershipResponse.Merge(m, src) -} -func (m *MsgSendClassOwnershipResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgSendClassOwnershipResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgSendClassOwnershipResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgSendClassOwnershipResponse proto.InternalMessageInfo - -type MsgUpdateBaseTokenUri struct { - Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` - ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` - BaseTokenUri string `protobuf:"bytes,3,opt,name=base_token_uri,json=baseTokenUri,proto3" json:"base_token_uri,omitempty"` -} - -func (m *MsgUpdateBaseTokenUri) Reset() { *m = MsgUpdateBaseTokenUri{} } -func (m *MsgUpdateBaseTokenUri) String() string { return proto.CompactTextString(m) } -func (*MsgUpdateBaseTokenUri) ProtoMessage() {} -func (*MsgUpdateBaseTokenUri) Descriptor() ([]byte, []int) { - return fileDescriptor_47805922275bdc64, []int{4} -} -func (m *MsgUpdateBaseTokenUri) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgUpdateBaseTokenUri) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgUpdateBaseTokenUri.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 *MsgUpdateBaseTokenUri) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgUpdateBaseTokenUri.Merge(m, src) -} -func (m *MsgUpdateBaseTokenUri) XXX_Size() int { - return m.Size() -} -func (m *MsgUpdateBaseTokenUri) XXX_DiscardUnknown() { - xxx_messageInfo_MsgUpdateBaseTokenUri.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgUpdateBaseTokenUri proto.InternalMessageInfo - -func (m *MsgUpdateBaseTokenUri) GetSender() string { +func (m *MsgUpdateClass) GetName() string { if m != nil { - return m.Sender + return m.Name } return "" } -func (m *MsgUpdateBaseTokenUri) GetClassId() string { +func (m *MsgUpdateClass) GetSymbol() string { if m != nil { - return m.ClassId + return m.Symbol } return "" } -func (m *MsgUpdateBaseTokenUri) GetBaseTokenUri() string { +func (m *MsgUpdateClass) GetDescription() string { if m != nil { - return m.BaseTokenUri + return m.Description } return "" } -type MsgUpdateBaseTokenUriResponse struct { -} - -func (m *MsgUpdateBaseTokenUriResponse) Reset() { *m = MsgUpdateBaseTokenUriResponse{} } -func (m *MsgUpdateBaseTokenUriResponse) String() string { return proto.CompactTextString(m) } -func (*MsgUpdateBaseTokenUriResponse) ProtoMessage() {} -func (*MsgUpdateBaseTokenUriResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_47805922275bdc64, []int{5} -} -func (m *MsgUpdateBaseTokenUriResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgUpdateBaseTokenUriResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgUpdateBaseTokenUriResponse.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 *MsgUpdateBaseTokenUriResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgUpdateBaseTokenUriResponse.Merge(m, src) -} -func (m *MsgUpdateBaseTokenUriResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgUpdateBaseTokenUriResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgUpdateBaseTokenUriResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgUpdateBaseTokenUriResponse proto.InternalMessageInfo - -type MsgUpdateTokenSupplyCap struct { - Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` - ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` - TokenSupplyCap uint64 `protobuf:"varint,3,opt,name=token_supply_cap,json=tokenSupplyCap,proto3" json:"token_supply_cap,omitempty"` -} - -func (m *MsgUpdateTokenSupplyCap) Reset() { *m = MsgUpdateTokenSupplyCap{} } -func (m *MsgUpdateTokenSupplyCap) String() string { return proto.CompactTextString(m) } -func (*MsgUpdateTokenSupplyCap) ProtoMessage() {} -func (*MsgUpdateTokenSupplyCap) Descriptor() ([]byte, []int) { - return fileDescriptor_47805922275bdc64, []int{6} -} -func (m *MsgUpdateTokenSupplyCap) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgUpdateTokenSupplyCap) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgUpdateTokenSupplyCap.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 *MsgUpdateTokenSupplyCap) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgUpdateTokenSupplyCap.Merge(m, src) -} -func (m *MsgUpdateTokenSupplyCap) XXX_Size() int { - return m.Size() -} -func (m *MsgUpdateTokenSupplyCap) XXX_DiscardUnknown() { - xxx_messageInfo_MsgUpdateTokenSupplyCap.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgUpdateTokenSupplyCap proto.InternalMessageInfo - -func (m *MsgUpdateTokenSupplyCap) GetSender() string { +func (m *MsgUpdateClass) GetUri() string { if m != nil { - return m.Sender + return m.Uri } return "" } -func (m *MsgUpdateTokenSupplyCap) GetClassId() string { +func (m *MsgUpdateClass) GetUriHash() string { if m != nil { - return m.ClassId + return m.UriHash } return "" } -func (m *MsgUpdateTokenSupplyCap) GetTokenSupplyCap() uint64 { +func (m *MsgUpdateClass) GetData() *types.ClassData { if m != nil { - return m.TokenSupplyCap + return m.Data } - return 0 + return nil } -type MsgUpdateTokenSupplyCapResponse struct { +type MsgUpdateClassResponse struct { } -func (m *MsgUpdateTokenSupplyCapResponse) Reset() { *m = MsgUpdateTokenSupplyCapResponse{} } -func (m *MsgUpdateTokenSupplyCapResponse) String() string { return proto.CompactTextString(m) } -func (*MsgUpdateTokenSupplyCapResponse) ProtoMessage() {} -func (*MsgUpdateTokenSupplyCapResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_47805922275bdc64, []int{7} +func (m *MsgUpdateClassResponse) Reset() { *m = MsgUpdateClassResponse{} } +func (m *MsgUpdateClassResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateClassResponse) ProtoMessage() {} +func (*MsgUpdateClassResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_47805922275bdc64, []int{3} } -func (m *MsgUpdateTokenSupplyCapResponse) XXX_Unmarshal(b []byte) error { +func (m *MsgUpdateClassResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgUpdateTokenSupplyCapResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgUpdateClassResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgUpdateTokenSupplyCapResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgUpdateClassResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -440,17 +289,17 @@ func (m *MsgUpdateTokenSupplyCapResponse) XXX_Marshal(b []byte, deterministic bo return b[:n], nil } } -func (m *MsgUpdateTokenSupplyCapResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgUpdateTokenSupplyCapResponse.Merge(m, src) +func (m *MsgUpdateClassResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateClassResponse.Merge(m, src) } -func (m *MsgUpdateTokenSupplyCapResponse) XXX_Size() int { +func (m *MsgUpdateClassResponse) XXX_Size() int { return m.Size() } -func (m *MsgUpdateTokenSupplyCapResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgUpdateTokenSupplyCapResponse.DiscardUnknown(m) +func (m *MsgUpdateClassResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateClassResponse.DiscardUnknown(m) } -var xxx_messageInfo_MsgUpdateTokenSupplyCapResponse proto.InternalMessageInfo +var xxx_messageInfo_MsgUpdateClassResponse proto.InternalMessageInfo type MsgMintNFT struct { Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` @@ -463,7 +312,7 @@ func (m *MsgMintNFT) Reset() { *m = MsgMintNFT{} } func (m *MsgMintNFT) String() string { return proto.CompactTextString(m) } func (*MsgMintNFT) ProtoMessage() {} func (*MsgMintNFT) Descriptor() ([]byte, []int) { - return fileDescriptor_47805922275bdc64, []int{8} + return fileDescriptor_47805922275bdc64, []int{4} } func (m *MsgMintNFT) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -527,7 +376,7 @@ func (m *MsgMintNFTResponse) Reset() { *m = MsgMintNFTResponse{} } func (m *MsgMintNFTResponse) String() string { return proto.CompactTextString(m) } func (*MsgMintNFTResponse) ProtoMessage() {} func (*MsgMintNFTResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_47805922275bdc64, []int{9} + return fileDescriptor_47805922275bdc64, []int{5} } func (m *MsgMintNFTResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -566,7 +415,7 @@ func (m *MsgBurnNFT) Reset() { *m = MsgBurnNFT{} } func (m *MsgBurnNFT) String() string { return proto.CompactTextString(m) } func (*MsgBurnNFT) ProtoMessage() {} func (*MsgBurnNFT) Descriptor() ([]byte, []int) { - return fileDescriptor_47805922275bdc64, []int{10} + return fileDescriptor_47805922275bdc64, []int{6} } func (m *MsgBurnNFT) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -623,7 +472,7 @@ func (m *MsgBurnNFTResponse) Reset() { *m = MsgBurnNFTResponse{} } func (m *MsgBurnNFTResponse) String() string { return proto.CompactTextString(m) } func (*MsgBurnNFTResponse) ProtoMessage() {} func (*MsgBurnNFTResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_47805922275bdc64, []int{11} + return fileDescriptor_47805922275bdc64, []int{7} } func (m *MsgBurnNFTResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -652,64 +501,158 @@ func (m *MsgBurnNFTResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgBurnNFTResponse proto.InternalMessageInfo +// MsgChangeAdmin is the sdk.Msg type for allowing an admin account to reassign +// adminship of a class to a new account +type MsgChangeAdmin struct { + Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty" yaml:"sender"` + ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty" yaml:"class_id"` + NewAdmin string `protobuf:"bytes,3,opt,name=new_admin,json=newAdmin,proto3" json:"new_admin,omitempty" yaml:"new_admin"` +} + +func (m *MsgChangeAdmin) Reset() { *m = MsgChangeAdmin{} } +func (m *MsgChangeAdmin) String() string { return proto.CompactTextString(m) } +func (*MsgChangeAdmin) ProtoMessage() {} +func (*MsgChangeAdmin) Descriptor() ([]byte, []int) { + return fileDescriptor_47805922275bdc64, []int{8} +} +func (m *MsgChangeAdmin) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgChangeAdmin) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgChangeAdmin.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 *MsgChangeAdmin) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgChangeAdmin.Merge(m, src) +} +func (m *MsgChangeAdmin) XXX_Size() int { + return m.Size() +} +func (m *MsgChangeAdmin) XXX_DiscardUnknown() { + xxx_messageInfo_MsgChangeAdmin.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgChangeAdmin proto.InternalMessageInfo + +func (m *MsgChangeAdmin) GetSender() string { + if m != nil { + return m.Sender + } + return "" +} + +func (m *MsgChangeAdmin) GetClassId() string { + if m != nil { + return m.ClassId + } + return "" +} + +func (m *MsgChangeAdmin) GetNewAdmin() string { + if m != nil { + return m.NewAdmin + } + return "" +} + +type MsgChangeAdminResponse struct { +} + +func (m *MsgChangeAdminResponse) Reset() { *m = MsgChangeAdminResponse{} } +func (m *MsgChangeAdminResponse) String() string { return proto.CompactTextString(m) } +func (*MsgChangeAdminResponse) ProtoMessage() {} +func (*MsgChangeAdminResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_47805922275bdc64, []int{9} +} +func (m *MsgChangeAdminResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgChangeAdminResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgChangeAdminResponse.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 *MsgChangeAdminResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgChangeAdminResponse.Merge(m, src) +} +func (m *MsgChangeAdminResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgChangeAdminResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgChangeAdminResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgChangeAdminResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*MsgCreateClass)(nil), "ununifi.nftfactory.MsgCreateClass") proto.RegisterType((*MsgCreateClassResponse)(nil), "ununifi.nftfactory.MsgCreateClassResponse") - proto.RegisterType((*MsgSendClassOwnership)(nil), "ununifi.nftfactory.MsgSendClassOwnership") - proto.RegisterType((*MsgSendClassOwnershipResponse)(nil), "ununifi.nftfactory.MsgSendClassOwnershipResponse") - proto.RegisterType((*MsgUpdateBaseTokenUri)(nil), "ununifi.nftfactory.MsgUpdateBaseTokenUri") - proto.RegisterType((*MsgUpdateBaseTokenUriResponse)(nil), "ununifi.nftfactory.MsgUpdateBaseTokenUriResponse") - proto.RegisterType((*MsgUpdateTokenSupplyCap)(nil), "ununifi.nftfactory.MsgUpdateTokenSupplyCap") - proto.RegisterType((*MsgUpdateTokenSupplyCapResponse)(nil), "ununifi.nftfactory.MsgUpdateTokenSupplyCapResponse") + proto.RegisterType((*MsgUpdateClass)(nil), "ununifi.nftfactory.MsgUpdateClass") + proto.RegisterType((*MsgUpdateClassResponse)(nil), "ununifi.nftfactory.MsgUpdateClassResponse") proto.RegisterType((*MsgMintNFT)(nil), "ununifi.nftfactory.MsgMintNFT") proto.RegisterType((*MsgMintNFTResponse)(nil), "ununifi.nftfactory.MsgMintNFTResponse") proto.RegisterType((*MsgBurnNFT)(nil), "ununifi.nftfactory.MsgBurnNFT") proto.RegisterType((*MsgBurnNFTResponse)(nil), "ununifi.nftfactory.MsgBurnNFTResponse") + proto.RegisterType((*MsgChangeAdmin)(nil), "ununifi.nftfactory.MsgChangeAdmin") + proto.RegisterType((*MsgChangeAdminResponse)(nil), "ununifi.nftfactory.MsgChangeAdminResponse") } func init() { proto.RegisterFile("ununifi/nftfactory/tx.proto", fileDescriptor_47805922275bdc64) } var fileDescriptor_47805922275bdc64 = []byte{ - // 616 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0xcd, 0x6e, 0xd3, 0x4c, - 0x14, 0xad, 0xdb, 0xf4, 0x27, 0xb7, 0x9f, 0xa2, 0x8f, 0x51, 0x5b, 0x8c, 0x0b, 0x6e, 0x30, 0x3f, - 0x0a, 0x54, 0x8a, 0x45, 0xfb, 0x06, 0xad, 0xa8, 0xc4, 0x22, 0xfc, 0xa4, 0x09, 0x0b, 0x24, 0x14, - 0x39, 0xf6, 0xc4, 0x19, 0x51, 0x8f, 0x47, 0x33, 0x63, 0x48, 0xde, 0x82, 0xd7, 0xe1, 0x0d, 0x58, - 0x76, 0xc9, 0x12, 0x25, 0x5b, 0x1e, 0x02, 0x79, 0xec, 0x38, 0x7f, 0x76, 0x29, 0x11, 0x3b, 0xcf, - 0x3d, 0x27, 0xf7, 0x9c, 0xb9, 0xf7, 0x38, 0x86, 0xc3, 0x88, 0x46, 0x94, 0xf4, 0x88, 0x4d, 0x7b, - 0xb2, 0xe7, 0xb8, 0x32, 0xe4, 0x43, 0x5b, 0x0e, 0xea, 0x8c, 0x87, 0x32, 0x44, 0x28, 0x05, 0xeb, - 0x53, 0xd0, 0xd8, 0xf3, 0x43, 0x3f, 0x54, 0xb0, 0x1d, 0x3f, 0x25, 0x4c, 0xe3, 0x51, 0x4e, 0x9b, - 0xe9, 0x63, 0x42, 0xb2, 0xbe, 0xad, 0x43, 0xa5, 0x21, 0xfc, 0x73, 0x8e, 0x1d, 0x89, 0xcf, 0xaf, - 0x1c, 0x21, 0xd0, 0x01, 0x6c, 0x09, 0x4c, 0x3d, 0xcc, 0x75, 0xad, 0xaa, 0xd5, 0xca, 0xcd, 0xf4, - 0x84, 0x10, 0x94, 0xa8, 0x13, 0x60, 0x7d, 0x5d, 0x55, 0xd5, 0x33, 0x7a, 0x0c, 0x95, 0xae, 0x23, - 0x70, 0x47, 0x86, 0x9f, 0x30, 0xed, 0x44, 0x9c, 0xe8, 0x1b, 0x0a, 0xfd, 0x2f, 0xae, 0xb6, 0xe2, - 0x62, 0x9b, 0x13, 0x54, 0x83, 0xff, 0x13, 0x82, 0x88, 0x18, 0xbb, 0x1a, 0x76, 0x5c, 0x87, 0xe9, - 0xa5, 0xaa, 0x56, 0x2b, 0x35, 0x2b, 0xaa, 0x7e, 0xa9, 0xca, 0xe7, 0x0e, 0x43, 0x2d, 0x40, 0x01, - 0xa1, 0x92, 0x50, 0xbf, 0xc3, 0x30, 0x0f, 0x88, 0x10, 0x24, 0xa4, 0xfa, 0x66, 0x55, 0xab, 0x55, - 0x4e, 0x9e, 0xd4, 0x97, 0xaf, 0x5e, 0x6f, 0x24, 0xec, 0xb7, 0x19, 0xb9, 0x79, 0x27, 0x58, 0x2c, - 0xa9, 0x1b, 0x0d, 0x83, 0x6e, 0x78, 0xa5, 0x6f, 0xa7, 0x37, 0x52, 0x27, 0x54, 0x85, 0x5d, 0x0f, - 0x0b, 0x97, 0x13, 0x26, 0x63, 0x99, 0x1d, 0x05, 0xce, 0x96, 0xd0, 0x21, 0x94, 0xdd, 0x78, 0x28, - 0xea, 0x6a, 0x65, 0x85, 0xef, 0xa8, 0x42, 0x9b, 0x13, 0x4b, 0x87, 0x83, 0xf9, 0xd1, 0x35, 0xb1, - 0x60, 0x21, 0x15, 0xd8, 0xea, 0xc3, 0x7e, 0x43, 0xf8, 0x97, 0x98, 0x7a, 0xaa, 0xfe, 0xe6, 0x0b, - 0xc5, 0x5c, 0xf4, 0x09, 0x2b, 0x9c, 0xed, 0x3d, 0x48, 0xda, 0x76, 0x88, 0x97, 0xce, 0x77, 0x5b, - 0x9d, 0x5f, 0x79, 0xe8, 0x3e, 0x94, 0x39, 0x76, 0x09, 0x23, 0x98, 0xca, 0x74, 0xba, 0xd3, 0x82, - 0x75, 0x04, 0x0f, 0x72, 0x95, 0x32, 0x2b, 0x4c, 0x59, 0x69, 0x33, 0xcf, 0x91, 0xf8, 0x6c, 0x76, - 0x29, 0x2b, 0x58, 0xb9, 0xd5, 0xb6, 0x53, 0x4b, 0xcb, 0x8a, 0x99, 0xa5, 0xcf, 0x70, 0x37, 0x23, - 0xb4, 0xe6, 0xf7, 0xbf, 0x82, 0xa9, 0xbc, 0x70, 0x6d, 0xe4, 0x85, 0xcb, 0x7a, 0x08, 0x47, 0x05, - 0xba, 0x99, 0x35, 0x09, 0xd0, 0x10, 0x7e, 0x1c, 0xaa, 0xd7, 0x17, 0xad, 0x55, 0xdc, 0xec, 0xc3, - 0x16, 0xed, 0xc9, 0x18, 0x48, 0x46, 0xb3, 0x49, 0x7b, 0x72, 0x71, 0x89, 0xa5, 0xc5, 0x25, 0xee, - 0x01, 0x9a, 0xaa, 0x66, 0x5e, 0xde, 0x2b, 0x2f, 0x67, 0x11, 0xa7, 0xff, 0xd4, 0x4b, 0xaa, 0x96, - 0xf6, 0x9d, 0xa8, 0x9d, 0xfc, 0x2a, 0xc1, 0x46, 0x43, 0xf8, 0xe8, 0x23, 0xec, 0xce, 0xfe, 0x19, - 0x58, 0xb9, 0x2f, 0xdd, 0x5c, 0xea, 0x8d, 0xe7, 0x7f, 0xe6, 0x4c, 0x64, 0x10, 0x07, 0x94, 0xf3, - 0x5a, 0x3c, 0x2b, 0xe8, 0xb0, 0x4c, 0x35, 0x5e, 0xdc, 0x9a, 0x3a, 0xab, 0x99, 0x93, 0xff, 0x22, - 0xcd, 0x65, 0x6a, 0xa1, 0x66, 0x71, 0xc6, 0xd1, 0x00, 0xf6, 0x72, 0x03, 0x7e, 0x7c, 0x63, 0xab, - 0x79, 0xb2, 0x71, 0xfa, 0x17, 0xe4, 0x4c, 0xf9, 0x1d, 0x6c, 0x4f, 0xf2, 0x6b, 0x16, 0xfc, 0x3e, - 0xc5, 0x8d, 0xa7, 0x37, 0xe3, 0xb3, 0x2d, 0x27, 0x31, 0x2c, 0x6a, 0x99, 0xe2, 0x85, 0x2d, 0x17, - 0xe2, 0x76, 0xf6, 0xf2, 0xfb, 0xc8, 0xd4, 0xae, 0x47, 0xa6, 0xf6, 0x73, 0x64, 0x6a, 0x5f, 0xc7, - 0xe6, 0xda, 0xf5, 0xd8, 0x5c, 0xfb, 0x31, 0x36, 0xd7, 0x3e, 0x1c, 0xfb, 0x44, 0xf6, 0xa3, 0x6e, - 0xdd, 0x0d, 0x03, 0xbb, 0x4d, 0xdb, 0x94, 0x5c, 0x10, 0xdb, 0xed, 0x3b, 0x84, 0xda, 0x83, 0xb9, - 0x0f, 0xe2, 0x90, 0x61, 0xd1, 0xdd, 0x52, 0x5f, 0xb1, 0xd3, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, - 0x10, 0x8a, 0xf8, 0x28, 0x33, 0x07, 0x00, 0x00, + // 589 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x55, 0xcd, 0x6e, 0xd3, 0x40, + 0x10, 0x8e, 0x93, 0x34, 0x3f, 0x1b, 0x51, 0xca, 0x92, 0x46, 0x6e, 0x40, 0x4e, 0x64, 0x24, 0x54, + 0x8a, 0x64, 0x8b, 0x72, 0xe3, 0x46, 0x0a, 0x15, 0x3d, 0x04, 0x89, 0x88, 0x70, 0x40, 0x42, 0xd1, + 0xc6, 0xde, 0xd8, 0x2b, 0xc5, 0x6b, 0xcb, 0xbb, 0x56, 0x9b, 0xb7, 0xe0, 0x09, 0x78, 0x9e, 0x1e, + 0x7b, 0xe4, 0x14, 0x50, 0x72, 0xe3, 0x98, 0x27, 0x40, 0x5e, 0xff, 0xa6, 0xad, 0xa9, 0x84, 0xb8, + 0x70, 0x88, 0xb4, 0x3b, 0xdf, 0xcc, 0x37, 0xdf, 0x7c, 0x19, 0xdb, 0xe0, 0x51, 0x40, 0x03, 0x4a, + 0x66, 0x44, 0xa7, 0x33, 0x3e, 0x43, 0x06, 0x77, 0xfd, 0x85, 0xce, 0x2f, 0x34, 0xcf, 0x77, 0xb9, + 0x0b, 0x61, 0x0c, 0x6a, 0x19, 0xd8, 0x6d, 0x5b, 0xae, 0xe5, 0x0a, 0x58, 0x0f, 0x4f, 0x51, 0x66, + 0x77, 0x3f, 0x47, 0x13, 0xfe, 0xe2, 0xf0, 0x93, 0x5b, 0xd8, 0xb3, 0x63, 0x94, 0xa4, 0xfe, 0x90, + 0xc0, 0xee, 0x90, 0x59, 0x27, 0x3e, 0x46, 0x1c, 0x9f, 0xcc, 0x11, 0x63, 0xb0, 0x03, 0x6a, 0x0c, + 0x53, 0x13, 0xfb, 0xb2, 0xd4, 0x97, 0x0e, 0x9b, 0xa3, 0xf8, 0x06, 0x77, 0x41, 0x99, 0x98, 0x72, + 0x59, 0xc4, 0xca, 0xc4, 0x84, 0x10, 0x54, 0x29, 0x72, 0xb0, 0x5c, 0x11, 0x11, 0x71, 0x16, 0xb5, + 0x0b, 0x67, 0xea, 0xce, 0xe5, 0x6a, 0x5c, 0x2b, 0x6e, 0xb0, 0x0f, 0x5a, 0x26, 0x66, 0x86, 0x4f, + 0x3c, 0x4e, 0x5c, 0x2a, 0xef, 0x08, 0x30, 0x1f, 0x82, 0x7b, 0xa0, 0x12, 0xf8, 0x44, 0xae, 0x09, + 0x24, 0x3c, 0xc2, 0x03, 0xd0, 0x08, 0x7c, 0x32, 0xb1, 0x11, 0xb3, 0xe5, 0xba, 0x08, 0xd7, 0x03, + 0x9f, 0xbc, 0x43, 0xcc, 0x86, 0x47, 0xa0, 0x6a, 0x22, 0x8e, 0xe4, 0x46, 0x5f, 0x3a, 0x6c, 0x1d, + 0x77, 0xb4, 0x9c, 0x55, 0x9a, 0x18, 0xe2, 0x0d, 0xe2, 0x68, 0x24, 0x72, 0x54, 0x19, 0x74, 0xb6, + 0x07, 0x1c, 0x61, 0xe6, 0xb9, 0x94, 0x61, 0xf5, 0x57, 0x34, 0xfb, 0xd8, 0x33, 0xef, 0x9c, 0xfd, + 0x00, 0x34, 0x8c, 0x30, 0x61, 0x92, 0x3a, 0x50, 0x17, 0xf7, 0xb3, 0xff, 0xcc, 0x86, 0xdc, 0xac, + 0xa9, 0x0d, 0x1c, 0x80, 0x21, 0xb3, 0x86, 0x84, 0xf2, 0xf7, 0xa7, 0x1f, 0xff, 0xc6, 0x81, 0x7d, + 0x50, 0xa3, 0x33, 0x1e, 0x02, 0x91, 0x07, 0x3b, 0x74, 0xc6, 0xcf, 0x4c, 0xf8, 0x18, 0x34, 0x7d, + 0x6c, 0x10, 0x8f, 0x60, 0xca, 0x63, 0x1f, 0xb2, 0x80, 0xda, 0x06, 0x30, 0xeb, 0x9a, 0x6a, 0xf9, + 0x24, 0xb4, 0x0c, 0x02, 0x9f, 0xfe, 0x53, 0x2d, 0x71, 0xb7, 0x98, 0x37, 0xed, 0xf6, 0x2d, 0x5e, + 0x7e, 0x1b, 0x51, 0x0b, 0xbf, 0x36, 0x1d, 0x42, 0xe1, 0xb3, 0xed, 0x96, 0x83, 0x07, 0x9b, 0x65, + 0xef, 0xde, 0x02, 0x39, 0xf3, 0x57, 0x6a, 0x14, 0x57, 0x53, 0x15, 0xda, 0x75, 0x15, 0x83, 0x87, + 0x9b, 0x65, 0xef, 0x7e, 0x94, 0x9c, 0x20, 0x6a, 0x26, 0xed, 0x05, 0x68, 0x52, 0x7c, 0x3e, 0x41, + 0x61, 0x9f, 0x48, 0xdd, 0xa0, 0xbd, 0x59, 0xf6, 0xf6, 0xa2, 0x82, 0x14, 0x52, 0x47, 0x0d, 0x8a, + 0xcf, 0x85, 0x9a, 0x64, 0x77, 0x33, 0x7d, 0x89, 0xf4, 0xe3, 0xcb, 0x0a, 0xa8, 0x0c, 0x99, 0x05, + 0xbf, 0x80, 0x56, 0xfe, 0xd9, 0x55, 0xb5, 0x9b, 0x6f, 0x0d, 0x6d, 0x7b, 0xfd, 0xbb, 0x47, 0x77, + 0xe7, 0x24, 0x6d, 0x42, 0xfa, 0xfc, 0xe3, 0x51, 0x44, 0x9f, 0xcb, 0x29, 0xa4, 0xbf, 0x65, 0xf5, + 0xe0, 0x07, 0x50, 0x4f, 0xf6, 0x4e, 0x29, 0x28, 0x8b, 0xf1, 0xee, 0xd3, 0x3f, 0xe3, 0x79, 0xca, + 0x64, 0x7d, 0x8a, 0x28, 0x63, 0xbc, 0x90, 0xf2, 0xda, 0x9a, 0x08, 0x8f, 0x73, 0x2b, 0x52, 0xe8, + 0x71, 0x96, 0x53, 0xec, 0xf1, 0xcd, 0xbf, 0x72, 0xf0, 0xf6, 0x72, 0xa5, 0x48, 0x57, 0x2b, 0x45, + 0xfa, 0xb9, 0x52, 0xa4, 0xaf, 0x6b, 0xa5, 0x74, 0xb5, 0x56, 0x4a, 0xdf, 0xd7, 0x4a, 0xe9, 0xf3, + 0x73, 0x8b, 0x70, 0x3b, 0x98, 0x6a, 0x86, 0xeb, 0xe8, 0x63, 0x3a, 0xa6, 0xe4, 0x94, 0xe8, 0x86, + 0x8d, 0x08, 0xd5, 0x2f, 0xb6, 0x3e, 0x19, 0x0b, 0x0f, 0xb3, 0x69, 0x4d, 0xbc, 0xd0, 0x5f, 0xfe, + 0x0e, 0x00, 0x00, 0xff, 0xff, 0x20, 0x53, 0xa4, 0x7d, 0x55, 0x06, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -725,11 +668,10 @@ const _ = grpc.SupportPackageIsVersion4 // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type MsgClient interface { CreateClass(ctx context.Context, in *MsgCreateClass, opts ...grpc.CallOption) (*MsgCreateClassResponse, error) - SendClassOwnership(ctx context.Context, in *MsgSendClassOwnership, opts ...grpc.CallOption) (*MsgSendClassOwnershipResponse, error) - UpdateBaseTokenUri(ctx context.Context, in *MsgUpdateBaseTokenUri, opts ...grpc.CallOption) (*MsgUpdateBaseTokenUriResponse, error) - UpdateTokenSupplyCap(ctx context.Context, in *MsgUpdateTokenSupplyCap, opts ...grpc.CallOption) (*MsgUpdateTokenSupplyCapResponse, error) + UpdateClass(ctx context.Context, in *MsgUpdateClass, opts ...grpc.CallOption) (*MsgUpdateClassResponse, error) MintNFT(ctx context.Context, in *MsgMintNFT, opts ...grpc.CallOption) (*MsgMintNFTResponse, error) BurnNFT(ctx context.Context, in *MsgBurnNFT, opts ...grpc.CallOption) (*MsgBurnNFTResponse, error) + ChangeAdmin(ctx context.Context, in *MsgChangeAdmin, opts ...grpc.CallOption) (*MsgChangeAdminResponse, error) } type msgClient struct { @@ -749,27 +691,9 @@ func (c *msgClient) CreateClass(ctx context.Context, in *MsgCreateClass, opts .. return out, nil } -func (c *msgClient) SendClassOwnership(ctx context.Context, in *MsgSendClassOwnership, opts ...grpc.CallOption) (*MsgSendClassOwnershipResponse, error) { - out := new(MsgSendClassOwnershipResponse) - err := c.cc.Invoke(ctx, "/ununifi.nftfactory.Msg/SendClassOwnership", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) UpdateBaseTokenUri(ctx context.Context, in *MsgUpdateBaseTokenUri, opts ...grpc.CallOption) (*MsgUpdateBaseTokenUriResponse, error) { - out := new(MsgUpdateBaseTokenUriResponse) - err := c.cc.Invoke(ctx, "/ununifi.nftfactory.Msg/UpdateBaseTokenUri", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) UpdateTokenSupplyCap(ctx context.Context, in *MsgUpdateTokenSupplyCap, opts ...grpc.CallOption) (*MsgUpdateTokenSupplyCapResponse, error) { - out := new(MsgUpdateTokenSupplyCapResponse) - err := c.cc.Invoke(ctx, "/ununifi.nftfactory.Msg/UpdateTokenSupplyCap", in, out, opts...) +func (c *msgClient) UpdateClass(ctx context.Context, in *MsgUpdateClass, opts ...grpc.CallOption) (*MsgUpdateClassResponse, error) { + out := new(MsgUpdateClassResponse) + err := c.cc.Invoke(ctx, "/ununifi.nftfactory.Msg/UpdateClass", in, out, opts...) if err != nil { return nil, err } @@ -794,14 +718,22 @@ func (c *msgClient) BurnNFT(ctx context.Context, in *MsgBurnNFT, opts ...grpc.Ca return out, nil } +func (c *msgClient) ChangeAdmin(ctx context.Context, in *MsgChangeAdmin, opts ...grpc.CallOption) (*MsgChangeAdminResponse, error) { + out := new(MsgChangeAdminResponse) + err := c.cc.Invoke(ctx, "/ununifi.nftfactory.Msg/ChangeAdmin", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { CreateClass(context.Context, *MsgCreateClass) (*MsgCreateClassResponse, error) - SendClassOwnership(context.Context, *MsgSendClassOwnership) (*MsgSendClassOwnershipResponse, error) - UpdateBaseTokenUri(context.Context, *MsgUpdateBaseTokenUri) (*MsgUpdateBaseTokenUriResponse, error) - UpdateTokenSupplyCap(context.Context, *MsgUpdateTokenSupplyCap) (*MsgUpdateTokenSupplyCapResponse, error) + UpdateClass(context.Context, *MsgUpdateClass) (*MsgUpdateClassResponse, error) MintNFT(context.Context, *MsgMintNFT) (*MsgMintNFTResponse, error) BurnNFT(context.Context, *MsgBurnNFT) (*MsgBurnNFTResponse, error) + ChangeAdmin(context.Context, *MsgChangeAdmin) (*MsgChangeAdminResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -811,14 +743,8 @@ type UnimplementedMsgServer struct { func (*UnimplementedMsgServer) CreateClass(ctx context.Context, req *MsgCreateClass) (*MsgCreateClassResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method CreateClass not implemented") } -func (*UnimplementedMsgServer) SendClassOwnership(ctx context.Context, req *MsgSendClassOwnership) (*MsgSendClassOwnershipResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method SendClassOwnership not implemented") -} -func (*UnimplementedMsgServer) UpdateBaseTokenUri(ctx context.Context, req *MsgUpdateBaseTokenUri) (*MsgUpdateBaseTokenUriResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method UpdateBaseTokenUri not implemented") -} -func (*UnimplementedMsgServer) UpdateTokenSupplyCap(ctx context.Context, req *MsgUpdateTokenSupplyCap) (*MsgUpdateTokenSupplyCapResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method UpdateTokenSupplyCap not implemented") +func (*UnimplementedMsgServer) UpdateClass(ctx context.Context, req *MsgUpdateClass) (*MsgUpdateClassResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateClass not implemented") } func (*UnimplementedMsgServer) MintNFT(ctx context.Context, req *MsgMintNFT) (*MsgMintNFTResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method MintNFT not implemented") @@ -826,6 +752,9 @@ func (*UnimplementedMsgServer) MintNFT(ctx context.Context, req *MsgMintNFT) (*M func (*UnimplementedMsgServer) BurnNFT(ctx context.Context, req *MsgBurnNFT) (*MsgBurnNFTResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method BurnNFT not implemented") } +func (*UnimplementedMsgServer) ChangeAdmin(ctx context.Context, req *MsgChangeAdmin) (*MsgChangeAdminResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ChangeAdmin not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -849,92 +778,74 @@ func _Msg_CreateClass_Handler(srv interface{}, ctx context.Context, dec func(int return interceptor(ctx, in, info, handler) } -func _Msg_SendClassOwnership_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgSendClassOwnership) +func _Msg_UpdateClass_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateClass) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(MsgServer).SendClassOwnership(ctx, in) + return srv.(MsgServer).UpdateClass(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/ununifi.nftfactory.Msg/SendClassOwnership", + FullMethod: "/ununifi.nftfactory.Msg/UpdateClass", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).SendClassOwnership(ctx, req.(*MsgSendClassOwnership)) + return srv.(MsgServer).UpdateClass(ctx, req.(*MsgUpdateClass)) } return interceptor(ctx, in, info, handler) } -func _Msg_UpdateBaseTokenUri_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgUpdateBaseTokenUri) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).UpdateBaseTokenUri(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ununifi.nftfactory.Msg/UpdateBaseTokenUri", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).UpdateBaseTokenUri(ctx, req.(*MsgUpdateBaseTokenUri)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_UpdateTokenSupplyCap_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgUpdateTokenSupplyCap) +func _Msg_MintNFT_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgMintNFT) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(MsgServer).UpdateTokenSupplyCap(ctx, in) + return srv.(MsgServer).MintNFT(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/ununifi.nftfactory.Msg/UpdateTokenSupplyCap", + FullMethod: "/ununifi.nftfactory.Msg/MintNFT", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).UpdateTokenSupplyCap(ctx, req.(*MsgUpdateTokenSupplyCap)) + return srv.(MsgServer).MintNFT(ctx, req.(*MsgMintNFT)) } return interceptor(ctx, in, info, handler) } -func _Msg_MintNFT_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgMintNFT) +func _Msg_BurnNFT_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgBurnNFT) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(MsgServer).MintNFT(ctx, in) + return srv.(MsgServer).BurnNFT(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/ununifi.nftfactory.Msg/MintNFT", + FullMethod: "/ununifi.nftfactory.Msg/BurnNFT", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).MintNFT(ctx, req.(*MsgMintNFT)) + return srv.(MsgServer).BurnNFT(ctx, req.(*MsgBurnNFT)) } return interceptor(ctx, in, info, handler) } -func _Msg_BurnNFT_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgBurnNFT) +func _Msg_ChangeAdmin_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgChangeAdmin) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(MsgServer).BurnNFT(ctx, in) + return srv.(MsgServer).ChangeAdmin(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/ununifi.nftfactory.Msg/BurnNFT", + FullMethod: "/ununifi.nftfactory.Msg/ChangeAdmin", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).BurnNFT(ctx, req.(*MsgBurnNFT)) + return srv.(MsgServer).ChangeAdmin(ctx, req.(*MsgChangeAdmin)) } return interceptor(ctx, in, info, handler) } @@ -948,16 +859,8 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ Handler: _Msg_CreateClass_Handler, }, { - MethodName: "SendClassOwnership", - Handler: _Msg_SendClassOwnership_Handler, - }, - { - MethodName: "UpdateBaseTokenUri", - Handler: _Msg_UpdateBaseTokenUri_Handler, - }, - { - MethodName: "UpdateTokenSupplyCap", - Handler: _Msg_UpdateTokenSupplyCap_Handler, + MethodName: "UpdateClass", + Handler: _Msg_UpdateClass_Handler, }, { MethodName: "MintNFT", @@ -967,110 +870,16 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "BurnNFT", Handler: _Msg_BurnNFT_Handler, }, + { + MethodName: "ChangeAdmin", + Handler: _Msg_ChangeAdmin_Handler, + }, }, Streams: []grpc.StreamDesc{}, - Metadata: "ununifi/nftfactory/tx.proto", -} - -func (m *MsgCreateClass) 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 *MsgCreateClass) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgCreateClass) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.ClassUri) > 0 { - i -= len(m.ClassUri) - copy(dAtA[i:], m.ClassUri) - i = encodeVarintTx(dAtA, i, uint64(len(m.ClassUri))) - i-- - dAtA[i] = 0x4a - } - if len(m.Description) > 0 { - i -= len(m.Description) - copy(dAtA[i:], m.Description) - i = encodeVarintTx(dAtA, i, uint64(len(m.Description))) - i-- - dAtA[i] = 0x42 - } - if len(m.Symbol) > 0 { - i -= len(m.Symbol) - copy(dAtA[i:], m.Symbol) - i = encodeVarintTx(dAtA, i, uint64(len(m.Symbol))) - i-- - dAtA[i] = 0x3a - } - if m.MintingPermission != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.MintingPermission)) - i-- - dAtA[i] = 0x28 - } - if m.TokenSupplyCap != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.TokenSupplyCap)) - i-- - dAtA[i] = 0x20 - } - if len(m.BaseTokenUri) > 0 { - i -= len(m.BaseTokenUri) - copy(dAtA[i:], m.BaseTokenUri) - i = encodeVarintTx(dAtA, i, uint64(len(m.BaseTokenUri))) - i-- - dAtA[i] = 0x1a - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintTx(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0x12 - } - if len(m.Sender) > 0 { - i -= len(m.Sender) - copy(dAtA[i:], m.Sender) - i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgCreateClassResponse) 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 *MsgCreateClassResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgCreateClassResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil + Metadata: "ununifi/nftfactory/tx.proto", } -func (m *MsgSendClassOwnership) Marshal() (dAtA []byte, err error) { +func (m *MsgCreateClass) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1080,27 +889,67 @@ func (m *MsgSendClassOwnership) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgSendClassOwnership) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgCreateClass) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgSendClassOwnership) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgCreateClass) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.Recipient) > 0 { - i -= len(m.Recipient) - copy(dAtA[i:], m.Recipient) - i = encodeVarintTx(dAtA, i, uint64(len(m.Recipient))) + if m.Data != nil { + { + size, err := m.Data.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x42 + } + if len(m.UriHash) > 0 { + i -= len(m.UriHash) + copy(dAtA[i:], m.UriHash) + i = encodeVarintTx(dAtA, i, uint64(len(m.UriHash))) + i-- + dAtA[i] = 0x3a + } + if len(m.Uri) > 0 { + i -= len(m.Uri) + copy(dAtA[i:], m.Uri) + i = encodeVarintTx(dAtA, i, uint64(len(m.Uri))) + i-- + dAtA[i] = 0x32 + } + if len(m.Description) > 0 { + i -= len(m.Description) + copy(dAtA[i:], m.Description) + i = encodeVarintTx(dAtA, i, uint64(len(m.Description))) + i-- + dAtA[i] = 0x2a + } + if len(m.Symbol) > 0 { + i -= len(m.Symbol) + copy(dAtA[i:], m.Symbol) + i = encodeVarintTx(dAtA, i, uint64(len(m.Symbol))) + i-- + dAtA[i] = 0x22 + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintTx(dAtA, i, uint64(len(m.Name))) i-- dAtA[i] = 0x1a } - if len(m.ClassId) > 0 { - i -= len(m.ClassId) - copy(dAtA[i:], m.ClassId) - i = encodeVarintTx(dAtA, i, uint64(len(m.ClassId))) + if len(m.Id) > 0 { + i -= len(m.Id) + copy(dAtA[i:], m.Id) + i = encodeVarintTx(dAtA, i, uint64(len(m.Id))) i-- dAtA[i] = 0x12 } @@ -1114,7 +963,7 @@ func (m *MsgSendClassOwnership) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *MsgSendClassOwnershipResponse) Marshal() (dAtA []byte, err error) { +func (m *MsgCreateClassResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1124,12 +973,12 @@ func (m *MsgSendClassOwnershipResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgSendClassOwnershipResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgCreateClassResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgSendClassOwnershipResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgCreateClassResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1137,7 +986,7 @@ func (m *MsgSendClassOwnershipResponse) MarshalToSizedBuffer(dAtA []byte) (int, return len(dAtA) - i, nil } -func (m *MsgUpdateBaseTokenUri) Marshal() (dAtA []byte, err error) { +func (m *MsgUpdateClass) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1147,20 +996,60 @@ func (m *MsgUpdateBaseTokenUri) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgUpdateBaseTokenUri) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgUpdateClass) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgUpdateBaseTokenUri) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgUpdateClass) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.BaseTokenUri) > 0 { - i -= len(m.BaseTokenUri) - copy(dAtA[i:], m.BaseTokenUri) - i = encodeVarintTx(dAtA, i, uint64(len(m.BaseTokenUri))) + if m.Data != nil { + { + size, err := m.Data.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x42 + } + if len(m.UriHash) > 0 { + i -= len(m.UriHash) + copy(dAtA[i:], m.UriHash) + i = encodeVarintTx(dAtA, i, uint64(len(m.UriHash))) + i-- + dAtA[i] = 0x3a + } + if len(m.Uri) > 0 { + i -= len(m.Uri) + copy(dAtA[i:], m.Uri) + i = encodeVarintTx(dAtA, i, uint64(len(m.Uri))) + i-- + dAtA[i] = 0x32 + } + if len(m.Description) > 0 { + i -= len(m.Description) + copy(dAtA[i:], m.Description) + i = encodeVarintTx(dAtA, i, uint64(len(m.Description))) + i-- + dAtA[i] = 0x2a + } + if len(m.Symbol) > 0 { + i -= len(m.Symbol) + copy(dAtA[i:], m.Symbol) + i = encodeVarintTx(dAtA, i, uint64(len(m.Symbol))) + i-- + dAtA[i] = 0x22 + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintTx(dAtA, i, uint64(len(m.Name))) i-- dAtA[i] = 0x1a } @@ -1181,7 +1070,7 @@ func (m *MsgUpdateBaseTokenUri) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *MsgUpdateBaseTokenUriResponse) Marshal() (dAtA []byte, err error) { +func (m *MsgUpdateClassResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1191,12 +1080,12 @@ func (m *MsgUpdateBaseTokenUriResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgUpdateBaseTokenUriResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgUpdateClassResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgUpdateBaseTokenUriResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgUpdateClassResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1204,7 +1093,7 @@ func (m *MsgUpdateBaseTokenUriResponse) MarshalToSizedBuffer(dAtA []byte) (int, return len(dAtA) - i, nil } -func (m *MsgUpdateTokenSupplyCap) Marshal() (dAtA []byte, err error) { +func (m *MsgMintNFT) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1214,20 +1103,29 @@ func (m *MsgUpdateTokenSupplyCap) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgUpdateTokenSupplyCap) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgMintNFT) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgUpdateTokenSupplyCap) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgMintNFT) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.TokenSupplyCap != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.TokenSupplyCap)) + if len(m.Recipient) > 0 { + i -= len(m.Recipient) + copy(dAtA[i:], m.Recipient) + i = encodeVarintTx(dAtA, i, uint64(len(m.Recipient))) i-- - dAtA[i] = 0x18 + dAtA[i] = 0x22 + } + if len(m.NftId) > 0 { + i -= len(m.NftId) + copy(dAtA[i:], m.NftId) + i = encodeVarintTx(dAtA, i, uint64(len(m.NftId))) + i-- + dAtA[i] = 0x1a } if len(m.ClassId) > 0 { i -= len(m.ClassId) @@ -1246,7 +1144,7 @@ func (m *MsgUpdateTokenSupplyCap) MarshalToSizedBuffer(dAtA []byte) (int, error) return len(dAtA) - i, nil } -func (m *MsgUpdateTokenSupplyCapResponse) Marshal() (dAtA []byte, err error) { +func (m *MsgMintNFTResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1256,12 +1154,12 @@ func (m *MsgUpdateTokenSupplyCapResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgUpdateTokenSupplyCapResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgMintNFTResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgUpdateTokenSupplyCapResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgMintNFTResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1269,7 +1167,7 @@ func (m *MsgUpdateTokenSupplyCapResponse) MarshalToSizedBuffer(dAtA []byte) (int return len(dAtA) - i, nil } -func (m *MsgMintNFT) Marshal() (dAtA []byte, err error) { +func (m *MsgBurnNFT) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1279,23 +1177,16 @@ func (m *MsgMintNFT) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgMintNFT) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgBurnNFT) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgMintNFT) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgBurnNFT) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.Recipient) > 0 { - i -= len(m.Recipient) - copy(dAtA[i:], m.Recipient) - i = encodeVarintTx(dAtA, i, uint64(len(m.Recipient))) - i-- - dAtA[i] = 0x22 - } if len(m.NftId) > 0 { i -= len(m.NftId) copy(dAtA[i:], m.NftId) @@ -1320,7 +1211,7 @@ func (m *MsgMintNFT) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *MsgMintNFTResponse) Marshal() (dAtA []byte, err error) { +func (m *MsgBurnNFTResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1330,12 +1221,12 @@ func (m *MsgMintNFTResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgMintNFTResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgBurnNFTResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgMintNFTResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgBurnNFTResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1343,7 +1234,7 @@ func (m *MsgMintNFTResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *MsgBurnNFT) Marshal() (dAtA []byte, err error) { +func (m *MsgChangeAdmin) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1353,20 +1244,20 @@ func (m *MsgBurnNFT) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgBurnNFT) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgChangeAdmin) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgBurnNFT) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgChangeAdmin) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.NftId) > 0 { - i -= len(m.NftId) - copy(dAtA[i:], m.NftId) - i = encodeVarintTx(dAtA, i, uint64(len(m.NftId))) + if len(m.NewAdmin) > 0 { + i -= len(m.NewAdmin) + copy(dAtA[i:], m.NewAdmin) + i = encodeVarintTx(dAtA, i, uint64(len(m.NewAdmin))) i-- dAtA[i] = 0x1a } @@ -1387,7 +1278,7 @@ func (m *MsgBurnNFT) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *MsgBurnNFTResponse) Marshal() (dAtA []byte, err error) { +func (m *MsgChangeAdminResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1397,12 +1288,12 @@ func (m *MsgBurnNFTResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgBurnNFTResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgChangeAdminResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgBurnNFTResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgChangeAdminResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1431,20 +1322,14 @@ func (m *MsgCreateClass) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } - l = len(m.Name) + l = len(m.Id) if l > 0 { n += 1 + l + sovTx(uint64(l)) } - l = len(m.BaseTokenUri) + l = len(m.Name) if l > 0 { n += 1 + l + sovTx(uint64(l)) } - if m.TokenSupplyCap != 0 { - n += 1 + sovTx(uint64(m.TokenSupplyCap)) - } - if m.MintingPermission != 0 { - n += 1 + sovTx(uint64(m.MintingPermission)) - } l = len(m.Symbol) if l > 0 { n += 1 + l + sovTx(uint64(l)) @@ -1453,10 +1338,18 @@ func (m *MsgCreateClass) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } - l = len(m.ClassUri) + l = len(m.Uri) if l > 0 { n += 1 + l + sovTx(uint64(l)) } + l = len(m.UriHash) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.Data != nil { + l = m.Data.Size() + n += 1 + l + sovTx(uint64(l)) + } return n } @@ -1469,7 +1362,7 @@ func (m *MsgCreateClassResponse) Size() (n int) { return n } -func (m *MsgSendClassOwnership) Size() (n int) { +func (m *MsgUpdateClass) Size() (n int) { if m == nil { return 0 } @@ -1483,44 +1376,34 @@ func (m *MsgSendClassOwnership) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } - l = len(m.Recipient) + l = len(m.Name) if l > 0 { n += 1 + l + sovTx(uint64(l)) } - return n -} - -func (m *MsgSendClassOwnershipResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *MsgUpdateBaseTokenUri) Size() (n int) { - if m == nil { - return 0 + l = len(m.Symbol) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) } - var l int - _ = l - l = len(m.Sender) + l = len(m.Description) if l > 0 { n += 1 + l + sovTx(uint64(l)) } - l = len(m.ClassId) + l = len(m.Uri) if l > 0 { n += 1 + l + sovTx(uint64(l)) } - l = len(m.BaseTokenUri) + l = len(m.UriHash) if l > 0 { n += 1 + l + sovTx(uint64(l)) } + if m.Data != nil { + l = m.Data.Size() + n += 1 + l + sovTx(uint64(l)) + } return n } -func (m *MsgUpdateBaseTokenUriResponse) Size() (n int) { +func (m *MsgUpdateClassResponse) Size() (n int) { if m == nil { return 0 } @@ -1529,7 +1412,7 @@ func (m *MsgUpdateBaseTokenUriResponse) Size() (n int) { return n } -func (m *MsgUpdateTokenSupplyCap) Size() (n int) { +func (m *MsgMintNFT) Size() (n int) { if m == nil { return 0 } @@ -1543,13 +1426,18 @@ func (m *MsgUpdateTokenSupplyCap) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } - if m.TokenSupplyCap != 0 { - n += 1 + sovTx(uint64(m.TokenSupplyCap)) + l = len(m.NftId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Recipient) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) } return n } -func (m *MsgUpdateTokenSupplyCapResponse) Size() (n int) { +func (m *MsgMintNFTResponse) Size() (n int) { if m == nil { return 0 } @@ -1558,7 +1446,7 @@ func (m *MsgUpdateTokenSupplyCapResponse) Size() (n int) { return n } -func (m *MsgMintNFT) Size() (n int) { +func (m *MsgBurnNFT) Size() (n int) { if m == nil { return 0 } @@ -1576,14 +1464,10 @@ func (m *MsgMintNFT) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } - l = len(m.Recipient) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } return n } -func (m *MsgMintNFTResponse) Size() (n int) { +func (m *MsgBurnNFTResponse) Size() (n int) { if m == nil { return 0 } @@ -1592,7 +1476,7 @@ func (m *MsgMintNFTResponse) Size() (n int) { return n } -func (m *MsgBurnNFT) Size() (n int) { +func (m *MsgChangeAdmin) Size() (n int) { if m == nil { return 0 } @@ -1606,14 +1490,14 @@ func (m *MsgBurnNFT) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } - l = len(m.NftId) + l = len(m.NewAdmin) if l > 0 { n += 1 + l + sovTx(uint64(l)) } return n } -func (m *MsgBurnNFTResponse) Size() (n int) { +func (m *MsgChangeAdminResponse) Size() (n int) { if m == nil { return 0 } @@ -1691,7 +1575,7 @@ func (m *MsgCreateClass) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1719,11 +1603,11 @@ func (m *MsgCreateClass) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Name = string(dAtA[iNdEx:postIndex]) + m.Id = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BaseTokenUri", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1751,13 +1635,13 @@ func (m *MsgCreateClass) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.BaseTokenUri = string(dAtA[iNdEx:postIndex]) + m.Name = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TokenSupplyCap", wireType) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Symbol", wireType) } - m.TokenSupplyCap = 0 + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -1767,16 +1651,29 @@ func (m *MsgCreateClass) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.TokenSupplyCap |= uint64(b&0x7F) << shift + 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.Symbol = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MintingPermission", wireType) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) } - m.MintingPermission = 0 + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -1786,14 +1683,27 @@ func (m *MsgCreateClass) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.MintingPermission |= MintingPermission(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - case 7: + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Description = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Symbol", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Uri", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1821,11 +1731,11 @@ func (m *MsgCreateClass) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Symbol = string(dAtA[iNdEx:postIndex]) + m.Uri = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 8: + case 7: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field UriHash", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1853,13 +1763,13 @@ func (m *MsgCreateClass) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Description = string(dAtA[iNdEx:postIndex]) + m.UriHash = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 9: + case 8: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClassUri", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -1869,23 +1779,27 @@ func (m *MsgCreateClass) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - m.ClassUri = string(dAtA[iNdEx:postIndex]) + if m.Data == nil { + m.Data = &types.ClassData{} + } + if err := m.Data.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex default: iNdEx = preIndex @@ -1958,7 +1872,7 @@ func (m *MsgCreateClassResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgSendClassOwnership) Unmarshal(dAtA []byte) error { +func (m *MsgUpdateClass) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1981,15 +1895,47 @@ func (m *MsgSendClassOwnership) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgSendClassOwnership: wiretype end group for non-group") + return fmt.Errorf("proto: MsgUpdateClass: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgSendClassOwnership: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgUpdateClass: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2017,11 +1963,11 @@ func (m *MsgSendClassOwnership) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Sender = string(dAtA[iNdEx:postIndex]) + m.ClassId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 2: + case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2049,11 +1995,11 @@ func (m *MsgSendClassOwnership) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ClassId = string(dAtA[iNdEx:postIndex]) + m.Name = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 3: + case 4: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Recipient", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Symbol", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2081,111 +2027,43 @@ func (m *MsgSendClassOwnership) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Recipient = string(dAtA[iNdEx:postIndex]) + m.Symbol = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgSendClassOwnershipResponse) 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 + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgSendClassOwnershipResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgSendClassOwnershipResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err + 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 + } } - if (skippy < 0) || (iNdEx+skippy) < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthTx } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgUpdateBaseTokenUri) 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 + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx } - if iNdEx >= l { + if postIndex > 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: MsgUpdateBaseTokenUri: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUpdateBaseTokenUri: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: + m.Description = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Uri", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2213,11 +2091,11 @@ func (m *MsgUpdateBaseTokenUri) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Sender = string(dAtA[iNdEx:postIndex]) + m.Uri = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 2: + case 7: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field UriHash", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2245,13 +2123,13 @@ func (m *MsgUpdateBaseTokenUri) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ClassId = string(dAtA[iNdEx:postIndex]) + m.UriHash = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 3: + case 8: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BaseTokenUri", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -2261,23 +2139,27 @@ func (m *MsgUpdateBaseTokenUri) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - m.BaseTokenUri = string(dAtA[iNdEx:postIndex]) + if m.Data == nil { + m.Data = &types.ClassData{} + } + if err := m.Data.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex default: iNdEx = preIndex @@ -2300,7 +2182,7 @@ func (m *MsgUpdateBaseTokenUri) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgUpdateBaseTokenUriResponse) Unmarshal(dAtA []byte) error { +func (m *MsgUpdateClassResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2323,10 +2205,10 @@ func (m *MsgUpdateBaseTokenUriResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgUpdateBaseTokenUriResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgUpdateClassResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUpdateBaseTokenUriResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgUpdateClassResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -2350,7 +2232,7 @@ func (m *MsgUpdateBaseTokenUriResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgUpdateTokenSupplyCap) Unmarshal(dAtA []byte) error { +func (m *MsgMintNFT) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2373,10 +2255,10 @@ func (m *MsgUpdateTokenSupplyCap) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgUpdateTokenSupplyCap: wiretype end group for non-group") + return fmt.Errorf("proto: MsgMintNFT: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUpdateTokenSupplyCap: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgMintNFT: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -2444,10 +2326,42 @@ func (m *MsgUpdateTokenSupplyCap) Unmarshal(dAtA []byte) error { m.ClassId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TokenSupplyCap", wireType) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NftId", 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.NftId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Recipient", wireType) } - m.TokenSupplyCap = 0 + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -2457,11 +2371,24 @@ func (m *MsgUpdateTokenSupplyCap) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.TokenSupplyCap |= uint64(b&0x7F) << shift + 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.Recipient = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) @@ -2483,7 +2410,7 @@ func (m *MsgUpdateTokenSupplyCap) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgUpdateTokenSupplyCapResponse) Unmarshal(dAtA []byte) error { +func (m *MsgMintNFTResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2506,10 +2433,10 @@ func (m *MsgUpdateTokenSupplyCapResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgUpdateTokenSupplyCapResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgMintNFTResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUpdateTokenSupplyCapResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgMintNFTResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -2533,7 +2460,7 @@ func (m *MsgUpdateTokenSupplyCapResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgMintNFT) Unmarshal(dAtA []byte) error { +func (m *MsgBurnNFT) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2556,10 +2483,10 @@ func (m *MsgMintNFT) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgMintNFT: wiretype end group for non-group") + return fmt.Errorf("proto: MsgBurnNFT: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgMintNFT: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgBurnNFT: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -2658,38 +2585,6 @@ func (m *MsgMintNFT) Unmarshal(dAtA []byte) error { } m.NftId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Recipient", 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.Recipient = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) @@ -2711,7 +2606,7 @@ func (m *MsgMintNFT) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgMintNFTResponse) Unmarshal(dAtA []byte) error { +func (m *MsgBurnNFTResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2734,10 +2629,10 @@ func (m *MsgMintNFTResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgMintNFTResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgBurnNFTResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgMintNFTResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgBurnNFTResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -2761,7 +2656,7 @@ func (m *MsgMintNFTResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgBurnNFT) Unmarshal(dAtA []byte) error { +func (m *MsgChangeAdmin) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2784,10 +2679,10 @@ func (m *MsgBurnNFT) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgBurnNFT: wiretype end group for non-group") + return fmt.Errorf("proto: MsgChangeAdmin: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgBurnNFT: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgChangeAdmin: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -2856,7 +2751,7 @@ func (m *MsgBurnNFT) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field NewAdmin", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2884,7 +2779,7 @@ func (m *MsgBurnNFT) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.NftId = string(dAtA[iNdEx:postIndex]) + m.NewAdmin = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -2907,7 +2802,7 @@ func (m *MsgBurnNFT) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgBurnNFTResponse) Unmarshal(dAtA []byte) error { +func (m *MsgChangeAdminResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2930,10 +2825,10 @@ func (m *MsgBurnNFTResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgBurnNFTResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgChangeAdminResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgBurnNFTResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgChangeAdminResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: From 046b0e64320798b0476c49db5dc6c54de4fb5fff Mon Sep 17 00:00:00 2001 From: KIMURA Yu <33382781+KimuraYu45z@users.noreply.github.com> Date: Thu, 10 Aug 2023 14:02:41 +0800 Subject: [PATCH 02/20] feat: nftfactory --- x/nftfactory/client/cli/query.go | 127 +++--- x/nftfactory/genesis.go | 75 ---- x/nftfactory/keeper/admins.go | 49 +++ x/nftfactory/keeper/class.go | 332 ---------------- x/nftfactory/keeper/class_test.go | 514 ------------------------- x/nftfactory/keeper/createclass.go | 93 +++++ x/nftfactory/keeper/creators.go | 27 ++ x/nftfactory/keeper/genesis.go | 53 +++ x/nftfactory/keeper/grpc_query.go | 97 +---- x/nftfactory/keeper/keeper.go | 22 ++ x/nftfactory/keeper/nft.go | 125 ------ x/nftfactory/keeper/nft_test.go | 193 ---------- x/nftfactory/keeper/params.go | 13 +- x/nftfactory/keeper/utils.go | 25 -- x/nftfactory/module.go | 8 +- x/nftfactory/types/class.go | 26 -- x/nftfactory/types/codec.go | 2 +- x/nftfactory/types/denoms.go | 68 ++++ x/nftfactory/types/errors.go | 29 +- x/nftfactory/types/expected_keepers.go | 15 + x/nftfactory/types/genesis.go | 53 ++- x/nftfactory/types/keys.go | 42 +- x/nftfactory/types/metadata.go | 15 + x/nftfactory/types/msgs.go | 128 ++---- x/nftfactory/types/params.go | 170 ++------ x/nftfactory/types/validation.go | 139 ------- x/nftfactory/types/validation_test.go | 150 -------- 27 files changed, 556 insertions(+), 2034 deletions(-) delete mode 100644 x/nftfactory/genesis.go create mode 100644 x/nftfactory/keeper/admins.go delete mode 100644 x/nftfactory/keeper/class.go delete mode 100644 x/nftfactory/keeper/class_test.go create mode 100644 x/nftfactory/keeper/createclass.go create mode 100644 x/nftfactory/keeper/creators.go create mode 100644 x/nftfactory/keeper/genesis.go delete mode 100644 x/nftfactory/keeper/nft.go delete mode 100644 x/nftfactory/keeper/nft_test.go delete mode 100644 x/nftfactory/keeper/utils.go delete mode 100644 x/nftfactory/types/class.go create mode 100644 x/nftfactory/types/denoms.go create mode 100644 x/nftfactory/types/metadata.go delete mode 100644 x/nftfactory/types/validation.go delete mode 100644 x/nftfactory/types/validation_test.go diff --git a/x/nftfactory/client/cli/query.go b/x/nftfactory/client/cli/query.go index 0ba484408..31e9af70e 100644 --- a/x/nftfactory/client/cli/query.go +++ b/x/nftfactory/client/cli/query.go @@ -1,8 +1,8 @@ package cli import ( - "context" "fmt" + "strings" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" @@ -13,8 +13,8 @@ import ( ) // GetQueryCmd returns the cli query commands for this module -func GetQueryCmd(queryRoute string) *cobra.Command { - +func GetQueryCmd() *cobra.Command { + // Group tokenfactory queries under a subcommand cmd := &cobra.Command{ Use: types.ModuleName, Short: fmt.Sprintf("Querying commands for the %s module", types.ModuleName), @@ -24,139 +24,102 @@ func GetQueryCmd(queryRoute string) *cobra.Command { } cmd.AddCommand( - CmdQueryParams(), - CmdQueryClassAttributes(), - CmdQueryClassIdsByOwner(), - CmdQueryClassIdsByName(), - CmdQueryNFTMinter(), + GetParams(), + GetCmdClassAuthorityMetadata(), + GetCmdDenomsFromCreator(), ) return cmd } -func CmdQueryParams() *cobra.Command { +// GetParams returns the params for the module +func GetParams() *cobra.Command { cmd := &cobra.Command{ - Use: "params", - Short: "shows params", + Use: "params [flags]", + Short: "Get the params for the x/nftfactory module", Args: cobra.ExactArgs(0), - RunE: func(cmd *cobra.Command, _ []string) error { - clientCtx := client.GetClientContextFromCmd(cmd) - - queryClient := types.NewQueryClient(clientCtx) - - params := &types.QueryParamsRequest{} - - res, err := queryClient.Params(context.Background(), params) + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) if err != nil { return err } - return clientCtx.PrintProto(&res.Params) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - return cmd -} - -func CmdQueryClassAttributes() *cobra.Command { - cmd := &cobra.Command{ - Use: "class-attributes [class-id]", - Args: cobra.ExactArgs(1), - Short: "Query the class attributes by class-id", - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx := client.GetClientContextFromCmd(cmd) - queryClient := types.NewQueryClient(clientCtx) - res, err := queryClient.ClassAttributes( - context.Background(), - &types.QueryClassAttributesRequest{ClassId: args[0]}, - ) + res, err := queryClient.Params(cmd.Context(), &types.QueryParamsRequest{}) if err != nil { return err } + return clientCtx.PrintProto(res) }, } flags.AddQueryFlagsToCmd(cmd) + return cmd } -func CmdQueryClassIdsByOwner() *cobra.Command { +// GetCmdClassAuthorityMetadata returns the authority metadata for a queried denom +func GetCmdClassAuthorityMetadata() *cobra.Command { cmd := &cobra.Command{ - Use: "class-ids-by-owner [owner-address]", + Use: "class-authority-metadata [class-id] [flags]", + Short: "Get the authority metadata for a specific class id", Args: cobra.ExactArgs(1), - Short: "Query classIDs owned by the owner address", RunE: func(cmd *cobra.Command, args []string) error { - clientCtx := client.GetClientContextFromCmd(cmd) - - queryClient := types.NewQueryClient(clientCtx) - - res, err := queryClient.ClassIdsByOwner( - context.Background(), - &types.QueryClassIdsByOwnerRequest{Owner: args[0]}, - ) + clientCtx, err := client.GetClientQueryContext(cmd) if err != nil { return err } - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - return cmd -} + queryClient := types.NewQueryClient(clientCtx) -func CmdQueryClassIdsByName() *cobra.Command { - cmd := &cobra.Command{ - Use: "class-ids-by-name [class-name]", - Args: cobra.ExactArgs(1), - Short: "Query classIDs which have the class name", - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx := client.GetClientContextFromCmd(cmd) + denom := strings.Split(args[0], "/") - queryClient := types.NewQueryClient(clientCtx) + if len(denom) != 3 { + return fmt.Errorf("invalid denom format, expected format: factory/[creator]/[subdenom]") + } - res, err := queryClient.ClassIdsByName( - context.Background(), - &types.QueryClassIdsByNameRequest{ClassName: args[0]}, - ) + res, err := queryClient.ClassAuthorityMetadata(cmd.Context(), &types.QueryClassAuthorityMetadataRequest{ + Creator: denom[1], + Subclass: denom[2], + }) if err != nil { return err } + return clientCtx.PrintProto(res) }, } flags.AddQueryFlagsToCmd(cmd) + return cmd } -func CmdQueryNFTMinter() *cobra.Command { +// GetCmdDenomsFromCreator a command to get a list of all tokens created by a specific creator address +func GetCmdDenomsFromCreator() *cobra.Command { cmd := &cobra.Command{ - Use: "nft-minter [class-id] [nft-id]", - Args: cobra.ExactArgs(2), - Short: "Query nft minter with class and nft id", + Use: "classes-from-creator [creator address] [flags]", + Short: "Returns a list of all tokens created by a specific creator address", + Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) error { - clientCtx := client.GetClientContextFromCmd(cmd) - + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } queryClient := types.NewQueryClient(clientCtx) - res, err := queryClient.NFTMinter( - context.Background(), - &types.QueryNFTMinterRequest{ - ClassId: args[0], - NftId: args[1], - }, - ) + res, err := queryClient.ClassesFromCreator(cmd.Context(), &types.QueryClassesFromCreatorRequest{ + Creator: args[0], + }) if err != nil { return err } + return clientCtx.PrintProto(res) }, } flags.AddQueryFlagsToCmd(cmd) + return cmd } diff --git a/x/nftfactory/genesis.go b/x/nftfactory/genesis.go deleted file mode 100644 index 3a5034121..000000000 --- a/x/nftfactory/genesis.go +++ /dev/null @@ -1,75 +0,0 @@ -package nftfactory - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - nfttypes "github.com/cosmos/cosmos-sdk/x/nft" - - "github.com/UnUniFi/chain/x/nftfactory/keeper" - "github.com/UnUniFi/chain/x/nftfactory/types" -) - -// InitGenesis initializes the store state from a genesis state. -func InitGenesis(ctx sdk.Context, k keeper.Keeper, nftKeeper types.NftKeeper, gs types.GenesisState) { - k.SetParamSet(ctx, gs.Params) - - for _, classOwnership := range gs.ClassOwnerships { - if err := InitClassRelatingData(ctx, k, nftKeeper, classOwnership); err != nil { - panic(err) - } - } -} - -// ExportGenesis export genesis state for nftbackedloan module -func ExportGenesis(ctx sdk.Context, k keeper.Keeper) types.GenesisState { - classAttributesList := k.GetClassAttributesList(ctx) - - return types.GenesisState{ - Params: k.GetParamSet(ctx), - ClassAttributesList: classAttributesList, - } -} - -func InitClassRelatingData(ctx sdk.Context, k keeper.Keeper, nftKeeper types.NftKeeper, classAttributes types.ClassOwnership) error { - class, exists := nftKeeper.GetClass(ctx, classAttributes.ClassId) - if !exists { - return sdkerrors.Wrap(nfttypes.ErrClassNotExists, classAttributes.ClassId) - } - - params := k.GetParamSet(ctx) - if err := types.ValidateCreateClass( - params, - class.Name, class.Symbol, classAttributes.BaseTokenUri, class.Description, - classAttributes.MintingPermission, - classAttributes.TokenSupplyCap, - ); err != nil { - return err - } - - owner, err := sdk.AccAddressFromBech32(classAttributes.Owner) - if err != nil { - return err - } - - if err := k.SetClassAttributes(ctx, types.NewClassAttributes( - class.Id, - owner, - classAttributes.BaseTokenUri, - classAttributes.MintingPermission, - classAttributes.TokenSupplyCap, - )); err != nil { - return err - } - - owningClassIdList := k.AddClassIDToOwningClassIdList(ctx, owner, class.Id) - if err := k.SetOwningClassIdList(ctx, owningClassIdList); err != nil { - return err - } - - classNameIdList := k.AddClassNameIdList(ctx, class.Name, class.Id) - if err := k.SetClassNameIdList(ctx, classNameIdList); err != nil { - return err - } - - return nil -} diff --git a/x/nftfactory/keeper/admins.go b/x/nftfactory/keeper/admins.go new file mode 100644 index 000000000..84ee51be1 --- /dev/null +++ b/x/nftfactory/keeper/admins.go @@ -0,0 +1,49 @@ +package keeper + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/gogo/protobuf/proto" + + "github.com/UnUniFi/chain/x/nftfactory/types" +) + +// GetAuthorityMetadata returns the authority metadata for a specific denom +func (k Keeper) GetAuthorityMetadata(ctx sdk.Context, denom string) (types.ClassAuthorityMetadata, error) { + bz := k.GetDenomPrefixStore(ctx, denom).Get([]byte(types.ClassAuthorityMetadataKey)) + + metadata := types.ClassAuthorityMetadata{} + err := proto.Unmarshal(bz, &metadata) + if err != nil { + return types.ClassAuthorityMetadata{}, err + } + return metadata, nil +} + +// setAuthorityMetadata stores authority metadata for a specific denom +func (k Keeper) setAuthorityMetadata(ctx sdk.Context, denom string, metadata types.ClassAuthorityMetadata) error { + err := metadata.Validate() + if err != nil { + return err + } + + store := k.GetDenomPrefixStore(ctx, denom) + + bz, err := proto.Marshal(&metadata) + if err != nil { + return err + } + + store.Set([]byte(types.ClassAuthorityMetadataKey), bz) + return nil +} + +func (k Keeper) setAdmin(ctx sdk.Context, denom, admin string) error { + metadata, err := k.GetAuthorityMetadata(ctx, denom) + if err != nil { + return err + } + + metadata.Admin = admin + + return k.setAuthorityMetadata(ctx, denom, metadata) +} diff --git a/x/nftfactory/keeper/class.go b/x/nftfactory/keeper/class.go deleted file mode 100644 index 603eaff6e..000000000 --- a/x/nftfactory/keeper/class.go +++ /dev/null @@ -1,332 +0,0 @@ -package keeper - -import ( - "crypto/sha256" - "encoding/hex" - "strings" - - "github.com/cosmos/cosmos-sdk/store/prefix" - sdk "github.com/cosmos/cosmos-sdk/types" - nfttypes "github.com/cosmos/cosmos-sdk/x/nft" - - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - - "github.com/UnUniFi/chain/x/nftfactory/types" -) - -const ( - PrefixClassId = "ununifi-" - LenHashByteToHex = 32 - 20 -) - -// CreateClass does validate the contents of MsgCreateClass and operate whole flow for CreateClass message -func (k Keeper) CreateClass(ctx sdk.Context, classID string, msg *types.MsgCreateClass) error { - exists := k.nftKeeper.HasClass(ctx, classID) - if exists { - return sdkerrors.Wrap(nfttypes.ErrClassExists, classID) - } - - params := k.GetParamSet(ctx) - err := types.ValidateCreateClass( - params, - msg.Name, msg.Symbol, msg.BaseTokenUri, msg.Description, - msg.MintingPermission, - msg.TokenSupplyCap, - ) - if err != nil { - return err - } - - if err := k.nftKeeper.SaveClass(ctx, types.NewClass(classID, msg.Name, msg.Symbol, msg.Description, msg.ClassUri)); err != nil { - return err - } - - sender, err := sdk.AccAddressFromBech32(msg.Sender) - if err != nil { - return err - } - - if err = k.SetClassAttributes(ctx, types.NewClassAttributes(classID, sender, msg.BaseTokenUri, msg.MintingPermission, msg.TokenSupplyCap)); err != nil { - return err - } - - owningClassIdList := k.AddClassIDToOwningClassIdList(ctx, sender, classID) - if err = k.SetOwningClassIdList(ctx, owningClassIdList); err != nil { - return err - } - - classNameIdList := k.AddClassNameIdList(ctx, msg.Name, classID) - if err = k.SetClassNameIdList(ctx, classNameIdList); err != nil { - return err - } - - return nil -} - -// Create class id on UnUniFi using addr sequence and addr byte -func CreateClassId(num uint64, addr sdk.Address) string { - sequenceByte := UintToByte(num) - addrByte := addr.Bytes() - idByte := append(addrByte, sequenceByte...) - - idHash := sha256.Sum256(idByte) - idString := hex.EncodeToString(idHash[LenHashByteToHex:]) - classID := PrefixClassId + strings.ToUpper(idString) - - return classID -} - -// SendClassOwnership does validate the contents of MsgSendClassOwnership and operate whole flow for SendClassOwnership message -func (k Keeper) SendClassOwnership(ctx sdk.Context, msg *types.MsgSendClassOwnership) error { - if !k.nftKeeper.HasClass(ctx, msg.ClassId) { - return sdkerrors.Wrap(nfttypes.ErrClassNotExists, msg.ClassId) - } - - classAttirbutes, exists := k.GetClassAttributes(ctx, msg.ClassId) - if !exists { - return sdkerrors.Wrap(types.ErrClassAttributesNotExists, msg.ClassId) - } - - if msg.Sender != classAttirbutes.Owner { - return sdkerrors.Wrapf(sdkerrors.ErrUnauthorized, "%s is not the owner of the class", msg.Sender) - } - - classAttirbutes.Owner = msg.Recipient - if err := k.SetClassAttributes(ctx, classAttirbutes); err != nil { - return err - } - - return nil -} - -// UpdateTokenSupplyCap does validate the contents of MsgUpdateTokenSupplyCap and operate whole flow for UpdateTokenSupplyCap message -func (k Keeper) UpdateTokenSupplyCap(ctx sdk.Context, msg *types.MsgUpdateTokenSupplyCap) error { - classAttributes, exists := k.GetClassAttributes(ctx, msg.ClassId) - if !exists { - return sdkerrors.Wrap(types.ErrClassAttributesNotExists, msg.ClassId) - } - - sender, err := sdk.AccAddressFromBech32(msg.Sender) - if err != nil { - return err - } - - if err := k.IsUpgradable(ctx, sender, classAttributes); err != nil { - return err - } - - params := k.GetParamSet(ctx) - if err := types.ValidateTokenSupplyCap(params.MaxNFTSupplyCap, msg.TokenSupplyCap); err != nil { - return err - } - currentSupply := k.nftKeeper.GetTotalSupply(ctx, msg.ClassId) - if err := types.ValidateTokenSupply(currentSupply, msg.TokenSupplyCap); err != nil { - return err - } - - classAttributes.TokenSupplyCap = msg.TokenSupplyCap - if err := k.SetClassAttributes(ctx, classAttributes); err != nil { - return err - } - - return nil -} - -// UpdateBaseTokenUri does validate the contents of MsgUpdateBaseTokenUri and operate whole flow for UpdateBaseTokenUri message -func (k Keeper) UpdateBaseTokenUri(ctx sdk.Context, msg *types.MsgUpdateBaseTokenUri) error { - classAttributes, exists := k.GetClassAttributes(ctx, msg.ClassId) - if !exists { - return sdkerrors.Wrap(types.ErrClassAttributesNotExists, msg.ClassId) - } - - sender, err := sdk.AccAddressFromBech32(msg.Sender) - if err != nil { - return err - } - - if err := k.IsUpgradable(ctx, sender, classAttributes); err != nil { - return err - } - - params := k.GetParamSet(ctx) - if err := types.ValidateUri(params.MinUriLen, params.MaxUriLen, msg.BaseTokenUri); err != nil { - return err - } - - classAttributes.BaseTokenUri = msg.BaseTokenUri - if err := k.SetClassAttributes(ctx, classAttributes); err != nil { - return err - } - - if err := k.UpdateNFTUri(ctx, classAttributes.ClassId, classAttributes.BaseTokenUri); err != nil { - return err - } - - return nil -} - -// check if update relating messages are permitted -func (k Keeper) IsUpgradable(ctx sdk.Context, sender sdk.AccAddress, classAttributes types.ClassAttributes) error { - if exists := k.nftKeeper.HasClass(ctx, classAttributes.ClassId); !exists { - return sdkerrors.Wrap(nfttypes.ErrClassNotExists, classAttributes.ClassId) - } - - if sender.String() != classAttributes.Owner { - return sdkerrors.Wrapf(sdkerrors.ErrUnauthorized, "%s is not the owner of the class", sender.String()) - } - - return nil -} - -func (k Keeper) SetClassAttributes(ctx sdk.Context, classAttributes types.ClassAttributes) error { - bz, err := k.cdc.Marshal(&classAttributes) - if err != nil { - return sdkerrors.Wrap(err, "Marshal nftmint.ClassAttributes failed") - } - store := ctx.KVStore(k.storeKey) - prefixStore := prefix.NewStore(store, []byte(types.KeyPrefixClassAttributes)) - prefixStore.Set([]byte(classAttributes.ClassId), bz) - return nil -} - -func (k Keeper) SetOwningClassIdList(ctx sdk.Context, owningClassIdList types.OwningClassIdList) error { - store := ctx.KVStore(k.storeKey) - prefixStore := prefix.NewStore(store, types.KeyPrefixOwningClassIdList) - - bz, err := k.cdc.Marshal(&owningClassIdList) - if err != nil { - return sdkerrors.Wrap(err, "Marshal nftmint.OwningClassIdList failed") - } - - owner, err := sdk.AccAddressFromBech32(owningClassIdList.Owner) - if err != nil { - return err - } - - owningClassIdListKey := types.OwningClassIdListKey(owner) - prefixStore.Set(owningClassIdListKey, bz) - return nil -} - -func (k Keeper) SetClassNameIdList(ctx sdk.Context, classNameIdList types.ClassNameIdList) error { - store := ctx.KVStore(k.storeKey) - prefixStore := prefix.NewStore(store, types.KeyPrefixClassNameIdList) - - bz, err := k.cdc.Marshal(&classNameIdList) - if err != nil { - return sdkerrors.Wrap(err, "Marshal nftmint.ClassNameIdList failed") - } - prefixStore.Set([]byte(classNameIdList.ClassName), bz) - return nil -} - -func (k Keeper) GetClassAttributes(ctx sdk.Context, classID string) (types.ClassAttributes, bool) { - store := ctx.KVStore(k.storeKey) - prefixStore := prefix.NewStore(store, types.KeyPrefixClassAttributes) - - bz := prefixStore.Get([]byte(classID)) - if bz == nil { - return types.ClassAttributes{}, false - } - var classAttributes types.ClassAttributes - k.cdc.MustUnmarshal(bz, &classAttributes) - return classAttributes, true -} - -func (k Keeper) GetOwningClassIdList(ctx sdk.Context, owner sdk.AccAddress) (types.OwningClassIdList, bool) { - store := ctx.KVStore(k.storeKey) - prefixStore := prefix.NewStore(store, types.KeyPrefixOwningClassIdList) - - var owningClassIdList types.OwningClassIdList - bz := prefixStore.Get(owner.Bytes()) - if bz == nil { - return types.OwningClassIdList{}, false - } - k.cdc.MustUnmarshal(bz, &owningClassIdList) - return owningClassIdList, true -} - -func (k Keeper) GetClassNameIdList(ctx sdk.Context, className string) (types.ClassNameIdList, bool) { - store := ctx.KVStore(k.storeKey) - prefixStore := prefix.NewStore(store, types.KeyPrefixClassNameIdList) - - var classNameIdList types.ClassNameIdList - bz := prefixStore.Get([]byte(className)) - if bz == nil { - return types.ClassNameIdList{}, false - } - k.cdc.MustUnmarshal(bz, &classNameIdList) - return classNameIdList, true -} - -func (k Keeper) GetClassAttributesList(ctx sdk.Context) (classAttributesList []types.ClassAttributes) { - store := ctx.KVStore(k.storeKey) - iterator := sdk.KVStorePrefixIterator(store, types.KeyPrefixClassAttributes) - defer iterator.Close() - for ; iterator.Valid(); iterator.Next() { - var classAttributes types.ClassAttributes - k.cdc.MustUnmarshal(iterator.Value(), &classAttributes) - classAttributesList = append(classAttributesList, classAttributes) - } - - return -} - -func (k Keeper) GetOwningClassIdLists(ctx sdk.Context) (owningClassIdLists []*types.OwningClassIdList) { - store := ctx.KVStore(k.storeKey) - iterator := sdk.KVStorePrefixIterator(store, types.KeyPrefixOwningClassIdList) - defer iterator.Close() - for ; iterator.Valid(); iterator.Next() { - var owningClassIdList types.OwningClassIdList - k.cdc.MustUnmarshal(iterator.Value(), &owningClassIdList) - owningClassIdLists = append(owningClassIdLists, &owningClassIdList) - } - - return -} - -func (k Keeper) GetClassNameIdLists(ctx sdk.Context) (classNameIdLists []*types.ClassNameIdList) { - store := ctx.KVStore(k.storeKey) - iterator := sdk.KVStorePrefixIterator(store, types.KeyPrefixClassNameIdList) - defer iterator.Close() - for ; iterator.Valid(); iterator.Next() { - var classNameIdList types.ClassNameIdList - k.cdc.MustUnmarshal(iterator.Value(), &classNameIdList) - classNameIdLists = append(classNameIdLists, &classNameIdList) - } - - return -} - -func (k Keeper) AddClassIDToOwningClassIdList(ctx sdk.Context, owner sdk.AccAddress, classID string) types.OwningClassIdList { - owningClassIdList, exists := k.GetOwningClassIdList(ctx, owner) - if !exists { - owningClassIdList = types.NewOwningClassIdList(owner) - } - owningClassIdList.ClassId = append(owningClassIdList.ClassId, classID) - return owningClassIdList -} - -func (k Keeper) AddClassNameIdList(ctx sdk.Context, className string, classID string) types.ClassNameIdList { - classNameIdList, exists := k.GetClassNameIdList(ctx, className) - if !exists { - classNameIdList = types.NewClassNameIdList(className) - } - classNameIdList.ClassId = append(classNameIdList.ClassId, classID) - return classNameIdList -} - -func (k Keeper) DeleteClassIDInOwningClassList(ctx sdk.Context, owner sdk.AccAddress, classID string) error { - owningClassIdList, exists := k.GetOwningClassIdList(ctx, owner) - if !exists { - return sdkerrors.Wrap(types.ErrOwningClassIdListNotExists, owner.String()) - } - - index := SliceIndex(owningClassIdList.ClassId, classID) - if index == -1 { - return sdkerrors.Wrap(types.ErrIndexNotFoundInOwningClassIDs, classID) - } - - owningClassIdList.ClassId = RemoveIndex(owningClassIdList.ClassId, index) - return nil -} diff --git a/x/nftfactory/keeper/class_test.go b/x/nftfactory/keeper/class_test.go deleted file mode 100644 index db016ecd4..000000000 --- a/x/nftfactory/keeper/class_test.go +++ /dev/null @@ -1,514 +0,0 @@ -package keeper_test - -import ( - "testing" - - "github.com/cometbft/cometbft/crypto/ed25519" - sdk "github.com/cosmos/cosmos-sdk/types" - nfttypes "github.com/cosmos/cosmos-sdk/x/nft" - "github.com/stretchr/testify/require" - - "github.com/UnUniFi/chain/x/nftfactory/keeper" - "github.com/UnUniFi/chain/x/nftfactory/types" -) - -const ( - testName = "test" - testBaseTokenUri = "ipfs://testcid-sample/" - testTokenSupplyCap = 10000 - testMintingPermission = 0 - testNftID = "a00" -) - -// test basic functions of nftmint -func (suite *KeeperTestSuite) TestNftMintClassBasics() { - owner := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().String()) - owner_seq, _ := suite.accountKeeper.GetSequence(suite.ctx, owner) - - classId := keeper.CreateClassId(owner_seq, owner) - - // test relating ClassAttributes - classAttributes := types.ClassAttributes{ - ClassId: classId, - } - // check setting ClassAttributes function - err := suite.nftmintKeeper.SetClassAttributes(suite.ctx, classAttributes) - suite.Require().NoError(err) - // check getting ClassAttributes function - gotClassAttributes, exists := suite.nftmintKeeper.GetClassAttributes(suite.ctx, classAttributes.ClassId) - suite.Require().True(exists) - suite.Require().Equal(classAttributes, gotClassAttributes) - - // test relating OwningClassIdList - var classIdList []string - classIdList = append(classIdList, classId) - owningClassIdList := types.OwningClassIdList{ - Owner: owner.String(), - ClassId: classIdList, - } - // check setting OwningClassIdList function - err = suite.nftmintKeeper.SetOwningClassIdList(suite.ctx, owningClassIdList) - suite.Require().NoError(err) - // check getting OwningClassIdList function - gotOwningClassIdList, exists := suite.nftmintKeeper.GetOwningClassIdList(suite.ctx, owner) - suite.Require().True(exists) - suite.Require().Equal(owningClassIdList, gotOwningClassIdList) - - // test relating ClassNameIdList - testClassName := "test" - classNameIdList := types.ClassNameIdList{ - ClassName: testClassName, - ClassId: classIdList, - } - // check setting ClassNameIdList function - err = suite.nftmintKeeper.SetClassNameIdList(suite.ctx, classNameIdList) - suite.Require().NoError(err) - // check getting ClassNameIdList function - gotClassNameIdList, exists := suite.nftmintKeeper.GetClassNameIdList(suite.ctx, testClassName) - suite.Require().True(exists) - suite.Require().Equal(classNameIdList, gotClassNameIdList) -} - -// test of the method to create a class.Id -func TestCreateId(t *testing.T) { - var seq uint64 = 0 - addr := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address()) - accAddr, _ := sdk.AccAddressFromBech32(addr.String()) - classIdSeq0 := keeper.CreateClassId(seq, accAddr) - err := types.ValidateClassID(classIdSeq0) - require.NoError(t, err) - - // add one to imitate actual account sequence transition of the expected situation - seq += 1 - classIdSeq1 := keeper.CreateClassId(seq, accAddr) - require.NoError(t, err) - require.NotEqual(t, classIdSeq0, classIdSeq1) -} - -// test for the CreateClass relating functions -func (suite *KeeperTestSuite) TestCreateClass() { - sender := suite.addrs[0] - sender_seq, _ := suite.accountKeeper.GetSequence(suite.ctx, sender) - classId := keeper.CreateClassId(sender_seq, sender) - err := suite.CreateClass(suite.ctx, classId, sender) - suite.Require().NoError(err) - - // check if Class is set - class, exists := suite.nftKeeper.GetClass(suite.ctx, classId) - suite.Require().True(exists) - expectedClass := nfttypes.Class{ - Id: classId, - Name: testName, - } - suite.Require().Equal(class, expectedClass) - - // check if ClassAttributes is set - classAttributes, exists := suite.nftmintKeeper.GetClassAttributes(suite.ctx, classId) - suite.Require().True(exists) - expectedClassAttributes := types.ClassAttributes{ - ClassId: classId, - Owner: sender.String(), - BaseTokenUri: testBaseTokenUri, - MintingPermission: testMintingPermission, - TokenSupplyCap: testTokenSupplyCap, - } - suite.Require().Equal(classAttributes, expectedClassAttributes) - - // check if OwningClassIdList is set - owningClassIdList, exists := suite.nftmintKeeper.GetOwningClassIdList(suite.ctx, sender) - suite.Require().True(exists) - var classIdList []string - classIdList = append(classIdList, classId) - expectedOwningClassIdList := types.OwningClassIdList{ - Owner: sender.String(), - ClassId: classIdList, - } - suite.Require().Equal(owningClassIdList, expectedOwningClassIdList) - - // check if ClassNameIdList is set - classNameIdList, exists := suite.nftmintKeeper.GetClassNameIdList(suite.ctx, testName) - suite.Require().True(exists) - expectedClassNameIdList := types.ClassNameIdList{ - ClassName: testName, - ClassId: classIdList, - } - suite.Require().Equal(classNameIdList, expectedClassNameIdList) - - senderInInvalidCase := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().String()) - senderInInvalidCase_seq, _ := suite.accountKeeper.GetSequence(suite.ctx, senderInInvalidCase) - classIdInInvalidCase := keeper.CreateClassId(senderInInvalidCase_seq, senderInInvalidCase) - // in case which contains the invalid name - testMsgCreateClassInvalidName := types.MsgCreateClass{ - Sender: senderInInvalidCase.String(), - Name: "t", // shorter than the minimum length defined on UnUniFi - BaseTokenUri: testBaseTokenUri, - TokenSupplyCap: testTokenSupplyCap, - MintingPermission: testMintingPermission, - } - err = suite.nftmintKeeper.CreateClass(suite.ctx, classIdInInvalidCase, &testMsgCreateClassInvalidName) - suite.Require().Error(err) - - // check if data objects aren't set - exists = suite.nftKeeper.HasClass(suite.ctx, classIdInInvalidCase) - suite.Require().False(exists) - _, exists = suite.nftmintKeeper.GetClassAttributes(suite.ctx, classIdInInvalidCase) - suite.Require().False(exists) - _, exists = suite.nftmintKeeper.GetOwningClassIdList(suite.ctx, senderInInvalidCase) - suite.Require().False(exists) - _, exists = suite.nftmintKeeper.GetClassNameIdList(suite.ctx, testMsgCreateClassInvalidName.Name) - suite.Require().False(exists) - - // in case which contains the invalid uri - testMsgCreateClassInvalidUri := types.MsgCreateClass{ - Sender: sender.String(), - Name: testName, - BaseTokenUri: "ipfs", // shorter than the minimum length defined on UnUniFi - TokenSupplyCap: testTokenSupplyCap, - MintingPermission: testMintingPermission, - } - err = suite.nftmintKeeper.CreateClass(suite.ctx, classIdInInvalidCase, &testMsgCreateClassInvalidUri) - suite.Require().Error(err) - - // in case which contains the invalid token supply cap - testMsgCreateClassInvalidTokenSupplyCap := types.MsgCreateClass{ - Sender: sender.String(), - Name: testName, - BaseTokenUri: testBaseTokenUri, - TokenSupplyCap: 10000000, // bigger than the token supply cap - MintingPermission: 0, - } - err = suite.nftmintKeeper.CreateClass(suite.ctx, classIdInInvalidCase, &testMsgCreateClassInvalidTokenSupplyCap) - suite.Require().Error(err) - - // in case which contains the invalid minting permission - testMsgCreateClassInvalidMintingPermission := types.MsgCreateClass{ - Sender: sender.String(), - Name: testName, - BaseTokenUri: testBaseTokenUri, - TokenSupplyCap: 10000, - MintingPermission: 10, // not allowed minting permission option - } - err = suite.nftmintKeeper.CreateClass(suite.ctx, classIdInInvalidCase, &testMsgCreateClassInvalidMintingPermission) - suite.Require().Error(err) -} - -// test for the SendClassOwnership relating functions -func (suite *KeeperTestSuite) TestSendClassOwnership() { - sender := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().String()) - sender_seq, _ := suite.accountKeeper.GetSequence(suite.ctx, sender) - classId := keeper.CreateClassId(sender_seq, sender) - _ = suite.CreateClass(suite.ctx, classId, sender) - - recipient := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().String()) - - testMsgSendClassOwnership := types.MsgSendClassOwnership{ - Sender: sender.String(), - ClassId: classId, - Recipient: recipient.String(), - } - err := suite.nftmintKeeper.SendClassOwnership(suite.ctx, &testMsgSendClassOwnership) - suite.Require().NoError(err) - // check if recipient address becomes new owner of class - classAttributes, exists := suite.nftmintKeeper.GetClassAttributes(suite.ctx, classId) - suite.Require().True(exists) - expectedOwner := recipient - suite.Require().Equal(expectedOwner, classAttributes.Owner) - - // invalid sender of MsgSendClassOwnership - invalidSender := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().String()) - - testMsgSendClassOwnershipInvalidSender := types.MsgSendClassOwnership{ - Sender: invalidSender.String(), // not the owner of class - ClassId: classId, - Recipient: recipient.String(), - } - err = suite.nftmintKeeper.SendClassOwnership(suite.ctx, &testMsgSendClassOwnershipInvalidSender) - suite.Require().Error(err) - - // invalid class id specification - invalidClassId := "nonexistance" - testMsgCreateClassInvalidClassId := types.MsgSendClassOwnership{ - Sender: sender.String(), - ClassId: invalidClassId, // non-existant class - Recipient: recipient.String(), - } - err = suite.nftmintKeeper.SendClassOwnership(suite.ctx, &testMsgCreateClassInvalidClassId) - suite.Require().Error(err) -} - -// test for the UpdateTokenSupplyCap relating functions -func (suite *KeeperTestSuite) TestUpdateTokenSupplyCap() { - sender := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().String()) - sender_seq, _ := suite.accountKeeper.GetSequence(suite.ctx, sender) - classId := keeper.CreateClassId(sender_seq, sender) - _ = suite.CreateClass(suite.ctx, classId, sender) - - var updatingTokenSupplyCap uint64 = 100 - testMsgUpdateTokenSupplyCap := types.MsgUpdateTokenSupplyCap{ - Sender: sender.String(), - ClassId: classId, - TokenSupplyCap: updatingTokenSupplyCap, - } - err := suite.nftmintKeeper.UpdateTokenSupplyCap(suite.ctx, &testMsgUpdateTokenSupplyCap) - suite.Require().NoError(err) - classAttributes, exists := suite.nftmintKeeper.GetClassAttributes(suite.ctx, classId) - suite.Require().True(exists) - expectedTokenSupplyCap := updatingTokenSupplyCap - suite.Require().Equal(expectedTokenSupplyCap, classAttributes.TokenSupplyCap) - - // invalid sender of MsgUpdateTokenSupplyCap - invalidSender := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().String()) - - testMsgUpdateTokenSupplyCapInvalidSender := types.MsgUpdateTokenSupplyCap{ - Sender: invalidSender.String(), // not the owner of class - ClassId: classId, - TokenSupplyCap: 100, - } - err = suite.nftmintKeeper.UpdateTokenSupplyCap(suite.ctx, &testMsgUpdateTokenSupplyCapInvalidSender) - suite.Require().Error(err) - - // invalid token supply cap specification - testMsgUpdateTokenSupplyCapInvalidCap := types.MsgUpdateTokenSupplyCap{ - Sender: sender.String(), - ClassId: classId, - TokenSupplyCap: 1000000, // bigger than the maximum token supply cap on UnUniFi - } - err = suite.nftmintKeeper.UpdateTokenSupplyCap(suite.ctx, &testMsgUpdateTokenSupplyCapInvalidCap) - suite.Require().Error(err) - - // invalid case which current token supply is bigger than the updating supply cap - _ = suite.nftKeeper.Mint(suite.ctx, nfttypes.NFT{ClassId: classId, Id: "a00"}, sender) - _ = suite.nftKeeper.Mint(suite.ctx, nfttypes.NFT{ClassId: classId, Id: "a01"}, sender) - testMsgUpdateTokenSupplyCapSmaller := types.MsgUpdateTokenSupplyCap{ - Sender: sender.String(), - ClassId: classId, - TokenSupplyCap: 1, // smaller than the current token supply 2 of the specified class - } - err = suite.nftmintKeeper.UpdateTokenSupplyCap(suite.ctx, &testMsgUpdateTokenSupplyCapSmaller) - suite.Require().Error(err) -} - -// test for the UpdateBaseTokenUri relating functions -func (suite *KeeperTestSuite) TestUpdateBaseTokenUri() { - sender := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().String()) - sender_seq, _ := suite.accountKeeper.GetSequence(suite.ctx, sender) - classId := keeper.CreateClassId(sender_seq, sender) - _ = suite.CreateClass(suite.ctx, classId, sender) - _ = suite.MintNFT(suite.ctx, classId, testNftID, sender) - - invalidSender := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().String()) - var baseTokenUriInvalidLonger string - for i := 0; i <= types.DefaultMaxUriLen; i++ { - baseTokenUriInvalidLonger += "a" - } - - tests := []struct { - testCase string - msg types.MsgUpdateBaseTokenUri - validSender bool - validBaseTokenUir bool - }{ - { - testCase: "invalid sender", - msg: types.MsgUpdateBaseTokenUri{ - Sender: invalidSender.String(), // not the owner of class - ClassId: classId, - BaseTokenUri: "ipfs://testcid-sample-latest/", - }, - validSender: false, - validBaseTokenUir: true, - }, - { - testCase: "updating BaseTokenUri is longer than the maximum length on UnUniFi", - msg: types.MsgUpdateBaseTokenUri{ - Sender: sender.String(), - ClassId: classId, - BaseTokenUri: baseTokenUriInvalidLonger, - }, - validSender: true, - validBaseTokenUir: false, - }, - { - testCase: "updating BaseTokenUri is longer than the maximum length on UnUniFi", - msg: types.MsgUpdateBaseTokenUri{ - Sender: sender.String(), - ClassId: classId, - BaseTokenUri: "t", - }, - validSender: true, - validBaseTokenUir: false, - }, - { - testCase: "successful case", - msg: types.MsgUpdateBaseTokenUri{ - Sender: sender.String(), - ClassId: classId, - BaseTokenUri: "ipfs://testcid-sample-latest/", - }, - validSender: true, - validBaseTokenUir: true, - }, - } - - for _, tc := range tests { - err := suite.nftmintKeeper.UpdateBaseTokenUri(suite.ctx, &tc.msg) - - // invalid cases - if !tc.validSender || !tc.validBaseTokenUir { - suite.Require().Error(err) - gotClassAttributes, _ := suite.nftmintKeeper.GetClassAttributes(suite.ctx, classId) - suite.Require().Equal(testBaseTokenUri, gotClassAttributes.BaseTokenUri) - nft, _ := suite.nftKeeper.GetNFT(suite.ctx, classId, testNftID) - expectedNFTUri := testBaseTokenUri + testNFTId - suite.Require().Equal(expectedNFTUri, nft.Uri) - } - - // valid case - if tc.validSender && tc.validBaseTokenUir { - suite.Require().NoError(err) - gotClassAttributes, _ := suite.nftmintKeeper.GetClassAttributes(suite.ctx, classId) - suite.Require().Equal(tc.msg.BaseTokenUri, gotClassAttributes.BaseTokenUri) - nft, _ := suite.nftKeeper.GetNFT(suite.ctx, classId, testNftID) - expectedNFTUri := tc.msg.BaseTokenUri + testNftID - suite.Require().Equal(expectedNFTUri, nft.Uri) - } - } -} - -// execute CreateClass as the common function -func (suite *KeeperTestSuite) CreateClass(ctx sdk.Context, classID string, sender sdk.AccAddress) error { - testMsgCreateClass := types.MsgCreateClass{ - Sender: sender.String(), - Name: testName, - BaseTokenUri: testBaseTokenUri, - TokenSupplyCap: testTokenSupplyCap, - MintingPermission: testMintingPermission, - } - - err := suite.nftmintKeeper.CreateClass(ctx, classID, &testMsgCreateClass) - return err -} - -// test for the GetClassAttributes relating functions -func (suite *KeeperTestSuite) TestGetClassAttributes() { - owner := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().String()) - owner_seq, _ := suite.accountKeeper.GetSequence(suite.ctx, owner) - classId := keeper.CreateClassId(owner_seq, owner) - _ = suite.CreateClass(suite.ctx, classId, owner) - - tests := []struct { - testCase string - classId string - validClass bool - }{ - { - testCase: "invalid class name", - classId: "invalid_class_id", - validClass: false, - }, - { - testCase: "successful case", - classId: classId, - validClass: true, - }, - } - for _, tc := range tests { - res, valid := suite.nftmintKeeper.GetClassAttributes(suite.ctx, tc.classId) - - // invalid cases - if !tc.validClass { - suite.Require().False(valid) - suite.Require().Equal(res.ClassId, "") - } - - // valid case - if tc.validClass { - suite.Require().True(valid) - suite.Require().Equal(res.ClassId, classId) - suite.Require().Equal(res.Owner, owner) - } - } -} - -// test for the GetOwningClassIdList relating functions -func (suite *KeeperTestSuite) TestGetOwningClassIdList() { - owner := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().String()) - owner_seq, _ := suite.accountKeeper.GetSequence(suite.ctx, owner) - classId := keeper.CreateClassId(owner_seq, owner) - _ = suite.CreateClass(suite.ctx, classId, owner) - - invalidOwner := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().String()) - - tests := []struct { - testCase string - ownerAddress sdk.AccAddress - validOwner bool - }{ - { - testCase: "invalid sender", - ownerAddress: invalidOwner, - validOwner: false, - }, - { - testCase: "successful case", - ownerAddress: owner, - validOwner: true, - }, - } - for _, tc := range tests { - res, valid := suite.nftmintKeeper.GetOwningClassIdList(suite.ctx, tc.ownerAddress) - - // invalid cases - if !tc.validOwner { - suite.Require().False(valid) - suite.Require().Equal(len(res.ClassId), 0) - } - - // valid case - if tc.validOwner { - suite.Require().True(valid) - suite.Require().Equal(res.Owner, tc.ownerAddress) - suite.Require().Equal(res.ClassId[0], classId) - } - } -} - -// test for the GetClassNameIdList relating functions -func (suite *KeeperTestSuite) TestGetClassNameIdList() { - owner := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().String()) - owner_seq, _ := suite.accountKeeper.GetSequence(suite.ctx, owner) - classId := keeper.CreateClassId(owner_seq, owner) - _ = suite.CreateClass(suite.ctx, classId, owner) - - tests := []struct { - testCase string - className string - validClass bool - }{ - { - testCase: "invalid class name", - className: "invalid_class", - validClass: false, - }, - { - testCase: "successful case", - className: testName, - validClass: true, - }, - } - for _, tc := range tests { - res, valid := suite.nftmintKeeper.GetClassNameIdList(suite.ctx, tc.className) - - // invalid cases - if !tc.validClass { - suite.Require().False(valid) - suite.Require().Equal(len(res.ClassId), 0) - } - - // valid case - if tc.validClass { - suite.Require().True(valid) - suite.Require().Equal(res.ClassId[0], classId) - } - } -} diff --git a/x/nftfactory/keeper/createclass.go b/x/nftfactory/keeper/createclass.go new file mode 100644 index 000000000..bb92df3c2 --- /dev/null +++ b/x/nftfactory/keeper/createclass.go @@ -0,0 +1,93 @@ +package keeper + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + + "github.com/cosmos/cosmos-sdk/x/nft" + + "github.com/UnUniFi/chain/x/nftfactory/types" +) + +// CreateClass creates new class id with `nftfactory/{creatorAddr}/{subdenom}` name. +// Charges creatorAddr fee for creation +func (k Keeper) CreateClass(ctx sdk.Context, creatorAddr, subdenom string) (newTokenDenom string, err error) { + err = k.chargeFeeForDenomCreation(ctx, creatorAddr) + if err != nil { + return "", sdkerrors.Wrapf(types.ErrUnableToCharge, "class fee collection error: %v", err) + } + + denom, err := k.validateCreateDenom(ctx, creatorAddr, subdenom) + if err != nil { + return "", sdkerrors.Wrapf(types.ErrInvalidClassId, "class id validation error: %v", err) + } + + err = k.createClassAfterValidation(ctx, creatorAddr, denom) + if err != nil { + return "", sdkerrors.Wrap(err, "create class after validation error") + } + + return denom, nil +} + +// Runs CreateClass logic after the charge and all denom validation has been handled. +// Made into a second function for genesis initialization. +func (k Keeper) createClassAfterValidation(ctx sdk.Context, creatorAddr, classId string) (err error) { + k.nftKeeper.SaveClass(ctx, nft.Class{}) + + authorityMetadata := types.ClassAuthorityMetadata{ + Admin: creatorAddr, + } + err = k.setAuthorityMetadata(ctx, classId, authorityMetadata) + if err != nil { + return sdkerrors.Wrapf(types.ErrInvalidAuthorityMetadata, "unable to set authority metadata: %v", err) + } + + k.addDenomFromCreator(ctx, creatorAddr, classId) + return nil +} + +func (k Keeper) validateCreateDenom(ctx sdk.Context, creatorAddr, subclass string) (newClassId string, err error) { + + denom, err := types.GetClassId(creatorAddr, subclass) + if err != nil { + return "", sdkerrors.Wrapf(types.ErrInvalidClassId, "invalid class id: %v", err) + } + + _, found := k.nftKeeper.GetClass(ctx, denom) + if found { + return "", types.ErrClassExists + } + + return denom, nil +} + +func (k Keeper) chargeFeeForDenomCreation(ctx sdk.Context, creatorAddr string) (err error) { + // Send creation fee to community pool + creationFee := k.GetParams(ctx).ClassCreationFee + accAddr, err := sdk.AccAddressFromBech32(creatorAddr) + if err != nil { + return sdkerrors.Wrapf(types.ErrUnableToCharge, "wrong creator address: %v", err) + } + + params := k.GetParams(ctx) + + if len(creationFee) > 0 { + feeCollectorAddr, err := sdk.AccAddressFromBech32(params.FeeCollectorAddress) + if err != nil { + return sdkerrors.Wrapf(types.ErrUnableToCharge, "wrong fee collector address: %v", err) + } + + err = k.bankKeeper.SendCoins( + ctx, + accAddr, feeCollectorAddr, + creationFee, + ) + + if err != nil { + return sdkerrors.Wrap(err, "unable to send coins to fee collector") + } + } + + return nil +} diff --git a/x/nftfactory/keeper/creators.go b/x/nftfactory/keeper/creators.go new file mode 100644 index 000000000..c3145474e --- /dev/null +++ b/x/nftfactory/keeper/creators.go @@ -0,0 +1,27 @@ +package keeper + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" +) + +func (k Keeper) addDenomFromCreator(ctx sdk.Context, creator, denom string) { + store := k.GetCreatorPrefixStore(ctx, creator) + store.Set([]byte(denom), []byte(denom)) +} + +func (k Keeper) getDenomsFromCreator(ctx sdk.Context, creator string) []string { + store := k.GetCreatorPrefixStore(ctx, creator) + + iterator := store.Iterator(nil, nil) + defer iterator.Close() + + denoms := []string{} + for ; iterator.Valid(); iterator.Next() { + denoms = append(denoms, string(iterator.Key())) + } + return denoms +} + +func (k Keeper) GetAllDenomsIterator(ctx sdk.Context) sdk.Iterator { + return k.GetCreatorsPrefixStore(ctx).Iterator(nil, nil) +} diff --git a/x/nftfactory/keeper/genesis.go b/x/nftfactory/keeper/genesis.go new file mode 100644 index 000000000..6aad34f79 --- /dev/null +++ b/x/nftfactory/keeper/genesis.go @@ -0,0 +1,53 @@ +package keeper + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/UnUniFi/chain/x/nftfactory/types" +) + +// InitGenesis initializes the tokenfactory module's state from a provided genesis +// state. +func (k Keeper) InitGenesis(ctx sdk.Context, genState types.GenesisState) { + k.SetParams(ctx, genState.Params) + + for _, genClass := range genState.GetClasses() { + creator, _, err := types.DeconstructDenom(genClass.GetClassId()) + if err != nil { + panic(err) + } + err = k.createClassAfterValidation(ctx, creator, genClass.GetClassId()) + if err != nil { + panic(err) + } + err = k.setAuthorityMetadata(ctx, genClass.GetClassId(), genClass.GetAuthorityMetadata()) + if err != nil { + panic(err) + } + } +} + +// ExportGenesis returns the tokenfactory module's exported genesis. +func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState { + genClasses := []types.GenesisClass{} + iterator := k.GetAllDenomsIterator(ctx) + defer iterator.Close() + for ; iterator.Valid(); iterator.Next() { + class := string(iterator.Value()) + + authorityMetadata, err := k.GetAuthorityMetadata(ctx, class) + if err != nil { + panic(err) + } + + genClasses = append(genClasses, types.GenesisClass{ + ClassId: class, + AuthorityMetadata: authorityMetadata, + }) + } + + return &types.GenesisState{ + Classes: genClasses, + Params: k.GetParams(ctx), + } +} diff --git a/x/nftfactory/keeper/grpc_query.go b/x/nftfactory/keeper/grpc_query.go index 891a00a95..27764d7f7 100644 --- a/x/nftfactory/keeper/grpc_query.go +++ b/x/nftfactory/keeper/grpc_query.go @@ -2,104 +2,37 @@ package keeper import ( "context" + "fmt" sdk "github.com/cosmos/cosmos-sdk/types" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" "github.com/UnUniFi/chain/x/nftfactory/types" - - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - nfttypes "github.com/cosmos/cosmos-sdk/x/nft" ) var _ types.QueryServer = Keeper{} -func (k Keeper) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid argument") - } - - ctx := sdk.UnwrapSDKContext(c) - return &types.QueryParamsResponse{ - Params: k.GetParamSet(ctx), - }, nil -} - -func (k Keeper) ClassAttributes(c context.Context, req *types.QueryClassAttributesRequest) (*types.QueryClassAttributesResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid argument") - } - - if err := types.ValidateClassID(req.ClassId); err != nil { - return nil, err - } +func (k Keeper) Params(ctx context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { + sdkCtx := sdk.UnwrapSDKContext(ctx) + params := k.GetParams(sdkCtx) - ctx := sdk.UnwrapSDKContext(c) - classAttributes, found := k.GetClassAttributes(ctx, req.ClassId) - if !found { - return nil, sdkerrors.Wrap(nfttypes.ErrClassNotExists, "class which has that class id doesn't exist") - } - return &types.QueryClassAttributesResponse{ - ClassAttributes: &classAttributes, - }, nil + return &types.QueryParamsResponse{Params: params}, nil } -func (k Keeper) NFTMinter(c context.Context, req *types.QueryNFTMinterRequest) (*types.QueryNFTMinterResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid argument") - } - - if err := types.ValidateClassID(req.ClassId); err != nil { - return nil, err - } - if err := types.ValidateNFTID(req.NftId); err != nil { - return nil, err - } - - ctx := sdk.UnwrapSDKContext(c) - nftMinter, exists := k.GetNFTMinter(ctx, req.ClassId, req.NftId) - if !exists { - return nil, sdkerrors.Wrapf(types.ErrNftAttributesNotExists, "NftAttributes with this %s class and %s nft id doesn't exist", req.ClassId, req.NftId) - } +func (k Keeper) ClassAuthorityMetadata(ctx context.Context, req *types.QueryClassAuthorityMetadataRequest) (*types.QueryClassAuthorityMetadataResponse, error) { + sdkCtx := sdk.UnwrapSDKContext(ctx) - return &types.QueryNFTMinterResponse{ - Minter: nftMinter.String(), - }, nil -} + class_id := fmt.Sprintf("nftfactory/%s/%s", req.GetCreator(), req.GetSubclass()) -func (k Keeper) ClassIdsByName(c context.Context, req *types.QueryClassIdsByNameRequest) (*types.QueryClassIdsByNameResponse, error) { - ctx := sdk.UnwrapSDKContext(c) - params := k.GetParamSet(ctx) - if err := types.ValidateClassName(params.MinClassNameLen, params.MaxClassNameLen, req.ClassName); err != nil { + authorityMetadata, err := k.GetAuthorityMetadata(sdkCtx, class_id) + if err != nil { return nil, err } - classNameIdList, exists := k.GetClassNameIdList(ctx, req.ClassName) - if !exists { - return nil, sdkerrors.Wrap(types.ErrClassNameIdListNotExists, req.ClassName) - } - return &types.QueryClassIdsByNameResponse{ - ClassNameIdList: &classNameIdList, - }, nil + return &types.QueryClassAuthorityMetadataResponse{AuthorityMetadata: authorityMetadata}, nil } -func (k Keeper) ClassIdsByOwner(c context.Context, req *types.QueryClassIdsByOwnerRequest) (*types.QueryClassIdsByOwnerResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid argument") - } - - ctx := sdk.UnwrapSDKContext(c) - owner, err := sdk.AccAddressFromBech32(req.Owner) - if err != nil { - return nil, err - } - owningClassIdList, found := k.GetOwningClassIdList(ctx, owner) - if !found { - return nil, sdkerrors.Wrap(types.ErrOwningClassIdListNotExists, "owner doesn't have any class") - } - - return &types.QueryClassIdsByOwnerResponse{ - OwningClassIdList: &owningClassIdList, - }, nil +func (k Keeper) ClassesFromCreator(ctx context.Context, req *types.QueryClassesFromCreatorRequest) (*types.QueryClassesFromCreatorResponse, error) { + sdkCtx := sdk.UnwrapSDKContext(ctx) + classes := k.getDenomsFromCreator(sdkCtx, req.GetCreator()) + return &types.QueryClassesFromCreatorResponse{Classes: classes}, nil } diff --git a/x/nftfactory/keeper/keeper.go b/x/nftfactory/keeper/keeper.go index efeb1d012..1a8a1aecb 100644 --- a/x/nftfactory/keeper/keeper.go +++ b/x/nftfactory/keeper/keeper.go @@ -6,6 +6,7 @@ import ( "github.com/cometbft/cometbft/libs/log" "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/store/prefix" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" @@ -19,11 +20,13 @@ type Keeper struct { memKey storetypes.StoreKey paramSpace paramstypes.Subspace accountKeeper types.AccountKeeper + bankKeeper types.BankKeeper nftKeeper types.NftKeeper } func NewKeeper(cdc codec.Codec, storeKey, memKey storetypes.StoreKey, paramSpace paramstypes.Subspace, accountKeeper types.AccountKeeper, + bankKeeper types.BankKeeper, nftKeeper types.NftKeeper) Keeper { if !paramSpace.HasKeyTable() { paramSpace = paramSpace.WithKeyTable(types.ParamKeyTable()) @@ -35,6 +38,7 @@ func NewKeeper(cdc codec.Codec, storeKey, memKey storetypes.StoreKey, memKey: memKey, paramSpace: paramSpace, accountKeeper: accountKeeper, + bankKeeper: bankKeeper, nftKeeper: nftKeeper, } } @@ -42,3 +46,21 @@ func NewKeeper(cdc codec.Codec, storeKey, memKey storetypes.StoreKey, func (k Keeper) Logger(ctx sdk.Context) log.Logger { return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) } + +// GetDenomPrefixStore returns the substore for a specific denom +func (k Keeper) GetDenomPrefixStore(ctx sdk.Context, denom string) sdk.KVStore { + store := ctx.KVStore(k.storeKey) + return prefix.NewStore(store, types.GetDenomPrefixStore(denom)) +} + +// GetCreatorPrefixStore returns the substore for a specific creator address +func (k Keeper) GetCreatorPrefixStore(ctx sdk.Context, creator string) sdk.KVStore { + store := ctx.KVStore(k.storeKey) + return prefix.NewStore(store, types.GetCreatorPrefix(creator)) +} + +// GetCreatorsPrefixStore returns the substore that contains a list of creators +func (k Keeper) GetCreatorsPrefixStore(ctx sdk.Context) sdk.KVStore { + store := ctx.KVStore(k.storeKey) + return prefix.NewStore(store, types.GetCreatorsPrefix()) +} diff --git a/x/nftfactory/keeper/nft.go b/x/nftfactory/keeper/nft.go deleted file mode 100644 index 3ef3ebfbf..000000000 --- a/x/nftfactory/keeper/nft.go +++ /dev/null @@ -1,125 +0,0 @@ -package keeper - -import ( - "github.com/cosmos/cosmos-sdk/store/prefix" - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - nfttypes "github.com/cosmos/cosmos-sdk/x/nft" - - "github.com/UnUniFi/chain/x/nftfactory/types" -) - -// MintNFT does validate the contents of MsgMintNFT and operate whole flow for MintNFT message -func (k Keeper) MintNFT(ctx sdk.Context, msg *types.MsgMintNFT) error { - if !k.nftKeeper.HasClass(ctx, msg.ClassId) { - return sdkerrors.Wrap(nfttypes.ErrClassExists, msg.ClassId) - } - - classAttributes, exists := k.GetClassAttributes(ctx, msg.ClassId) - if !exists { - return sdkerrors.Wrapf(types.ErrClassAttributesNotExists, "class attributes with class id %s doesn't exist", msg.ClassId) - } - - nftUri := classAttributes.BaseTokenUri + msg.NftId - params := k.GetParamSet(ctx) - currentTokenSupply := k.nftKeeper.GetTotalSupply(ctx, msg.ClassId) - - owner, err := sdk.AccAddressFromBech32(classAttributes.Owner) - if err != nil { - return err - } - sender, err := sdk.AccAddressFromBech32(msg.Sender) - if err != nil { - return err - } - - err = types.ValidateMintNFT( - params, - classAttributes.MintingPermission, - owner, sender, - nftUri, msg.NftId, - currentTokenSupply, classAttributes.TokenSupplyCap, - ) - if err != nil { - return err - } - - recipient, err := sdk.AccAddressFromBech32(msg.Recipient) - if err != nil { - return err - } - - if err := k.nftKeeper.Mint(ctx, types.NewNFT(msg.ClassId, msg.NftId, nftUri), recipient); err != nil { - return err - } - - if err := k.SetNFTMinter(ctx, msg.ClassId, msg.NftId, sender); err != nil { - return err - } - - return nil -} - -// BurnNFT does validate the contents of MsgBurnNFT and operate whole flow for BurnNFT message -func (k Keeper) BurnNFT(ctx sdk.Context, msg *types.MsgBurnNFT) error { - if !k.nftKeeper.HasClass(ctx, msg.ClassId) { - return sdkerrors.Wrap(nfttypes.ErrClassNotExists, msg.ClassId) - } - - if !k.nftKeeper.HasNFT(ctx, msg.ClassId, msg.NftId) { - return sdkerrors.Wrap(nfttypes.ErrNFTNotExists, msg.NftId) - } - - owner := k.nftKeeper.GetOwner(ctx, msg.ClassId, msg.NftId) - if owner.String() != msg.Sender { - return sdkerrors.Wrapf(sdkerrors.ErrUnauthorized, "%s is not the owner of nft %s", msg.Sender, msg.NftId) - } - - if err := k.nftKeeper.Burn(ctx, msg.ClassId, msg.NftId); err != nil { - return err - } - return nil -} - -// UpdateNFTUri is called in UpdateBaseTokenUri message to apply the changed BaseTokenUri to each NFT.Uri -func (k Keeper) UpdateNFTUri(ctx sdk.Context, classID, baseTokenUri string) error { - nfts := k.nftKeeper.GetNFTsOfClass(ctx, classID) - if len(nfts) == 0 { - return nil - } - - params := k.GetParamSet(ctx) - for _, nft := range nfts { - nftUriLatest := baseTokenUri + nft.Id - nft.Uri = nftUriLatest - if err := types.ValidateUri(params.MinUriLen, params.MaxUriLen, nftUriLatest); err != nil { - return err - } - if err := k.nftKeeper.Update(ctx, nft); err != nil { - return err - } - } - - return nil -} - -func (k Keeper) SetNFTMinter(ctx sdk.Context, classID, nftID string, minter sdk.AccAddress) error { - store := ctx.KVStore(k.storeKey) - prefixStore := prefix.NewStore(store, []byte(types.KeyPrefixNFTMinter)) - - prefixStore.Set(types.NFTMinterKey(classID, nftID), minter.Bytes()) - return nil -} - -func (k Keeper) GetNFTMinter(ctx sdk.Context, classID, nftID string) (sdk.AccAddress, bool) { - store := ctx.KVStore(k.storeKey) - prefixStore := prefix.NewStore(store, []byte(types.KeyPrefixNFTMinter)) - - bz := prefixStore.Get(types.NFTMinterKey(classID, nftID)) - if bz == nil { - return nil, false - } - - minter := sdk.AccAddress(bz) - return minter, true -} diff --git a/x/nftfactory/keeper/nft_test.go b/x/nftfactory/keeper/nft_test.go deleted file mode 100644 index 69795a2b2..000000000 --- a/x/nftfactory/keeper/nft_test.go +++ /dev/null @@ -1,193 +0,0 @@ -package keeper_test - -import ( - "fmt" - - "github.com/cometbft/cometbft/crypto/ed25519" - sdk "github.com/cosmos/cosmos-sdk/types" - nfttypes "github.com/cosmos/cosmos-sdk/x/nft" - - "github.com/UnUniFi/chain/x/nftfactory/keeper" - "github.com/UnUniFi/chain/x/nftfactory/types" -) - -const ( - testNFTId = "a00" -) - -// test for the MintNFT relating functions -func (suite *KeeperTestSuite) TestMintNFT() { - sender := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - sender_seq, _ := suite.accountKeeper.GetSequence(suite.ctx, sender) - - classId := keeper.CreateClassId(sender_seq, sender) - _ = suite.CreateClass(suite.ctx, classId, sender) - - recipient := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - - testMsgMintNFT := types.MsgMintNFT{ - Sender: sender.String(), - ClassId: classId, - NftId: testNFTId, - Recipient: recipient.String(), - } - err := suite.nftmintKeeper.MintNFT(suite.ctx, &testMsgMintNFT) - suite.Require().NoError(err) - // check owner - owner := suite.nftKeeper.GetOwner(suite.ctx, classId, testNFTId) - expectedOwner := recipient - suite.Require().Equal(expectedOwner, owner) - // check minter - minter, exists := suite.nftmintKeeper.GetNFTMinter(suite.ctx, classId, testNFTId) - suite.Require().True(exists) - expectedMinter := sender - suite.Require().Equal(expectedMinter, minter) - - // invalid nft id case to give invalid nft uri length on UnUniFi - invalidNFTIdUri := "test" - for i := 0; i < types.DefaultMaxUriLen; i++ { - invalidNFTIdUri += "a" - } - testMsgMintNFTInvalidNftIdUri := types.MsgMintNFT{ - Sender: sender.String(), - ClassId: classId, - NftId: invalidNFTIdUri, - Recipient: recipient.String(), - } - err = suite.nftmintKeeper.MintNFT(suite.ctx, &testMsgMintNFTInvalidNftIdUri) - suite.Require().Error(err) - exists = suite.nftKeeper.HasNFT(suite.ctx, classId, invalidNFTIdUri) - suite.Require().False(exists) - - // invalid nft id by sdk's x/nft validation in case for not being called through message - invalidNFTId := "a" // shorter than the defined minimum length by sdk's x/nft module - testMsgMintNFTInvalidNftId := types.MsgMintNFT{ - Sender: sender.String(), - ClassId: classId, - NftId: invalidNFTId, - Recipient: recipient.String(), - } - err = suite.nftmintKeeper.MintNFT(suite.ctx, &testMsgMintNFTInvalidNftId) - suite.Require().Error(err) - exists = suite.nftKeeper.HasNFT(suite.ctx, classId, invalidNFTId) - suite.Require().False(exists) - - // invalid case by the minting permission limitation - // estimate MintingPermission = 0 (OnlyOwner) - notOwnerOfClass := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - testNFTId2 := testNFTId + "2" - testMsgMintNFTInvalidMinter := types.MsgMintNFT{ - Sender: notOwnerOfClass.String(), - ClassId: classId, - NftId: testNFTId2, - Recipient: recipient.String(), - } - err = suite.nftmintKeeper.MintNFT(suite.ctx, &testMsgMintNFTInvalidMinter) - suite.Require().Error(err) - exists = suite.nftKeeper.HasNFT(suite.ctx, classId, testNFTId2) - suite.Require().False(exists) - - // invalid case which is over the defined token supply cap - classId = "test" - testMsgCreateClass := types.MsgCreateClass{ - Sender: sender.String(), - Name: "test", - BaseTokenUri: "ipfs://testuri/", - TokenSupplyCap: 1, - MintingPermission: 0, - } - _ = suite.nftmintKeeper.CreateClass(suite.ctx, classId, &testMsgCreateClass) - _ = suite.nftKeeper.Mint(suite.ctx, nfttypes.NFT{ClassId: classId, Id: testNFTId}, sender) - testMsgMintNFTOverCap := types.MsgMintNFT{ - Sender: sender.String(), - ClassId: classId, - NftId: testNFTId2, - Recipient: sender.String(), - } - err = suite.nftmintKeeper.MintNFT(suite.ctx, &testMsgMintNFTOverCap) - suite.Require().Error(err) - exists = suite.nftKeeper.HasNFT(suite.ctx, classId, testNFTId2) - suite.Require().False(exists) -} - -// tests for the BurnNFT relating functions -func (suite *KeeperTestSuite) TestBurnNFT() { - sender := suite.addrs[0] - fmt.Println("sender") - fmt.Println(sender) - sender_ := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - fmt.Println("sender_") - fmt.Println(sender_) - sender_seq, _ := suite.accountKeeper.GetSequence(suite.ctx, sender) - // sender_seq, _ := suite.app.AccountKeeper.GetSequence(suite.ctx, sender) - - classId := keeper.CreateClassId(sender_seq, sender) - _ = suite.MintNFT(suite.ctx, classId, testNFTId, sender) - - testMsgBurnNFT := types.MsgBurnNFT{ - Sender: sender.String(), - ClassId: classId, - NftId: testNFTId, - } - err := suite.nftmintKeeper.BurnNFT(suite.ctx, &testMsgBurnNFT) - suite.Require().NoError(err) - // check if burned successfully - exists := suite.nftKeeper.HasNFT(suite.ctx, classId, testNFTId) - suite.Require().False(exists) - - // invalid case which sender is not the owner of the nft - invalidSender := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - _ = suite.MintNFT(suite.ctx, classId, testNFTId, sender) - testMsgBurnNFTInvalidSender := types.MsgBurnNFT{ - Sender: invalidSender.String(), - ClassId: classId, - NftId: testNFTId, - } - err = suite.nftmintKeeper.BurnNFT(suite.ctx, &testMsgBurnNFTInvalidSender) - suite.Require().Error(err) - // check if not burned as intended - exists = suite.nftKeeper.HasNFT(suite.ctx, classId, testNFTId) - suite.Require().True(exists) -} - -// tests for UpdateNFTUri function -func (suite *KeeperTestSuite) TestUpdateNFTUri() { - sender := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - sender_seq, _ := suite.accountKeeper.GetSequence(suite.ctx, sender) - - classId := keeper.CreateClassId(sender_seq, sender) - _ = suite.MintNFT(suite.ctx, classId, testNFTId, sender) - - updatingBaseTokenUri := "ipfs://test-latest/" - err := suite.nftmintKeeper.UpdateNFTUri(suite.ctx, classId, updatingBaseTokenUri) - suite.Require().NoError(err) - nft, _ := suite.nftKeeper.GetNFT(suite.ctx, classId, testNFTId) - expectedNFTUri := updatingBaseTokenUri + testNFTId - suite.Require().Equal(expectedNFTUri, nft.Uri) - - // invalid BaseTokenUri length defined on UnUniFi - invalidBaseTokenUri := "invalid" - for i := 0; i < types.DefaultMaxUriLen; i++ { - invalidBaseTokenUri += "a" - } - err = suite.nftmintKeeper.UpdateNFTUri(suite.ctx, classId, invalidBaseTokenUri) - suite.Require().Error(err) - // check if nft uri doesn't change after updating - nft, _ = suite.nftKeeper.GetNFT(suite.ctx, classId, testNFTId) - expectedNFTUri = updatingBaseTokenUri + testNFTId - suite.Require().Equal(expectedNFTUri, nft.Uri) -} - -// mint nft method for keeper test -func (suite *KeeperTestSuite) MintNFT(ctx sdk.Context, classID, nftID string, sender sdk.AccAddress) error { - _ = suite.CreateClass(suite.ctx, classID, sender) - - testMsgMintNFT := types.MsgMintNFT{ - Sender: sender.String(), - ClassId: classID, - NftId: nftID, - Recipient: sender.String(), - } - err := suite.nftmintKeeper.MintNFT(suite.ctx, &testMsgMintNFT) - return err -} diff --git a/x/nftfactory/keeper/params.go b/x/nftfactory/keeper/params.go index 262044c33..ca8b5e8bf 100644 --- a/x/nftfactory/keeper/params.go +++ b/x/nftfactory/keeper/params.go @@ -6,14 +6,13 @@ import ( "github.com/UnUniFi/chain/x/nftfactory/types" ) -// GetParamSet returns token params from the global param store -func (k Keeper) GetParamSet(ctx sdk.Context) types.Params { - var p types.Params - k.paramSpace.GetParamSet(ctx, &p) - return p +// GetParams returns the total set params. +func (k Keeper) GetParams(ctx sdk.Context) (params types.Params) { + k.paramSpace.GetParamSet(ctx, ¶ms) + return params } -// SetParamSet sets token params to the global param store -func (k Keeper) SetParamSet(ctx sdk.Context, params types.Params) { +// SetParams sets the total set of params. +func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { k.paramSpace.SetParamSet(ctx, ¶ms) } diff --git a/x/nftfactory/keeper/utils.go b/x/nftfactory/keeper/utils.go deleted file mode 100644 index 650c4994a..000000000 --- a/x/nftfactory/keeper/utils.go +++ /dev/null @@ -1,25 +0,0 @@ -package keeper - -import ( - "encoding/binary" -) - -// use with error handler -func SliceIndex(s []string, element string) int { - for i := 0; i < len(s); i++ { - if element == s[i] { - return i - } - } - return -1 -} - -func RemoveIndex(s []string, index int) []string { - return (append(s[:index], s[index+1:]...)) -} - -func UintToByte(u uint64) []byte { - b := make([]byte, 8) - binary.LittleEndian.PutUint64(b, u) - return b -} diff --git a/x/nftfactory/module.go b/x/nftfactory/module.go index bdb2392ae..c89ade74e 100644 --- a/x/nftfactory/module.go +++ b/x/nftfactory/module.go @@ -89,7 +89,7 @@ func (a AppModuleBasic) GetTxCmd() *cobra.Command { // GetQueryCmd returns the capability module's root query command. func (AppModuleBasic) GetQueryCmd() *cobra.Command { - return cli.GetQueryCmd(types.StoreKey) + return cli.GetQueryCmd() } // ---------------------------------------------------------------------------- @@ -137,15 +137,15 @@ func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, gs json.Ra // Initialize global index to index in genesis state cdc.MustUnmarshalJSON(gs, &genState) - InitGenesis(ctx, am.keeper, am.nftKeeper, genState) + am.keeper.InitGenesis(ctx, genState) return []abci.ValidatorUpdate{} } // ExportGenesis returns the capability module's exported genesis state as raw JSON bytes. func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { - genState := ExportGenesis(ctx, am.keeper) - return cdc.MustMarshalJSON(&genState) + genState := am.keeper.ExportGenesis(ctx) + return cdc.MustMarshalJSON(genState) } // ConsensusVersion implements AppModule/ConsensusVersion. diff --git a/x/nftfactory/types/class.go b/x/nftfactory/types/class.go deleted file mode 100644 index 2019140a7..000000000 --- a/x/nftfactory/types/class.go +++ /dev/null @@ -1,26 +0,0 @@ -package types - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - nfttypes "github.com/cosmos/cosmos-sdk/x/nft" -) - -func NewClass(classID, name, symbol, description, classUri string) nfttypes.Class { - return nfttypes.Class{ - Id: classID, - Name: name, - Symbol: symbol, - Description: description, - Uri: classUri, - } -} - -func NewClassOwnership( - classID string, - owner sdk.AccAddress, -) ClassOwnership { - return ClassOwnership{ - ClassId: classID, - Owner: owner.String(), - } -} diff --git a/x/nftfactory/types/codec.go b/x/nftfactory/types/codec.go index 7f26d9bab..d7e94cbc2 100644 --- a/x/nftfactory/types/codec.go +++ b/x/nftfactory/types/codec.go @@ -14,9 +14,9 @@ func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { registry.RegisterImplementations((*sdk.Msg)(nil), &MsgCreateClass{}, &MsgUpdateClass{}, - &MsgSendClassOwnership{}, &MsgMintNFT{}, &MsgBurnNFT{}, + &MsgChangeAdmin{}, ) msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) diff --git a/x/nftfactory/types/denoms.go b/x/nftfactory/types/denoms.go new file mode 100644 index 000000000..92f0c5af8 --- /dev/null +++ b/x/nftfactory/types/denoms.go @@ -0,0 +1,68 @@ +package types + +import ( + "strings" + + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" +) + +const ( + ModuleDenomPrefix = "nftfactory" + // See the TokenFactory readme for a derivation of these. + // TL;DR, MaxSubdenomLength + MaxHrpLength = 60 comes from SDK max denom length = 128 + // and the structure of tokenfactory denoms. + MaxSubdenomLength = 44 + MaxHrpLength = 16 + // MaxCreatorLength = 59 + MaxHrpLength + MaxCreatorLength = 59 + MaxHrpLength +) + +// GetClassId constructs a denom string for tokens created by tokenfactory +// based on an input creator address and a subdenom +// The denom constructed is factory/{creator}/{subdenom} +func GetClassId(creator, subclass string) (string, error) { + if len(subclass) > MaxSubdenomLength { + return "", ErrSubclassTooLong + } + if len(subclass) > MaxCreatorLength { + return "", ErrCreatorTooLong + } + if strings.Contains(creator, "/") { + return "", ErrInvalidCreator + } + denom := strings.Join([]string{ModuleDenomPrefix, creator, subclass}, "/") + return denom, sdk.ValidateDenom(denom) +} + +// DeconstructDenom takes a token denom string and verifies that it is a valid +// denom of the tokenfactory module, and is of the form `factory/{creator}/{subdenom}` +// If valid, it returns the creator address and subdenom +func DeconstructDenom(class_id string) (creator, subclass string, err error) { + err = sdk.ValidateDenom(class_id) + if err != nil { + return "", "", err + } + + strParts := strings.Split(class_id, "/") + if len(strParts) < 3 { + return "", "", sdkerrors.Wrapf(ErrInvalidClassId, "not enough parts of class id %s", class_id) + } + + if strParts[0] != ModuleDenomPrefix { + return "", "", sdkerrors.Wrapf(ErrInvalidClassId, "class id prefix is incorrect. Is: %s. Should be: %s", strParts[0], ModuleDenomPrefix) + } + + creator = strParts[1] + _, err = sdk.AccAddressFromBech32(creator) + if err != nil { + return "", "", sdkerrors.Wrapf(ErrInvalidClassId, "Invalid creator address (%s)", err) + } + + // Handle the case where a denom has a slash in its subdenom. For example, + // when we did the split, we'd turn factory/accaddr/atomderivative/sikka into ["factory", "accaddr", "atomderivative", "sikka"] + // So we have to join [2:] with a "/" as the delimiter to get back the correct subdenom which should be "atomderivative/sikka" + subclass = strings.Join(strParts[2:], "/") + + return creator, subclass, nil +} diff --git a/x/nftfactory/types/errors.go b/x/nftfactory/types/errors.go index b79b838f9..e81bfe5b5 100644 --- a/x/nftfactory/types/errors.go +++ b/x/nftfactory/types/errors.go @@ -1,22 +1,23 @@ package types +// DONTCOVER + import ( + fmt "fmt" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) +// x/tokenfactory module sentinel errors var ( - ErrClassIdInvalidLength = sdkerrors.Register(ModuleName, 1, "class id length is invalid") - ErrClassAttributesNotExists = sdkerrors.Register(ModuleName, 2, "class attributes does not exist") - ErrOwningClassIdListNotExists = sdkerrors.Register(ModuleName, 3, "owning class list does not exist") - ErrIndexNotFoundInOwningClassIDs = sdkerrors.Register(ModuleName, 4, "class id is not found in list") - ErrInvalidMintingPermission = sdkerrors.Register(ModuleName, 5, "invalid minting permission for the class") - ErrClassNameIdListNotExists = sdkerrors.Register(ModuleName, 6, "class name id list with this class name does not exists") - ErrClassNameInvalidLength = sdkerrors.Register(ModuleName, 7, "invalid class name length on UnUniFi") - ErrUriInvalidLength = sdkerrors.Register(ModuleName, 8, "invalid uri length on UnUniFi") - ErrInvalidTokenSupplyCap = sdkerrors.Register(ModuleName, 9, "invalid token supply cap on UnUniFi") - ErrClassSymbolInvalidLength = sdkerrors.Register(ModuleName, 10, "invalid class symbol length on UnUniFi") - ErrClassDescriptionInvalidLength = sdkerrors.Register(ModuleName, 11, "invalid class description length on UnUniFi") - ErrTokenSupplyBelow = sdkerrors.Register(ModuleName, 12, "updating token supply cap number is over the number of the current supplied token") - ErrNftAttributesNotExists = sdkerrors.Register(ModuleName, 13, "nft attributes does not exist") - ErrTokenSupplyCapOver = sdkerrors.Register(ModuleName, 14, "current token supply is reached the number of the defined token supply cap") + ErrClassExists = sdkerrors.Register(ModuleName, 2, "attempting to create a denom that already exists (has bank metadata)") + ErrUnauthorized = sdkerrors.Register(ModuleName, 3, "unauthorized account") + ErrInvalidClassId = sdkerrors.Register(ModuleName, 4, "invalid class id") + ErrInvalidCreator = sdkerrors.Register(ModuleName, 5, "invalid creator") + ErrInvalidAuthorityMetadata = sdkerrors.Register(ModuleName, 6, "invalid authority metadata") + ErrInvalidGenesis = sdkerrors.Register(ModuleName, 7, "invalid genesis") + ErrSubclassTooLong = sdkerrors.Register(ModuleName, 8, fmt.Sprintf("subclass too long, max length is %d bytes", MaxSubdenomLength)) + ErrCreatorTooLong = sdkerrors.Register(ModuleName, 9, fmt.Sprintf("creator too long, max length is %d bytes", MaxCreatorLength)) + ErrDenomDoesNotExist = sdkerrors.Register(ModuleName, 10, "denom does not exist") + ErrUnableToCharge = sdkerrors.Register(ModuleName, 11, "unable to charge for denom creation") ) diff --git a/x/nftfactory/types/expected_keepers.go b/x/nftfactory/types/expected_keepers.go index 036d8c233..74f781c03 100644 --- a/x/nftfactory/types/expected_keepers.go +++ b/x/nftfactory/types/expected_keepers.go @@ -9,6 +9,21 @@ type AccountKeeper interface { GetSequence(ctx sdk.Context, addr sdk.AccAddress) (uint64, error) } +type BankKeeper interface { + // View + GetAllBalances(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins + GetBalance(ctx sdk.Context, addr sdk.AccAddress, denom string) sdk.Coin + GetSupply(ctx sdk.Context, denom string) sdk.Coin + + // Send + SendCoins(ctx sdk.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) error + SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error + SendCoinsFromModuleToModule(ctx sdk.Context, senderModule, recipientModule string, amt sdk.Coins) error + SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error + MintCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error + BurnCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error +} + type NftKeeper interface { SaveClass(ctx sdk.Context, class nfttypes.Class) error diff --git a/x/nftfactory/types/genesis.go b/x/nftfactory/types/genesis.go index 08693623e..605e2b218 100644 --- a/x/nftfactory/types/genesis.go +++ b/x/nftfactory/types/genesis.go @@ -1,49 +1,46 @@ package types import ( - "encoding/json" - - "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) // DefaultGenesis returns the default Capability genesis state func DefaultGenesis() *GenesisState { - params := DefaultParams() return &GenesisState{ - Params: params, + Params: DefaultParams(), + Classes: []GenesisClass{}, } } +// Validate performs basic genesis state validation returning an error upon any +// failure. func (gs GenesisState) Validate() error { - if err := gs.Params.Validate(); err != nil { + err := gs.Params.Validate() + if err != nil { return err } - for _, classAttributes := range gs.ClassOwnerships { - if err := ValidateClassAttributes(classAttributes, gs.Params); err != nil { - return err - } - } + seenDenoms := map[string]bool{} - return nil -} - -func NewGenesisState(params Params) *GenesisState { - return &GenesisState{ - Params: params, - } -} - -func DefaultGenesisState() *GenesisState { - return NewGenesisState(DefaultParams()) -} + for _, class := range gs.GetClasses() { + if seenDenoms[class.GetClassId()] { + return sdkerrors.Wrapf(ErrInvalidGenesis, "duplicate class id: %s", class.GetClassId()) + } + seenDenoms[class.GetClassId()] = true -func GetGenesisStateFromAppState(cdc codec.JSONCodec, appState map[string]json.RawMessage) *GenesisState { - var genesisState GenesisState + _, _, err := DeconstructDenom(class.GetClassId()) + if err != nil { + return err + } - if appState[ModuleName] != nil { - cdc.MustUnmarshalJSON(appState[ModuleName], &genesisState) + if class.AuthorityMetadata.Admin != "" { + _, err = sdk.AccAddressFromBech32(class.AuthorityMetadata.Admin) + if err != nil { + return sdkerrors.Wrapf(ErrInvalidAuthorityMetadata, "Invalid admin address (%s)", err) + } + } } - return &genesisState + return nil } diff --git a/x/nftfactory/types/keys.go b/x/nftfactory/types/keys.go index 254250daf..eaa66be22 100644 --- a/x/nftfactory/types/keys.go +++ b/x/nftfactory/types/keys.go @@ -1,16 +1,13 @@ package types import ( - sdk "github.com/cosmos/cosmos-sdk/types" + "strings" ) const ( // ModuleName defines the module name ModuleName = "nftfactory" - // ChainName defines the chain name to put StoreKey for avoiding the KVStore collision to sdk's nft module KVStore key - ChainName = "ununifi" - // StoreKey defines the primary module store key StoreKey = "_" + ModuleName @@ -24,26 +21,29 @@ const ( MemStoreKey = "mem_nftfactory" ) -var ( - // KeyPrefixClassAttributes defines prefix key for ClassAttributes - KeyPrefixClassAttributes = []byte{0x01} - - // KeyPrefixNFTAttributes defines prefix key for NFTAttributes - KeyPrefixNFTMinter = []byte{0x02} - - // KeyPrefixOwningClassList defines prefix key for OwningClassList - KeyPrefixOwningClassIdList = []byte{0x03} +// KeySeparator is used to combine parts of the keys in the store +const KeySeparator = "|" - // KeyPrefixClassNameIdList defines prefix key for ClassNameIdList - KeyPrefixClassNameIdList = []byte{0x04} +var ( + ClassAuthorityMetadataKey = "authoritymetadata" + ClassIdsPrefixKey = "class_ids" + CreatorPrefixKey = "creator" + AdminPrefixKey = "admin" ) -func NFTMinterKey(classID, nftID string) []byte { - nftIdentifier := classID + nftID - return []byte(nftIdentifier) +// GetDenomPrefixStore returns the store prefix where all the data associated with a specific denom +// is stored +func GetDenomPrefixStore(classId string) []byte { + return []byte(strings.Join([]string{ClassIdsPrefixKey, classId, ""}, KeySeparator)) +} + +// GetCreatorsPrefix returns the store prefix where the list of the denoms created by a specific +// creator are stored +func GetCreatorPrefix(creator string) []byte { + return []byte(strings.Join([]string{CreatorPrefixKey, creator, ""}, KeySeparator)) } -func OwningClassIdListKey(owner sdk.AccAddress) []byte { - ownerAddr, _ := sdk.AccAddressFromBech32(owner.String()) - return ownerAddr.Bytes() +// GetCreatorsPrefix returns the store prefix where a list of all creator addresses are stored +func GetCreatorsPrefix() []byte { + return []byte(strings.Join([]string{CreatorPrefixKey, ""}, KeySeparator)) } diff --git a/x/nftfactory/types/metadata.go b/x/nftfactory/types/metadata.go new file mode 100644 index 000000000..c8d96fcdb --- /dev/null +++ b/x/nftfactory/types/metadata.go @@ -0,0 +1,15 @@ +package types + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" +) + +func (metadata ClassAuthorityMetadata) Validate() error { + if metadata.Admin != "" { + _, err := sdk.AccAddressFromBech32(metadata.Admin) + if err != nil { + return err + } + } + return nil +} diff --git a/x/nftfactory/types/msgs.go b/x/nftfactory/types/msgs.go index 436af4813..8de1c1848 100644 --- a/x/nftfactory/types/msgs.go +++ b/x/nftfactory/types/msgs.go @@ -8,29 +8,17 @@ import ( var ( _ sdk.Msg = &MsgCreateClass{} + _ sdk.Msg = &MsgUpdateClass{} _ sdk.Msg = &MsgMintNFT{} - _ sdk.Msg = &MsgSendClassOwnership{} - _ sdk.Msg = &MsgUpdateBaseTokenUri{} - _ sdk.Msg = &MsgUpdateTokenSupplyCap{} _ sdk.Msg = &MsgBurnNFT{} + _ sdk.Msg = &MsgChangeAdmin{} ) func NewMsgCreateClass( sender string, - name, baseTokenUri string, - tokenSupplyCap uint64, - mintingPermission MintingPermission, - symbol, description, classUri string, ) *MsgCreateClass { return &MsgCreateClass{ - Sender: sender, - Name: name, - BaseTokenUri: baseTokenUri, - TokenSupplyCap: tokenSupplyCap, - MintingPermission: mintingPermission, - Symbol: symbol, - Description: description, - ClassUri: classUri, + Sender: sender, } } @@ -49,51 +37,43 @@ func (msg MsgCreateClass) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{addr} } -func NewMsgMintNFT( +func NewMsgUpdateClass( sender string, - classID, nftID string, - recipient string, -) *MsgMintNFT { - return &MsgMintNFT{ - Sender: sender, - ClassId: classID, - NftId: nftID, - Recipient: recipient, +) *MsgUpdateClass { + return &MsgUpdateClass{ + Sender: sender, } } -func (msg MsgMintNFT) ValidateBasic() error { +func (msg MsgUpdateClass) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Sender) if err != nil { return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, "sender address is not valid") } - if err := ValidateClassID(msg.ClassId); err != nil { - return sdkerrors.Wrapf(nfttypes.ErrEmptyClassID, "Invalid class id (%s)", msg.ClassId) - } - - if err := ValidateNFTID(msg.NftId); err != nil { - return sdkerrors.Wrapf(nfttypes.ErrEmptyNFTID, "Invalid nft id (%s)", msg.NftId) - } - return nil } // GetSigners returns the addresses of signers that must sign. -func (msg MsgMintNFT) GetSigners() []sdk.AccAddress { +func (msg MsgUpdateClass) GetSigners() []sdk.AccAddress { addr, _ := sdk.AccAddressFromBech32(msg.Sender) return []sdk.AccAddress{addr} } -func NewMsgSendClassOwnership(sender string, classID string, recipient string) *MsgSendClassOwnership { - return &MsgSendClassOwnership{ +func NewMsgMintNFT( + sender string, + classID, nftID string, + recipient string, +) *MsgMintNFT { + return &MsgMintNFT{ Sender: sender, ClassId: classID, + NftId: nftID, Recipient: recipient, } } -func (msg MsgSendClassOwnership) ValidateBasic() error { +func (msg MsgMintNFT) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Sender) if err != nil { return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, "sender address is not valid") @@ -103,50 +83,31 @@ func (msg MsgSendClassOwnership) ValidateBasic() error { return sdkerrors.Wrapf(nfttypes.ErrEmptyClassID, "Invalid class id (%s)", msg.ClassId) } - return nil -} - -// GetSigners returns the addresses of signers that must sign. -func (msg MsgSendClassOwnership) GetSigners() []sdk.AccAddress { - addr, _ := sdk.AccAddressFromBech32(msg.Sender) - return []sdk.AccAddress{addr} -} - -func NewMsgUpdateBaseTokenUri(sender string, classID, baseTokenUri string) *MsgUpdateBaseTokenUri { - return &MsgUpdateBaseTokenUri{ - Sender: sender, - ClassId: classID, - BaseTokenUri: baseTokenUri, - } -} - -func (msg MsgUpdateBaseTokenUri) ValidateBasic() error { - _, err := sdk.AccAddressFromBech32(msg.Sender) - if err != nil { - return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, "sender address is not valid") + if err := ValidateNFTID(msg.NftId); err != nil { + return sdkerrors.Wrapf(nfttypes.ErrEmptyNFTID, "Invalid nft id (%s)", msg.NftId) } - if err := ValidateClassID(msg.ClassId); err != nil { - return sdkerrors.Wrapf(nfttypes.ErrEmptyClassID, "Invalid class id (%s)", msg.ClassId) - } return nil } // GetSigners returns the addresses of signers that must sign. -func (msg MsgUpdateBaseTokenUri) GetSigners() []sdk.AccAddress { +func (msg MsgMintNFT) GetSigners() []sdk.AccAddress { addr, _ := sdk.AccAddressFromBech32(msg.Sender) return []sdk.AccAddress{addr} } -func NewMsgUpdateTokenSupplyCap(sender string, classID string, tokenSupplyCap uint64) *MsgUpdateTokenSupplyCap { - return &MsgUpdateTokenSupplyCap{ - Sender: sender, - ClassId: classID, - TokenSupplyCap: tokenSupplyCap, +func NewMsgBurnNFT( + burner string, + classID, nftID string, +) *MsgBurnNFT { + return &MsgBurnNFT{ + Sender: burner, + ClassId: classID, + NftId: nftID, } } -func (msg MsgUpdateTokenSupplyCap) ValidateBasic() error { +func (msg MsgBurnNFT) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Sender) if err != nil { return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, "sender address is not valid") @@ -156,45 +117,38 @@ func (msg MsgUpdateTokenSupplyCap) ValidateBasic() error { return sdkerrors.Wrapf(nfttypes.ErrEmptyClassID, "Invalid class id (%s)", msg.ClassId) } + if err := ValidateNFTID(msg.NftId); err != nil { + return sdkerrors.Wrapf(nfttypes.ErrEmptyNFTID, "Invalid nft id (%s)", msg.NftId) + } + return nil } // GetSigners returns the addresses of signers that must sign. -func (msg MsgUpdateTokenSupplyCap) GetSigners() []sdk.AccAddress { +func (msg MsgBurnNFT) GetSigners() []sdk.AccAddress { addr, _ := sdk.AccAddressFromBech32(msg.Sender) return []sdk.AccAddress{addr} } -func NewMsgBurnNFT( - burner string, - classID, nftID string, -) *MsgBurnNFT { - return &MsgBurnNFT{ - Sender: burner, - ClassId: classID, - NftId: nftID, +func NewMsgChangeAdmin( + sender string, +) *MsgChangeAdmin { + return &MsgChangeAdmin{ + Sender: sender, } } -func (msg MsgBurnNFT) ValidateBasic() error { +func (msg MsgChangeAdmin) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Sender) if err != nil { return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, "sender address is not valid") } - if err := ValidateClassID(msg.ClassId); err != nil { - return sdkerrors.Wrapf(nfttypes.ErrEmptyClassID, "Invalid class id (%s)", msg.ClassId) - } - - if err := ValidateNFTID(msg.NftId); err != nil { - return sdkerrors.Wrapf(nfttypes.ErrEmptyNFTID, "Invalid nft id (%s)", msg.NftId) - } - return nil } // GetSigners returns the addresses of signers that must sign. -func (msg MsgBurnNFT) GetSigners() []sdk.AccAddress { +func (msg MsgChangeAdmin) GetSigners() []sdk.AccAddress { addr, _ := sdk.AccAddressFromBech32(msg.Sender) return []sdk.AccAddress{addr} } diff --git a/x/nftfactory/types/params.go b/x/nftfactory/types/params.go index a8c4f07df..fca96adc1 100644 --- a/x/nftfactory/types/params.go +++ b/x/nftfactory/types/params.go @@ -3,171 +3,83 @@ package types import ( fmt "fmt" + sdk "github.com/cosmos/cosmos-sdk/types" paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" ) -const ( - DefaultMaxNFTSupplyCap = 100000 - DefaultMinClassNameLen = 3 - DefaultMaxClassNameLen = 128 - DefaultMinUriLen = 8 - DefaultMaxUriLen = 512 - DefaultMaxSymbolLen = 16 - DefaultMaxDescriptionLen = 1024 +// Parameter store keys. +var ( + KeyDenomCreationFee = []byte("ClassCreationFee") + DefaultFeeDenom = "uguu" + DefaultFeeAmount int64 = 1_000_000 + KeyFeeCollectorAddress = []byte("FeeCollectorAddress") + DefaultFeeCollectorAddress = "" ) -// NewParams returns a new params object -func NewParams( - maxNFTMintSupplyCap, - minClassNameLen, maxClassNameLen, - minUriLen, maxUriLen, - maxSymbolLen, - maxDescriptionLen uint64, -) Params { - return Params{ - MaxNFTSupplyCap: maxNFTMintSupplyCap, - MinClassNameLen: minClassNameLen, - MaxClassNameLen: maxClassNameLen, - MinUriLen: minUriLen, - MaxUriLen: maxClassNameLen, - MaxSymbolLen: maxSymbolLen, - MaxDescriptionLen: maxDescriptionLen, - } +// ParamTable for tokenfactory module. +func ParamKeyTable() paramstypes.KeyTable { + return paramstypes.NewKeyTable().RegisterParamSet(&Params{}) } -// DefaultParams returns default params for nftmint module -func DefaultParams() Params { +func NewParams(denomCreationFee sdk.Coins, feeCollectorAddress string) Params { return Params{ - MaxNFTSupplyCap: DefaultMaxNFTSupplyCap, - MinClassNameLen: DefaultMinClassNameLen, - MaxClassNameLen: DefaultMaxClassNameLen, - MinUriLen: DefaultMinUriLen, - MaxUriLen: DefaultMaxUriLen, - MaxSymbolLen: DefaultMaxSymbolLen, - MaxDescriptionLen: DefaultMaxDescriptionLen, + ClassCreationFee: denomCreationFee, + FeeCollectorAddress: feeCollectorAddress, } } -// ParamKeyTable Key declaration for parameters -func ParamKeyTable() paramstypes.KeyTable { - return paramstypes.NewKeyTable().RegisterParamSet(&Params{}) -} - -// Parameter keys -var ( - KeyMaxNFTSupplyCap = []byte("MaxNFTSupplyCap") - KeyMinClassNameLen = []byte("MinClassNameLen") - KeyMaxClassNameLen = []byte("MaxClassNameLen") - KeyMinUriLen = []byte("MinUriLen") - KeyMaxUriLen = []byte("MaxUriLen") - KeyMaxSymbolLen = []byte("MaxSymbolLen") - KeyMaxDescriptionLen = []byte("MaxDescriptionLen") -) - -// ParamSetPairs implements the ParamSet interface and returns all the key/value pairs -func (p *Params) ParamSetPairs() paramstypes.ParamSetPairs { - return paramstypes.ParamSetPairs{ - paramstypes.NewParamSetPair(KeyMaxNFTSupplyCap, &p.MaxNFTSupplyCap, validateMaxNFTSupplyCap), - paramstypes.NewParamSetPair(KeyMinClassNameLen, &p.MinClassNameLen, validateMinClassNameLen), - paramstypes.NewParamSetPair(KeyMaxClassNameLen, &p.MaxClassNameLen, validateMaxClassNameLen), - paramstypes.NewParamSetPair(KeyMinUriLen, &p.MinUriLen, validateMinUriLen), - paramstypes.NewParamSetPair(KeyMaxUriLen, &p.MaxUriLen, validateMaxUriLen), - paramstypes.NewParamSetPair(KeyMaxSymbolLen, &p.MaxSymbolLen, validateMaxSymbolLen), - paramstypes.NewParamSetPair(KeyMaxDescriptionLen, &p.MaxDescriptionLen, validateMaxDescriptionLen), +// default tokenfactory module parameters. +func DefaultParams() Params { + return Params{ + ClassCreationFee: sdk.NewCoins(sdk.NewInt64Coin(DefaultFeeDenom, DefaultFeeAmount)), + FeeCollectorAddress: DefaultFeeCollectorAddress, } } -// Validate checks that the parameters have valid values. +// validate params. func (p Params) Validate() error { - if err := validateMaxNFTSupplyCap(p.MaxNFTSupplyCap); err != nil { - return err - } - - if err := validateMinClassNameLen(p.MinClassNameLen); err != nil { - return err - } - - if err := validateMaxClassNameLen(p.MaxClassNameLen); err != nil { + if err := validateDenomCreationFee(p.ClassCreationFee); err != nil { return err } - if err := validateMinUriLen(p.MinUriLen); err != nil { - return err - } - - if err := validateMaxUriLen(p.MaxUriLen); err != nil { - return err - } - - if err := validateMaxSymbolLen(p.MaxSymbolLen); err != nil { - return err - } - - if err := validateMaxDescriptionLen(p.MaxDescriptionLen); err != nil { - return err - } - - return nil + return validateFeeCollectorAddress(p.FeeCollectorAddress) } -func validateMaxNFTSupplyCap(i interface{}) error { - _, ok := i.(uint64) - if !ok { - return fmt.Errorf("invalid parameter types: %T", i) +// Implements params.ParamSet. +func (p *Params) ParamSetPairs() paramstypes.ParamSetPairs { + return paramstypes.ParamSetPairs{ + paramstypes.NewParamSetPair(KeyDenomCreationFee, &p.ClassCreationFee, validateDenomCreationFee), + paramstypes.NewParamSetPair(KeyFeeCollectorAddress, &p.FeeCollectorAddress, validateFeeCollectorAddress), } - - return nil } -func validateMinClassNameLen(i interface{}) error { - _, ok := i.(uint64) +func validateDenomCreationFee(i interface{}) error { + v, ok := i.(sdk.Coins) if !ok { - return fmt.Errorf("invalid parameter types: %T", i) + return fmt.Errorf("invalid parameter type: %T", i) } - return nil -} - -func validateMaxClassNameLen(i interface{}) error { - _, ok := i.(uint64) - if !ok { - return fmt.Errorf("invalid parameter types: %T", i) + if err := v.Validate(); err != nil { + return fmt.Errorf("invalid denom creation fee: %+v, %w", i, err) } return nil } -func validateMinUriLen(i interface{}) error { - _, ok := i.(uint64) +func validateFeeCollectorAddress(i interface{}) error { + v, ok := i.(string) if !ok { - return fmt.Errorf("invalid parameter types: %T", i) + return fmt.Errorf("invalid parameter type: %T", i) } - return nil -} - -func validateMaxUriLen(i interface{}) error { - _, ok := i.(uint64) - if !ok { - return fmt.Errorf("invalid parameter types: %T", i) - } - - return nil -} - -func validateMaxSymbolLen(i interface{}) error { - _, ok := i.(uint64) - if !ok { - return fmt.Errorf("invalid parameter types: %T", i) + // Fee collector address might be explicitly empty in test environments + if len(v) == 0 { + return nil } - return nil -} - -func validateMaxDescriptionLen(i interface{}) error { - _, ok := i.(uint64) - if !ok { - return fmt.Errorf("invalid parameter types: %T", i) + _, err := sdk.AccAddressFromBech32(v) + if err != nil { + return fmt.Errorf("invalid fee collector address: %w", err) } return nil diff --git a/x/nftfactory/types/validation.go b/x/nftfactory/types/validation.go deleted file mode 100644 index c6e0cc0e3..000000000 --- a/x/nftfactory/types/validation.go +++ /dev/null @@ -1,139 +0,0 @@ -package types - -import ( - "strconv" - - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" -) - -func ValidateCreateClass( - params Params, - name, symbol, uri, description string, - mintingPermission MintingPermission, - tokenSupplyCap uint64, -) error { - if err := ValidateClassName(params.MinClassNameLen, params.MaxClassNameLen, name); err != nil { - return err - } - if err := ValidateSymbol(params.MaxSymbolLen, symbol); err != nil { - return err - } - if err := ValidateUri(params.MinUriLen, params.MaxUriLen, uri); err != nil { - return err - } - if err := ValidateDescription(params.MaxDescriptionLen, description); err != nil { - return err - } - if err := ValidateMintingPermission(mintingPermission, nil, nil); err != nil { - return err - } - if err := ValidateTokenSupplyCap(params.MaxNFTSupplyCap, tokenSupplyCap); err != nil { - return err - } - return nil -} - -func ValidateMintNFT( - params Params, - mintingPermission MintingPermission, - owner, minter sdk.AccAddress, - uri, nftID string, - currentTokenSupply, tokenSupplyCap uint64, -) error { - if err := ValidateMintingPermission(mintingPermission, owner, minter); err != nil { - return err - } - if err := ValidateUri(params.MinUriLen, params.MaxUriLen, uri); err != nil { - return err - } - if err := ValidateTokenSupply(currentTokenSupply, tokenSupplyCap); err != nil { - return err - } - if err := ValidateNFTID(nftID); err != nil { - return err - } - return nil -} - -func ValidateClassAttributes(classAttributes ClassAttributes, params Params) error { - if err := ValidateUri(params.MinUriLen, params.MaxUriLen, classAttributes.BaseTokenUri); err != nil { - return err - } - - if err := ValidateTokenSupplyCap(params.MaxNFTSupplyCap, classAttributes.TokenSupplyCap); err != nil { - return err - } - - return nil -} - -func ValidateMintingPermission(mintingPermission MintingPermission, owner, minter sdk.AccAddress) error { - switch mintingPermission { - case 0: - if !owner.Equals(minter) { - return ErrInvalidMintingPermission - } - return nil - case 1: - return nil - default: - return ErrInvalidMintingPermission - } -} - -// Measure length of the string as byte length -func ValidateClassName(minLen, maxLen uint64, className string) error { - len := len(className) - if len < int(minLen) || len > int(maxLen) { - return sdkerrors.Wrap(ErrClassNameInvalidLength, className) - } - return nil -} - -func ValidateUri(minLen, maxLen uint64, uri string) error { - len := len(uri) - if len == 0 { - return nil - } - - if len < int(minLen) || len > int(maxLen) { - return sdkerrors.Wrap(ErrUriInvalidLength, uri) - } - return nil -} - -func ValidateTokenSupplyCap(maxCap, tokenSupplyCap uint64) error { - if tokenSupplyCap > maxCap { - strTokenSupplyCap := strconv.FormatUint(tokenSupplyCap, 10) - return sdkerrors.Wrap(ErrInvalidTokenSupplyCap, strTokenSupplyCap) - } - return nil -} - -func ValidateTokenSupply(tokenSupply, tokenSupplyCap uint64) error { - if tokenSupply >= tokenSupplyCap { - strTokenSupply := strconv.FormatUint(tokenSupply, 10) - return sdkerrors.Wrap(ErrTokenSupplyCapOver, strTokenSupply) - } - return nil -} - -func ValidateSymbol(maxLen uint64, classSymbol string) error { - len := len(classSymbol) - if len > int(maxLen) { - return sdkerrors.Wrap(ErrClassSymbolInvalidLength, classSymbol) - } - return nil -} - -func ValidateDescription(maxLen uint64, classDescription string) error { - len := len(classDescription) - if len == 0 { - return nil - } - if len > int(maxLen) { - return sdkerrors.Wrap(ErrClassDescriptionInvalidLength, classDescription) - } - return nil -} diff --git a/x/nftfactory/types/validation_test.go b/x/nftfactory/types/validation_test.go deleted file mode 100644 index f317ad361..000000000 --- a/x/nftfactory/types/validation_test.go +++ /dev/null @@ -1,150 +0,0 @@ -package types_test - -import ( - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - - "github.com/UnUniFi/chain/x/nftfactory/types" -) - -const ( - // For the test, use "cosmos" prefix - testAddr = "cosmos1nyd8wdqyrnjfwfnfysv6t0rrpcj4pmzkykytjh" - testAddr2 = "cosmos1chjjqrherp2lgmj9wsqwe6leercydncqx2v209" - testAddr3 = "cosmos1hzgsxn26pn7zt0g3yssld7cmj86zr7fhhu2r3g" - testClassName = "UnUniFi" - testUri = "ipfs://test/" - testTokenSupplyCap = 10000 - testCurrentTokenSupply = 10 - testSymbol = "TEST" - testDescription = "This description is for the valdation uni test" -) - -func TestValidateMintingPermission(t *testing.T) { - // OnlyOwner case - owner, _ := sdk.AccAddressFromBech32(testAddr) - classAttirbutes := types.ClassAttributes{ - Owner: owner.String(), - MintingPermission: 0, - } - err := types.ValidateMintingPermission(classAttirbutes.MintingPermission, owner, owner) - require.NoError(t, err) - - falseCase, _ := sdk.AccAddressFromBech32(testAddr2) - err = types.ValidateMintingPermission(classAttirbutes.MintingPermission, owner, falseCase) - require.Error(t, err) - - // AnyOne case - classAttirbutes = types.ClassAttributes{ - MintingPermission: 1, - } - anyoneCase, _ := sdk.AccAddressFromBech32(testAddr3) - err = types.ValidateMintingPermission(classAttirbutes.MintingPermission, owner, anyoneCase) - require.NoError(t, err) - - // In case of now allowed option - classAttirbutes = types.ClassAttributes{ - MintingPermission: 3, - } - err = types.ValidateMintingPermission(classAttirbutes.MintingPermission, nil, nil) - require.Error(t, err) -} - -func TestValidateClassName(t *testing.T) { - params := types.DefaultParams() - - // valid case - err := types.ValidateClassName(params.MinClassNameLen, params.MaxClassNameLen, testClassName) - require.NoError(t, err) - - // invalid case which name is shorter than the default MinClassNameLen - invalidClassNameShort := testClassName[:2] - err = types.ValidateClassName(params.MinClassNameLen, 10000, invalidClassNameShort) - require.Error(t, err) - - // invalid case which name is longer than the default MaxClassNameLen - var invalidClassNameLong string - for i := 0; i <= (int(params.MaxClassNameLen) / 7); i++ { - invalidClassNameLong += testClassName - } - err = types.ValidateClassName(0, params.MaxClassNameLen, invalidClassNameLong) - require.Error(t, err) -} - -func TestValidateUri(t *testing.T) { - params := types.DefaultParams() - - // valid case - err := types.ValidateUri(params.MinUriLen, params.MaxUriLen, testUri) - require.NoError(t, err) - - // invalid case which uri is shoter than the default MinUriLen - invalidUriShort := testUri[:4] - err = types.ValidateUri(params.MinUriLen, 10000, invalidUriShort) - require.Error(t, err) - - // invalid case which uri is longer than the default MaxUriLen - var invalidUriLong string - for i := 0; i <= (int(params.MaxUriLen) / len(testUri)); i++ { - invalidUriLong += testUri - } - err = types.ValidateUri(0, params.MaxUriLen, invalidUriLong) - require.Error(t, err) -} - -func TestValidateTokenSupplyCap(t *testing.T) { - params := types.DefaultParams() - - // valid case - err := types.ValidateTokenSupplyCap(params.MaxNFTSupplyCap, testTokenSupplyCap) - require.NoError(t, err) - - // invalid case which token supply cap is bigger than the default MaxTokenSupplyCap - invalidTokenSupply := testTokenSupplyCap * ((params.MaxNFTSupplyCap)/testTokenSupplyCap + 1) - err = types.ValidateTokenSupplyCap(params.MaxNFTSupplyCap, invalidTokenSupply) - require.Error(t, err) -} - -func TestValidateTokenSupply(t *testing.T) { - err := types.ValidateTokenSupply(testCurrentTokenSupply, testTokenSupplyCap) - require.NoError(t, err) - - // invalid case which current token supply is over the token supply cap - invalidTokenSupplyCap := 5 - err = types.ValidateTokenSupply(testCurrentTokenSupply, uint64(invalidTokenSupplyCap)) - require.Error(t, err) -} - -func TestValidateSymbol(t *testing.T) { - params := types.DefaultParams() - - // valid case - err := types.ValidateSymbol(params.MaxSymbolLen, testSymbol) - require.NoError(t, err) - - // invalid case which symbol is longer that the default MaxSymbolLen - var invalidSymbol string - for i := 0; i <= (int(params.MaxSymbolLen) / len(testSymbol)); i++ { - invalidSymbol += testSymbol - } - err = types.ValidateSymbol(params.MaxSymbolLen, invalidSymbol) - require.Error(t, err) -} - -func TestValidateDescription(t *testing.T) { - params := types.DefaultParams() - - // valid case - err := types.ValidateDescription(params.MaxDescriptionLen, testDescription) - require.NoError(t, err) - - // invalid case which description is longer than the default MaxDescriptionLen - var invalidDescription string - for i := 0; i <= (int(params.MaxDescriptionLen) / len(testDescription)); i++ { - invalidDescription += testDescription - } - err = types.ValidateDescription(params.MaxDescriptionLen, invalidDescription) - require.Error(t, err) -} From 4619f40f531ccea2107f622e1d0671bbf9a84b1d Mon Sep 17 00:00:00 2001 From: KIMURA Yu <33382781+KimuraYu45z@users.noreply.github.com> Date: Fri, 11 Aug 2023 14:04:21 +0800 Subject: [PATCH 03/20] feat: nftfactory --- proto/ununifi/nftfactory/tx.proto | 2 +- x/nftfactory/types/tx.pb.go | 97 ++++++++++++++++--------------- 2 files changed, 50 insertions(+), 49 deletions(-) diff --git a/proto/ununifi/nftfactory/tx.proto b/proto/ununifi/nftfactory/tx.proto index ba12c4251..12aafdab0 100644 --- a/proto/ununifi/nftfactory/tx.proto +++ b/proto/ununifi/nftfactory/tx.proto @@ -17,7 +17,7 @@ service Msg { message MsgCreateClass { string sender = 1; - string id = 2; + string subclass = 2; string name = 3; string symbol = 4; string description = 5; diff --git a/x/nftfactory/types/tx.pb.go b/x/nftfactory/types/tx.pb.go index fa0be7441..70c9511f7 100644 --- a/x/nftfactory/types/tx.pb.go +++ b/x/nftfactory/types/tx.pb.go @@ -31,7 +31,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type MsgCreateClass struct { Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` - Id string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"` + Subclass string `protobuf:"bytes,2,opt,name=subclass,proto3" json:"subclass,omitempty"` Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` Symbol string `protobuf:"bytes,4,opt,name=symbol,proto3" json:"symbol,omitempty"` Description string `protobuf:"bytes,5,opt,name=description,proto3" json:"description,omitempty"` @@ -80,9 +80,9 @@ func (m *MsgCreateClass) GetSender() string { return "" } -func (m *MsgCreateClass) GetId() string { +func (m *MsgCreateClass) GetSubclass() string { if m != nil { - return m.Id + return m.Subclass } return "" } @@ -615,44 +615,45 @@ func init() { func init() { proto.RegisterFile("ununifi/nftfactory/tx.proto", fileDescriptor_47805922275bdc64) } var fileDescriptor_47805922275bdc64 = []byte{ - // 589 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x55, 0xcd, 0x6e, 0xd3, 0x40, - 0x10, 0x8e, 0x93, 0x34, 0x3f, 0x1b, 0x51, 0xca, 0x92, 0x46, 0x6e, 0x40, 0x4e, 0x64, 0x24, 0x54, - 0x8a, 0x64, 0x8b, 0x72, 0xe3, 0x46, 0x0a, 0x15, 0x3d, 0x04, 0x89, 0x88, 0x70, 0x40, 0x42, 0xd1, - 0xc6, 0xde, 0xd8, 0x2b, 0xc5, 0x6b, 0xcb, 0xbb, 0x56, 0x9b, 0xb7, 0xe0, 0x09, 0x78, 0x9e, 0x1e, - 0x7b, 0xe4, 0x14, 0x50, 0x72, 0xe3, 0x98, 0x27, 0x40, 0x5e, 0xff, 0xa6, 0xad, 0xa9, 0x84, 0xb8, - 0x70, 0x88, 0xb4, 0x3b, 0xdf, 0xcc, 0x37, 0xdf, 0x7c, 0x19, 0xdb, 0xe0, 0x51, 0x40, 0x03, 0x4a, - 0x66, 0x44, 0xa7, 0x33, 0x3e, 0x43, 0x06, 0x77, 0xfd, 0x85, 0xce, 0x2f, 0x34, 0xcf, 0x77, 0xb9, - 0x0b, 0x61, 0x0c, 0x6a, 0x19, 0xd8, 0x6d, 0x5b, 0xae, 0xe5, 0x0a, 0x58, 0x0f, 0x4f, 0x51, 0x66, - 0x77, 0x3f, 0x47, 0x13, 0xfe, 0xe2, 0xf0, 0x93, 0x5b, 0xd8, 0xb3, 0x63, 0x94, 0xa4, 0xfe, 0x90, - 0xc0, 0xee, 0x90, 0x59, 0x27, 0x3e, 0x46, 0x1c, 0x9f, 0xcc, 0x11, 0x63, 0xb0, 0x03, 0x6a, 0x0c, - 0x53, 0x13, 0xfb, 0xb2, 0xd4, 0x97, 0x0e, 0x9b, 0xa3, 0xf8, 0x06, 0x77, 0x41, 0x99, 0x98, 0x72, - 0x59, 0xc4, 0xca, 0xc4, 0x84, 0x10, 0x54, 0x29, 0x72, 0xb0, 0x5c, 0x11, 0x11, 0x71, 0x16, 0xb5, - 0x0b, 0x67, 0xea, 0xce, 0xe5, 0x6a, 0x5c, 0x2b, 0x6e, 0xb0, 0x0f, 0x5a, 0x26, 0x66, 0x86, 0x4f, - 0x3c, 0x4e, 0x5c, 0x2a, 0xef, 0x08, 0x30, 0x1f, 0x82, 0x7b, 0xa0, 0x12, 0xf8, 0x44, 0xae, 0x09, - 0x24, 0x3c, 0xc2, 0x03, 0xd0, 0x08, 0x7c, 0x32, 0xb1, 0x11, 0xb3, 0xe5, 0xba, 0x08, 0xd7, 0x03, - 0x9f, 0xbc, 0x43, 0xcc, 0x86, 0x47, 0xa0, 0x6a, 0x22, 0x8e, 0xe4, 0x46, 0x5f, 0x3a, 0x6c, 0x1d, - 0x77, 0xb4, 0x9c, 0x55, 0x9a, 0x18, 0xe2, 0x0d, 0xe2, 0x68, 0x24, 0x72, 0x54, 0x19, 0x74, 0xb6, - 0x07, 0x1c, 0x61, 0xe6, 0xb9, 0x94, 0x61, 0xf5, 0x57, 0x34, 0xfb, 0xd8, 0x33, 0xef, 0x9c, 0xfd, - 0x00, 0x34, 0x8c, 0x30, 0x61, 0x92, 0x3a, 0x50, 0x17, 0xf7, 0xb3, 0xff, 0xcc, 0x86, 0xdc, 0xac, - 0xa9, 0x0d, 0x1c, 0x80, 0x21, 0xb3, 0x86, 0x84, 0xf2, 0xf7, 0xa7, 0x1f, 0xff, 0xc6, 0x81, 0x7d, - 0x50, 0xa3, 0x33, 0x1e, 0x02, 0x91, 0x07, 0x3b, 0x74, 0xc6, 0xcf, 0x4c, 0xf8, 0x18, 0x34, 0x7d, - 0x6c, 0x10, 0x8f, 0x60, 0xca, 0x63, 0x1f, 0xb2, 0x80, 0xda, 0x06, 0x30, 0xeb, 0x9a, 0x6a, 0xf9, - 0x24, 0xb4, 0x0c, 0x02, 0x9f, 0xfe, 0x53, 0x2d, 0x71, 0xb7, 0x98, 0x37, 0xed, 0xf6, 0x2d, 0x5e, - 0x7e, 0x1b, 0x51, 0x0b, 0xbf, 0x36, 0x1d, 0x42, 0xe1, 0xb3, 0xed, 0x96, 0x83, 0x07, 0x9b, 0x65, - 0xef, 0xde, 0x02, 0x39, 0xf3, 0x57, 0x6a, 0x14, 0x57, 0x53, 0x15, 0xda, 0x75, 0x15, 0x83, 0x87, - 0x9b, 0x65, 0xef, 0x7e, 0x94, 0x9c, 0x20, 0x6a, 0x26, 0xed, 0x05, 0x68, 0x52, 0x7c, 0x3e, 0x41, - 0x61, 0x9f, 0x48, 0xdd, 0xa0, 0xbd, 0x59, 0xf6, 0xf6, 0xa2, 0x82, 0x14, 0x52, 0x47, 0x0d, 0x8a, - 0xcf, 0x85, 0x9a, 0x64, 0x77, 0x33, 0x7d, 0x89, 0xf4, 0xe3, 0xcb, 0x0a, 0xa8, 0x0c, 0x99, 0x05, - 0xbf, 0x80, 0x56, 0xfe, 0xd9, 0x55, 0xb5, 0x9b, 0x6f, 0x0d, 0x6d, 0x7b, 0xfd, 0xbb, 0x47, 0x77, - 0xe7, 0x24, 0x6d, 0x42, 0xfa, 0xfc, 0xe3, 0x51, 0x44, 0x9f, 0xcb, 0x29, 0xa4, 0xbf, 0x65, 0xf5, - 0xe0, 0x07, 0x50, 0x4f, 0xf6, 0x4e, 0x29, 0x28, 0x8b, 0xf1, 0xee, 0xd3, 0x3f, 0xe3, 0x79, 0xca, - 0x64, 0x7d, 0x8a, 0x28, 0x63, 0xbc, 0x90, 0xf2, 0xda, 0x9a, 0x08, 0x8f, 0x73, 0x2b, 0x52, 0xe8, - 0x71, 0x96, 0x53, 0xec, 0xf1, 0xcd, 0xbf, 0x72, 0xf0, 0xf6, 0x72, 0xa5, 0x48, 0x57, 0x2b, 0x45, - 0xfa, 0xb9, 0x52, 0xa4, 0xaf, 0x6b, 0xa5, 0x74, 0xb5, 0x56, 0x4a, 0xdf, 0xd7, 0x4a, 0xe9, 0xf3, - 0x73, 0x8b, 0x70, 0x3b, 0x98, 0x6a, 0x86, 0xeb, 0xe8, 0x63, 0x3a, 0xa6, 0xe4, 0x94, 0xe8, 0x86, - 0x8d, 0x08, 0xd5, 0x2f, 0xb6, 0x3e, 0x19, 0x0b, 0x0f, 0xb3, 0x69, 0x4d, 0xbc, 0xd0, 0x5f, 0xfe, - 0x0e, 0x00, 0x00, 0xff, 0xff, 0x20, 0x53, 0xa4, 0x7d, 0x55, 0x06, 0x00, 0x00, + // 593 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x55, 0x4f, 0x6f, 0xd3, 0x30, + 0x1c, 0x6d, 0x68, 0xd7, 0x3f, 0xae, 0x80, 0x61, 0xba, 0x2a, 0x2b, 0x28, 0xad, 0x82, 0x84, 0xc6, + 0x90, 0x12, 0x31, 0x6e, 0xdc, 0xe8, 0x60, 0x62, 0x87, 0x22, 0x51, 0x51, 0x0e, 0x48, 0xa8, 0x72, + 0x13, 0x37, 0xb1, 0xd4, 0x3a, 0x51, 0xec, 0x68, 0xeb, 0xb7, 0xe0, 0x13, 0xf0, 0x79, 0x76, 0xdc, + 0x91, 0x53, 0x85, 0xda, 0x1b, 0xdc, 0xfa, 0x09, 0x50, 0x1c, 0xe7, 0x4f, 0xb7, 0x85, 0x49, 0x88, + 0x0b, 0x87, 0x4a, 0xf6, 0xef, 0xbd, 0xbc, 0xdf, 0xf3, 0xeb, 0xcf, 0x09, 0x78, 0x14, 0xd2, 0x90, + 0x92, 0x29, 0x31, 0xe9, 0x94, 0x4f, 0x91, 0xc5, 0xbd, 0x60, 0x61, 0xf2, 0x73, 0xc3, 0x0f, 0x3c, + 0xee, 0x41, 0x28, 0x41, 0x23, 0x03, 0x3b, 0x2d, 0xc7, 0x73, 0x3c, 0x01, 0x9b, 0xd1, 0x2a, 0x66, + 0x76, 0xf6, 0x72, 0x32, 0xd1, 0x4f, 0x96, 0x9f, 0xdc, 0xa0, 0x9e, 0x2d, 0x63, 0x92, 0xfe, 0x4b, + 0x01, 0xf7, 0x06, 0xcc, 0x39, 0x0e, 0x30, 0xe2, 0xf8, 0x78, 0x86, 0x18, 0x83, 0x6d, 0x50, 0x65, + 0x98, 0xda, 0x38, 0x50, 0x95, 0x9e, 0x72, 0xd0, 0x18, 0xca, 0x1d, 0xec, 0x80, 0x3a, 0x0b, 0x27, + 0x56, 0xc4, 0x51, 0xef, 0x08, 0x24, 0xdd, 0x43, 0x08, 0x2a, 0x14, 0xcd, 0xb1, 0x5a, 0x16, 0x75, + 0xb1, 0x16, 0x3a, 0x8b, 0xf9, 0xc4, 0x9b, 0xa9, 0x15, 0xa9, 0x23, 0x76, 0xb0, 0x07, 0x9a, 0x36, + 0x66, 0x56, 0x40, 0x7c, 0x4e, 0x3c, 0xaa, 0xee, 0x08, 0x30, 0x5f, 0x82, 0xbb, 0xa0, 0x1c, 0x06, + 0x44, 0xad, 0x0a, 0x24, 0x5a, 0xc2, 0x7d, 0x50, 0x0f, 0x03, 0x32, 0x76, 0x11, 0x73, 0xd5, 0x9a, + 0x28, 0xd7, 0xc2, 0x80, 0xbc, 0x43, 0xcc, 0x85, 0x87, 0xa0, 0x62, 0x23, 0x8e, 0xd4, 0x7a, 0x4f, + 0x39, 0x68, 0x1e, 0xb5, 0x8d, 0x5c, 0x6c, 0x86, 0x38, 0xd0, 0x1b, 0xc4, 0xd1, 0x50, 0x70, 0x74, + 0x15, 0xb4, 0xb7, 0x0f, 0x3b, 0xc4, 0xcc, 0xf7, 0x28, 0xc3, 0xfa, 0xcf, 0x38, 0x87, 0x91, 0x6f, + 0xdf, 0x9a, 0xc3, 0x3e, 0xa8, 0x8b, 0x43, 0x8f, 0x89, 0x2d, 0x73, 0xa8, 0x89, 0xfd, 0xa9, 0xfd, + 0x7f, 0xc5, 0x90, 0x3b, 0x6b, 0x1a, 0x03, 0x07, 0x60, 0xc0, 0x9c, 0x01, 0xa1, 0xfc, 0xfd, 0xc9, + 0xc7, 0xbf, 0x49, 0x60, 0x0f, 0x54, 0xe9, 0x94, 0x47, 0x40, 0x9c, 0xc1, 0x0e, 0x9d, 0xf2, 0x53, + 0x1b, 0x3e, 0x06, 0x8d, 0x00, 0x5b, 0xc4, 0x27, 0x98, 0x72, 0x99, 0x43, 0x56, 0xd0, 0x5b, 0x00, + 0x66, 0x5d, 0x53, 0x2f, 0x9f, 0x84, 0x97, 0x7e, 0x18, 0xd0, 0x7f, 0xea, 0x45, 0x76, 0x93, 0xba, + 0x69, 0xb7, 0x6f, 0xf2, 0x22, 0xb8, 0x88, 0x3a, 0xf8, 0xb5, 0x3d, 0x27, 0x14, 0x3e, 0xdb, 0x6e, + 0xd9, 0x7f, 0xb0, 0x59, 0x76, 0xef, 0x2e, 0xd0, 0x7c, 0xf6, 0x4a, 0x8f, 0xeb, 0x7a, 0xea, 0xc2, + 0xb8, 0xea, 0xa2, 0xff, 0x70, 0xb3, 0xec, 0xde, 0x8f, 0xc9, 0x09, 0xa2, 0x67, 0xd6, 0x5e, 0x80, + 0x06, 0xc5, 0x67, 0x63, 0x14, 0xf5, 0x89, 0xdd, 0xf5, 0x5b, 0x9b, 0x65, 0x77, 0x37, 0x7e, 0x20, + 0x85, 0xf4, 0x61, 0x9d, 0xe2, 0x33, 0xe1, 0x26, 0x99, 0xdd, 0xcc, 0x5f, 0x62, 0xfd, 0xe8, 0xa2, + 0x0c, 0xca, 0x03, 0xe6, 0xc0, 0x2f, 0xa0, 0x99, 0xbf, 0xc7, 0xba, 0x71, 0xfd, 0x0d, 0x62, 0x6c, + 0x8f, 0x7f, 0xe7, 0xf0, 0x76, 0x4e, 0xd2, 0x26, 0x92, 0xcf, 0x5f, 0x8f, 0x22, 0xf9, 0x1c, 0xa7, + 0x50, 0xfe, 0x86, 0xd1, 0x83, 0x1f, 0x40, 0x2d, 0x99, 0x3b, 0xad, 0xe0, 0x31, 0x89, 0x77, 0x9e, + 0xfe, 0x19, 0xcf, 0x4b, 0x26, 0xe3, 0x53, 0x24, 0x29, 0xf1, 0x42, 0xc9, 0x2b, 0x63, 0x22, 0x32, + 0xce, 0x8d, 0x48, 0x61, 0xc6, 0x19, 0xa7, 0x38, 0xe3, 0xeb, 0x7f, 0x65, 0xff, 0xed, 0xc5, 0x4a, + 0x53, 0x2e, 0x57, 0x9a, 0xf2, 0x63, 0xa5, 0x29, 0x5f, 0xd7, 0x5a, 0xe9, 0x72, 0xad, 0x95, 0xbe, + 0xaf, 0xb5, 0xd2, 0xe7, 0xe7, 0x0e, 0xe1, 0x6e, 0x38, 0x31, 0x2c, 0x6f, 0x6e, 0x8e, 0xe8, 0x88, + 0x92, 0x13, 0x62, 0x5a, 0x2e, 0x22, 0xd4, 0x3c, 0xdf, 0xfa, 0x7c, 0x2c, 0x7c, 0xcc, 0x26, 0x55, + 0xf1, 0x72, 0x7f, 0xf9, 0x3b, 0x00, 0x00, 0xff, 0xff, 0x40, 0xcf, 0x39, 0xb9, 0x61, 0x06, 0x00, + 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -946,10 +947,10 @@ func (m *MsgCreateClass) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x1a } - if len(m.Id) > 0 { - i -= len(m.Id) - copy(dAtA[i:], m.Id) - i = encodeVarintTx(dAtA, i, uint64(len(m.Id))) + if len(m.Subclass) > 0 { + i -= len(m.Subclass) + copy(dAtA[i:], m.Subclass) + i = encodeVarintTx(dAtA, i, uint64(len(m.Subclass))) i-- dAtA[i] = 0x12 } @@ -1322,7 +1323,7 @@ func (m *MsgCreateClass) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } - l = len(m.Id) + l = len(m.Subclass) if l > 0 { n += 1 + l + sovTx(uint64(l)) } @@ -1575,7 +1576,7 @@ func (m *MsgCreateClass) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Subclass", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1603,7 +1604,7 @@ func (m *MsgCreateClass) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Id = string(dAtA[iNdEx:postIndex]) + m.Subclass = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: if wireType != 2 { From a62a2ddd6c04a660b8ee5694eed336c1d34806a2 Mon Sep 17 00:00:00 2001 From: KIMURA Yu <33382781+KimuraYu45z@users.noreply.github.com> Date: Sun, 13 Aug 2023 18:33:49 +0800 Subject: [PATCH 04/20] feat: wip nftfactory --- proto/ununifi/nftfactory/tx.proto | 4 +- x/nft/keeper/keeper.go | 16 +-- x/nft/keeper/msg_server.go | 49 ++++---- x/nftbackedloan/keeper/keeper_test.go | 2 +- x/nftfactory/client/cli/flags.go | 15 ++- x/nftfactory/client/cli/tx.go | 170 +++++++++++++------------- x/nftfactory/keeper/createclass.go | 19 +-- x/nftfactory/keeper/creators.go | 10 +- x/nftfactory/types/msgs.go | 52 ++++++-- x/nftfactory/types/tx.pb.go | 118 +++++++++--------- 10 files changed, 248 insertions(+), 207 deletions(-) diff --git a/proto/ununifi/nftfactory/tx.proto b/proto/ununifi/nftfactory/tx.proto index 12aafdab0..b857e323e 100644 --- a/proto/ununifi/nftfactory/tx.proto +++ b/proto/ununifi/nftfactory/tx.proto @@ -42,7 +42,7 @@ message MsgUpdateClassResponse {} message MsgMintNFT { string sender = 1; string class_id = 2; - string nft_id = 3; + string token_id = 3; string recipient = 4; } message MsgMintNFTResponse {} @@ -50,7 +50,7 @@ message MsgMintNFTResponse {} message MsgBurnNFT { string sender = 1; string class_id = 2; - string nft_id = 3; + string token_id = 3; } message MsgBurnNFTResponse {} diff --git a/x/nft/keeper/keeper.go b/x/nft/keeper/keeper.go index da3d895fb..88c5beb7f 100644 --- a/x/nft/keeper/keeper.go +++ b/x/nft/keeper/keeper.go @@ -8,7 +8,7 @@ import ( "github.com/cosmos/cosmos-sdk/x/nft" "github.com/cosmos/cosmos-sdk/x/nft/keeper" - wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" + // wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" "github.com/UnUniFi/chain/x/nft/types" ) @@ -16,16 +16,16 @@ type Keeper struct { keeper.Keeper cdc codec.BinaryCodec - wasmKeeper wasmtypes.ContractOpsKeeper - authority string + // wasmKeeper wasmtypes.ContractOpsKeeper + authority string } -func NewKeeper(k keeper.Keeper, cdc codec.BinaryCodec, wasmKeeper wasmtypes.ContractOpsKeeper, authority string) Keeper { +func NewKeeper(k keeper.Keeper, cdc codec.BinaryCodec /*wasmKeeper wasmtypes.ContractOpsKeeper,*/, authority string) Keeper { return Keeper{ - Keeper: k, - cdc: cdc, - wasmKeeper: wasmKeeper, - authority: authority, + Keeper: k, + cdc: cdc, + // wasmKeeper: wasmKeeper, + authority: authority, } } diff --git a/x/nft/keeper/msg_server.go b/x/nft/keeper/msg_server.go index 9a54eaf7a..3d6591758 100644 --- a/x/nft/keeper/msg_server.go +++ b/x/nft/keeper/msg_server.go @@ -2,13 +2,13 @@ package keeper import ( "context" - "encoding/json" + // "encoding/json" + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/x/nft" - - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + // authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) var _ nft.MsgServer = Keeper{} @@ -23,7 +23,7 @@ func (k Keeper) Send(goCtx context.Context, msg *nft.MsgSend) (*nft.MsgSendRespo owner := k.GetOwner(ctx, msg.ClassId, msg.Id) if !owner.Equals(sender) { - return nil, sdkerrors.Wrapf(sdkerrors.ErrUnauthorized, "%s is not the owner of nft %s", sender, msg.Id) + return nil, errorsmod.Wrapf(sdkerrors.ErrUnauthorized, "%s is not the owner of nft %s", sender, msg.Id) } receiver, err := sdk.AccAddressFromBech32(msg.Receiver) @@ -38,30 +38,31 @@ func (k Keeper) Send(goCtx context.Context, msg *nft.MsgSend) (*nft.MsgSendRespo } if nftData.SendDisabled { - return nil, sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "Sending NFT %s of class %s is disabled", msg.Id, msg.ClassId) + return nil, errorsmod.Wrapf(sdkerrors.ErrInvalidRequest, "Sending NFT %s of class %s is disabled", msg.Id, msg.ClassId) } // Check ClassData - class, found := k.GetClassData(ctx, msg.ClassId) - if !found { - return nil, nft.ErrClassNotExists - } - if class.SendPrehookContract != "" { - contractAddr, err := sdk.AccAddressFromBech32(class.SendPrehookContract) - if err != nil { - return nil, err - } - address := authtypes.NewModuleAddress(nft.ModuleName) - wasmMsg, err := json.Marshal(struct{}{}) - if err != nil { - return nil, err - } + // Must be done after checking NftData + // class, found := k.GetClassData(ctx, msg.ClassId) + // if !found { + // return nil, nft.ErrClassNotExists + // } + // if class.SendPrehookContract != "" { + // contractAddr, err := sdk.AccAddressFromBech32(class.SendPrehookContract) + // if err != nil { + // return nil, err + // } + // address := authtypes.NewModuleAddress(nft.ModuleName) + // wasmMsg, err := json.Marshal(struct{}{}) + // if err != nil { + // return nil, err + // } - _, err = k.wasmKeeper.Execute(ctx, contractAddr, address, []byte(wasmMsg), sdk.Coins{}) - if err != nil { - return nil, err - } - } + // _, err = k.wasmKeeper.Execute(ctx, contractAddr, address, []byte(wasmMsg), sdk.Coins{}) + // if err != nil { + // return nil, err + // } + // } if err := k.Transfer(ctx, msg.ClassId, msg.Id, receiver); err != nil { return nil, err diff --git a/x/nftbackedloan/keeper/keeper_test.go b/x/nftbackedloan/keeper/keeper_test.go index 139e06a68..d481ed396 100644 --- a/x/nftbackedloan/keeper/keeper_test.go +++ b/x/nftbackedloan/keeper/keeper_test.go @@ -82,7 +82,7 @@ func (suite *KeeperTestSuite) SetupTest() { app.BlockedAddrs(), authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) - nftKeeper := nftkeeper.NewKeeper(sdknftkeeper.NewKeeper(app.GetKey(nft.StoreKey), appCodec, accountKeeper, bankKeeper), appCodec) + nftKeeper := nftkeeper.NewKeeper(sdknftkeeper.NewKeeper(app.GetKey(nft.StoreKey), appCodec, accountKeeper, bankKeeper), appCodec, authtypes.NewModuleAddress(govtypes.ModuleName).String()) keeper := keeper.NewKeeper(appCodec, app.GetKey(types.StoreKey), app.GetKey(types.MemStoreKey), suite.app.GetSubspace(types.ModuleName), accountKeeper, bankKeeper, nftKeeper) hooks := dummyNftmarketHook{} keeper.SetHooks(&hooks) diff --git a/x/nftfactory/client/cli/flags.go b/x/nftfactory/client/cli/flags.go index ed6157a42..6b7992cc6 100644 --- a/x/nftfactory/client/cli/flags.go +++ b/x/nftfactory/client/cli/flags.go @@ -5,17 +5,28 @@ import ( ) const ( + FlagName = "name" FlagSymbol = "symbol" FlagDescription = "description" - FlagClassUri = "class-uri" + FlagUri = "uri" + FlagUriHash = "uri-hash" ) var ( FsCreateClass = flag.NewFlagSet("", flag.ContinueOnError) + FsUpdateClass = flag.NewFlagSet("", flag.ContinueOnError) ) func init() { + FsCreateClass.String(FlagSymbol, "", "Class name") FsCreateClass.String(FlagSymbol, "", "Class symbol") FsCreateClass.String(FlagDescription, "", "Description for denom") - FsCreateClass.String(FlagClassUri, "", "Content URI for class") + FsCreateClass.String(FlagUri, "", "Content URI for class") + FsCreateClass.String(FlagUriHash, "", "Hash of content URI for class") + + FsUpdateClass.String(FlagSymbol, "", "Class name") + FsUpdateClass.String(FlagSymbol, "", "Class symbol") + FsUpdateClass.String(FlagDescription, "", "Description for denom") + FsUpdateClass.String(FlagUri, "", "Content URI for class") + FsUpdateClass.String(FlagUriHash, "", "Hash of content URI for class") } diff --git a/x/nftfactory/client/cli/tx.go b/x/nftfactory/client/cli/tx.go index 554cd077f..303a0970e 100644 --- a/x/nftfactory/client/cli/tx.go +++ b/x/nftfactory/client/cli/tx.go @@ -2,7 +2,6 @@ package cli import ( "fmt" - "strconv" "strings" "github.com/spf13/cobra" @@ -29,11 +28,10 @@ func GetTxCmd() *cobra.Command { cmd.AddCommand( CmdCreateClass(), + CmdUpdateClass(), CmdMintNFT(), CmdBurnNFT(), - CmdSendClassOwnership(), - CmdUpdateTokenSupplyCap(), - CmdUpdateBaseTokenUri(), + CmdChangeAdmin(), ) return cmd @@ -41,15 +39,17 @@ func GetTxCmd() *cobra.Command { func CmdCreateClass() *cobra.Command { cmd := &cobra.Command{ - Use: "create-class [class-name] [base-token-uri]] [token-supply-cap] [minting-permission] --from [sender]", - Args: cobra.ExactArgs(4), + Use: "create-class [subclass] --from [sender]", + Args: cobra.ExactArgs(1), Short: "create class for minting NFTs", Long: strings.TrimSpace(fmt.Sprintf( - "Example:$ %s tx %s create-class "+ + "Example:$ %s tx %s create-class "+ "--from "+ - "--symbol "+ - "--description "+ - "--class-uri "+ + "--name "+ + "--symbol "+ + "--description "+ + "--class-uri "+ + "--class-uri-hash "+ "--chain-id= "+ "--fees=", version.AppName, types.ModuleName), ), @@ -59,36 +59,37 @@ func CmdCreateClass() *cobra.Command { return err } - tokenSupplyCap, err := strconv.ParseUint(args[2], 10, 64) + subClass := args[0] + + className, err := cmd.Flags().GetString(FlagName) if err != nil { return err } - mintingPermission, err := strconv.ParseInt(args[3], 10, 32) + classSymbol, err := cmd.Flags().GetString(FlagSymbol) if err != nil { return err } - classSymbol, err := cmd.Flags().GetString(FlagSymbol) + classDescription, err := cmd.Flags().GetString(FlagDescription) if err != nil { return err } - classDescription, err := cmd.Flags().GetString(FlagDescription) + classUri, err := cmd.Flags().GetString(FlagUri) if err != nil { return err } - classUri, err := cmd.Flags().GetString(FlagClassUri) + classUriHash, err := cmd.Flags().GetString(FlagUriHash) if err != nil { return err } msg := types.NewMsgCreateClass( clientCtx.GetFromAddress().String(), - args[0], - args[1], - tokenSupplyCap, - types.MintingPermission(mintingPermission), + subClass, + className, classSymbol, classDescription, classUri, + classUriHash, ) if err := msg.ValidateBasic(); err != nil { return err @@ -102,16 +103,19 @@ func CmdCreateClass() *cobra.Command { return cmd } -func CmdMintNFT() *cobra.Command { +func CmdUpdateClass() *cobra.Command { cmd := &cobra.Command{ - Use: "mint-nft [class-id] [nft-id] [receiver] --from [sender]", - Args: cobra.ExactArgs(3), - Short: "mint NFT under specific class by class-id", + Use: "update-class [class-id] --from [sender]", + Args: cobra.ExactArgs(1), + Short: "update class", Long: strings.TrimSpace(fmt.Sprintf( - "Note: nft-id must start with [a-zA-Z] character."+ - "nft-id will be that nft-uri combined with base token uri of the class-id, like "+ - "$ %s tx %s mint-nft "+ + "Example:$ %s tx %s create-class "+ "--from "+ + "--name "+ + "--symbol "+ + "--description "+ + "--class-uri "+ + "--class-uri-hash "+ "--chain-id= "+ "--fees=", version.AppName, types.ModuleName), ), @@ -121,69 +125,61 @@ func CmdMintNFT() *cobra.Command { return err } - sender := clientCtx.GetFromAddress() + classId := args[0] - recipient := args[2] - recipientAddr, err := sdk.AccAddressFromBech32(recipient) + className, err := cmd.Flags().GetString(FlagName) if err != nil { return err } - - msg := types.NewMsgMintNFT( - sender.String(), - args[0], - args[1], - recipientAddr.String(), - ) - - if err := msg.ValidateBasic(); err != nil { + classSymbol, err := cmd.Flags().GetString(FlagSymbol) + if err != nil { return err } - - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) - }, - } - - flags.AddTxFlagsToCmd(cmd) - return cmd -} - -func CmdBurnNFT() *cobra.Command { - cmd := &cobra.Command{ - Use: "burn-nft [class-id] [nft-id] --from [sender]", - Args: cobra.ExactArgs(2), - Short: "burn specified NFT", - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) + classDescription, err := cmd.Flags().GetString(FlagDescription) + if err != nil { + return err + } + classUri, err := cmd.Flags().GetString(FlagUri) + if err != nil { + return err + } + classUriHash, err := cmd.Flags().GetString(FlagUriHash) if err != nil { return err } - sender := clientCtx.GetFromAddress() - - msg := types.NewMsgBurnNFT( - sender.String(), - args[0], - args[1], + msg := types.NewMsgUpdateClass( + clientCtx.GetFromAddress().String(), + classId, + className, + classSymbol, + classDescription, + classUri, + classUriHash, ) - if err := msg.ValidateBasic(); err != nil { return err } - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) }, } + cmd.Flags().AddFlagSet(FsUpdateClass) flags.AddTxFlagsToCmd(cmd) return cmd } -func CmdSendClassOwnership() *cobra.Command { +func CmdMintNFT() *cobra.Command { cmd := &cobra.Command{ - Use: "send-class [class-id] [recipient] --from [sender]", - Args: cobra.ExactArgs(2), - Short: "send the ownership of class", + Use: "mint-nft [class-id] [token-id] [receiver] --from [sender]", + Args: cobra.ExactArgs(3), + Short: "mint NFT under specific class by class-id", + Long: strings.TrimSpace(fmt.Sprintf( + "$ %s tx %s mint-nft "+ + "--from "+ + "--chain-id= "+ + "--fees=", version.AppName, types.ModuleName), + ), RunE: func(cmd *cobra.Command, args []string) error { clientCtx, err := client.GetClientTxContext(cmd) if err != nil { @@ -191,15 +187,19 @@ func CmdSendClassOwnership() *cobra.Command { } sender := clientCtx.GetFromAddress() - recipient := args[1] + + classId := args[0] + tokenId := args[1] + recipient := args[2] recipientAddr, err := sdk.AccAddressFromBech32(recipient) if err != nil { return err } - msg := types.NewMsgSendClassOwnership( + msg := types.NewMsgMintNFT( sender.String(), - args[0], + classId, + tokenId, recipientAddr.String(), ) @@ -215,11 +215,11 @@ func CmdSendClassOwnership() *cobra.Command { return cmd } -func CmdUpdateTokenSupplyCap() *cobra.Command { +func CmdBurnNFT() *cobra.Command { cmd := &cobra.Command{ - Use: "update-token-supply-cap [class-id] [token-supply-cap] --from [sender]", + Use: "burn-nft [class-id] [token-id] --from [sender]", Args: cobra.ExactArgs(2), - Short: "update the token supply cap of class specified by class id", + Short: "burn specified NFT", RunE: func(cmd *cobra.Command, args []string) error { clientCtx, err := client.GetClientTxContext(cmd) if err != nil { @@ -228,15 +228,13 @@ func CmdUpdateTokenSupplyCap() *cobra.Command { sender := clientCtx.GetFromAddress() - tokenSupplyCap, err := strconv.ParseUint(args[1], 10, 64) - if err != nil { - return err - } + classId := args[0] + tokenId := args[1] - msg := types.NewMsgUpdateTokenSupplyCap( + msg := types.NewMsgBurnNFT( sender.String(), - args[0], - tokenSupplyCap, + classId, + tokenId, ) if err := msg.ValidateBasic(); err != nil { @@ -251,11 +249,11 @@ func CmdUpdateTokenSupplyCap() *cobra.Command { return cmd } -func CmdUpdateBaseTokenUri() *cobra.Command { +func CmdChangeAdmin() *cobra.Command { cmd := &cobra.Command{ - Use: "update-base-token-uri [class-id] [base-token-uri] --from [sender]", + Use: "change-admin [class-id] [new-admin-address] --from [sender]", Args: cobra.ExactArgs(2), - Short: "update the base token uri of class specified by class id and automatically change the belonging nft uris", + Short: "Changes the admin address for a factory-created class. Must have admin authority to do so.", RunE: func(cmd *cobra.Command, args []string) error { clientCtx, err := client.GetClientTxContext(cmd) if err != nil { @@ -263,11 +261,13 @@ func CmdUpdateBaseTokenUri() *cobra.Command { } sender := clientCtx.GetFromAddress() + classId := args[0] + newAdmin := args[1] - msg := types.NewMsgUpdateBaseTokenUri( + msg := types.NewMsgChangeAdmin( sender.String(), - args[0], - args[1], + classId, + newAdmin, ) if err := msg.ValidateBasic(); err != nil { diff --git a/x/nftfactory/keeper/createclass.go b/x/nftfactory/keeper/createclass.go index bb92df3c2..7f836d39a 100644 --- a/x/nftfactory/keeper/createclass.go +++ b/x/nftfactory/keeper/createclass.go @@ -1,8 +1,9 @@ package keeper import ( + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + // sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/x/nft" @@ -14,17 +15,17 @@ import ( func (k Keeper) CreateClass(ctx sdk.Context, creatorAddr, subdenom string) (newTokenDenom string, err error) { err = k.chargeFeeForDenomCreation(ctx, creatorAddr) if err != nil { - return "", sdkerrors.Wrapf(types.ErrUnableToCharge, "class fee collection error: %v", err) + return "", errorsmod.Wrapf(types.ErrUnableToCharge, "class fee collection error: %v", err) } denom, err := k.validateCreateDenom(ctx, creatorAddr, subdenom) if err != nil { - return "", sdkerrors.Wrapf(types.ErrInvalidClassId, "class id validation error: %v", err) + return "", errorsmod.Wrapf(types.ErrInvalidClassId, "class id validation error: %v", err) } err = k.createClassAfterValidation(ctx, creatorAddr, denom) if err != nil { - return "", sdkerrors.Wrap(err, "create class after validation error") + return "", errorsmod.Wrap(err, "create class after validation error") } return denom, nil @@ -40,7 +41,7 @@ func (k Keeper) createClassAfterValidation(ctx sdk.Context, creatorAddr, classId } err = k.setAuthorityMetadata(ctx, classId, authorityMetadata) if err != nil { - return sdkerrors.Wrapf(types.ErrInvalidAuthorityMetadata, "unable to set authority metadata: %v", err) + return errorsmod.Wrapf(types.ErrInvalidAuthorityMetadata, "unable to set authority metadata: %v", err) } k.addDenomFromCreator(ctx, creatorAddr, classId) @@ -51,7 +52,7 @@ func (k Keeper) validateCreateDenom(ctx sdk.Context, creatorAddr, subclass strin denom, err := types.GetClassId(creatorAddr, subclass) if err != nil { - return "", sdkerrors.Wrapf(types.ErrInvalidClassId, "invalid class id: %v", err) + return "", errorsmod.Wrapf(types.ErrInvalidClassId, "invalid class id: %v", err) } _, found := k.nftKeeper.GetClass(ctx, denom) @@ -67,7 +68,7 @@ func (k Keeper) chargeFeeForDenomCreation(ctx sdk.Context, creatorAddr string) ( creationFee := k.GetParams(ctx).ClassCreationFee accAddr, err := sdk.AccAddressFromBech32(creatorAddr) if err != nil { - return sdkerrors.Wrapf(types.ErrUnableToCharge, "wrong creator address: %v", err) + return errorsmod.Wrapf(types.ErrUnableToCharge, "wrong creator address: %v", err) } params := k.GetParams(ctx) @@ -75,7 +76,7 @@ func (k Keeper) chargeFeeForDenomCreation(ctx sdk.Context, creatorAddr string) ( if len(creationFee) > 0 { feeCollectorAddr, err := sdk.AccAddressFromBech32(params.FeeCollectorAddress) if err != nil { - return sdkerrors.Wrapf(types.ErrUnableToCharge, "wrong fee collector address: %v", err) + return errorsmod.Wrapf(types.ErrUnableToCharge, "wrong fee collector address: %v", err) } err = k.bankKeeper.SendCoins( @@ -85,7 +86,7 @@ func (k Keeper) chargeFeeForDenomCreation(ctx sdk.Context, creatorAddr string) ( ) if err != nil { - return sdkerrors.Wrap(err, "unable to send coins to fee collector") + return errorsmod.Wrap(err, "unable to send coins to fee collector") } } diff --git a/x/nftfactory/keeper/creators.go b/x/nftfactory/keeper/creators.go index c3145474e..29db98c12 100644 --- a/x/nftfactory/keeper/creators.go +++ b/x/nftfactory/keeper/creators.go @@ -4,9 +4,9 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ) -func (k Keeper) addDenomFromCreator(ctx sdk.Context, creator, denom string) { +func (k Keeper) addDenomFromCreator(ctx sdk.Context, creator, classId string) { store := k.GetCreatorPrefixStore(ctx, creator) - store.Set([]byte(denom), []byte(denom)) + store.Set([]byte(classId), []byte(classId)) } func (k Keeper) getDenomsFromCreator(ctx sdk.Context, creator string) []string { @@ -15,11 +15,11 @@ func (k Keeper) getDenomsFromCreator(ctx sdk.Context, creator string) []string { iterator := store.Iterator(nil, nil) defer iterator.Close() - denoms := []string{} + classIds := []string{} for ; iterator.Valid(); iterator.Next() { - denoms = append(denoms, string(iterator.Key())) + classIds = append(classIds, string(iterator.Key())) } - return denoms + return classIds } func (k Keeper) GetAllDenomsIterator(ctx sdk.Context) sdk.Iterator { diff --git a/x/nftfactory/types/msgs.go b/x/nftfactory/types/msgs.go index 8de1c1848..61318ba39 100644 --- a/x/nftfactory/types/msgs.go +++ b/x/nftfactory/types/msgs.go @@ -16,9 +16,21 @@ var ( func NewMsgCreateClass( sender string, + subclass string, + name string, + symbol string, + description string, + uri string, + uriHash string, ) *MsgCreateClass { return &MsgCreateClass{ - Sender: sender, + Sender: sender, + Subclass: subclass, + Name: name, + Symbol: symbol, + Description: description, + Uri: uri, + UriHash: uriHash, } } @@ -39,9 +51,21 @@ func (msg MsgCreateClass) GetSigners() []sdk.AccAddress { func NewMsgUpdateClass( sender string, + classId string, + name string, + symbol string, + description string, + uri string, + uriHash string, ) *MsgUpdateClass { return &MsgUpdateClass{ - Sender: sender, + Sender: sender, + ClassId: classId, + Name: name, + Symbol: symbol, + Description: description, + Uri: uri, + UriHash: uriHash, } } @@ -62,13 +86,13 @@ func (msg MsgUpdateClass) GetSigners() []sdk.AccAddress { func NewMsgMintNFT( sender string, - classID, nftID string, + classID, tokenID string, recipient string, ) *MsgMintNFT { return &MsgMintNFT{ Sender: sender, ClassId: classID, - NftId: nftID, + TokenId: tokenID, Recipient: recipient, } } @@ -83,8 +107,8 @@ func (msg MsgMintNFT) ValidateBasic() error { return sdkerrors.Wrapf(nfttypes.ErrEmptyClassID, "Invalid class id (%s)", msg.ClassId) } - if err := ValidateNFTID(msg.NftId); err != nil { - return sdkerrors.Wrapf(nfttypes.ErrEmptyNFTID, "Invalid nft id (%s)", msg.NftId) + if err := ValidateNFTID(msg.TokenId); err != nil { + return sdkerrors.Wrapf(nfttypes.ErrEmptyNFTID, "Invalid nft id (%s)", msg.TokenId) } return nil @@ -98,12 +122,12 @@ func (msg MsgMintNFT) GetSigners() []sdk.AccAddress { func NewMsgBurnNFT( burner string, - classID, nftID string, + classId, tokenId string, ) *MsgBurnNFT { return &MsgBurnNFT{ Sender: burner, - ClassId: classID, - NftId: nftID, + ClassId: classId, + TokenId: tokenId, } } @@ -117,8 +141,8 @@ func (msg MsgBurnNFT) ValidateBasic() error { return sdkerrors.Wrapf(nfttypes.ErrEmptyClassID, "Invalid class id (%s)", msg.ClassId) } - if err := ValidateNFTID(msg.NftId); err != nil { - return sdkerrors.Wrapf(nfttypes.ErrEmptyNFTID, "Invalid nft id (%s)", msg.NftId) + if err := ValidateNFTID(msg.TokenId); err != nil { + return sdkerrors.Wrapf(nfttypes.ErrEmptyNFTID, "Invalid nft id (%s)", msg.TokenId) } return nil @@ -132,9 +156,13 @@ func (msg MsgBurnNFT) GetSigners() []sdk.AccAddress { func NewMsgChangeAdmin( sender string, + classId string, + newAdmin string, ) *MsgChangeAdmin { return &MsgChangeAdmin{ - Sender: sender, + Sender: sender, + ClassId: classId, + NewAdmin: newAdmin, } } diff --git a/x/nftfactory/types/tx.pb.go b/x/nftfactory/types/tx.pb.go index 70c9511f7..6040a6b09 100644 --- a/x/nftfactory/types/tx.pb.go +++ b/x/nftfactory/types/tx.pb.go @@ -304,7 +304,7 @@ var xxx_messageInfo_MsgUpdateClassResponse proto.InternalMessageInfo type MsgMintNFT struct { Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` - NftId string `protobuf:"bytes,3,opt,name=nft_id,json=nftId,proto3" json:"nft_id,omitempty"` + TokenId string `protobuf:"bytes,3,opt,name=token_id,json=tokenId,proto3" json:"token_id,omitempty"` Recipient string `protobuf:"bytes,4,opt,name=recipient,proto3" json:"recipient,omitempty"` } @@ -355,9 +355,9 @@ func (m *MsgMintNFT) GetClassId() string { return "" } -func (m *MsgMintNFT) GetNftId() string { +func (m *MsgMintNFT) GetTokenId() string { if m != nil { - return m.NftId + return m.TokenId } return "" } @@ -408,7 +408,7 @@ var xxx_messageInfo_MsgMintNFTResponse proto.InternalMessageInfo type MsgBurnNFT struct { Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` - NftId string `protobuf:"bytes,3,opt,name=nft_id,json=nftId,proto3" json:"nft_id,omitempty"` + TokenId string `protobuf:"bytes,3,opt,name=token_id,json=tokenId,proto3" json:"token_id,omitempty"` } func (m *MsgBurnNFT) Reset() { *m = MsgBurnNFT{} } @@ -458,9 +458,9 @@ func (m *MsgBurnNFT) GetClassId() string { return "" } -func (m *MsgBurnNFT) GetNftId() string { +func (m *MsgBurnNFT) GetTokenId() string { if m != nil { - return m.NftId + return m.TokenId } return "" } @@ -615,45 +615,45 @@ func init() { func init() { proto.RegisterFile("ununifi/nftfactory/tx.proto", fileDescriptor_47805922275bdc64) } var fileDescriptor_47805922275bdc64 = []byte{ - // 593 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x55, 0x4f, 0x6f, 0xd3, 0x30, - 0x1c, 0x6d, 0x68, 0xd7, 0x3f, 0xae, 0x80, 0x61, 0xba, 0x2a, 0x2b, 0x28, 0xad, 0x82, 0x84, 0xc6, - 0x90, 0x12, 0x31, 0x6e, 0xdc, 0xe8, 0x60, 0x62, 0x87, 0x22, 0x51, 0x51, 0x0e, 0x48, 0xa8, 0x72, - 0x13, 0x37, 0xb1, 0xd4, 0x3a, 0x51, 0xec, 0x68, 0xeb, 0xb7, 0xe0, 0x13, 0xf0, 0x79, 0x76, 0xdc, - 0x91, 0x53, 0x85, 0xda, 0x1b, 0xdc, 0xfa, 0x09, 0x50, 0x1c, 0xe7, 0x4f, 0xb7, 0x85, 0x49, 0x88, - 0x0b, 0x87, 0x4a, 0xf6, 0xef, 0xbd, 0xbc, 0xdf, 0xf3, 0xeb, 0xcf, 0x09, 0x78, 0x14, 0xd2, 0x90, - 0x92, 0x29, 0x31, 0xe9, 0x94, 0x4f, 0x91, 0xc5, 0xbd, 0x60, 0x61, 0xf2, 0x73, 0xc3, 0x0f, 0x3c, - 0xee, 0x41, 0x28, 0x41, 0x23, 0x03, 0x3b, 0x2d, 0xc7, 0x73, 0x3c, 0x01, 0x9b, 0xd1, 0x2a, 0x66, - 0x76, 0xf6, 0x72, 0x32, 0xd1, 0x4f, 0x96, 0x9f, 0xdc, 0xa0, 0x9e, 0x2d, 0x63, 0x92, 0xfe, 0x4b, - 0x01, 0xf7, 0x06, 0xcc, 0x39, 0x0e, 0x30, 0xe2, 0xf8, 0x78, 0x86, 0x18, 0x83, 0x6d, 0x50, 0x65, - 0x98, 0xda, 0x38, 0x50, 0x95, 0x9e, 0x72, 0xd0, 0x18, 0xca, 0x1d, 0xec, 0x80, 0x3a, 0x0b, 0x27, - 0x56, 0xc4, 0x51, 0xef, 0x08, 0x24, 0xdd, 0x43, 0x08, 0x2a, 0x14, 0xcd, 0xb1, 0x5a, 0x16, 0x75, - 0xb1, 0x16, 0x3a, 0x8b, 0xf9, 0xc4, 0x9b, 0xa9, 0x15, 0xa9, 0x23, 0x76, 0xb0, 0x07, 0x9a, 0x36, - 0x66, 0x56, 0x40, 0x7c, 0x4e, 0x3c, 0xaa, 0xee, 0x08, 0x30, 0x5f, 0x82, 0xbb, 0xa0, 0x1c, 0x06, - 0x44, 0xad, 0x0a, 0x24, 0x5a, 0xc2, 0x7d, 0x50, 0x0f, 0x03, 0x32, 0x76, 0x11, 0x73, 0xd5, 0x9a, - 0x28, 0xd7, 0xc2, 0x80, 0xbc, 0x43, 0xcc, 0x85, 0x87, 0xa0, 0x62, 0x23, 0x8e, 0xd4, 0x7a, 0x4f, - 0x39, 0x68, 0x1e, 0xb5, 0x8d, 0x5c, 0x6c, 0x86, 0x38, 0xd0, 0x1b, 0xc4, 0xd1, 0x50, 0x70, 0x74, - 0x15, 0xb4, 0xb7, 0x0f, 0x3b, 0xc4, 0xcc, 0xf7, 0x28, 0xc3, 0xfa, 0xcf, 0x38, 0x87, 0x91, 0x6f, - 0xdf, 0x9a, 0xc3, 0x3e, 0xa8, 0x8b, 0x43, 0x8f, 0x89, 0x2d, 0x73, 0xa8, 0x89, 0xfd, 0xa9, 0xfd, - 0x7f, 0xc5, 0x90, 0x3b, 0x6b, 0x1a, 0x03, 0x07, 0x60, 0xc0, 0x9c, 0x01, 0xa1, 0xfc, 0xfd, 0xc9, - 0xc7, 0xbf, 0x49, 0x60, 0x0f, 0x54, 0xe9, 0x94, 0x47, 0x40, 0x9c, 0xc1, 0x0e, 0x9d, 0xf2, 0x53, - 0x1b, 0x3e, 0x06, 0x8d, 0x00, 0x5b, 0xc4, 0x27, 0x98, 0x72, 0x99, 0x43, 0x56, 0xd0, 0x5b, 0x00, - 0x66, 0x5d, 0x53, 0x2f, 0x9f, 0x84, 0x97, 0x7e, 0x18, 0xd0, 0x7f, 0xea, 0x45, 0x76, 0x93, 0xba, - 0x69, 0xb7, 0x6f, 0xf2, 0x22, 0xb8, 0x88, 0x3a, 0xf8, 0xb5, 0x3d, 0x27, 0x14, 0x3e, 0xdb, 0x6e, - 0xd9, 0x7f, 0xb0, 0x59, 0x76, 0xef, 0x2e, 0xd0, 0x7c, 0xf6, 0x4a, 0x8f, 0xeb, 0x7a, 0xea, 0xc2, - 0xb8, 0xea, 0xa2, 0xff, 0x70, 0xb3, 0xec, 0xde, 0x8f, 0xc9, 0x09, 0xa2, 0x67, 0xd6, 0x5e, 0x80, - 0x06, 0xc5, 0x67, 0x63, 0x14, 0xf5, 0x89, 0xdd, 0xf5, 0x5b, 0x9b, 0x65, 0x77, 0x37, 0x7e, 0x20, - 0x85, 0xf4, 0x61, 0x9d, 0xe2, 0x33, 0xe1, 0x26, 0x99, 0xdd, 0xcc, 0x5f, 0x62, 0xfd, 0xe8, 0xa2, - 0x0c, 0xca, 0x03, 0xe6, 0xc0, 0x2f, 0xa0, 0x99, 0xbf, 0xc7, 0xba, 0x71, 0xfd, 0x0d, 0x62, 0x6c, - 0x8f, 0x7f, 0xe7, 0xf0, 0x76, 0x4e, 0xd2, 0x26, 0x92, 0xcf, 0x5f, 0x8f, 0x22, 0xf9, 0x1c, 0xa7, - 0x50, 0xfe, 0x86, 0xd1, 0x83, 0x1f, 0x40, 0x2d, 0x99, 0x3b, 0xad, 0xe0, 0x31, 0x89, 0x77, 0x9e, - 0xfe, 0x19, 0xcf, 0x4b, 0x26, 0xe3, 0x53, 0x24, 0x29, 0xf1, 0x42, 0xc9, 0x2b, 0x63, 0x22, 0x32, - 0xce, 0x8d, 0x48, 0x61, 0xc6, 0x19, 0xa7, 0x38, 0xe3, 0xeb, 0x7f, 0x65, 0xff, 0xed, 0xc5, 0x4a, - 0x53, 0x2e, 0x57, 0x9a, 0xf2, 0x63, 0xa5, 0x29, 0x5f, 0xd7, 0x5a, 0xe9, 0x72, 0xad, 0x95, 0xbe, - 0xaf, 0xb5, 0xd2, 0xe7, 0xe7, 0x0e, 0xe1, 0x6e, 0x38, 0x31, 0x2c, 0x6f, 0x6e, 0x8e, 0xe8, 0x88, - 0x92, 0x13, 0x62, 0x5a, 0x2e, 0x22, 0xd4, 0x3c, 0xdf, 0xfa, 0x7c, 0x2c, 0x7c, 0xcc, 0x26, 0x55, - 0xf1, 0x72, 0x7f, 0xf9, 0x3b, 0x00, 0x00, 0xff, 0xff, 0x40, 0xcf, 0x39, 0xb9, 0x61, 0x06, 0x00, - 0x00, + // 594 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x55, 0x4f, 0x8f, 0xd2, 0x40, + 0x14, 0xa7, 0x82, 0x50, 0x86, 0xa8, 0xeb, 0x88, 0xa4, 0xa0, 0x29, 0xa4, 0x26, 0x66, 0x5d, 0x93, + 0x36, 0xae, 0x37, 0x6f, 0xb2, 0xba, 0x71, 0x0f, 0x98, 0x48, 0xe4, 0xb2, 0x89, 0x21, 0x43, 0x3b, + 0xb4, 0x13, 0x61, 0xda, 0x74, 0xa6, 0x59, 0xf8, 0x16, 0x7e, 0x02, 0x3f, 0xcf, 0x1e, 0xf7, 0xe8, + 0x89, 0x18, 0xb8, 0xe9, 0x8d, 0x4f, 0x60, 0x3a, 0xfd, 0xcb, 0xee, 0xd6, 0x4d, 0x8c, 0x97, 0x3d, + 0x90, 0xcc, 0x7b, 0xbf, 0xd7, 0xdf, 0xfb, 0xcd, 0x8f, 0xf7, 0x5a, 0xf0, 0x24, 0xa0, 0x01, 0x25, + 0x53, 0x62, 0xd0, 0x29, 0x9f, 0x22, 0x93, 0xbb, 0xfe, 0xd2, 0xe0, 0x0b, 0xdd, 0xf3, 0x5d, 0xee, + 0x42, 0x18, 0x83, 0x7a, 0x06, 0x76, 0x9a, 0xb6, 0x6b, 0xbb, 0x02, 0x36, 0xc2, 0x53, 0x54, 0xd9, + 0x79, 0x9c, 0xa3, 0x09, 0x7f, 0x71, 0xfa, 0xd9, 0x35, 0xec, 0xd9, 0x31, 0x2a, 0xd2, 0x7e, 0x4b, + 0xe0, 0xfe, 0x80, 0xd9, 0x47, 0x3e, 0x46, 0x1c, 0x1f, 0xcd, 0x10, 0x63, 0xb0, 0x05, 0xaa, 0x0c, + 0x53, 0x0b, 0xfb, 0x8a, 0xd4, 0x93, 0xf6, 0xeb, 0xc3, 0x38, 0x82, 0x1d, 0x20, 0xb3, 0x60, 0x62, + 0x86, 0x35, 0xca, 0x1d, 0x81, 0xa4, 0x31, 0x84, 0xa0, 0x42, 0xd1, 0x1c, 0x2b, 0x65, 0x91, 0x17, + 0x67, 0xc1, 0xb3, 0x9c, 0x4f, 0xdc, 0x99, 0x52, 0x89, 0x79, 0x44, 0x04, 0x7b, 0xa0, 0x61, 0x61, + 0x66, 0xfa, 0xc4, 0xe3, 0xc4, 0xa5, 0xca, 0x5d, 0x01, 0xe6, 0x53, 0x70, 0x0f, 0x94, 0x03, 0x9f, + 0x28, 0x55, 0x81, 0x84, 0x47, 0xd8, 0x06, 0x72, 0xe0, 0x93, 0xb1, 0x83, 0x98, 0xa3, 0xd4, 0x44, + 0xba, 0x16, 0xf8, 0xe4, 0x03, 0x62, 0x0e, 0x3c, 0x00, 0x15, 0x0b, 0x71, 0xa4, 0xc8, 0x3d, 0x69, + 0xbf, 0x71, 0xd8, 0xd2, 0x73, 0xb6, 0xe9, 0xe2, 0x42, 0xef, 0x10, 0x47, 0x43, 0x51, 0xa3, 0x29, + 0xa0, 0xb5, 0x7b, 0xd9, 0x21, 0x66, 0x9e, 0x4b, 0x19, 0xd6, 0x7e, 0x45, 0x3e, 0x8c, 0x3c, 0xeb, + 0x46, 0x1f, 0xda, 0x40, 0x16, 0x97, 0x1e, 0x13, 0x2b, 0xf6, 0xa1, 0x26, 0xe2, 0x13, 0xeb, 0x76, + 0xd9, 0x90, 0xbb, 0x6b, 0x6a, 0xc3, 0x02, 0x80, 0x01, 0xb3, 0x07, 0x84, 0xf2, 0x8f, 0xc7, 0x9f, + 0xff, 0xc5, 0x81, 0x36, 0x90, 0xb9, 0xfb, 0x15, 0xd3, 0x10, 0x8a, 0x5c, 0xa8, 0x89, 0xf8, 0xc4, + 0x82, 0x4f, 0x41, 0xdd, 0xc7, 0x26, 0xf1, 0x08, 0xa6, 0x3c, 0xf6, 0x22, 0x4b, 0x68, 0x4d, 0x00, + 0xb3, 0xce, 0xa9, 0x9e, 0x53, 0xa1, 0xa7, 0x1f, 0xf8, 0xf4, 0xbf, 0xeb, 0x89, 0x3b, 0xc6, 0xdc, + 0x69, 0xc7, 0xef, 0xf1, 0x42, 0x38, 0x88, 0xda, 0xf8, 0xad, 0x35, 0x27, 0x14, 0xbe, 0xd8, 0x6d, + 0xdb, 0x7f, 0xb8, 0x5d, 0x75, 0xef, 0x2d, 0xd1, 0x7c, 0xf6, 0x46, 0x8b, 0xf2, 0x5a, 0xaa, 0x44, + 0xbf, 0xac, 0xa4, 0xff, 0x68, 0xbb, 0xea, 0x3e, 0x88, 0x8a, 0x13, 0x44, 0xcb, 0xe4, 0xbd, 0x02, + 0x75, 0x8a, 0xcf, 0xc6, 0x28, 0xec, 0x13, 0xe9, 0xeb, 0x37, 0xb7, 0xab, 0xee, 0x5e, 0xf4, 0x40, + 0x0a, 0x69, 0x43, 0x99, 0xe2, 0x33, 0xa1, 0x26, 0x99, 0xe1, 0x4c, 0x5f, 0x22, 0xfd, 0xf0, 0xbc, + 0x0c, 0xca, 0x03, 0x66, 0xc3, 0x2f, 0xa0, 0x91, 0xdf, 0x67, 0x4d, 0xbf, 0xfa, 0x26, 0xd1, 0x77, + 0xd7, 0xa0, 0x73, 0x70, 0x73, 0x4d, 0xd2, 0x26, 0xa4, 0xcf, 0xaf, 0x49, 0x11, 0x7d, 0xae, 0xa6, + 0x90, 0xfe, 0x9a, 0x11, 0x84, 0x9f, 0x40, 0x2d, 0x99, 0x3f, 0xb5, 0xe0, 0xb1, 0x18, 0xef, 0x3c, + 0xff, 0x3b, 0x9e, 0xa7, 0x4c, 0x46, 0xa8, 0x88, 0x32, 0xc6, 0x0b, 0x29, 0x2f, 0x8d, 0x89, 0xf0, + 0x38, 0x37, 0x22, 0x85, 0x1e, 0x67, 0x35, 0xc5, 0x1e, 0x5f, 0xfd, 0x2b, 0xfb, 0xef, 0xcf, 0xd7, + 0xaa, 0x74, 0xb1, 0x56, 0xa5, 0x9f, 0x6b, 0x55, 0xfa, 0xb6, 0x51, 0x4b, 0x17, 0x1b, 0xb5, 0xf4, + 0x63, 0xa3, 0x96, 0x4e, 0x5f, 0xda, 0x84, 0x3b, 0xc1, 0x44, 0x37, 0xdd, 0xb9, 0x31, 0xa2, 0x23, + 0x4a, 0x8e, 0x89, 0x61, 0x3a, 0x88, 0x50, 0x63, 0xb1, 0xf3, 0x19, 0x59, 0x7a, 0x98, 0x4d, 0xaa, + 0xe2, 0x25, 0xff, 0xfa, 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x35, 0xf1, 0x63, 0xb1, 0x69, 0x06, + 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1121,10 +1121,10 @@ func (m *MsgMintNFT) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x22 } - if len(m.NftId) > 0 { - i -= len(m.NftId) - copy(dAtA[i:], m.NftId) - i = encodeVarintTx(dAtA, i, uint64(len(m.NftId))) + if len(m.TokenId) > 0 { + i -= len(m.TokenId) + copy(dAtA[i:], m.TokenId) + i = encodeVarintTx(dAtA, i, uint64(len(m.TokenId))) i-- dAtA[i] = 0x1a } @@ -1188,10 +1188,10 @@ func (m *MsgBurnNFT) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.NftId) > 0 { - i -= len(m.NftId) - copy(dAtA[i:], m.NftId) - i = encodeVarintTx(dAtA, i, uint64(len(m.NftId))) + if len(m.TokenId) > 0 { + i -= len(m.TokenId) + copy(dAtA[i:], m.TokenId) + i = encodeVarintTx(dAtA, i, uint64(len(m.TokenId))) i-- dAtA[i] = 0x1a } @@ -1427,7 +1427,7 @@ func (m *MsgMintNFT) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } - l = len(m.NftId) + l = len(m.TokenId) if l > 0 { n += 1 + l + sovTx(uint64(l)) } @@ -1461,7 +1461,7 @@ func (m *MsgBurnNFT) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } - l = len(m.NftId) + l = len(m.TokenId) if l > 0 { n += 1 + l + sovTx(uint64(l)) } @@ -2328,7 +2328,7 @@ func (m *MsgMintNFT) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field TokenId", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2356,7 +2356,7 @@ func (m *MsgMintNFT) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.NftId = string(dAtA[iNdEx:postIndex]) + m.TokenId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 4: if wireType != 2 { @@ -2556,7 +2556,7 @@ func (m *MsgBurnNFT) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field TokenId", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2584,7 +2584,7 @@ func (m *MsgBurnNFT) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.NftId = string(dAtA[iNdEx:postIndex]) + m.TokenId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex From 4e2e341dd26eed8009989d2b1916ac69df2db45d Mon Sep 17 00:00:00 2001 From: KIMURA Yu <33382781+KimuraYu45z@users.noreply.github.com> Date: Mon, 14 Aug 2023 12:20:30 +0800 Subject: [PATCH 05/20] feat: nftfactory --- proto/ununifi/nftfactory/event.proto | 18 +- proto/ununifi/nftfactory/nftfactory.proto | 2 +- proto/ununifi/nftfactory/tx.proto | 41 ++- x/nftfactory/keeper/admins.go | 14 +- x/nftfactory/keeper/createclass.go | 13 +- x/nftfactory/keeper/genesis.go | 2 +- x/nftfactory/keeper/msg_server.go | 142 +++++--- x/nftfactory/keeper/nftactions.go | 44 +++ x/nftfactory/spec/02_state.md | 63 +--- x/nftfactory/spec/03_msgs_and_queries.md | 201 +---------- x/nftfactory/spec/04_events.md | 51 +-- x/nftfactory/spec/05_params.md | 38 +- x/nftfactory/spec/README.md | 11 +- x/nftfactory/types/{denoms.go => class_id.go} | 23 +- x/nftfactory/types/errors.go | 5 +- x/nftfactory/types/event.pb.go | 162 ++++----- x/nftfactory/types/genesis.go | 2 +- x/nftfactory/types/nftfactory.pb.go | 2 +- x/nftfactory/types/tx.pb.go | 329 ++++++++---------- 19 files changed, 481 insertions(+), 682 deletions(-) create mode 100644 x/nftfactory/keeper/nftactions.go rename x/nftfactory/types/{denoms.go => class_id.go} (68%) diff --git a/proto/ununifi/nftfactory/event.proto b/proto/ununifi/nftfactory/event.proto index 184d3303a..03fce426b 100644 --- a/proto/ununifi/nftfactory/event.proto +++ b/proto/ununifi/nftfactory/event.proto @@ -7,30 +7,30 @@ import "ununifi/nftfactory/nftfactory.proto"; option go_package = "github.com/UnUniFi/chain/x/nftfactory/types"; message EventCreateClass { - string owner = 1; + string sender = 1; string class_id = 2; } message EventUpdateClass { - string owner = 1; + string sender = 1; string class_id = 2; } message EventMintNFT { - string owner = 1; + string sender = 1; string class_id = 2; - string nft_id = 3; + string token_id = 3; string recipient = 4; } message EventBurnNFT { - string owner = 1; + string sender = 1; string class_id = 2; - string nft_id = 3; + string token_id = 3; } message EventChangeAdmin { - string admin = 1; - string class_id = 3; - string new_admin = 2; + string admin = 1; + string class_id = 3; + string new_admin = 2; } diff --git a/proto/ununifi/nftfactory/nftfactory.proto b/proto/ununifi/nftfactory/nftfactory.proto index d11e1fe9e..af87fc5fb 100644 --- a/proto/ununifi/nftfactory/nftfactory.proto +++ b/proto/ununifi/nftfactory/nftfactory.proto @@ -12,7 +12,7 @@ option go_package = "github.com/UnUniFi/chain/x/nftfactory/types"; message ClassAuthorityMetadata { option (gogoproto.equal) = true; - // Can be empty for no admin, or a valid osmosis address + // Can be empty for no admin, or a valid address string Admin = 1 [ (gogoproto.moretags) = "yaml:\"admin\"" ]; } diff --git a/proto/ununifi/nftfactory/tx.proto b/proto/ununifi/nftfactory/tx.proto index b857e323e..82df2c3f6 100644 --- a/proto/ununifi/nftfactory/tx.proto +++ b/proto/ununifi/nftfactory/tx.proto @@ -2,7 +2,6 @@ syntax = "proto3"; package ununifi.nftfactory; import "gogoproto/gogo.proto"; -import "ununifi/nft/nft.proto"; import "ununifi/nftfactory/nftfactory.proto"; option go_package = "github.com/UnUniFi/chain/x/nftfactory/types"; @@ -16,35 +15,38 @@ service Msg { } message MsgCreateClass { - string sender = 1; - string subclass = 2; - string name = 3; - string symbol = 4; - string description = 5; - string uri = 6; - string uri_hash = 7; - ununifi.nft.ClassData data = 8; + string sender = 1; + string subclass = 2; + string name = 3; + string symbol = 4; + string description = 5; + string uri = 6; + string uri_hash = 7; } + message MsgCreateClassResponse {} message MsgUpdateClass { - string sender = 1; - string class_id = 2; - string name = 3; - string symbol = 4; - string description = 5; - string uri = 6; - string uri_hash = 7; - ununifi.nft.ClassData data = 8; + string sender = 1; + string class_id = 2; + string name = 3; + string symbol = 4; + string description = 5; + string uri = 6; + string uri_hash = 7; } + message MsgUpdateClassResponse {} message MsgMintNFT { string sender = 1; string class_id = 2; - string token_id = 3; - string recipient = 4; + string token_id = 3; + string uri = 4; + string uri_hash = 5; + string recipient = 6; } + message MsgMintNFTResponse {} message MsgBurnNFT { @@ -52,6 +54,7 @@ message MsgBurnNFT { string class_id = 2; string token_id = 3; } + message MsgBurnNFTResponse {} // MsgChangeAdmin is the sdk.Msg type for allowing an admin account to reassign diff --git a/x/nftfactory/keeper/admins.go b/x/nftfactory/keeper/admins.go index 84ee51be1..a43cfa76f 100644 --- a/x/nftfactory/keeper/admins.go +++ b/x/nftfactory/keeper/admins.go @@ -8,8 +8,8 @@ import ( ) // GetAuthorityMetadata returns the authority metadata for a specific denom -func (k Keeper) GetAuthorityMetadata(ctx sdk.Context, denom string) (types.ClassAuthorityMetadata, error) { - bz := k.GetDenomPrefixStore(ctx, denom).Get([]byte(types.ClassAuthorityMetadataKey)) +func (k Keeper) GetAuthorityMetadata(ctx sdk.Context, classId string) (types.ClassAuthorityMetadata, error) { + bz := k.GetDenomPrefixStore(ctx, classId).Get([]byte(types.ClassAuthorityMetadataKey)) metadata := types.ClassAuthorityMetadata{} err := proto.Unmarshal(bz, &metadata) @@ -20,13 +20,13 @@ func (k Keeper) GetAuthorityMetadata(ctx sdk.Context, denom string) (types.Class } // setAuthorityMetadata stores authority metadata for a specific denom -func (k Keeper) setAuthorityMetadata(ctx sdk.Context, denom string, metadata types.ClassAuthorityMetadata) error { +func (k Keeper) setAuthorityMetadata(ctx sdk.Context, classId string, metadata types.ClassAuthorityMetadata) error { err := metadata.Validate() if err != nil { return err } - store := k.GetDenomPrefixStore(ctx, denom) + store := k.GetDenomPrefixStore(ctx, classId) bz, err := proto.Marshal(&metadata) if err != nil { @@ -37,13 +37,13 @@ func (k Keeper) setAuthorityMetadata(ctx sdk.Context, denom string, metadata typ return nil } -func (k Keeper) setAdmin(ctx sdk.Context, denom, admin string) error { - metadata, err := k.GetAuthorityMetadata(ctx, denom) +func (k Keeper) setAdmin(ctx sdk.Context, classId, admin string) error { + metadata, err := k.GetAuthorityMetadata(ctx, classId) if err != nil { return err } metadata.Admin = admin - return k.setAuthorityMetadata(ctx, denom, metadata) + return k.setAuthorityMetadata(ctx, classId, metadata) } diff --git a/x/nftfactory/keeper/createclass.go b/x/nftfactory/keeper/createclass.go index 7f836d39a..f16334ef9 100644 --- a/x/nftfactory/keeper/createclass.go +++ b/x/nftfactory/keeper/createclass.go @@ -5,36 +5,33 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" // sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/cosmos/cosmos-sdk/x/nft" - "github.com/UnUniFi/chain/x/nftfactory/types" ) -// CreateClass creates new class id with `nftfactory/{creatorAddr}/{subdenom}` name. +// CreateClass creates new class id with `factory/{creatorAddr}/{subclass}` name. // Charges creatorAddr fee for creation -func (k Keeper) CreateClass(ctx sdk.Context, creatorAddr, subdenom string) (newTokenDenom string, err error) { +func (k Keeper) CreateClass(ctx sdk.Context, creatorAddr, subclass string) (newClassId string, err error) { err = k.chargeFeeForDenomCreation(ctx, creatorAddr) if err != nil { return "", errorsmod.Wrapf(types.ErrUnableToCharge, "class fee collection error: %v", err) } - denom, err := k.validateCreateDenom(ctx, creatorAddr, subdenom) + classId, err := k.validateCreateDenom(ctx, creatorAddr, subclass) if err != nil { return "", errorsmod.Wrapf(types.ErrInvalidClassId, "class id validation error: %v", err) } - err = k.createClassAfterValidation(ctx, creatorAddr, denom) + err = k.createClassAfterValidation(ctx, creatorAddr, classId) if err != nil { return "", errorsmod.Wrap(err, "create class after validation error") } - return denom, nil + return classId, nil } // Runs CreateClass logic after the charge and all denom validation has been handled. // Made into a second function for genesis initialization. func (k Keeper) createClassAfterValidation(ctx sdk.Context, creatorAddr, classId string) (err error) { - k.nftKeeper.SaveClass(ctx, nft.Class{}) authorityMetadata := types.ClassAuthorityMetadata{ Admin: creatorAddr, diff --git a/x/nftfactory/keeper/genesis.go b/x/nftfactory/keeper/genesis.go index 6aad34f79..7ed10a54c 100644 --- a/x/nftfactory/keeper/genesis.go +++ b/x/nftfactory/keeper/genesis.go @@ -12,7 +12,7 @@ func (k Keeper) InitGenesis(ctx sdk.Context, genState types.GenesisState) { k.SetParams(ctx, genState.Params) for _, genClass := range genState.GetClasses() { - creator, _, err := types.DeconstructDenom(genClass.GetClassId()) + creator, _, err := types.DeconstructClassId(genClass.GetClassId()) if err != nil { panic(err) } diff --git a/x/nftfactory/keeper/msg_server.go b/x/nftfactory/keeper/msg_server.go index d12eae472..44cbcccc9 100644 --- a/x/nftfactory/keeper/msg_server.go +++ b/x/nftfactory/keeper/msg_server.go @@ -2,11 +2,12 @@ package keeper import ( "context" - "strconv" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/UnUniFi/chain/x/nftfactory/types" + + "github.com/cosmos/cosmos-sdk/x/nft" ) type msgServer struct { @@ -24,105 +25,144 @@ var _ types.MsgServer = msgServer{} func (k msgServer) CreateClass(c context.Context, msg *types.MsgCreateClass) (*types.MsgCreateClassResponse, error) { ctx := sdk.UnwrapSDKContext(c) - sender, err := sdk.AccAddressFromBech32(msg.Sender) + classId, err := k.keeper.CreateClass(ctx, msg.Sender, msg.Subclass) if err != nil { return nil, err } - seq, err := k.keeper.accountKeeper.GetSequence(ctx, sender) - if err != nil { - return nil, err + class := nft.Class{ + Id: classId, + Name: msg.Name, + Symbol: msg.Symbol, + Description: msg.Description, + Uri: msg.Uri, + UriHash: msg.UriHash, } - - classID := CreateClassId(seq, sender) - err = k.keeper.CreateClass(ctx, classID, msg) + err = k.keeper.nftKeeper.SaveClass(ctx, class) if err != nil { return nil, err } ctx.EventManager().EmitTypedEvent(&types.EventCreateClass{ - Owner: msg.Sender, - ClassId: classID, - BaseTokenUri: msg.BaseTokenUri, - TokenSupplyCap: strconv.FormatUint(msg.TokenSupplyCap, 10), - MintingPermission: msg.MintingPermission, + Sender: msg.Sender, + ClassId: classId, }) return &types.MsgCreateClassResponse{}, nil } -func (k msgServer) SendClassOwnership(c context.Context, msg *types.MsgSendClassOwnership) (*types.MsgSendClassOwnershipResponse, error) { +func (k msgServer) UpdateClass(c context.Context, msg *types.MsgUpdateClass) (*types.MsgUpdateClassResponse, error) { ctx := sdk.UnwrapSDKContext(c) - if err := k.keeper.SendClassOwnership(ctx, msg); err != nil { + authorityMetadata, err := k.keeper.GetAuthorityMetadata(ctx, msg.ClassId) + if err != nil { return nil, err } - ctx.EventManager().EmitTypedEvent(&types.EventSendClassOwnership{ - Sender: msg.Sender, - ClassId: msg.ClassId, - Receiver: msg.Recipient, + if msg.Sender != authorityMetadata.GetAdmin() { + return nil, types.ErrUnauthorized + } + + k.keeper.nftKeeper.SaveClass(ctx, nft.Class{ + Id: msg.ClassId, + Name: msg.Name, + Symbol: msg.Symbol, + Description: msg.Description, + Uri: msg.Uri, + UriHash: msg.UriHash, + }) + + ctx.EventManager().EmitTypedEvent(&types.EventUpdateClass{ + Sender: msg.Sender, + ClassId: msg.ClassId, }) - return &types.MsgSendClassOwnershipResponse{}, nil + + return &types.MsgUpdateClassResponse{}, nil } -func (k msgServer) UpdateBaseTokenUri(c context.Context, msg *types.MsgUpdateBaseTokenUri) (*types.MsgUpdateBaseTokenUriResponse, error) { +func (k msgServer) MintNFT(c context.Context, msg *types.MsgMintNFT) (*types.MsgMintNFTResponse, error) { ctx := sdk.UnwrapSDKContext(c) - if err := k.keeper.UpdateBaseTokenUri(ctx, msg); err != nil { + _, classExists := k.keeper.nftKeeper.GetClass(ctx, msg.ClassId) + if !classExists { + return nil, types.ErrClassDoesNotExist.Wrapf("class id: %s", msg.ClassId) + } + + authorityMetadata, err := k.keeper.GetAuthorityMetadata(ctx, msg.ClassId) + if err != nil { return nil, err } - ctx.EventManager().EmitTypedEvent(&types.EventUpdateBaseTokenUri{ - Owner: msg.Sender, - ClassId: msg.ClassId, - BaseTokenUri: msg.BaseTokenUri, - }) - return &types.MsgUpdateBaseTokenUriResponse{}, nil -} + if msg.Sender != authorityMetadata.GetAdmin() { + return nil, types.ErrUnauthorized + } -func (k msgServer) UpdateTokenSupplyCap(c context.Context, msg *types.MsgUpdateTokenSupplyCap) (*types.MsgUpdateTokenSupplyCapResponse, error) { - ctx := sdk.UnwrapSDKContext(c) + err = k.keeper.mintTo(ctx, nft.NFT{ + ClassId: msg.ClassId, + Id: msg.TokenId, + Uri: msg.Uri, + UriHash: msg.UriHash, + }, msg.Sender) - if err := k.keeper.UpdateTokenSupplyCap(ctx, msg); err != nil { + if err != nil { return nil, err } - ctx.EventManager().EmitTypedEvent(&types.EventUpdateTokenSupplyCap{ - Owner: msg.Sender, - ClassId: msg.ClassId, - TokenSupplyCap: strconv.FormatUint(msg.TokenSupplyCap, 10), + ctx.EventManager().EmitTypedEvent(&types.EventMintNFT{ + Sender: msg.Sender, + ClassId: msg.ClassId, + TokenId: msg.TokenId, + Recipient: msg.Recipient, }) - return &types.MsgUpdateTokenSupplyCapResponse{}, nil + return &types.MsgMintNFTResponse{}, nil } -func (k msgServer) MintNFT(c context.Context, msg *types.MsgMintNFT) (*types.MsgMintNFTResponse, error) { +func (k msgServer) BurnNFT(c context.Context, msg *types.MsgBurnNFT) (*types.MsgBurnNFTResponse, error) { ctx := sdk.UnwrapSDKContext(c) - if err := k.keeper.MintNFT(ctx, msg); err != nil { + authorityMetadata, err := k.keeper.GetAuthorityMetadata(ctx, msg.ClassId) + if err != nil { return nil, err } - ctx.EventManager().EmitTypedEvent(&types.EventMintNFT{ + if msg.Sender != authorityMetadata.GetAdmin() { + return nil, types.ErrUnauthorized + } + + err = k.keeper.burnFrom(ctx, msg.ClassId, msg.TokenId) + if err != nil { + return nil, err + } + + ctx.EventManager().EmitTypedEvent(&types.EventBurnNFT{ + Sender: msg.Sender, ClassId: msg.ClassId, - NftId: msg.NftId, - Owner: msg.Recipient, - Minter: msg.Sender, + TokenId: msg.TokenId, }) - return &types.MsgMintNFTResponse{}, nil + return &types.MsgBurnNFTResponse{}, nil } -func (k msgServer) BurnNFT(c context.Context, msg *types.MsgBurnNFT) (*types.MsgBurnNFTResponse, error) { +func (k msgServer) ChangeAdmin(c context.Context, msg *types.MsgChangeAdmin) (*types.MsgChangeAdminResponse, error) { ctx := sdk.UnwrapSDKContext(c) - if err := k.keeper.BurnNFT(ctx, msg); err != nil { + authorityMetadata, err := k.keeper.GetAuthorityMetadata(ctx, msg.ClassId) + if err != nil { return nil, err } - ctx.EventManager().EmitTypedEvent(&types.EventBurnNFT{ - Burner: msg.Sender, - ClassId: msg.ClassId, - NftId: msg.NftId, + if msg.Sender != authorityMetadata.GetAdmin() { + return nil, types.ErrUnauthorized + } + + err = k.keeper.setAdmin(ctx, msg.ClassId, msg.NewAdmin) + if err != nil { + return nil, err + } + + ctx.EventManager().EmitTypedEvent(&types.EventChangeAdmin{ + Admin: msg.Sender, + ClassId: msg.ClassId, + NewAdmin: msg.NewAdmin, }) - return &types.MsgBurnNFTResponse{}, nil + return &types.MsgChangeAdminResponse{}, nil } diff --git a/x/nftfactory/keeper/nftactions.go b/x/nftfactory/keeper/nftactions.go new file mode 100644 index 000000000..47dd0c817 --- /dev/null +++ b/x/nftfactory/keeper/nftactions.go @@ -0,0 +1,44 @@ +package keeper + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/cosmos/cosmos-sdk/x/nft" + + "github.com/UnUniFi/chain/x/nftfactory/types" +) + +func (k Keeper) mintTo(ctx sdk.Context, token nft.NFT, mintTo string) error { + // verify that denom is an x/nftfactory denom + _, _, err := types.DeconstructClassId(token.ClassId) + if err != nil { + return err + } + + addr, err := sdk.AccAddressFromBech32(mintTo) + if err != nil { + return err + } + + err = k.nftKeeper.Mint(ctx, token, addr) + if err != nil { + return err + } + + return nil +} + +func (k Keeper) burnFrom(ctx sdk.Context, classId string, tokenId string) error { + // verify that denom is an x/nftfactory denom + _, _, err := types.DeconstructClassId(classId) + if err != nil { + return err + } + + err = k.nftKeeper.Burn(ctx, classId, tokenId) + if err != nil { + return err + } + + return nil +} diff --git a/x/nftfactory/spec/02_state.md b/x/nftfactory/spec/02_state.md index 16cc1d5af..951ed2cb4 100644 --- a/x/nftfactory/spec/02_state.md +++ b/x/nftfactory/spec/02_state.md @@ -1,65 +1,24 @@ # State -## Class and its Relating Attributes - -### ClassAttributes - -We use `ClassAttributes` data object to represent the information which sdk's x/nft module's `Class` doesn't have like owner of the `Class`. -We require to choose the parameter values when to send `MsgCreateClass` message. To change the parameters in `ClassAttributes` can be made by sending messages to achieve it like `MsgUpdateBaseTokenUri`. -The close explanation of each parameter lies in 01_concept page. - - ```protobuf -message ClassAttributes { - string class_id = 1; - string owner = 2; - string base_token_uri = 3; - MintingPermission minting_permission = 4; - uint64 token_supply_cap = 5; -} +message ClassAuthorityMetadata { + option (gogoproto.equal) = true; -enum MintingPermission { - OnlyOwner = 0; - Anyone = 1; - WhiteList = 2; + // Can be empty for no admin, or a valid address + string Admin = 1 [ (gogoproto.moretags) = "yaml:\"admin\"" ]; } ``` -### OwningClassIdList - -OwningClassIdList data is to record the class ids which are owned by specific address. -This is specifically used to query `QueryClassIdsByOwner`. - ```protobuf -message OwningClassIdList { - string owner = 1 [ - (gogoproto.moretags) = "yaml:\"owner\"", - (gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", +message Params { + // ClassCreationFee is the fee required to create a new denom using the nftfactory module + repeated cosmos.base.v1beta1.Coin class_creation_fee = 1 [ + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", + (gogoproto.moretags) = "yaml:\"denom_creation_fee\"", (gogoproto.nullable) = false ]; - repeated string class_id = 2; -} -``` - -### ClassNameIdList -ClassNameIdList data is to record the class ids which has specific name. -This is specifically used to query `QueryClassIdsByName`. - -```protobuf -message ClassNameIdList { - string class_name = 1; - repeated string class_id = 2; + // FeeCollectorAddress is the address where fees collected from denom creation are sent to + string fee_collector_address = 2; } ``` - -- ClassAttributes with prefix "0x01": `format(class_id) -> ClassAttributes` -- OwningClassIdList with prefix "0x03": `format(owner) -> OwningClassIdList` -- ClassNameIdList with prefix "0x04": `format(name) -> ClassNameIdList` - -## NFT and its Relating Attributes - -There aren't types defined in proto for the relating to nft data. -But, in UnUniFi, the minter of each NFT is recorded. - -- Minter with prefix "0x02": `format(class_id + nft_id) -> AccAddress.Byte()` diff --git a/x/nftfactory/spec/03_msgs_and_queries.md b/x/nftfactory/spec/03_msgs_and_queries.md index 562bf82c0..1df9aa388 100644 --- a/x/nftfactory/spec/03_msgs_and_queries.md +++ b/x/nftfactory/spec/03_msgs_and_queries.md @@ -2,94 +2,19 @@ ## Messages -The `nftmint` module provides below messages. +The `nftfactory` module provides below messages. ### CreateClass -CreateClass message is used to create `Class` for minting NFTs using cosmos sdk's x/nft module functions. -In cosmos sdk, the `Class` object is to the contract in EVM. So to mint NFT requires corresponding the `Class`. - -Additionaly on UnUniFi, we create `ClassAttributes` data with some parameters. -The `MintingPermission` defines who can mint NFTs under this `Class`. The current providing options are `OnlyOwner` (0) and `Anyone` (1). -If the `Class` have `OnlyOwner` permission, the NFTs can be minted by literaly only owner of the `Class`. -If the `Class` have `Anyone` permission, the NFTs can be minted by anyone. - -The `Symbol`, `Description` and `ClassUri` are the flag options which can be set blank. - ```protobuf message MsgCreateClass { - string sender = 1 [ - (gogoproto.moretags) = "yaml:\"sender\"", - (gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", - (gogoproto.nullable) = false - ]; - string name = 2; - string base_token_uri = 3; - uint64 token_supply_cap = 4; - MintingPermission minting_permission = 5; - string symbol = 7; - string description = 8; - string class_uri = 9; -} - -enum MintingPermission { - OnlyOwner = 0; - Anyone = 1; -} -``` - -### SendClass - -The SendClass message is used to change the owner of the `Class` on UnUniFi. -Technically speaking, this message, if accepted, changes the parameter value of the `ClassAttributes.Owner` to the recipient. - -```protobuf -message MsgSendClass { - string sender = 1 [ - (gogoproto.moretags) = "yaml:\"sender\"", - (gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", - (gogoproto.nullable) = false - ]; - string class_id = 2; - string recipient = 3 [ - (gogoproto.moretags) = "yaml:\"recipient\"", - (gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", - (gogoproto.nullable) = false - ]; -} -``` - -### UpdateBaseTokenUri - -The UpdateBaseTokenUri message is used to change the `BaseTokenUri` of the `Class` by defining `Class.Id`. -When this message is sended successfully, the all belonging NFT's `NFT.Uri` are changed according to the updating `BaseTokenUri`. - -```protobuf -message MsgUpdateBaseTokenUri { - string sender = 1 [ - (gogoproto.moretags) = "yaml:\"sender\"", - (gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", - (gogoproto.nullable) = false - ]; - string class_id = 2; - string base_token_uri = 3; -} -``` - -### UpdateTokenSupplyCap - -The UpdateTokenSupplyCap message is used to change the `TokenSupplyCap` of the `Class` by defining `Class.Id`. -This message fails if the tokens supply under the `Class` is over the updating `TokenSupplyCap`. - -```protobuf -message MsgUpdateTokenSupplyCap { - string sender = 1 [ - (gogoproto.moretags) = "yaml:\"sender\"", - (gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", - (gogoproto.nullable) = false - ]; - string class_id = 2; - uint64 token_supply_cap = 3; + string sender = 1; + string subclass = 2; + string name = 3; + string symbol = 4; + string description = 5; + string uri = 6; + string uri_hash = 7; } ``` @@ -100,18 +25,12 @@ The specifing `NFT.Id` becomes a part of the `NFT.Uri`. ```protobuf message MsgMintNFT { - string sender = 1 [ - (gogoproto.moretags) = "yaml:\"sender\"", - (gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", - (gogoproto.nullable) = false - ]; - string class_id = 2; - string nft_id = 3; - string recipient = 4 [ - (gogoproto.moretags) = "yaml:\"recipient\"", - (gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", - (gogoproto.nullable) = false - ]; + string sender = 1; + string class_id = 2; + string token_id = 3; + string uri = 4; + string uri_hash = 5; + string recipient = 6; } ``` @@ -122,96 +41,8 @@ Only the owner of the `NFT` can send this message. ```protobuf message MsgBurnNFT { - string sender = 1 [ - (gogoproto.moretags) = "yaml:\"sender\"", - (gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", - (gogoproto.nullable) = false - ]; + string sender = 1; string class_id = 2; - string nft_id = 3; -} -``` - -## Queries - -The `nftmint` module supports below queries. - -### ClassAttributes - -The ClassAttributes query is used to get `ClassAttributes` data specified by `Class.Id`. -The `ClassAttributes` data structure is as below. - -```protobuf -message QueryClassAttributesRequest { - string class_id = 1; -} -message QueryClassAttributesResponse { - ClassAttributes class_attributes = 1; -} - -message ClassAttributes { - string class_id = 1; - string owner = 2 [ - (gogoproto.moretags) = "yaml:\"owner\"", - (gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", - (gogoproto.nullable) = false - ]; - string base_token_uri = 3; - MintingPermission minting_permission = 4; - uint64 token_supply_cap = 5; -} -``` - -### NFTMinter - -The NFTMinter query is used to get the minter of the `NFT` specified by `Class.Id` and `NFT.Id`. - -```protobuf -message QueryNFTMinterRequest { - string class_id = 1; - string nft_id = 2; -} -message QueryNFTMinterResponse { - string minter = 1; -} -``` - -### ClassIdsByName - -The ClassIdsByName query is used to get the `ClassNameIdList` data specified by `Class.Name`. - -```protobuf -message QueryClassIdsByNameRequest { - string class_name = 1; -} -message QueryClassIdsByNameResponse { - ClassNameIdList class_name_id_list = 1; -} - -message ClassNameIdList { - string class_name = 1; - repeated string class_id = 2; -} -``` - -### ClassIdsByOwner - -The ClassIdsByOwner query is used to get the `OwningClassIdList` data specified by the owner address. - -```protobuf -message QueryClassIdsByOwnerRequest { - string owner = 1; -} -message QueryClassIdsByOwnerResponse { - OwningClassIdList owning_class_id_list = 1; -} - -message OwningClassIdList { - string owner = 1 [ - (gogoproto.moretags) = "yaml:\"owner\"", - (gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", - (gogoproto.nullable) = false - ]; - repeated string class_id = 2; + string token_id = 3; } ``` diff --git a/x/nftfactory/spec/04_events.md b/x/nftfactory/spec/04_events.md index 6c0ce6fc1..ce2eab679 100644 --- a/x/nftfactory/spec/04_events.md +++ b/x/nftfactory/spec/04_events.md @@ -2,65 +2,32 @@ The `nftmint` module emits the following events. -## EventMsgCreateClass +## EventCreateClass ```protobuf message EventCreateClass { string owner = 1; string class_id = 2; - string base_token_uri = 3; - string token_supply_cap = 4; - MintingPermission minting_permission = 5; } ``` -## EventMsgSendClass - -```protobuf -message EventSendClass { - string sender = 1; - string receiver = 2; - string class_id = 3; -} -``` - -## EventMsgUpdateBaseTokenUri - -```protobuf -message EventUpdateBaseTokenUri { - string owner = 1; - string class_id = 2; - string base_token_uri = 3; -} -``` - -## EventMsgUpdateTokenSupplyCap - -```protobuf -message EventUpdateTokenSupplyCap { - string owner = 1; - string class_id = 2; - string token_supply_cap = 3; -} -``` - -## EventMsgMintNFT +## EventMintNFT ```protobuf message EventMintNFT { - string class_id = 1; - string nft_id = 2; - string owner = 3; - string minter = 4; + string sender = 1; + string class_id = 2; + string token_id = 3; + string recipient = 4; } ``` -## EventMsgBurnNFT +## EventBurnNFT ```protobuf message EventBurnNFT { - string burner = 1; + string sender = 1; string class_id = 2; - string nft_id = 3; + string token_id = 3; } ``` diff --git a/x/nftfactory/spec/05_params.md b/x/nftfactory/spec/05_params.md index c0330e25f..03c595a3b 100644 --- a/x/nftfactory/spec/05_params.md +++ b/x/nftfactory/spec/05_params.md @@ -2,34 +2,16 @@ `Params` describes global parameters that are maintained by governance. -| Key | Type | -| ----------------------| -------------| -| MaxNFTSupplyCap | uint64 | -| MinClassNameLen | uint64 | -| MaxClassNameLen | uint64 | -| MinUriLen | uint64 | -| MaxUriLen | uint64 | -| MaxSymbolLen | uint64 | -| MaxDescriptionLen | uint64 | +```protobuf +message Params { + // ClassCreationFee is the fee required to create a new denom using the nftfactory module + repeated cosmos.base.v1beta1.Coin class_creation_fee = 1 [ + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", + (gogoproto.moretags) = "yaml:\"denom_creation_fee\"", + (gogoproto.nullable) = false + ]; -1. **MaxTokenSupply** - The max token supply is the cap of the number of each `Class`'s `NFT`. -1. **MinClassNameLen** - The min class name length is the min string length that `Class.Name` can be put. -1. **MaxClassNameLen** - The max class name length is the max string length that `Class.Name` can be put. -1. **MinUriLen** - The min uri length is the min string length that uris on UnUniFi can be put. -1. **MaxUriLen** - The max uri length is the max string length that uris on UnUniFi can be put. -1. **MaxSymbolLen** - The max symbol length is the max string length that `Class.Symbol` can be put. -1. **MaxDescriptionLen** - The max description length is the max string length that `Class.Description` can be put. - -### Default values - -```json -{ - "MaxTokenSupplyLimit": 100000, - "MinClassNameLen": 3, - "MaxClassNameLen": 128, - "MinUriLen": 8, - "MaxUriLen": 512, - "MaxSymbolLen": 16, - "MaxDescriptionLen": 1024 + // FeeCollectorAddress is the address where fees collected from denom creation are sent to + string fee_collector_address = 2; } ``` diff --git a/x/nftfactory/spec/README.md b/x/nftfactory/spec/README.md index c3924f357..cd49eac0c 100644 --- a/x/nftfactory/spec/README.md +++ b/x/nftfactory/spec/README.md @@ -1,14 +1,13 @@ -# NFT Mint +# NFT Factory ## Abstract -The `nftmint` module provides the feature to mint NFTs on UnUniFi. -Users can mint collective NFTs by sending specific messages. +The `nftfactory` module provides the feature to create NFTs. ## Contents -[Concepts](https://github.com/UnUniFi/chain/blob/design/spec/x/nftmint/spec/01_concepts.md) -[State](https://github.com/UnUniFi/chain/blob/design/spec/x/nftmint/spec/02_state.md) -[Messages and Query](https://github.com/UnUniFi/chain/blob/design/spec/x/nftmint/spec/03_msgs_and_queries.md) +[Concepts](https://github.com/UnUniFi/chain/blob/design/spec/x/nftmint/spec/01_concepts.md) +[State](https://github.com/UnUniFi/chain/blob/design/spec/x/nftmint/spec/02_state.md) +[Messages and Query](https://github.com/UnUniFi/chain/blob/design/spec/x/nftmint/spec/03_msgs_and_queries.md) [Events](https://github.com/UnUniFi/chain/blob/design/spec/x/nftmint/spec/04_events.md) [Params](https://github.com/UnUniFi/chain/blob/design/spec/x/nftmint/spec/05_params.md) diff --git a/x/nftfactory/types/denoms.go b/x/nftfactory/types/class_id.go similarity index 68% rename from x/nftfactory/types/denoms.go rename to x/nftfactory/types/class_id.go index 92f0c5af8..e3a7bb289 100644 --- a/x/nftfactory/types/denoms.go +++ b/x/nftfactory/types/class_id.go @@ -3,16 +3,13 @@ package types import ( "strings" + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) const ( - ModuleDenomPrefix = "nftfactory" - // See the TokenFactory readme for a derivation of these. - // TL;DR, MaxSubdenomLength + MaxHrpLength = 60 comes from SDK max denom length = 128 - // and the structure of tokenfactory denoms. - MaxSubdenomLength = 44 + ModuleDenomPrefix = "factory" + MaxSubdenomLength = 512 MaxHrpLength = 16 // MaxCreatorLength = 59 + MaxHrpLength MaxCreatorLength = 59 + MaxHrpLength @@ -35,28 +32,28 @@ func GetClassId(creator, subclass string) (string, error) { return denom, sdk.ValidateDenom(denom) } -// DeconstructDenom takes a token denom string and verifies that it is a valid +// DeconstructClassId takes a token denom string and verifies that it is a valid // denom of the tokenfactory module, and is of the form `factory/{creator}/{subdenom}` // If valid, it returns the creator address and subdenom -func DeconstructDenom(class_id string) (creator, subclass string, err error) { - err = sdk.ValidateDenom(class_id) +func DeconstructClassId(classId string) (creator, subclass string, err error) { + err = sdk.ValidateDenom(classId) if err != nil { return "", "", err } - strParts := strings.Split(class_id, "/") + strParts := strings.Split(classId, "/") if len(strParts) < 3 { - return "", "", sdkerrors.Wrapf(ErrInvalidClassId, "not enough parts of class id %s", class_id) + return "", "", errorsmod.Wrapf(ErrInvalidClassId, "not enough parts of class id %s", classId) } if strParts[0] != ModuleDenomPrefix { - return "", "", sdkerrors.Wrapf(ErrInvalidClassId, "class id prefix is incorrect. Is: %s. Should be: %s", strParts[0], ModuleDenomPrefix) + return "", "", errorsmod.Wrapf(ErrInvalidClassId, "class id prefix is incorrect. Is: %s. Should be: %s", strParts[0], ModuleDenomPrefix) } creator = strParts[1] _, err = sdk.AccAddressFromBech32(creator) if err != nil { - return "", "", sdkerrors.Wrapf(ErrInvalidClassId, "Invalid creator address (%s)", err) + return "", "", errorsmod.Wrapf(ErrInvalidClassId, "Invalid creator address (%s)", err) } // Handle the case where a denom has a slash in its subdenom. For example, diff --git a/x/nftfactory/types/errors.go b/x/nftfactory/types/errors.go index e81bfe5b5..d3f7f7d44 100644 --- a/x/nftfactory/types/errors.go +++ b/x/nftfactory/types/errors.go @@ -5,12 +5,13 @@ package types import ( fmt "fmt" + errorsmod "cosmossdk.io/errors" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) // x/tokenfactory module sentinel errors var ( - ErrClassExists = sdkerrors.Register(ModuleName, 2, "attempting to create a denom that already exists (has bank metadata)") + ErrClassExists = errorsmod.Register(ModuleName, 2, "attempting to create a denom that already exists (has bank metadata)") ErrUnauthorized = sdkerrors.Register(ModuleName, 3, "unauthorized account") ErrInvalidClassId = sdkerrors.Register(ModuleName, 4, "invalid class id") ErrInvalidCreator = sdkerrors.Register(ModuleName, 5, "invalid creator") @@ -18,6 +19,6 @@ var ( ErrInvalidGenesis = sdkerrors.Register(ModuleName, 7, "invalid genesis") ErrSubclassTooLong = sdkerrors.Register(ModuleName, 8, fmt.Sprintf("subclass too long, max length is %d bytes", MaxSubdenomLength)) ErrCreatorTooLong = sdkerrors.Register(ModuleName, 9, fmt.Sprintf("creator too long, max length is %d bytes", MaxCreatorLength)) - ErrDenomDoesNotExist = sdkerrors.Register(ModuleName, 10, "denom does not exist") + ErrClassDoesNotExist = sdkerrors.Register(ModuleName, 10, "class does not exist") ErrUnableToCharge = sdkerrors.Register(ModuleName, 11, "unable to charge for denom creation") ) diff --git a/x/nftfactory/types/event.pb.go b/x/nftfactory/types/event.pb.go index b177934d7..13474472e 100644 --- a/x/nftfactory/types/event.pb.go +++ b/x/nftfactory/types/event.pb.go @@ -24,7 +24,7 @@ var _ = math.Inf const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type EventCreateClass struct { - Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` + Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` } @@ -61,9 +61,9 @@ func (m *EventCreateClass) XXX_DiscardUnknown() { var xxx_messageInfo_EventCreateClass proto.InternalMessageInfo -func (m *EventCreateClass) GetOwner() string { +func (m *EventCreateClass) GetSender() string { if m != nil { - return m.Owner + return m.Sender } return "" } @@ -76,7 +76,7 @@ func (m *EventCreateClass) GetClassId() string { } type EventUpdateClass struct { - Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` + Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` } @@ -113,9 +113,9 @@ func (m *EventUpdateClass) XXX_DiscardUnknown() { var xxx_messageInfo_EventUpdateClass proto.InternalMessageInfo -func (m *EventUpdateClass) GetOwner() string { +func (m *EventUpdateClass) GetSender() string { if m != nil { - return m.Owner + return m.Sender } return "" } @@ -128,9 +128,9 @@ func (m *EventUpdateClass) GetClassId() string { } type EventMintNFT struct { - Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` + Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` - NftId string `protobuf:"bytes,3,opt,name=nft_id,json=nftId,proto3" json:"nft_id,omitempty"` + TokenId string `protobuf:"bytes,3,opt,name=token_id,json=tokenId,proto3" json:"token_id,omitempty"` Recipient string `protobuf:"bytes,4,opt,name=recipient,proto3" json:"recipient,omitempty"` } @@ -167,9 +167,9 @@ func (m *EventMintNFT) XXX_DiscardUnknown() { var xxx_messageInfo_EventMintNFT proto.InternalMessageInfo -func (m *EventMintNFT) GetOwner() string { +func (m *EventMintNFT) GetSender() string { if m != nil { - return m.Owner + return m.Sender } return "" } @@ -181,9 +181,9 @@ func (m *EventMintNFT) GetClassId() string { return "" } -func (m *EventMintNFT) GetNftId() string { +func (m *EventMintNFT) GetTokenId() string { if m != nil { - return m.NftId + return m.TokenId } return "" } @@ -196,9 +196,9 @@ func (m *EventMintNFT) GetRecipient() string { } type EventBurnNFT struct { - Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` + Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` - NftId string `protobuf:"bytes,3,opt,name=nft_id,json=nftId,proto3" json:"nft_id,omitempty"` + TokenId string `protobuf:"bytes,3,opt,name=token_id,json=tokenId,proto3" json:"token_id,omitempty"` } func (m *EventBurnNFT) Reset() { *m = EventBurnNFT{} } @@ -234,9 +234,9 @@ func (m *EventBurnNFT) XXX_DiscardUnknown() { var xxx_messageInfo_EventBurnNFT proto.InternalMessageInfo -func (m *EventBurnNFT) GetOwner() string { +func (m *EventBurnNFT) GetSender() string { if m != nil { - return m.Owner + return m.Sender } return "" } @@ -248,9 +248,9 @@ func (m *EventBurnNFT) GetClassId() string { return "" } -func (m *EventBurnNFT) GetNftId() string { +func (m *EventBurnNFT) GetTokenId() string { if m != nil { - return m.NftId + return m.TokenId } return "" } @@ -326,27 +326,27 @@ func init() { func init() { proto.RegisterFile("ununifi/nftfactory/event.proto", fileDescriptor_8d5133c6cc79979f) } var fileDescriptor_8d5133c6cc79979f = []byte{ - // 317 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x92, 0xc1, 0x4e, 0x32, 0x31, - 0x10, 0xc7, 0xd9, 0x8f, 0x4f, 0x84, 0xc6, 0x83, 0x69, 0x30, 0x41, 0x34, 0x8d, 0xc1, 0x8b, 0x89, - 0x09, 0x3d, 0xf8, 0x04, 0x42, 0x20, 0xe1, 0xa0, 0x07, 0x23, 0x1e, 0xbc, 0x60, 0xd9, 0xed, 0x2e, - 0x4d, 0x64, 0xba, 0x29, 0xb3, 0x22, 0x6f, 0xe1, 0x63, 0x79, 0xe4, 0xe8, 0xd1, 0xb0, 0x2f, 0x62, - 0xda, 0x82, 0x2b, 0x89, 0x17, 0x8d, 0xb7, 0x99, 0xfe, 0x66, 0x7e, 0xff, 0xa4, 0x19, 0xc2, 0x32, - 0xc8, 0x40, 0xc5, 0x8a, 0x43, 0x8c, 0xb1, 0x08, 0x51, 0x9b, 0x05, 0x97, 0x4f, 0x12, 0xb0, 0x9d, - 0x1a, 0x8d, 0x9a, 0xd2, 0x35, 0x6f, 0x17, 0xbc, 0x59, 0x4f, 0x74, 0xa2, 0x1d, 0xe6, 0xb6, 0xf2, - 0x93, 0xcd, 0xd3, 0x6f, 0x4c, 0x45, 0xe9, 0x87, 0x5a, 0x5d, 0xb2, 0xdf, 0xb3, 0xf6, 0xae, 0x91, - 0x02, 0x65, 0xf7, 0x51, 0xcc, 0x66, 0xb4, 0x4e, 0x76, 0xf4, 0x1c, 0xa4, 0x69, 0x04, 0x27, 0xc1, - 0x59, 0xed, 0xc6, 0x37, 0xf4, 0x90, 0x54, 0x43, 0x8b, 0x47, 0x2a, 0x6a, 0xfc, 0x73, 0x60, 0xd7, - 0xf5, 0x83, 0xe8, 0x53, 0x32, 0x4c, 0xa3, 0xdf, 0x4b, 0x90, 0xec, 0x39, 0xc9, 0x95, 0x02, 0xbc, - 0xee, 0xdf, 0xfe, 0x58, 0x40, 0x0f, 0x48, 0x05, 0x62, 0xb4, 0xa0, 0xec, 0x37, 0x20, 0xc6, 0x41, - 0x44, 0x8f, 0x49, 0xcd, 0xc8, 0x50, 0xa5, 0x4a, 0x02, 0x36, 0xfe, 0x3b, 0x52, 0x3c, 0xb4, 0xee, - 0xd6, 0xa9, 0x9d, 0xcc, 0xc0, 0x1f, 0xa6, 0xb6, 0x1e, 0x36, 0xff, 0x3a, 0x11, 0x90, 0xc8, 0xcb, - 0x68, 0xaa, 0xc0, 0xba, 0x85, 0x2d, 0x36, 0x6e, 0xd7, 0x6c, 0xb9, 0xcb, 0xdb, 0xee, 0x23, 0x52, - 0x03, 0x39, 0x1f, 0xf9, 0x25, 0x9f, 0x5b, 0x05, 0x39, 0x77, 0xb6, 0x4e, 0xef, 0x75, 0xc5, 0x82, - 0xe5, 0x8a, 0x05, 0xef, 0x2b, 0x16, 0xbc, 0xe4, 0xac, 0xb4, 0xcc, 0x59, 0xe9, 0x2d, 0x67, 0xa5, - 0xfb, 0xf3, 0x44, 0xe1, 0x24, 0x1b, 0xb7, 0x43, 0x3d, 0xe5, 0x43, 0x18, 0x82, 0xea, 0x2b, 0x1e, - 0x4e, 0x84, 0x02, 0xfe, 0xfc, 0xf5, 0x16, 0x70, 0x91, 0xca, 0xd9, 0xb8, 0xe2, 0xee, 0xe0, 0xe2, - 0x23, 0x00, 0x00, 0xff, 0xff, 0x41, 0x06, 0xe6, 0xc0, 0x78, 0x02, 0x00, 0x00, + // 318 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x92, 0x41, 0x4b, 0x02, 0x41, + 0x14, 0xc7, 0xdd, 0x2c, 0xd3, 0xa1, 0x43, 0x2c, 0x12, 0x66, 0x31, 0x84, 0x5d, 0x82, 0xc0, 0x39, + 0xf4, 0x09, 0x52, 0x14, 0x3c, 0xd4, 0x21, 0xf2, 0x12, 0x81, 0x8d, 0x3b, 0xcf, 0x75, 0x28, 0xdf, + 0x2c, 0xb3, 0xb3, 0x99, 0x7d, 0x8a, 0x3e, 0x56, 0x47, 0x8f, 0x1d, 0x43, 0xbf, 0x48, 0xcc, 0xcc, + 0x96, 0x09, 0x9d, 0xaa, 0xdb, 0xfb, 0xef, 0xef, 0xed, 0xef, 0x0f, 0xc3, 0x23, 0x34, 0xc3, 0x0c, + 0xe5, 0x48, 0x32, 0x1c, 0x99, 0x11, 0x8f, 0x8c, 0xd2, 0x33, 0x06, 0x8f, 0x80, 0xa6, 0x99, 0x68, + 0x65, 0x54, 0x18, 0xe6, 0xbc, 0xb9, 0xe2, 0xf5, 0x6a, 0xac, 0x62, 0xe5, 0x30, 0xb3, 0x93, 0xdf, + 0xac, 0x1f, 0xff, 0x60, 0x5a, 0x8d, 0x7e, 0xa9, 0xd1, 0x21, 0xbb, 0x1d, 0x6b, 0x6f, 0x6b, 0xe0, + 0x06, 0xda, 0x0f, 0x3c, 0x4d, 0xc3, 0x3d, 0x52, 0x4a, 0x01, 0x05, 0xe8, 0x5a, 0x70, 0x14, 0x9c, + 0x54, 0xae, 0xf2, 0x14, 0xee, 0x93, 0x72, 0x64, 0x17, 0x06, 0x52, 0xd4, 0x36, 0x1c, 0xd9, 0x76, + 0xb9, 0x27, 0xbe, 0x34, 0xfd, 0x44, 0xfc, 0x45, 0xf3, 0x4c, 0x76, 0x9c, 0xe6, 0x42, 0xa2, 0xb9, + 0xec, 0x5e, 0xff, 0x42, 0x61, 0x91, 0x51, 0xf7, 0x80, 0x16, 0x15, 0x3d, 0x72, 0xb9, 0x27, 0xc2, + 0x43, 0x52, 0xd1, 0x10, 0xc9, 0x44, 0x02, 0x9a, 0xda, 0xa6, 0x63, 0xab, 0x0f, 0x8d, 0xdb, 0xbc, + 0xbb, 0x95, 0x69, 0xfc, 0xf7, 0xee, 0xc6, 0xdd, 0xe7, 0x3b, 0x8f, 0x39, 0xc6, 0x70, 0x2e, 0x26, + 0x12, 0xc3, 0x2a, 0xd9, 0xe2, 0x76, 0xc8, 0x0b, 0x7c, 0x58, 0xf3, 0x17, 0xd7, 0xfd, 0x07, 0xa4, + 0x82, 0x30, 0x1d, 0xf8, 0x9f, 0x7c, 0x77, 0x19, 0x61, 0xea, 0x6c, 0xad, 0xce, 0xeb, 0x82, 0x06, + 0xf3, 0x05, 0x0d, 0xde, 0x17, 0x34, 0x78, 0x59, 0xd2, 0xc2, 0x7c, 0x49, 0x0b, 0x6f, 0x4b, 0x5a, + 0xb8, 0x39, 0x8d, 0xa5, 0x19, 0x67, 0xc3, 0x66, 0xa4, 0x26, 0xac, 0x8f, 0x7d, 0x94, 0x5d, 0xc9, + 0xa2, 0x31, 0x97, 0xc8, 0x9e, 0xbe, 0xdf, 0x86, 0x99, 0x25, 0x90, 0x0e, 0x4b, 0xee, 0x2e, 0xce, + 0x3e, 0x02, 0x00, 0x00, 0xff, 0xff, 0x20, 0xfc, 0x30, 0x5c, 0x88, 0x02, 0x00, 0x00, } func (m *EventCreateClass) Marshal() (dAtA []byte, err error) { @@ -376,10 +376,10 @@ func (m *EventCreateClass) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x12 } - if len(m.Owner) > 0 { - i -= len(m.Owner) - copy(dAtA[i:], m.Owner) - i = encodeVarintEvent(dAtA, i, uint64(len(m.Owner))) + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintEvent(dAtA, i, uint64(len(m.Sender))) i-- dAtA[i] = 0xa } @@ -413,10 +413,10 @@ func (m *EventUpdateClass) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x12 } - if len(m.Owner) > 0 { - i -= len(m.Owner) - copy(dAtA[i:], m.Owner) - i = encodeVarintEvent(dAtA, i, uint64(len(m.Owner))) + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintEvent(dAtA, i, uint64(len(m.Sender))) i-- dAtA[i] = 0xa } @@ -450,10 +450,10 @@ func (m *EventMintNFT) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x22 } - if len(m.NftId) > 0 { - i -= len(m.NftId) - copy(dAtA[i:], m.NftId) - i = encodeVarintEvent(dAtA, i, uint64(len(m.NftId))) + if len(m.TokenId) > 0 { + i -= len(m.TokenId) + copy(dAtA[i:], m.TokenId) + i = encodeVarintEvent(dAtA, i, uint64(len(m.TokenId))) i-- dAtA[i] = 0x1a } @@ -464,10 +464,10 @@ func (m *EventMintNFT) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x12 } - if len(m.Owner) > 0 { - i -= len(m.Owner) - copy(dAtA[i:], m.Owner) - i = encodeVarintEvent(dAtA, i, uint64(len(m.Owner))) + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintEvent(dAtA, i, uint64(len(m.Sender))) i-- dAtA[i] = 0xa } @@ -494,10 +494,10 @@ func (m *EventBurnNFT) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.NftId) > 0 { - i -= len(m.NftId) - copy(dAtA[i:], m.NftId) - i = encodeVarintEvent(dAtA, i, uint64(len(m.NftId))) + if len(m.TokenId) > 0 { + i -= len(m.TokenId) + copy(dAtA[i:], m.TokenId) + i = encodeVarintEvent(dAtA, i, uint64(len(m.TokenId))) i-- dAtA[i] = 0x1a } @@ -508,10 +508,10 @@ func (m *EventBurnNFT) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x12 } - if len(m.Owner) > 0 { - i -= len(m.Owner) - copy(dAtA[i:], m.Owner) - i = encodeVarintEvent(dAtA, i, uint64(len(m.Owner))) + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintEvent(dAtA, i, uint64(len(m.Sender))) i-- dAtA[i] = 0xa } @@ -579,7 +579,7 @@ func (m *EventCreateClass) Size() (n int) { } var l int _ = l - l = len(m.Owner) + l = len(m.Sender) if l > 0 { n += 1 + l + sovEvent(uint64(l)) } @@ -596,7 +596,7 @@ func (m *EventUpdateClass) Size() (n int) { } var l int _ = l - l = len(m.Owner) + l = len(m.Sender) if l > 0 { n += 1 + l + sovEvent(uint64(l)) } @@ -613,7 +613,7 @@ func (m *EventMintNFT) Size() (n int) { } var l int _ = l - l = len(m.Owner) + l = len(m.Sender) if l > 0 { n += 1 + l + sovEvent(uint64(l)) } @@ -621,7 +621,7 @@ func (m *EventMintNFT) Size() (n int) { if l > 0 { n += 1 + l + sovEvent(uint64(l)) } - l = len(m.NftId) + l = len(m.TokenId) if l > 0 { n += 1 + l + sovEvent(uint64(l)) } @@ -638,7 +638,7 @@ func (m *EventBurnNFT) Size() (n int) { } var l int _ = l - l = len(m.Owner) + l = len(m.Sender) if l > 0 { n += 1 + l + sovEvent(uint64(l)) } @@ -646,7 +646,7 @@ func (m *EventBurnNFT) Size() (n int) { if l > 0 { n += 1 + l + sovEvent(uint64(l)) } - l = len(m.NftId) + l = len(m.TokenId) if l > 0 { n += 1 + l + sovEvent(uint64(l)) } @@ -711,7 +711,7 @@ func (m *EventCreateClass) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -739,7 +739,7 @@ func (m *EventCreateClass) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Owner = string(dAtA[iNdEx:postIndex]) + m.Sender = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { @@ -825,7 +825,7 @@ func (m *EventUpdateClass) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -853,7 +853,7 @@ func (m *EventUpdateClass) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Owner = string(dAtA[iNdEx:postIndex]) + m.Sender = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { @@ -939,7 +939,7 @@ func (m *EventMintNFT) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -967,7 +967,7 @@ func (m *EventMintNFT) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Owner = string(dAtA[iNdEx:postIndex]) + m.Sender = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { @@ -1003,7 +1003,7 @@ func (m *EventMintNFT) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field TokenId", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1031,7 +1031,7 @@ func (m *EventMintNFT) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.NftId = string(dAtA[iNdEx:postIndex]) + m.TokenId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 4: if wireType != 2 { @@ -1117,7 +1117,7 @@ func (m *EventBurnNFT) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1145,7 +1145,7 @@ func (m *EventBurnNFT) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Owner = string(dAtA[iNdEx:postIndex]) + m.Sender = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { @@ -1181,7 +1181,7 @@ func (m *EventBurnNFT) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field TokenId", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1209,7 +1209,7 @@ func (m *EventBurnNFT) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.NftId = string(dAtA[iNdEx:postIndex]) + m.TokenId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex diff --git a/x/nftfactory/types/genesis.go b/x/nftfactory/types/genesis.go index 605e2b218..3931a94d5 100644 --- a/x/nftfactory/types/genesis.go +++ b/x/nftfactory/types/genesis.go @@ -29,7 +29,7 @@ func (gs GenesisState) Validate() error { } seenDenoms[class.GetClassId()] = true - _, _, err := DeconstructDenom(class.GetClassId()) + _, _, err := DeconstructClassId(class.GetClassId()) if err != nil { return err } diff --git a/x/nftfactory/types/nftfactory.pb.go b/x/nftfactory/types/nftfactory.pb.go index f1662446f..df0d865d4 100644 --- a/x/nftfactory/types/nftfactory.pb.go +++ b/x/nftfactory/types/nftfactory.pb.go @@ -29,7 +29,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // capabilities over a nft factory class. Right now there is only one Admin // permission, but is planned to be extended to the future. type ClassAuthorityMetadata struct { - // Can be empty for no admin, or a valid osmosis address + // Can be empty for no admin, or a valid address Admin string `protobuf:"bytes,1,opt,name=Admin,proto3" json:"Admin,omitempty" yaml:"admin"` } diff --git a/x/nftfactory/types/tx.pb.go b/x/nftfactory/types/tx.pb.go index 6040a6b09..1c465a0e7 100644 --- a/x/nftfactory/types/tx.pb.go +++ b/x/nftfactory/types/tx.pb.go @@ -6,7 +6,6 @@ package types import ( context "context" fmt "fmt" - types "github.com/UnUniFi/chain/x/nft/types" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" @@ -30,14 +29,13 @@ var _ = math.Inf const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type MsgCreateClass struct { - Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` - Subclass string `protobuf:"bytes,2,opt,name=subclass,proto3" json:"subclass,omitempty"` - Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` - Symbol string `protobuf:"bytes,4,opt,name=symbol,proto3" json:"symbol,omitempty"` - Description string `protobuf:"bytes,5,opt,name=description,proto3" json:"description,omitempty"` - Uri string `protobuf:"bytes,6,opt,name=uri,proto3" json:"uri,omitempty"` - UriHash string `protobuf:"bytes,7,opt,name=uri_hash,json=uriHash,proto3" json:"uri_hash,omitempty"` - Data *types.ClassData `protobuf:"bytes,8,opt,name=data,proto3" json:"data,omitempty"` + Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` + Subclass string `protobuf:"bytes,2,opt,name=subclass,proto3" json:"subclass,omitempty"` + Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` + Symbol string `protobuf:"bytes,4,opt,name=symbol,proto3" json:"symbol,omitempty"` + Description string `protobuf:"bytes,5,opt,name=description,proto3" json:"description,omitempty"` + Uri string `protobuf:"bytes,6,opt,name=uri,proto3" json:"uri,omitempty"` + UriHash string `protobuf:"bytes,7,opt,name=uri_hash,json=uriHash,proto3" json:"uri_hash,omitempty"` } func (m *MsgCreateClass) Reset() { *m = MsgCreateClass{} } @@ -122,13 +120,6 @@ func (m *MsgCreateClass) GetUriHash() string { return "" } -func (m *MsgCreateClass) GetData() *types.ClassData { - if m != nil { - return m.Data - } - return nil -} - type MsgCreateClassResponse struct { } @@ -166,14 +157,13 @@ func (m *MsgCreateClassResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgCreateClassResponse proto.InternalMessageInfo type MsgUpdateClass struct { - Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` - ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` - Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` - Symbol string `protobuf:"bytes,4,opt,name=symbol,proto3" json:"symbol,omitempty"` - Description string `protobuf:"bytes,5,opt,name=description,proto3" json:"description,omitempty"` - Uri string `protobuf:"bytes,6,opt,name=uri,proto3" json:"uri,omitempty"` - UriHash string `protobuf:"bytes,7,opt,name=uri_hash,json=uriHash,proto3" json:"uri_hash,omitempty"` - Data *types.ClassData `protobuf:"bytes,8,opt,name=data,proto3" json:"data,omitempty"` + Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` + ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` + Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` + Symbol string `protobuf:"bytes,4,opt,name=symbol,proto3" json:"symbol,omitempty"` + Description string `protobuf:"bytes,5,opt,name=description,proto3" json:"description,omitempty"` + Uri string `protobuf:"bytes,6,opt,name=uri,proto3" json:"uri,omitempty"` + UriHash string `protobuf:"bytes,7,opt,name=uri_hash,json=uriHash,proto3" json:"uri_hash,omitempty"` } func (m *MsgUpdateClass) Reset() { *m = MsgUpdateClass{} } @@ -258,13 +248,6 @@ func (m *MsgUpdateClass) GetUriHash() string { return "" } -func (m *MsgUpdateClass) GetData() *types.ClassData { - if m != nil { - return m.Data - } - return nil -} - type MsgUpdateClassResponse struct { } @@ -305,7 +288,9 @@ type MsgMintNFT struct { Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` TokenId string `protobuf:"bytes,3,opt,name=token_id,json=tokenId,proto3" json:"token_id,omitempty"` - Recipient string `protobuf:"bytes,4,opt,name=recipient,proto3" json:"recipient,omitempty"` + Uri string `protobuf:"bytes,4,opt,name=uri,proto3" json:"uri,omitempty"` + UriHash string `protobuf:"bytes,5,opt,name=uri_hash,json=uriHash,proto3" json:"uri_hash,omitempty"` + Recipient string `protobuf:"bytes,6,opt,name=recipient,proto3" json:"recipient,omitempty"` } func (m *MsgMintNFT) Reset() { *m = MsgMintNFT{} } @@ -362,6 +347,20 @@ func (m *MsgMintNFT) GetTokenId() string { return "" } +func (m *MsgMintNFT) GetUri() string { + if m != nil { + return m.Uri + } + return "" +} + +func (m *MsgMintNFT) GetUriHash() string { + if m != nil { + return m.UriHash + } + return "" +} + func (m *MsgMintNFT) GetRecipient() string { if m != nil { return m.Recipient @@ -615,45 +614,43 @@ func init() { func init() { proto.RegisterFile("ununifi/nftfactory/tx.proto", fileDescriptor_47805922275bdc64) } var fileDescriptor_47805922275bdc64 = []byte{ - // 594 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x55, 0x4f, 0x8f, 0xd2, 0x40, - 0x14, 0xa7, 0x82, 0x50, 0x86, 0xa8, 0xeb, 0x88, 0xa4, 0xa0, 0x29, 0xa4, 0x26, 0x66, 0x5d, 0x93, - 0x36, 0xae, 0x37, 0x6f, 0xb2, 0xba, 0x71, 0x0f, 0x98, 0x48, 0xe4, 0xb2, 0x89, 0x21, 0x43, 0x3b, - 0xb4, 0x13, 0x61, 0xda, 0x74, 0xa6, 0x59, 0xf8, 0x16, 0x7e, 0x02, 0x3f, 0xcf, 0x1e, 0xf7, 0xe8, - 0x89, 0x18, 0xb8, 0xe9, 0x8d, 0x4f, 0x60, 0x3a, 0xfd, 0xcb, 0xee, 0xd6, 0x4d, 0x8c, 0x97, 0x3d, - 0x90, 0xcc, 0x7b, 0xbf, 0xd7, 0xdf, 0xfb, 0xcd, 0x8f, 0xf7, 0x5a, 0xf0, 0x24, 0xa0, 0x01, 0x25, - 0x53, 0x62, 0xd0, 0x29, 0x9f, 0x22, 0x93, 0xbb, 0xfe, 0xd2, 0xe0, 0x0b, 0xdd, 0xf3, 0x5d, 0xee, - 0x42, 0x18, 0x83, 0x7a, 0x06, 0x76, 0x9a, 0xb6, 0x6b, 0xbb, 0x02, 0x36, 0xc2, 0x53, 0x54, 0xd9, - 0x79, 0x9c, 0xa3, 0x09, 0x7f, 0x71, 0xfa, 0xd9, 0x35, 0xec, 0xd9, 0x31, 0x2a, 0xd2, 0x7e, 0x4b, - 0xe0, 0xfe, 0x80, 0xd9, 0x47, 0x3e, 0x46, 0x1c, 0x1f, 0xcd, 0x10, 0x63, 0xb0, 0x05, 0xaa, 0x0c, - 0x53, 0x0b, 0xfb, 0x8a, 0xd4, 0x93, 0xf6, 0xeb, 0xc3, 0x38, 0x82, 0x1d, 0x20, 0xb3, 0x60, 0x62, - 0x86, 0x35, 0xca, 0x1d, 0x81, 0xa4, 0x31, 0x84, 0xa0, 0x42, 0xd1, 0x1c, 0x2b, 0x65, 0x91, 0x17, - 0x67, 0xc1, 0xb3, 0x9c, 0x4f, 0xdc, 0x99, 0x52, 0x89, 0x79, 0x44, 0x04, 0x7b, 0xa0, 0x61, 0x61, - 0x66, 0xfa, 0xc4, 0xe3, 0xc4, 0xa5, 0xca, 0x5d, 0x01, 0xe6, 0x53, 0x70, 0x0f, 0x94, 0x03, 0x9f, - 0x28, 0x55, 0x81, 0x84, 0x47, 0xd8, 0x06, 0x72, 0xe0, 0x93, 0xb1, 0x83, 0x98, 0xa3, 0xd4, 0x44, - 0xba, 0x16, 0xf8, 0xe4, 0x03, 0x62, 0x0e, 0x3c, 0x00, 0x15, 0x0b, 0x71, 0xa4, 0xc8, 0x3d, 0x69, - 0xbf, 0x71, 0xd8, 0xd2, 0x73, 0xb6, 0xe9, 0xe2, 0x42, 0xef, 0x10, 0x47, 0x43, 0x51, 0xa3, 0x29, - 0xa0, 0xb5, 0x7b, 0xd9, 0x21, 0x66, 0x9e, 0x4b, 0x19, 0xd6, 0x7e, 0x45, 0x3e, 0x8c, 0x3c, 0xeb, - 0x46, 0x1f, 0xda, 0x40, 0x16, 0x97, 0x1e, 0x13, 0x2b, 0xf6, 0xa1, 0x26, 0xe2, 0x13, 0xeb, 0x76, - 0xd9, 0x90, 0xbb, 0x6b, 0x6a, 0xc3, 0x02, 0x80, 0x01, 0xb3, 0x07, 0x84, 0xf2, 0x8f, 0xc7, 0x9f, - 0xff, 0xc5, 0x81, 0x36, 0x90, 0xb9, 0xfb, 0x15, 0xd3, 0x10, 0x8a, 0x5c, 0xa8, 0x89, 0xf8, 0xc4, - 0x82, 0x4f, 0x41, 0xdd, 0xc7, 0x26, 0xf1, 0x08, 0xa6, 0x3c, 0xf6, 0x22, 0x4b, 0x68, 0x4d, 0x00, - 0xb3, 0xce, 0xa9, 0x9e, 0x53, 0xa1, 0xa7, 0x1f, 0xf8, 0xf4, 0xbf, 0xeb, 0x89, 0x3b, 0xc6, 0xdc, - 0x69, 0xc7, 0xef, 0xf1, 0x42, 0x38, 0x88, 0xda, 0xf8, 0xad, 0x35, 0x27, 0x14, 0xbe, 0xd8, 0x6d, - 0xdb, 0x7f, 0xb8, 0x5d, 0x75, 0xef, 0x2d, 0xd1, 0x7c, 0xf6, 0x46, 0x8b, 0xf2, 0x5a, 0xaa, 0x44, - 0xbf, 0xac, 0xa4, 0xff, 0x68, 0xbb, 0xea, 0x3e, 0x88, 0x8a, 0x13, 0x44, 0xcb, 0xe4, 0xbd, 0x02, - 0x75, 0x8a, 0xcf, 0xc6, 0x28, 0xec, 0x13, 0xe9, 0xeb, 0x37, 0xb7, 0xab, 0xee, 0x5e, 0xf4, 0x40, - 0x0a, 0x69, 0x43, 0x99, 0xe2, 0x33, 0xa1, 0x26, 0x99, 0xe1, 0x4c, 0x5f, 0x22, 0xfd, 0xf0, 0xbc, - 0x0c, 0xca, 0x03, 0x66, 0xc3, 0x2f, 0xa0, 0x91, 0xdf, 0x67, 0x4d, 0xbf, 0xfa, 0x26, 0xd1, 0x77, - 0xd7, 0xa0, 0x73, 0x70, 0x73, 0x4d, 0xd2, 0x26, 0xa4, 0xcf, 0xaf, 0x49, 0x11, 0x7d, 0xae, 0xa6, - 0x90, 0xfe, 0x9a, 0x11, 0x84, 0x9f, 0x40, 0x2d, 0x99, 0x3f, 0xb5, 0xe0, 0xb1, 0x18, 0xef, 0x3c, - 0xff, 0x3b, 0x9e, 0xa7, 0x4c, 0x46, 0xa8, 0x88, 0x32, 0xc6, 0x0b, 0x29, 0x2f, 0x8d, 0x89, 0xf0, - 0x38, 0x37, 0x22, 0x85, 0x1e, 0x67, 0x35, 0xc5, 0x1e, 0x5f, 0xfd, 0x2b, 0xfb, 0xef, 0xcf, 0xd7, - 0xaa, 0x74, 0xb1, 0x56, 0xa5, 0x9f, 0x6b, 0x55, 0xfa, 0xb6, 0x51, 0x4b, 0x17, 0x1b, 0xb5, 0xf4, - 0x63, 0xa3, 0x96, 0x4e, 0x5f, 0xda, 0x84, 0x3b, 0xc1, 0x44, 0x37, 0xdd, 0xb9, 0x31, 0xa2, 0x23, - 0x4a, 0x8e, 0x89, 0x61, 0x3a, 0x88, 0x50, 0x63, 0xb1, 0xf3, 0x19, 0x59, 0x7a, 0x98, 0x4d, 0xaa, - 0xe2, 0x25, 0xff, 0xfa, 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x35, 0xf1, 0x63, 0xb1, 0x69, 0x06, - 0x00, 0x00, + // 572 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x55, 0xcb, 0x6e, 0xd3, 0x40, + 0x14, 0xad, 0x49, 0x9a, 0xc7, 0x54, 0x40, 0x19, 0xa2, 0xca, 0x09, 0xc8, 0xa9, 0x8c, 0x84, 0x78, + 0x48, 0xb6, 0x80, 0x1d, 0x3b, 0x52, 0x51, 0xd1, 0x45, 0x90, 0x88, 0xc8, 0xa6, 0x12, 0x8a, 0x1c, + 0x7b, 0x62, 0x8f, 0x48, 0x66, 0xac, 0x99, 0xb1, 0xda, 0xfc, 0x05, 0x5f, 0xc0, 0x8e, 0xdf, 0x80, + 0x6d, 0x97, 0x5d, 0xb2, 0x8a, 0x50, 0xf2, 0x07, 0xf9, 0x02, 0xe4, 0xf1, 0xf8, 0x91, 0x36, 0xa6, + 0x12, 0x42, 0x62, 0x77, 0xef, 0x3d, 0xd7, 0xe7, 0x9e, 0x33, 0xb9, 0x33, 0x01, 0x0f, 0x22, 0x12, + 0x11, 0x3c, 0xc1, 0x36, 0x99, 0x88, 0x89, 0xe3, 0x0a, 0xca, 0xe6, 0xb6, 0x38, 0xb7, 0x42, 0x46, + 0x05, 0x85, 0x50, 0x81, 0x56, 0x0e, 0x76, 0x5a, 0x3e, 0xf5, 0xa9, 0x84, 0xed, 0x38, 0x4a, 0x3a, + 0x3b, 0x8f, 0xb6, 0xd0, 0xe4, 0x61, 0xd2, 0x64, 0xfe, 0xd0, 0xc0, 0x9d, 0x3e, 0xf7, 0x8f, 0x18, + 0x72, 0x04, 0x3a, 0x9a, 0x3a, 0x9c, 0xc3, 0x03, 0x50, 0xe3, 0x88, 0x78, 0x88, 0xe9, 0xda, 0xa1, + 0xf6, 0xa4, 0x39, 0x50, 0x19, 0xec, 0x80, 0x06, 0x8f, 0xc6, 0x6e, 0xdc, 0xa3, 0xdf, 0x92, 0x48, + 0x96, 0x43, 0x08, 0xaa, 0xc4, 0x99, 0x21, 0xbd, 0x22, 0xeb, 0x32, 0x96, 0x3c, 0xf3, 0xd9, 0x98, + 0x4e, 0xf5, 0xaa, 0xe2, 0x91, 0x19, 0x3c, 0x04, 0x7b, 0x1e, 0xe2, 0x2e, 0xc3, 0xa1, 0xc0, 0x94, + 0xe8, 0xbb, 0x12, 0x2c, 0x96, 0xe0, 0x3e, 0xa8, 0x44, 0x0c, 0xeb, 0x35, 0x89, 0xc4, 0x21, 0x6c, + 0x83, 0x46, 0xc4, 0xf0, 0x28, 0x70, 0x78, 0xa0, 0xd7, 0x65, 0xb9, 0x1e, 0x31, 0xfc, 0xce, 0xe1, + 0x81, 0xa9, 0x83, 0x83, 0x4d, 0x03, 0x03, 0xc4, 0x43, 0x4a, 0x38, 0x32, 0xbf, 0x27, 0xde, 0x86, + 0xa1, 0x77, 0xa3, 0xb7, 0x36, 0x68, 0x48, 0x23, 0x23, 0xec, 0x29, 0x6f, 0x75, 0x99, 0x9f, 0x78, + 0xff, 0xdf, 0x5a, 0x41, 0x7f, 0x66, 0xed, 0x9b, 0x06, 0x40, 0x9f, 0xfb, 0x7d, 0x4c, 0xc4, 0xfb, + 0xe3, 0x8f, 0x7f, 0x63, 0xab, 0x0d, 0x1a, 0x82, 0x7e, 0x46, 0x24, 0x86, 0x12, 0x6b, 0x75, 0x99, + 0x9f, 0x78, 0xa9, 0xc6, 0xea, 0x76, 0x8d, 0xbb, 0x1b, 0x1a, 0xe1, 0x43, 0xd0, 0x64, 0xc8, 0xc5, + 0x21, 0x46, 0x44, 0x28, 0x5b, 0x79, 0xc1, 0x6c, 0x01, 0x98, 0xcb, 0xcc, 0xd4, 0x9f, 0x4a, 0xf1, + 0xbd, 0x88, 0x91, 0x7f, 0x2e, 0x5e, 0x4d, 0x54, 0xdc, 0xd9, 0xc4, 0xaf, 0x6a, 0xcd, 0x03, 0x87, + 0xf8, 0xe8, 0x8d, 0x37, 0xc3, 0x04, 0x3e, 0xdd, 0x1c, 0xdb, 0xbb, 0xb7, 0x5e, 0x74, 0x6f, 0xcf, + 0x9d, 0xd9, 0xf4, 0xb5, 0x99, 0xd4, 0xcd, 0x4c, 0x89, 0x75, 0x55, 0x49, 0xef, 0xfe, 0x7a, 0xd1, + 0xbd, 0x9b, 0x34, 0xa7, 0x88, 0x99, 0xcb, 0x7b, 0x01, 0x9a, 0x04, 0x9d, 0x8d, 0x9c, 0x78, 0x4e, + 0xa2, 0xaf, 0xd7, 0x5a, 0x2f, 0xba, 0xfb, 0xc9, 0x07, 0x19, 0x64, 0x0e, 0x1a, 0x04, 0x9d, 0x49, + 0x35, 0xe9, 0x16, 0xe7, 0xfa, 0x52, 0xe9, 0x2f, 0x2f, 0x2a, 0xa0, 0xd2, 0xe7, 0x3e, 0xfc, 0x04, + 0xf6, 0x8a, 0xb7, 0xd4, 0xb4, 0xae, 0x3f, 0x04, 0xd6, 0xe6, 0x45, 0xe8, 0x3c, 0xbb, 0xb9, 0x27, + 0x1d, 0x13, 0xd3, 0x17, 0x2f, 0x4a, 0x19, 0x7d, 0xa1, 0xa7, 0x94, 0x7e, 0xcb, 0xc2, 0xc2, 0x0f, + 0xa0, 0x9e, 0x2e, 0xab, 0x51, 0xf2, 0x99, 0xc2, 0x3b, 0x8f, 0xff, 0x8c, 0x17, 0x29, 0xd3, 0x15, + 0x2a, 0xa3, 0x54, 0x78, 0x29, 0xe5, 0x95, 0x35, 0x91, 0x67, 0x5c, 0x58, 0x91, 0xd2, 0x33, 0xce, + 0x7b, 0xca, 0xcf, 0xf8, 0xfa, 0x4f, 0xd9, 0x7b, 0x7b, 0xb1, 0x34, 0xb4, 0xcb, 0xa5, 0xa1, 0xfd, + 0x5a, 0x1a, 0xda, 0x97, 0x95, 0xb1, 0x73, 0xb9, 0x32, 0x76, 0x7e, 0xae, 0x8c, 0x9d, 0xd3, 0xe7, + 0x3e, 0x16, 0x41, 0x34, 0xb6, 0x5c, 0x3a, 0xb3, 0x87, 0x64, 0x48, 0xf0, 0x31, 0xb6, 0xdd, 0xc0, + 0xc1, 0xc4, 0x3e, 0xdf, 0xf8, 0x17, 0x98, 0x87, 0x88, 0x8f, 0x6b, 0xf2, 0xe9, 0x7e, 0xf5, 0x3b, + 0x00, 0x00, 0xff, 0xff, 0xb6, 0x67, 0xcd, 0x42, 0x28, 0x06, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -900,18 +897,6 @@ func (m *MsgCreateClass) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.Data != nil { - { - size, err := m.Data.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x42 - } if len(m.UriHash) > 0 { i -= len(m.UriHash) copy(dAtA[i:], m.UriHash) @@ -1007,18 +992,6 @@ func (m *MsgUpdateClass) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.Data != nil { - { - size, err := m.Data.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x42 - } if len(m.UriHash) > 0 { i -= len(m.UriHash) copy(dAtA[i:], m.UriHash) @@ -1119,6 +1092,20 @@ func (m *MsgMintNFT) MarshalToSizedBuffer(dAtA []byte) (int, error) { copy(dAtA[i:], m.Recipient) i = encodeVarintTx(dAtA, i, uint64(len(m.Recipient))) i-- + dAtA[i] = 0x32 + } + if len(m.UriHash) > 0 { + i -= len(m.UriHash) + copy(dAtA[i:], m.UriHash) + i = encodeVarintTx(dAtA, i, uint64(len(m.UriHash))) + i-- + dAtA[i] = 0x2a + } + if len(m.Uri) > 0 { + i -= len(m.Uri) + copy(dAtA[i:], m.Uri) + i = encodeVarintTx(dAtA, i, uint64(len(m.Uri))) + i-- dAtA[i] = 0x22 } if len(m.TokenId) > 0 { @@ -1347,10 +1334,6 @@ func (m *MsgCreateClass) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } - if m.Data != nil { - l = m.Data.Size() - n += 1 + l + sovTx(uint64(l)) - } return n } @@ -1397,10 +1380,6 @@ func (m *MsgUpdateClass) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } - if m.Data != nil { - l = m.Data.Size() - n += 1 + l + sovTx(uint64(l)) - } return n } @@ -1431,6 +1410,14 @@ func (m *MsgMintNFT) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } + l = len(m.Uri) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.UriHash) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } l = len(m.Recipient) if l > 0 { n += 1 + l + sovTx(uint64(l)) @@ -1766,42 +1753,6 @@ func (m *MsgCreateClass) Unmarshal(dAtA []byte) error { } m.UriHash = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 8: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Data == nil { - m.Data = &types.ClassData{} - } - if err := m.Data.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) @@ -2126,42 +2077,6 @@ func (m *MsgUpdateClass) Unmarshal(dAtA []byte) error { } m.UriHash = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 8: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Data == nil { - m.Data = &types.ClassData{} - } - if err := m.Data.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) @@ -2359,6 +2274,70 @@ func (m *MsgMintNFT) Unmarshal(dAtA []byte) error { m.TokenId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Uri", 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.Uri = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UriHash", 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.UriHash = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Recipient", wireType) } From c0194e6d6efa9fc4a151cdcfb8afc06c65d368cc Mon Sep 17 00:00:00 2001 From: KIMURA Yu <33382781+KimuraYu45z@users.noreply.github.com> Date: Mon, 14 Aug 2023 12:46:59 +0800 Subject: [PATCH 06/20] feat: nftfactory --- x/nftfactory/keeper/grpc_query_test.go | 88 -------------------------- x/nftfactory/keeper/keeper_test.go | 8 +-- 2 files changed, 3 insertions(+), 93 deletions(-) delete mode 100644 x/nftfactory/keeper/grpc_query_test.go diff --git a/x/nftfactory/keeper/grpc_query_test.go b/x/nftfactory/keeper/grpc_query_test.go deleted file mode 100644 index a32f45a64..000000000 --- a/x/nftfactory/keeper/grpc_query_test.go +++ /dev/null @@ -1,88 +0,0 @@ -package keeper_test - -import ( - "github.com/cometbft/cometbft/crypto/ed25519" - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/UnUniFi/chain/x/nftfactory/keeper" - "github.com/UnUniFi/chain/x/nftfactory/types" -) - -func (suite *KeeperTestSuite) TestQueryClassAttributes() { - sender := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - sender_seq, _ := suite.accountKeeper.GetSequence(suite.ctx, sender) - classId := keeper.CreateClassId(sender_seq, sender) - _ = suite.CreateClass(suite.ctx, classId, sender) - - req := types.QueryClassAttributesRequest{ - ClassId: classId, - } - res, err := suite.nftmintKeeper.ClassAttributes(suite.ctx, &req) - suite.Require().NoError(err) - suite.Require().Equal(classId, res.ClassAttributes.ClassId) - suite.Require().Equal(testBaseTokenUri, res.ClassAttributes.BaseTokenUri) - - invalidReq := types.QueryClassAttributesRequest{ - ClassId: "invalidClassId", - } - _, err = suite.nftmintKeeper.ClassAttributes(suite.ctx, &invalidReq) - suite.Require().Error(err) -} - -func (suite *KeeperTestSuite) TestQueryNftMinter() { - sender := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - sender_seq, _ := suite.accountKeeper.GetSequence(suite.ctx, sender) - classId := keeper.CreateClassId(sender_seq, sender) - _ = suite.CreateClass(suite.ctx, classId, sender) - _ = suite.MintNFT(suite.ctx, classId, testNFTId, sender) - - req := types.QueryNFTMinterRequest{ - ClassId: classId, - NftId: testNFTId, - } - res, err := suite.nftmintKeeper.NFTMinter(suite.ctx, &req) - suite.Require().NoError(err) - suite.Require().Equal(sender.String(), res.Minter) -} - -func (suite *KeeperTestSuite) TestQueryClassIdsByOwner() { - sender := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - sender_seq, _ := suite.accountKeeper.GetSequence(suite.ctx, sender) - classId := keeper.CreateClassId(sender_seq, sender) - _ = suite.CreateClass(suite.ctx, classId, sender) - _ = suite.MintNFT(suite.ctx, classId, testNFTId, sender) - - req := types.QueryClassIdsByOwnerRequest{ - Owner: sender.String(), - } - res, err := suite.nftmintKeeper.ClassIdsByOwner(suite.ctx, &req) - suite.Require().NoError(err) - var classIds []string - classIds = append(classIds, classId) - expectedRes := types.OwningClassIdList{ - Owner: sender.String(), - ClassId: classIds[:], - } - suite.Require().Equal(&expectedRes, res.OwningClassIdList) -} - -func (suite *KeeperTestSuite) TestQueryIdsByName() { - sender := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - sender_seq, _ := suite.accountKeeper.GetSequence(suite.ctx, sender) - classId := keeper.CreateClassId(sender_seq, sender) - _ = suite.CreateClass(suite.ctx, classId, sender) - _ = suite.MintNFT(suite.ctx, classId, testNFTId, sender) - - req := types.QueryClassIdsByNameRequest{ - ClassName: testName, - } - res, err := suite.nftmintKeeper.ClassIdsByName(suite.ctx, &req) - suite.Require().NoError(err) - var classIds []string - classIds = append(classIds, classId) - expectedRes := types.ClassNameIdList{ - ClassName: testName, - ClassId: classIds, - } - suite.Require().Equal(&expectedRes, res.ClassNameIdList) -} diff --git a/x/nftfactory/keeper/keeper_test.go b/x/nftfactory/keeper/keeper_test.go index b698323a8..042c75f9f 100644 --- a/x/nftfactory/keeper/keeper_test.go +++ b/x/nftfactory/keeper/keeper_test.go @@ -32,10 +32,8 @@ type KeeperTestSuite struct { ctx sdk.Context addrs []sdk.AccAddress // queryClient nft.QueryClient - // nftKeeper nftkeeper.Keeper nftKeeper *testutil.MockNftKeeper - nftmintKeeper keeper.Keeper - // accountKeeper *nfttestutil.MockAccountKeeper + keeper keeper.Keeper accountKeeper *testutil.MockAccountKeeper encCfg moduletestutil.TestEncodingConfig @@ -122,7 +120,7 @@ func (s *KeeperTestSuite) SetupTest() { app := simapp.Setup(s.T(), ([]wasm.Option{})...) // encodingConfig := appparams.MakeEncodingConfig() // appCodec := s.encCfg.Marshaler - nftmintKeeper := keeper.NewKeeper( + keeper := keeper.NewKeeper( s.encCfg.Codec, storeKey, memKey, @@ -132,7 +130,7 @@ func (s *KeeperTestSuite) SetupTest() { ) s.nftKeeper = nftKeeper - s.nftmintKeeper = nftmintKeeper + s.keeper = keeper s.accountKeeper = accountKeeper // s.queryClient = nft.NewQueryClient(queryHelper) s.ctx = ctx From 060ea3978057fde1f40b677598ee4852ef304eca Mon Sep 17 00:00:00 2001 From: Senna46 <29295263+Senna46@users.noreply.github.com> Date: Mon, 14 Aug 2023 15:53:06 +0900 Subject: [PATCH 07/20] feat: remove depend nftfactory --- x/nftbackedloan/keeper/nft_listed_class.go | 23 +++++++++++----------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/x/nftbackedloan/keeper/nft_listed_class.go b/x/nftbackedloan/keeper/nft_listed_class.go index bee260da1..e44d53b7c 100644 --- a/x/nftbackedloan/keeper/nft_listed_class.go +++ b/x/nftbackedloan/keeper/nft_listed_class.go @@ -4,7 +4,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/UnUniFi/chain/x/nftbackedloan/types" - "github.com/UnUniFi/chain/x/nftfactory/keeper" ) func (k Keeper) UpdateListedClass(ctx sdk.Context, listing types.Listing) { @@ -44,10 +43,10 @@ func (k Keeper) SetListingInListedClass(ctx sdk.Context, listing types.Listing) k.cdc.MustUnmarshal(bzIdlist, &class) // return if the nft_id already exists - index := keeper.SliceIndex(class.NftIds, listing.NftId.TokenId) - if index != -1 { - return - } + // index := keeper.SliceIndex(class.NftIds, listing.NftId.TokenId) + // if index != -1 { + // return + // } class.NftIds = append(class.NftIds, listing.NftId.TokenId) bz := k.cdc.MustMarshal(&class) store.Set(types.ClassKey(listing.ClassIdBytes()), bz) @@ -61,13 +60,13 @@ func (k Keeper) DeleteListingFromListedClass(ctx sdk.Context, listing types.List class := types.ListedClass{} k.cdc.MustUnmarshal(bzIdlist, &class) - removeIndex := keeper.SliceIndex(class.NftIds, listing.NftId.TokenId) - if removeIndex == -1 { - return - } - class.NftIds = keeper.RemoveIndex(class.NftIds, removeIndex) - // if class doens't have any listed nft, just delete class id key from kvstore - if len(class.NftIds) == 0 { + // removeIndex := keeper.SliceIndex(class.NftIds, listing.NftId.TokenId) + // if removeIndex == -1 { + // return + // } + // class.NftIds = keeper.RemoveIndex(class.NftIds, removeIndex) + // if class doesn't have any listed nft, just delete class id key from KVStore + if len(class.NftIds) == 1 && class.NftIds[0] == listing.NftId.TokenId { store.Delete(types.ClassKey(listing.ClassIdBytes())) return } From faa29458e7dd8276f17de12b9b85f512cdb6cb68 Mon Sep 17 00:00:00 2001 From: Senna46 <29295263+Senna46@users.noreply.github.com> Date: Mon, 14 Aug 2023 16:02:07 +0900 Subject: [PATCH 08/20] nft keeper authlity --- app/keepers/keepers.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/keepers/keepers.go b/app/keepers/keepers.go index c8d288b79..fa208437e 100644 --- a/app/keepers/keepers.go +++ b/app/keepers/keepers.go @@ -346,7 +346,11 @@ func NewAppKeeper( appKeepers.BankKeeper, ) - appKeepers.UnUniFiNFTKeeper = ununifinftkeeper.NewKeeper(appKeepers.NFTKeeper, appCodec) + appKeepers.UnUniFiNFTKeeper = ununifinftkeeper.NewKeeper( + appKeepers.NFTKeeper, + appCodec, + authtypes.NewModuleAddress(nftfactorytypes.ModuleName).String(), + ) // Create evidence Keeper for to register the IBC light client misbehaviour evidence route evidenceKeeper := evidencekeeper.NewKeeper( @@ -451,6 +455,7 @@ func NewAppKeeper( appKeepers.keys[nftfactorytypes.MemStoreKey], appKeepers.GetSubspace(nftfactorytypes.ModuleName), appKeepers.AccountKeeper, + appKeepers.BankKeeper, appKeepers.UnUniFiNFTKeeper, ) From 479d33fa3a8a4967e8495f2ef4e47b28faa65465 Mon Sep 17 00:00:00 2001 From: Senna46 <29295263+Senna46@users.noreply.github.com> Date: Mon, 14 Aug 2023 16:21:57 +0900 Subject: [PATCH 09/20] fix: flag --- x/nftfactory/client/cli/flags.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x/nftfactory/client/cli/flags.go b/x/nftfactory/client/cli/flags.go index 6b7992cc6..1a085c4d9 100644 --- a/x/nftfactory/client/cli/flags.go +++ b/x/nftfactory/client/cli/flags.go @@ -18,13 +18,13 @@ var ( ) func init() { - FsCreateClass.String(FlagSymbol, "", "Class name") + FsCreateClass.String(FlagName, "", "Class name") FsCreateClass.String(FlagSymbol, "", "Class symbol") FsCreateClass.String(FlagDescription, "", "Description for denom") FsCreateClass.String(FlagUri, "", "Content URI for class") FsCreateClass.String(FlagUriHash, "", "Hash of content URI for class") - FsUpdateClass.String(FlagSymbol, "", "Class name") + FsUpdateClass.String(FlagName, "", "Class name") FsUpdateClass.String(FlagSymbol, "", "Class symbol") FsUpdateClass.String(FlagDescription, "", "Description for denom") FsUpdateClass.String(FlagUri, "", "Content URI for class") From 9d0448f249d40bac47bc3c0e8957b9671d336d84 Mon Sep 17 00:00:00 2001 From: Senna46 <29295263+Senna46@users.noreply.github.com> Date: Mon, 14 Aug 2023 16:28:32 +0900 Subject: [PATCH 10/20] test setup --- .github/workflows/go.yml | 2 +- x/nftfactory/keeper/keeper_test.go | 139 ++++++----------------------- 2 files changed, 28 insertions(+), 113 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index d9e08082b..f1e587c8b 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -17,4 +17,4 @@ jobs: run: go build -v ./... - name: Test - run: go test -v `go list ./... | grep -v -E 'deprecated/|x/ecosystemincentive/|x/nftfactory/'` + run: go test -v `go list ./... | grep -v -E 'x/ecosystemincentive/'` diff --git a/x/nftfactory/keeper/keeper_test.go b/x/nftfactory/keeper/keeper_test.go index 042c75f9f..9caac1d75 100644 --- a/x/nftfactory/keeper/keeper_test.go +++ b/x/nftfactory/keeper/keeper_test.go @@ -5,23 +5,18 @@ import ( "github.com/CosmWasm/wasmd/x/wasm" tmproto "github.com/cometbft/cometbft/proto/tendermint/types" - tmtime "github.com/cometbft/cometbft/types/time" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/suite" + authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" + + nftkeeper "github.com/UnUniFi/chain/x/nft/keeper" + "github.com/UnUniFi/chain/x/nftfactory/keeper" - "github.com/UnUniFi/chain/x/nftfactory/types" - sdktestutil "github.com/cosmos/cosmos-sdk/testutil" "github.com/cosmos/cosmos-sdk/x/nft" - "github.com/cosmos/cosmos-sdk/x/nft/module" - simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" - moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" - - // nfttestutil "github.com/cosmos/cosmos-sdk/x/nft/testutil" - "github.com/UnUniFi/chain/x/nftfactory/types/testutil" + "github.com/cosmos/cosmos-sdk/baseapp" simapp "github.com/UnUniFi/chain/app" ) @@ -29,111 +24,31 @@ import ( type KeeperTestSuite struct { suite.Suite - ctx sdk.Context - addrs []sdk.AccAddress - // queryClient nft.QueryClient - nftKeeper *testutil.MockNftKeeper + ctx sdk.Context + app *simapp.App + addrs []sdk.AccAddress + queryClient nft.QueryClient keeper keeper.Keeper - accountKeeper *testutil.MockAccountKeeper - - encCfg moduletestutil.TestEncodingConfig + nftKeeper nftkeeper.Keeper + accountKeeper authkeeper.AccountKeeper } -func (s *KeeperTestSuite) SetupTest() { - // s.addrs = simtestutil.CreateIncrementalAccounts(3) - // s.encCfg = moduletestutil.MakeTestEncodingConfig(module.AppModuleBasic{}) - - // key := sdk.NewKVStoreKey(nft.StoreKey) - // testCtx := sdktestutil.DefaultContextWithDB(s.T(), key, sdk.NewTransientStoreKey("transient_test")) - // ctx := testCtx.Ctx.WithBlockHeader(tmproto.Header{Time: tmtime.Now()}) - - // // gomock initializations - // ctrl := gomock.NewController(s.T()) - // accountKeeper := testutil.NewMockAccountKeeper(ctrl) - // bankKeeper := testutil.NewMockBankKeeper(ctrl) - // xbankKeeper := testutil.NewMockNftKeeper(ctrl) - // accountKeeper.EXPECT().GetModuleAddress("nft").Return(s.addrs[0]).AnyTimes() - - // nftKeeper := nftkeeper.NewKeeper(key, s.encCfg.Codec, accountKeeper, bankKeeper) - // queryHelper := baseapp.NewQueryServerTestHelper(ctx, s.encCfg.InterfaceRegistry) - // nft.RegisterQueryServer(queryHelper, nftKeeper) - - // storeKey := sdk.NewKVStoreKey(types.StoreKey) - // memKey := sdk.NewKVStoreKey(types.MemStoreKey) - // app := simapp.Setup(s.T(), ([]wasm.Option{})...) - // // encodingConfig := appparams.MakeEncodingConfig() - // // appCodec := s.encCfg.Marshaler - // nftmintKeeper := keeper.NewKeeper( - // s.encCfg.Codec, - // storeKey, - // memKey, - // app.GetSubspace(types.ModuleName), - // accountKeeper, - // nftKeeper, - // ) - - // s.nftKeeper = nftKeeper - // s.nftmintKeeper = nftmintKeeper - // s.queryClient = nft.NewQueryClient(queryHelper) - // s.ctx = ctx - - s.addrs = simtestutil.CreateIncrementalAccounts(3) - s.encCfg = moduletestutil.MakeTestEncodingConfig(module.AppModuleBasic{}) - - key := sdk.NewKVStoreKey(nft.StoreKey) - testCtx := sdktestutil.DefaultContextWithDB(s.T(), key, sdk.NewTransientStoreKey("transient_test")) - ctx := testCtx.Ctx.WithBlockHeader(tmproto.Header{Time: tmtime.Now()}) - - // gomock initializations - ctrl := gomock.NewController(s.T()) - defer ctrl.Finish() - accountKeeper := testutil.NewMockAccountKeeper(ctrl) - nftKeeper := testutil.NewMockNftKeeper(ctrl) - // uint64c := make(chan uint64) - // errorc := make(chan error) - // fmt.Println("s.addrs[0]") - // fmt.Println(s.addrs[0]) - // accountKeeper.EXPECT().GetSequence(gomock.Any(), uint(1)).Return(uint64(1), nil).AnyTimes() - - // loop addrs length - numIncrements := 5 - // for i := 0; i < len(s.addrs); i++ { - // for j := 0; j <= numIncrements; j++ { - // // mockCounter.EXPECT().Increment().Return(i) - // // accountKeeper.EXPECT().GetSequence(ctx, s.addrs[0]).Return(uint64(1), nil).AnyTimes() - // accountKeeper.EXPECT().GetSequence(ctx, s.addrs[i]).Return(uint64(j), nil) - // } - // } - for j := 0; j <= numIncrements; j++ { - accountKeeper.EXPECT().GetSequence(ctx, s.addrs[0]).Return(uint64(j), nil).Times(j).AnyTimes() - } - - // accountKeeper.EXPECT().GetSequence(ctx, s.addrs[0]).Return(uint64(1), nil).AnyTimes() - // accountKeeper.EXPECT().GetSequence(ctx,s.addrs[0]).Return(s.addrs[0]).AnyTimes() - - // nftKeeper := nftkeeper.NewKeeper(key, s.encCfg.Codec, accountKeeper, bankKeeper) - // queryHelper := baseapp.NewQueryServerTestHelper(ctx, s.encCfg.InterfaceRegistry) - // nft.RegisterQueryServer(queryHelper, nftKeeper) - - storeKey := sdk.NewKVStoreKey(types.StoreKey) - memKey := sdk.NewKVStoreKey(types.MemStoreKey) - app := simapp.Setup(s.T(), ([]wasm.Option{})...) - // encodingConfig := appparams.MakeEncodingConfig() - // appCodec := s.encCfg.Marshaler - keeper := keeper.NewKeeper( - s.encCfg.Codec, - storeKey, - memKey, - app.GetSubspace(types.ModuleName), - accountKeeper, - nftKeeper, - ) - - s.nftKeeper = nftKeeper - s.keeper = keeper - s.accountKeeper = accountKeeper - // s.queryClient = nft.NewQueryClient(queryHelper) - s.ctx = ctx +func (suite *KeeperTestSuite) SetupTest() { + isCheckTx := false + + app := simapp.Setup(suite.T(), ([]wasm.Option{})...) + + suite.ctx = app.BaseApp.NewContext(isCheckTx, tmproto.Header{}) + suite.app = app + suite.addrs = simapp.AddTestAddrsIncremental(app, suite.ctx, 3, sdk.NewInt(30000000)) + + queryHelper := baseapp.NewQueryServerTestHelper(suite.ctx, app.InterfaceRegistry()) + nft.RegisterQueryServer(queryHelper, app.UnUniFiNFTKeeper) + suite.queryClient = nft.NewQueryClient(queryHelper) + + suite.keeper = app.NftfactoryKeeper + suite.nftKeeper = app.UnUniFiNFTKeeper + suite.accountKeeper = app.AccountKeeper } func TestKeeperSuite(t *testing.T) { From 78f5ca06afc1971cda362d769d2993c1ea107417 Mon Sep 17 00:00:00 2001 From: Senna46 <29295263+Senna46@users.noreply.github.com> Date: Mon, 14 Aug 2023 16:37:27 +0900 Subject: [PATCH 11/20] fix: authority gov module --- app/keepers/keepers.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/keepers/keepers.go b/app/keepers/keepers.go index fa208437e..f18c21910 100644 --- a/app/keepers/keepers.go +++ b/app/keepers/keepers.go @@ -349,7 +349,7 @@ func NewAppKeeper( appKeepers.UnUniFiNFTKeeper = ununifinftkeeper.NewKeeper( appKeepers.NFTKeeper, appCodec, - authtypes.NewModuleAddress(nftfactorytypes.ModuleName).String(), + authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) // Create evidence Keeper for to register the IBC light client misbehaviour evidence route From 51be537e0cb470a15307d153483145b96044f7cc Mon Sep 17 00:00:00 2001 From: Senna46 <29295263+Senna46@users.noreply.github.com> Date: Mon, 14 Aug 2023 18:11:10 +0900 Subject: [PATCH 12/20] fix: init --- scripts/setup/init.sh | 46 +++++++++++++++++++++---------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/scripts/setup/init.sh b/scripts/setup/init.sh index eda868df0..c00e72cb9 100755 --- a/scripts/setup/init.sh +++ b/scripts/setup/init.sh @@ -101,29 +101,29 @@ jq '.app_state.pricefeed.posted_prices = [ # ununifid start --home=$NODE_HOME # for nftmint -jq '.app_state.nftfactory.class_attributes_list = [ - { - "base_token_uri": "ipfs://testcid/", - "class_id": "ununifi-1AFC3C85B52311F13161F724B284EF900458E3B3", - "minting_permission": "Anyone", - "owner": "ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w", - "token_supply_cap": "100000" - }, - { - "base_token_uri": "ipfs://testcid/", - "class_id": "ununifi-D4AC8DBC54261BB1B6ACBBF721A60D131A048F83", - "minting_permission": "OnlyOwner", - "owner": "ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w", - "token_supply_cap": "100000" - }, - { - "base_token_uri": "ipfs://testcid/", - "class_id": "derivatives/perpetual_futures/positions", - "minting_permission": "OnlyOwner", - "owner": "ununifi1j0ugkvzyjdlyhkeje27fexlwurv6xezdmpxm68", - "token_supply_cap": "100000" - } -]' $NODE_HOME/config/genesis.json > temp.json ; mv temp.json $NODE_HOME/config/genesis.json; +# jq '.app_state.nftfactory.class_attributes_list = [ +# { +# "base_token_uri": "ipfs://testcid/", +# "class_id": "ununifi-1AFC3C85B52311F13161F724B284EF900458E3B3", +# "minting_permission": "Anyone", +# "owner": "ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w", +# "token_supply_cap": "100000" +# }, +# { +# "base_token_uri": "ipfs://testcid/", +# "class_id": "ununifi-D4AC8DBC54261BB1B6ACBBF721A60D131A048F83", +# "minting_permission": "OnlyOwner", +# "owner": "ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w", +# "token_supply_cap": "100000" +# }, +# { +# "base_token_uri": "ipfs://testcid/", +# "class_id": "derivatives/perpetual_futures/positions", +# "minting_permission": "OnlyOwner", +# "owner": "ununifi1j0ugkvzyjdlyhkeje27fexlwurv6xezdmpxm68", +# "token_supply_cap": "100000" +# } +# ]' $NODE_HOME/config/genesis.json > temp.json ; mv temp.json $NODE_HOME/config/genesis.json; jq '.app_state.nft.classes = [ { "data": null, From 078f4bf1875beaaee7d03d39b4463a6768e5aa6a Mon Sep 17 00:00:00 2001 From: Senna46 <29295263+Senna46@users.noreply.github.com> Date: Mon, 14 Aug 2023 18:11:25 +0900 Subject: [PATCH 13/20] fix: init fee controller --- x/nftfactory/types/params.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/nftfactory/types/params.go b/x/nftfactory/types/params.go index fca96adc1..492678996 100644 --- a/x/nftfactory/types/params.go +++ b/x/nftfactory/types/params.go @@ -13,7 +13,7 @@ var ( DefaultFeeDenom = "uguu" DefaultFeeAmount int64 = 1_000_000 KeyFeeCollectorAddress = []byte("FeeCollectorAddress") - DefaultFeeCollectorAddress = "" + DefaultFeeCollectorAddress = "ununifi1a8jcsmla6heu99ldtazc27dna4qcd4jygsthx6" ) // ParamTable for tokenfactory module. From a3afcccc4fbc5ebbd394c6c1f4b4d1fc7bcccb65 Mon Sep 17 00:00:00 2001 From: Senna46 <29295263+Senna46@users.noreply.github.com> Date: Mon, 14 Aug 2023 18:11:37 +0900 Subject: [PATCH 14/20] cli doc --- x/nftfactory/client/cli/tx.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/x/nftfactory/client/cli/tx.go b/x/nftfactory/client/cli/tx.go index 303a0970e..365dd7aed 100644 --- a/x/nftfactory/client/cli/tx.go +++ b/x/nftfactory/client/cli/tx.go @@ -48,8 +48,8 @@ func CmdCreateClass() *cobra.Command { "--name "+ "--symbol "+ "--description "+ - "--class-uri "+ - "--class-uri-hash "+ + "--uri "+ + "--uri-hash "+ "--chain-id= "+ "--fees=", version.AppName, types.ModuleName), ), @@ -109,13 +109,13 @@ func CmdUpdateClass() *cobra.Command { Args: cobra.ExactArgs(1), Short: "update class", Long: strings.TrimSpace(fmt.Sprintf( - "Example:$ %s tx %s create-class "+ + "Example:$ %s tx %s update-class "+ "--from "+ "--name "+ "--symbol "+ "--description "+ - "--class-uri "+ - "--class-uri-hash "+ + "--uri "+ + "--uri-hash "+ "--chain-id= "+ "--fees=", version.AppName, types.ModuleName), ), From 5103225fd48cf5acb5aca90614e922874bd983db Mon Sep 17 00:00:00 2001 From: Senna46 <29295263+Senna46@users.noreply.github.com> Date: Mon, 14 Aug 2023 18:11:54 +0900 Subject: [PATCH 15/20] test01 --- .../keeper/test/01_create_update_class.sh | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 x/nftfactory/keeper/test/01_create_update_class.sh diff --git a/x/nftfactory/keeper/test/01_create_update_class.sh b/x/nftfactory/keeper/test/01_create_update_class.sh new file mode 100644 index 000000000..d895c5061 --- /dev/null +++ b/x/nftfactory/keeper/test/01_create_update_class.sh @@ -0,0 +1,41 @@ +#!/bin/sh + +# block speed +sleep=5 + +user1_address=ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w + +echo "------------create class id------------" +ununifid tx nftfactory create-class test \ +--from user1 --keyring-backend test --chain-id test --yes + +sleep $sleep + +class_id=$(ununifid q nftfactory classes-from-creator $user1_address -o json | jq .classes[0] | tr -d '"') +expected_class_id=factory/$user1_address/test + +echo "------------check class id------------" +if [ "$expected_class_id" = "$class_id" ]; then + echo "pass: class_id is correct: $class_id" +else + echo "error: class_id is incorrect:" + echo "expected: $expected_class_id actual: $class_id" +fi + +echo "------------update class------------" +ununifid tx nftfactory update-class $class_id \ +--name "updated" --symbol "OK" --description "after class changed" --uri "change url" --uri-hash "changed" \ +--from user1 --keyring-backend test --chain-id test --yes + +sleep $sleep + +class_name=$(ununifid q nft class $class_id -o json | jq .class.name | tr -d '"') +expected_class_name=updated + +echo "------------check class name------------" +if [ "$expected_class_name" = "$class_name" ]; then + echo "pass: class_name is correct: $class_name" +else + echo "error: class_name is incorrect:" + echo "expected: $expected_class_name actual: $class_name" +fi From 49bcd3100119a24297fb9435c352c137805048dc Mon Sep 17 00:00:00 2001 From: Senna46 <29295263+Senna46@users.noreply.github.com> Date: Mon, 14 Aug 2023 18:19:35 +0900 Subject: [PATCH 16/20] fix: update class bug --- x/nftfactory/keeper/msg_server.go | 15 +++++++++------ x/nftfactory/types/expected_keepers.go | 1 + 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/x/nftfactory/keeper/msg_server.go b/x/nftfactory/keeper/msg_server.go index 44cbcccc9..5aaf21692 100644 --- a/x/nftfactory/keeper/msg_server.go +++ b/x/nftfactory/keeper/msg_server.go @@ -43,7 +43,7 @@ func (k msgServer) CreateClass(c context.Context, msg *types.MsgCreateClass) (*t return nil, err } - ctx.EventManager().EmitTypedEvent(&types.EventCreateClass{ + _ = ctx.EventManager().EmitTypedEvent(&types.EventCreateClass{ Sender: msg.Sender, ClassId: classId, }) @@ -63,7 +63,7 @@ func (k msgServer) UpdateClass(c context.Context, msg *types.MsgUpdateClass) (*t return nil, types.ErrUnauthorized } - k.keeper.nftKeeper.SaveClass(ctx, nft.Class{ + err = k.keeper.nftKeeper.UpdateClass(ctx, nft.Class{ Id: msg.ClassId, Name: msg.Name, Symbol: msg.Symbol, @@ -71,8 +71,11 @@ func (k msgServer) UpdateClass(c context.Context, msg *types.MsgUpdateClass) (*t Uri: msg.Uri, UriHash: msg.UriHash, }) + if err != nil { + return nil, err + } - ctx.EventManager().EmitTypedEvent(&types.EventUpdateClass{ + _ = ctx.EventManager().EmitTypedEvent(&types.EventUpdateClass{ Sender: msg.Sender, ClassId: msg.ClassId, }) @@ -108,7 +111,7 @@ func (k msgServer) MintNFT(c context.Context, msg *types.MsgMintNFT) (*types.Msg return nil, err } - ctx.EventManager().EmitTypedEvent(&types.EventMintNFT{ + _ = ctx.EventManager().EmitTypedEvent(&types.EventMintNFT{ Sender: msg.Sender, ClassId: msg.ClassId, TokenId: msg.TokenId, @@ -134,7 +137,7 @@ func (k msgServer) BurnNFT(c context.Context, msg *types.MsgBurnNFT) (*types.Msg return nil, err } - ctx.EventManager().EmitTypedEvent(&types.EventBurnNFT{ + _ = ctx.EventManager().EmitTypedEvent(&types.EventBurnNFT{ Sender: msg.Sender, ClassId: msg.ClassId, TokenId: msg.TokenId, @@ -159,7 +162,7 @@ func (k msgServer) ChangeAdmin(c context.Context, msg *types.MsgChangeAdmin) (*t return nil, err } - ctx.EventManager().EmitTypedEvent(&types.EventChangeAdmin{ + _ = ctx.EventManager().EmitTypedEvent(&types.EventChangeAdmin{ Admin: msg.Sender, ClassId: msg.ClassId, NewAdmin: msg.NewAdmin, diff --git a/x/nftfactory/types/expected_keepers.go b/x/nftfactory/types/expected_keepers.go index 74f781c03..31afe96c7 100644 --- a/x/nftfactory/types/expected_keepers.go +++ b/x/nftfactory/types/expected_keepers.go @@ -26,6 +26,7 @@ type BankKeeper interface { type NftKeeper interface { SaveClass(ctx sdk.Context, class nfttypes.Class) error + UpdateClass(ctx sdk.Context, class nfttypes.Class) error Mint(ctx sdk.Context, token nfttypes.NFT, receiver sdk.AccAddress) error Burn(ctx sdk.Context, classID string, nftID string) error From db6e34ed2a705fc0e4556172497f2b88777be61d Mon Sep 17 00:00:00 2001 From: Senna46 <29295263+Senna46@users.noreply.github.com> Date: Mon, 14 Aug 2023 19:29:42 +0900 Subject: [PATCH 17/20] fix: query --- x/nftfactory/keeper/grpc_query.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/nftfactory/keeper/grpc_query.go b/x/nftfactory/keeper/grpc_query.go index 27764d7f7..226cff78b 100644 --- a/x/nftfactory/keeper/grpc_query.go +++ b/x/nftfactory/keeper/grpc_query.go @@ -21,7 +21,7 @@ func (k Keeper) Params(ctx context.Context, _ *types.QueryParamsRequest) (*types func (k Keeper) ClassAuthorityMetadata(ctx context.Context, req *types.QueryClassAuthorityMetadataRequest) (*types.QueryClassAuthorityMetadataResponse, error) { sdkCtx := sdk.UnwrapSDKContext(ctx) - class_id := fmt.Sprintf("nftfactory/%s/%s", req.GetCreator(), req.GetSubclass()) + class_id := fmt.Sprintf("factory/%s/%s", req.GetCreator(), req.GetSubclass()) authorityMetadata, err := k.GetAuthorityMetadata(sdkCtx, class_id) if err != nil { From 4126688e31fd8a1a71bc65dac5a0e9b1b81a4660 Mon Sep 17 00:00:00 2001 From: Senna46 <29295263+Senna46@users.noreply.github.com> Date: Mon, 14 Aug 2023 19:33:19 +0900 Subject: [PATCH 18/20] integration test --- .../keeper/test/02_create_delete-nft.sh | 62 +++++++++++++++++++ x/nftfactory/keeper/test/03_change_admin.sh | 47 ++++++++++++++ 2 files changed, 109 insertions(+) create mode 100644 x/nftfactory/keeper/test/02_create_delete-nft.sh create mode 100644 x/nftfactory/keeper/test/03_change_admin.sh diff --git a/x/nftfactory/keeper/test/02_create_delete-nft.sh b/x/nftfactory/keeper/test/02_create_delete-nft.sh new file mode 100644 index 000000000..2dd98962a --- /dev/null +++ b/x/nftfactory/keeper/test/02_create_delete-nft.sh @@ -0,0 +1,62 @@ +#!/bin/sh + +# block speed +sleep=5 + +user1_address=ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w + +echo "------------create class------------" +ununifid tx nftfactory create-class test \ +--from user1 --keyring-backend test --chain-id test --yes + +sleep $sleep + +class_id=$(ununifid q nftfactory classes-from-creator $user1_address -o json | jq .classes[0] | tr -d '"') + +echo "------------mint nft------------" +ununifid tx nftfactory mint-nft $class_id test01 $user1_address \ +--from user1 --keyring-backend test --chain-id test --yes + +sleep $sleep + +owner=$(ununifid q nft owner $class_id test01 -o json | jq .owner | tr -d '"') + +echo "------------check owner------------" +if [ "$user1_address" = "$owner" ]; then + echo "pass: owner is correct: $owner" +else + echo "error: owner is incorrect:" + echo "expected: $user1_address actual: $owner" +fi + +echo "------------not owner cannot burn nft------------" +ununifid tx nftfactory burn-nft $class_id test01 \ +--from user2 --keyring-backend test --chain-id test --yes + +sleep $sleep +owner=$(ununifid q nft owner $class_id test01 -o json | jq .owner | tr -d '"') + +echo "------------check owner------------" +if [ "$user1_address" = "$owner" ]; then + echo "pass: owner is correct: $owner" +else + echo "error: owner is incorrect:" + echo "expected: $user1_address actual: $owner" +fi + + +echo "------------burn nft------------" +ununifid tx nftfactory burn-nft $class_id test01 \ +--from user1 --keyring-backend test --chain-id test --yes + +sleep $sleep + +owner=$(ununifid q nft owner $class_id test01 -o json | jq .owner | tr -d '"') + +echo "------------check owner------------" +if [ "" = "$owner" ]; then + echo "pass: owner is correct: $owner" +else + echo "error: owner is incorrect:" + echo "expected: "" actual: $owner" +fi diff --git a/x/nftfactory/keeper/test/03_change_admin.sh b/x/nftfactory/keeper/test/03_change_admin.sh new file mode 100644 index 000000000..606ddf734 --- /dev/null +++ b/x/nftfactory/keeper/test/03_change_admin.sh @@ -0,0 +1,47 @@ +#!/bin/sh + +# block speed +sleep=5 + +user1_address=ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w +user2_address=ununifi1v0h8j7x7kfys29kj4uwdudcc9y0nx6twwxahla + +echo "------------create class------------" +ununifid tx nftfactory create-class test \ +--from user1 --keyring-backend test --chain-id test --yes + +sleep $sleep + +class_id=$(ununifid q nftfactory classes-from-creator $user1_address -o json | jq .classes[0] | tr -d '"') + +echo "------------change admin------------" +ununifid tx nftfactory change-admin $class_id $user2_address \ +--from user1 --keyring-backend test --chain-id test --yes + +sleep $sleep + +admin=$(ununifid q nftfactory class-authority-metadata $class_id -o json | jq .authority_metadata.Admin | tr -d '"') + +echo "------------check admin------------" +if [ "$user2_address" = "$admin" ]; then + echo "pass: admin is correct: $admin" +else + echo "error: admin is incorrect:" + echo "expected: $user2_address actual: $admin" +fi + +echo "------------mint nft------------" +ununifid tx nftfactory mint-nft $class_id test02 $user2_address \ +--from user2 --keyring-backend test --chain-id test --yes + +sleep $sleep + +owner=$(ununifid q nft owner $class_id test02 -o json | jq .owner | tr -d '"') + +echo "------------check owner------------" +if [ "$user2_address" = "$owner" ]; then + echo "pass: owner is correct: $owner" +else + echo "error: owner is incorrect:" + echo "expected: $user2_address actual: $owner" +fi From 4a977313512d78948f70d17a62134ff5aba9d693 Mon Sep 17 00:00:00 2001 From: Senna46 <29295263+Senna46@users.noreply.github.com> Date: Mon, 14 Aug 2023 19:54:02 +0900 Subject: [PATCH 19/20] add collector address --- scripts/setup/init.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/setup/init.sh b/scripts/setup/init.sh index c00e72cb9..5e835a398 100755 --- a/scripts/setup/init.sh +++ b/scripts/setup/init.sh @@ -101,6 +101,8 @@ jq '.app_state.pricefeed.posted_prices = [ # ununifid start --home=$NODE_HOME # for nftmint +jq '.app_state.nftfactory.params.fee_collector_address = "ununifi1a8jcsmla6heu99ldtazc27dna4qcd4jygsthx6"' $NODE_HOME/config/genesis.json > temp.json ; mv temp.json $NODE_HOME/config/genesis.json; + # jq '.app_state.nftfactory.class_attributes_list = [ # { # "base_token_uri": "ipfs://testcid/", From 0dbd12e7fe811036a947f9dc28d997e0b1f5c3f8 Mon Sep 17 00:00:00 2001 From: Senna46 <29295263+Senna46@users.noreply.github.com> Date: Mon, 14 Aug 2023 19:54:17 +0900 Subject: [PATCH 20/20] fix: params --- x/nftfactory/keeper/keeper_test.go | 4 ++++ x/nftfactory/types/params.go | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/x/nftfactory/keeper/keeper_test.go b/x/nftfactory/keeper/keeper_test.go index 9caac1d75..e3ad0ae5b 100644 --- a/x/nftfactory/keeper/keeper_test.go +++ b/x/nftfactory/keeper/keeper_test.go @@ -19,6 +19,7 @@ import ( "github.com/cosmos/cosmos-sdk/baseapp" simapp "github.com/UnUniFi/chain/app" + "github.com/UnUniFi/chain/x/nftfactory/types" ) type KeeperTestSuite struct { @@ -49,6 +50,9 @@ func (suite *KeeperTestSuite) SetupTest() { suite.keeper = app.NftfactoryKeeper suite.nftKeeper = app.UnUniFiNFTKeeper suite.accountKeeper = app.AccountKeeper + params := types.DefaultParams() + params.FeeCollectorAddress = suite.addrs[0].String() + app.NftfactoryKeeper.SetParams(suite.ctx, params) } func TestKeeperSuite(t *testing.T) { diff --git a/x/nftfactory/types/params.go b/x/nftfactory/types/params.go index 492678996..fca96adc1 100644 --- a/x/nftfactory/types/params.go +++ b/x/nftfactory/types/params.go @@ -13,7 +13,7 @@ var ( DefaultFeeDenom = "uguu" DefaultFeeAmount int64 = 1_000_000 KeyFeeCollectorAddress = []byte("FeeCollectorAddress") - DefaultFeeCollectorAddress = "ununifi1a8jcsmla6heu99ldtazc27dna4qcd4jygsthx6" + DefaultFeeCollectorAddress = "" ) // ParamTable for tokenfactory module.