From 0bf0cbcc956120108f0b9d668af66522e72cd359 Mon Sep 17 00:00:00 2001 From: Milad Zahedi Date: Thu, 19 Oct 2023 16:36:32 +0330 Subject: [PATCH 1/4] Implement class freeze for NFTs --- docs/api.md | 159 +++ docs/static/openapi.json | 129 +++ integration-tests/modules/assetnft_test.go | 178 +++ proto/coreum/asset/nft/v1/event.proto | 11 + proto/coreum/asset/nft/v1/genesis.proto | 6 + proto/coreum/asset/nft/v1/query.proto | 31 + proto/coreum/asset/nft/v1/tx.proto | 18 + x/asset/nft/client/cli/query.go | 88 ++ x/asset/nft/client/cli/query_test.go | 1 + x/asset/nft/client/cli/tx.go | 82 ++ x/asset/nft/client/cli/tx_test.go | 69 ++ x/asset/nft/genesis.go | 22 + x/asset/nft/genesis_test.go | 27 + x/asset/nft/keeper/grpc_query.go | 25 + x/asset/nft/keeper/keeper.go | 176 +++ x/asset/nft/keeper/keeper_test.go | 185 +++ x/asset/nft/keeper/msg_server.go | 40 + x/asset/nft/types/codec.go | 4 + x/asset/nft/types/event.pb.go | 520 ++++++++- x/asset/nft/types/genesis.go | 14 + x/asset/nft/types/genesis.pb.go | 357 +++++- x/asset/nft/types/keys.go | 25 + x/asset/nft/types/msgs.go | 84 ++ x/asset/nft/types/query.pb.go | 1191 +++++++++++++++++--- x/asset/nft/types/query.pb.gw.go | 242 ++++ x/asset/nft/types/tx.pb.go | 714 ++++++++++-- x/deterministicgas/config.go | 2 + 27 files changed, 4133 insertions(+), 267 deletions(-) diff --git a/docs/api.md b/docs/api.md index 2a9aa0884..e03d3283c 100644 --- a/docs/api.md +++ b/docs/api.md @@ -72,7 +72,9 @@ - [coreum/asset/nft/v1/event.proto](#coreum/asset/nft/v1/event.proto) - [EventAddedToClassWhitelist](#coreum.asset.nft.v1.EventAddedToClassWhitelist) - [EventAddedToWhitelist](#coreum.asset.nft.v1.EventAddedToWhitelist) + - [EventClassFrozen](#coreum.asset.nft.v1.EventClassFrozen) - [EventClassIssued](#coreum.asset.nft.v1.EventClassIssued) + - [EventClassUnfrozen](#coreum.asset.nft.v1.EventClassUnfrozen) - [EventFrozen](#coreum.asset.nft.v1.EventFrozen) - [EventRemovedFromClassWhitelist](#coreum.asset.nft.v1.EventRemovedFromClassWhitelist) - [EventRemovedFromWhitelist](#coreum.asset.nft.v1.EventRemovedFromWhitelist) @@ -80,6 +82,7 @@ - [coreum/asset/nft/v1/genesis.proto](#coreum/asset/nft/v1/genesis.proto) - [BurntNFT](#coreum.asset.nft.v1.BurntNFT) + - [ClassFrozenAccounts](#coreum.asset.nft.v1.ClassFrozenAccounts) - [ClassWhitelistedAccounts](#coreum.asset.nft.v1.ClassWhitelistedAccounts) - [FrozenNFT](#coreum.asset.nft.v1.FrozenNFT) - [GenesisState](#coreum.asset.nft.v1.GenesisState) @@ -99,6 +102,10 @@ - [QueryBurntNFTResponse](#coreum.asset.nft.v1.QueryBurntNFTResponse) - [QueryBurntNFTsInClassRequest](#coreum.asset.nft.v1.QueryBurntNFTsInClassRequest) - [QueryBurntNFTsInClassResponse](#coreum.asset.nft.v1.QueryBurntNFTsInClassResponse) + - [QueryClassFrozenAccountsRequest](#coreum.asset.nft.v1.QueryClassFrozenAccountsRequest) + - [QueryClassFrozenAccountsResponse](#coreum.asset.nft.v1.QueryClassFrozenAccountsResponse) + - [QueryClassFrozenRequest](#coreum.asset.nft.v1.QueryClassFrozenRequest) + - [QueryClassFrozenResponse](#coreum.asset.nft.v1.QueryClassFrozenResponse) - [QueryClassRequest](#coreum.asset.nft.v1.QueryClassRequest) - [QueryClassResponse](#coreum.asset.nft.v1.QueryClassResponse) - [QueryClassWhitelistedAccountsRequest](#coreum.asset.nft.v1.QueryClassWhitelistedAccountsRequest) @@ -121,6 +128,8 @@ - [MsgAddToClassWhitelist](#coreum.asset.nft.v1.MsgAddToClassWhitelist) - [MsgAddToWhitelist](#coreum.asset.nft.v1.MsgAddToWhitelist) - [MsgBurn](#coreum.asset.nft.v1.MsgBurn) + - [MsgClassFreeze](#coreum.asset.nft.v1.MsgClassFreeze) + - [MsgClassUnfreeze](#coreum.asset.nft.v1.MsgClassUnfreeze) - [MsgFreeze](#coreum.asset.nft.v1.MsgFreeze) - [MsgIssueClass](#coreum.asset.nft.v1.MsgIssueClass) - [MsgMint](#coreum.asset.nft.v1.MsgMint) @@ -1264,6 +1273,22 @@ Msg defines the Msg service. + + +### EventClassFrozen + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `class_id` | [string](#string) | | | +| `account` | [string](#string) | | | + + + + + + ### EventClassIssued @@ -1287,6 +1312,22 @@ EventClassIssued is emitted on MsgIssueClass. + + +### EventClassUnfrozen + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `class_id` | [string](#string) | | | +| `account` | [string](#string) | | | + + + + + + ### EventFrozen @@ -1386,6 +1427,22 @@ EventClassIssued is emitted on MsgIssueClass. + + +### ClassFrozenAccounts + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `classID` | [string](#string) | | | +| `accounts` | [string](#string) | repeated | | + + + + + + ### ClassWhitelistedAccounts @@ -1432,6 +1489,7 @@ GenesisState defines the nftasset module's genesis state. | `whitelisted_nft_accounts` | [WhitelistedNFTAccounts](#coreum.asset.nft.v1.WhitelistedNFTAccounts) | repeated | | | `burnt_nfts` | [BurntNFT](#coreum.asset.nft.v1.BurntNFT) | repeated | | | `class_whitelisted_accounts` | [ClassWhitelistedAccounts](#coreum.asset.nft.v1.ClassWhitelistedAccounts) | repeated | | +| `class_frozen_accounts` | [ClassFrozenAccounts](#coreum.asset.nft.v1.ClassFrozenAccounts) | repeated | | @@ -1637,6 +1695,69 @@ Params store gov manageable parameters. + + +### QueryClassFrozenAccountsRequest + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | pagination defines an optional pagination for the request. | +| `class_id` | [string](#string) | | | + + + + + + + + +### QueryClassFrozenAccountsResponse + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `pagination` | [cosmos.base.query.v1beta1.PageResponse](#cosmos.base.query.v1beta1.PageResponse) | | pagination defines the pagination in the response. | +| `accounts` | [string](#string) | repeated | | + + + + + + + + +### QueryClassFrozenRequest + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `class_id` | [string](#string) | | | +| `account` | [string](#string) | | | + + + + + + + + +### QueryClassFrozenResponse + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `frozen` | [bool](#bool) | | | + + + + + + ### QueryClassRequest @@ -1869,6 +1990,8 @@ Query defines the gRPC querier service. | `Class` | [QueryClassRequest](#coreum.asset.nft.v1.QueryClassRequest) | [QueryClassResponse](#coreum.asset.nft.v1.QueryClassResponse) | Class queries the non-fungible token class of the module. | GET|/coreum/asset/nft/v1/classes/{id}| | `Classes` | [QueryClassesRequest](#coreum.asset.nft.v1.QueryClassesRequest) | [QueryClassesResponse](#coreum.asset.nft.v1.QueryClassesResponse) | Classes queries the non-fungible token classes of the module. | GET|/coreum/asset/nft/v1/classes| | `Frozen` | [QueryFrozenRequest](#coreum.asset.nft.v1.QueryFrozenRequest) | [QueryFrozenResponse](#coreum.asset.nft.v1.QueryFrozenResponse) | Frozen queries to check if an NFT is frozen or not. | GET|/coreum/asset/nft/v1/classes/{class_id}/nfts/{id}/frozen| +| `ClassFrozen` | [QueryClassFrozenRequest](#coreum.asset.nft.v1.QueryClassFrozenRequest) | [QueryClassFrozenResponse](#coreum.asset.nft.v1.QueryClassFrozenResponse) | ClassFrozen queries to check if an account if frozen for an NFT class. | GET|/coreum/asset/nft/v1/classes/{class_id}/frozen/{account}| +| `ClassFrozenAccounts` | [QueryClassFrozenAccountsRequest](#coreum.asset.nft.v1.QueryClassFrozenAccountsRequest) | [QueryClassFrozenAccountsResponse](#coreum.asset.nft.v1.QueryClassFrozenAccountsResponse) | QueryClassFrozenAccountsRequest returns the list of accounts which are frozen to hold NFTs in this class. | GET|/coreum/asset/nft/v1/classes/{class_id}/frozen| | `Whitelisted` | [QueryWhitelistedRequest](#coreum.asset.nft.v1.QueryWhitelistedRequest) | [QueryWhitelistedResponse](#coreum.asset.nft.v1.QueryWhitelistedResponse) | Whitelisted queries to check if an account is whitelited to hold an NFT or not. | GET|/coreum/asset/nft/v1/classes/{class_id}/nfts/{id}/whitelisted/{account}| | `WhitelistedAccountsForNFT` | [QueryWhitelistedAccountsForNFTRequest](#coreum.asset.nft.v1.QueryWhitelistedAccountsForNFTRequest) | [QueryWhitelistedAccountsForNFTResponse](#coreum.asset.nft.v1.QueryWhitelistedAccountsForNFTResponse) | WhitelistedAccountsForNFT returns the list of accounts which are whitelisted to hold this NFT. | GET|/coreum/asset/nft/v1/classes/{class_id}/nfts/{id}/whitelisted| | `ClassWhitelistedAccounts` | [QueryClassWhitelistedAccountsRequest](#coreum.asset.nft.v1.QueryClassWhitelistedAccountsRequest) | [QueryClassWhitelistedAccountsResponse](#coreum.asset.nft.v1.QueryClassWhitelistedAccountsResponse) | ClassWhitelistedAccounts returns the list of accounts which are whitelisted to hold NFTs in this class. | GET|/coreum/asset/nft/v1/classes/{class_id}/whitelisted| @@ -1948,6 +2071,40 @@ MsgBurn defines message for the Burn method. + + +### MsgClassFreeze + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `sender` | [string](#string) | | | +| `class_id` | [string](#string) | | | +| `account` | [string](#string) | | | + + + + + + + + +### MsgClassUnfreeze + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `sender` | [string](#string) | | | +| `class_id` | [string](#string) | | | +| `account` | [string](#string) | | | + + + + + + ### MsgFreeze @@ -2099,6 +2256,8 @@ Msg defines the Msg service. | `RemoveFromWhitelist` | [MsgRemoveFromWhitelist](#coreum.asset.nft.v1.MsgRemoveFromWhitelist) | [EmptyResponse](#coreum.asset.nft.v1.EmptyResponse) | RemoveFromWhitelist removes an account from whitelisted list of the NFT | | | `AddToClassWhitelist` | [MsgAddToClassWhitelist](#coreum.asset.nft.v1.MsgAddToClassWhitelist) | [EmptyResponse](#coreum.asset.nft.v1.EmptyResponse) | AddToClassWhitelist adds account as whitelist for all the NFTs in the class NOTE: class whitelist does not affect the individual nft whitelisting. | | | `RemoveFromClassWhitelist` | [MsgRemoveFromClassWhitelist](#coreum.asset.nft.v1.MsgRemoveFromClassWhitelist) | [EmptyResponse](#coreum.asset.nft.v1.EmptyResponse) | RemoveFromClassWhitelist removes account as whitelist for the entire class NOTE: class whitelist does not affect the individual nft whitelisting. ie. if specific whitelist is granted for an NFT, that whitelist will still be valid, ater we add and remove it from the class whitelist. | | +| `ClassFreeze` | [MsgClassFreeze](#coreum.asset.nft.v1.MsgClassFreeze) | [EmptyResponse](#coreum.asset.nft.v1.EmptyResponse) | ClassFreeze freezes all NFTs of a class held by an account. | | +| `ClassUnfreeze` | [MsgClassUnfreeze](#coreum.asset.nft.v1.MsgClassUnfreeze) | [EmptyResponse](#coreum.asset.nft.v1.EmptyResponse) | ClassUnfreeze removes class-freeze on an account for an NFT class. NOTE: class unfreeze does not affect the individual nft freeze. | | | `UpdateParams` | [MsgUpdateParams](#coreum.asset.nft.v1.MsgUpdateParams) | [EmptyResponse](#coreum.asset.nft.v1.EmptyResponse) | UpdateParams is a governance operation that sets the parameters of the module. NOTE: all parameters must be provided. | | diff --git a/docs/static/openapi.json b/docs/static/openapi.json index 325065c25..637008364 100644 --- a/docs/static/openapi.json +++ b/docs/static/openapi.json @@ -597,6 +597,112 @@ ] } }, + "/coreum/asset/nft/v1/classes/{class_id}/frozen": { + "get": { + "operationId": "GithubComCoreumFoundationCoreumV3XAssetNftTypesClassFrozenAccounts", + "parameters": [ + { + "name": "class_id", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "pagination.key", + "description": "key is a value returned in PageResponse.next_key to begin\nquerying the next page most efficiently. Only one of offset or key\nshould be set.", + "in": "query", + "required": false, + "type": "string", + "format": "byte" + }, + { + "name": "pagination.offset", + "description": "offset is a numeric offset that can be used when key is unavailable.\nIt is less efficient than using key. Only one of offset or key should\nbe set.", + "in": "query", + "required": false, + "type": "string", + "format": "uint64" + }, + { + "name": "pagination.limit", + "description": "limit is the total number of results to be returned in the result page.\nIf left empty it will default to a value to be set by each app.", + "in": "query", + "required": false, + "type": "string", + "format": "uint64" + }, + { + "name": "pagination.count_total", + "description": "count_total is set to true to indicate that the result set should include\na count of the total number of items available for pagination in UIs.\ncount_total is only respected when offset is used. It is ignored when key\nis set.", + "in": "query", + "required": false, + "type": "boolean" + }, + { + "name": "pagination.reverse", + "description": "reverse is set to true if results are to be returned in the descending order.\n\nSince: cosmos-sdk 0.43", + "in": "query", + "required": false, + "type": "boolean" + } + ], + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/coreum.asset.nft.v1.QueryClassFrozenAccountsResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/google.rpc.Status" + } + } + }, + "summary": "QueryClassFrozenAccountsRequest returns the list of accounts which are frozen to hold NFTs in this class.", + "tags": [ + "Query" + ] + } + }, + "/coreum/asset/nft/v1/classes/{class_id}/frozen/{account}": { + "get": { + "operationId": "GithubComCoreumFoundationCoreumV3XAssetNftTypesClassFrozen", + "parameters": [ + { + "name": "class_id", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "account", + "in": "path", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/coreum.asset.nft.v1.QueryClassFrozenResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/google.rpc.Status" + } + } + }, + "summary": "ClassFrozen queries to check if an account if frozen for an NFT class.", + "tags": [ + "Query" + ] + } + }, "/coreum/asset/nft/v1/classes/{class_id}/nfts/{id}/frozen": { "get": { "operationId": "GithubComCoreumFoundationCoreumV3XAssetNftTypesFrozen", @@ -7212,6 +7318,29 @@ } } }, + "coreum.asset.nft.v1.QueryClassFrozenAccountsResponse": { + "type": "object", + "properties": { + "pagination": { + "$ref": "#/definitions/cosmos.base.query.v1beta1.PageResponse", + "description": "pagination defines the pagination in the response." + }, + "accounts": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "coreum.asset.nft.v1.QueryClassFrozenResponse": { + "type": "object", + "properties": { + "frozen": { + "type": "boolean" + } + } + }, "coreum.asset.nft.v1.QueryClassResponse": { "type": "object", "properties": { diff --git a/integration-tests/modules/assetnft_test.go b/integration-tests/modules/assetnft_test.go index 0f7d1aeff..188a63e2e 100644 --- a/integration-tests/modules/assetnft_test.go +++ b/integration-tests/modules/assetnft_test.go @@ -960,6 +960,184 @@ func TestAssetNFTBurnFrozen_Issuer(t *testing.T) { requireT.Contains(err.Error(), "not found nft") } +// TestAssetNFTClassFreeze tests non-fungible token class freezing. +func TestAssetNFTClassFreeze(t *testing.T) { + t.Parallel() + + ctx, chain := integrationtests.NewCoreumTestingContext(t) + + requireT := require.New(t) + issuer := chain.GenAccount() + recipient1 := chain.GenAccount() + nftClient := assetnfttypes.NewQueryClient(chain.ClientContext) + + chain.FundAccountWithOptions(ctx, t, issuer, integration.BalancesOptions{ + Messages: []sdk.Msg{ + &assetnfttypes.MsgIssueClass{}, + &assetnfttypes.MsgMint{}, + &nft.MsgSend{}, + &assetnfttypes.MsgClassFreeze{}, + &assetnfttypes.MsgClassUnfreeze{}, + }, + Amount: chain.QueryAssetNFTParams(ctx, t).MintFee.Amount, + }) + + chain.FundAccountWithOptions(ctx, t, recipient1, integration.BalancesOptions{ + Messages: []sdk.Msg{ + &nft.MsgSend{}, + &nft.MsgSend{}, + &nft.MsgSend{}, + }, + }) + + // issue new NFT class + issueMsg := &assetnfttypes.MsgIssueClass{ + Issuer: issuer.String(), + Symbol: "NFTClassSymbol", + Features: []assetnfttypes.ClassFeature{ + assetnfttypes.ClassFeature_freezing, + }, + } + _, err := client.BroadcastTx( + ctx, + chain.ClientContext.WithFromAddress(issuer), + chain.TxFactory().WithGas(chain.GasLimitByMsgs(issueMsg)), + issueMsg, + ) + requireT.NoError(err) + + // mint new token in that class + classID := assetnfttypes.BuildClassID(issueMsg.Symbol, issuer) + nftID := "id-1" + mintMsg := &assetnfttypes.MsgMint{ + Sender: issuer.String(), + ID: nftID, + ClassID: classID, + Recipient: recipient1.String(), + } + res, err := client.BroadcastTx( + ctx, + chain.ClientContext.WithFromAddress(issuer), + chain.TxFactory().WithGas(chain.GasLimitByMsgs(mintMsg)), + mintMsg, + ) + requireT.NoError(err) + requireT.Equal(chain.GasLimitByMsgs(mintMsg), uint64(res.GasUsed)) + + // class freeze the NFT + msgFreeze := &assetnfttypes.MsgClassFreeze{ + Sender: issuer.String(), + ClassID: classID, + Account: recipient1.String(), + } + res, err = client.BroadcastTx( + ctx, + chain.ClientContext.WithFromAddress(issuer), + chain.TxFactory().WithGas(chain.GasLimitByMsgs(msgFreeze)), + msgFreeze, + ) + requireT.NoError(err) + requireT.EqualValues(int64(chain.GasLimitByMsgs(msgFreeze)), res.GasUsed) + + queryRes, err := nftClient.Frozen(ctx, &assetnfttypes.QueryFrozenRequest{ + ClassId: classID, + Id: nftID, + }) + requireT.NoError(err) + requireT.True(queryRes.Frozen) + + // assert the freezing event + frozenEvents, err := event.FindTypedEvents[*assetnfttypes.EventClassFrozen](res.Events) + requireT.NoError(err) + frozenEvent := frozenEvents[0] + requireT.Equal(&assetnfttypes.EventClassFrozen{ + ClassId: classID, + Account: recipient1.String(), + }, frozenEvent) + + // send from recipient1 to recipient2 (send is not allowed since it is frozen) + recipient2 := chain.GenAccount() + sendMsg := &nft.MsgSend{ + Sender: recipient1.String(), + ClassId: classID, + Id: nftID, + Receiver: recipient2.String(), + } + + _, err = client.BroadcastTx( + ctx, + chain.ClientContext.WithFromAddress(recipient1), + chain.TxFactory().WithGas(chain.GasLimitByMsgs(sendMsg)), + sendMsg, + ) + requireT.Error(err) + requireT.ErrorIs(err, cosmoserrors.ErrUnauthorized) + + // send from recipient1 to issuer (send is not allowed since it is frozen) + sendMsg = &nft.MsgSend{ + Sender: recipient1.String(), + ClassId: classID, + Id: nftID, + Receiver: issuer.String(), + } + + _, err = client.BroadcastTx( + ctx, + chain.ClientContext.WithFromAddress(recipient1), + chain.TxFactory().WithGas(chain.GasLimitByMsgs(sendMsg)), + sendMsg, + ) + requireT.Error(err) + requireT.True(cosmoserrors.ErrUnauthorized.Is(err)) + + // unfreeze the NFT + msgUnfreeze := &assetnfttypes.MsgClassUnfreeze{ + Sender: issuer.String(), + ClassID: classID, + Account: recipient1.String(), + } + res, err = client.BroadcastTx( + ctx, + chain.ClientContext.WithFromAddress(issuer), + chain.TxFactory().WithGas(chain.GasLimitByMsgs(msgUnfreeze)), + msgUnfreeze, + ) + requireT.NoError(err) + requireT.EqualValues(int64(chain.GasLimitByMsgs(msgUnfreeze)), res.GasUsed) + + queryRes, err = nftClient.Frozen(ctx, &assetnfttypes.QueryFrozenRequest{ + ClassId: classID, + Id: nftID, + }) + requireT.NoError(err) + requireT.False(queryRes.Frozen) + + // assert the unfreezing event + unFrozenEvents, err := event.FindTypedEvents[*assetnfttypes.EventClassUnfrozen](res.Events) + requireT.NoError(err) + unfrozenEvent := unFrozenEvents[0] + requireT.Equal(&assetnfttypes.EventClassUnfrozen{ + ClassId: classID, + Account: recipient1.String(), + }, unfrozenEvent) + + // send from recipient1 to recipient2 (send is allowed since it is not frozen) + sendMsg = &nft.MsgSend{ + Sender: recipient1.String(), + ClassId: classID, + Id: nftID, + Receiver: recipient2.String(), + } + + _, err = client.BroadcastTx( + ctx, + chain.ClientContext.WithFromAddress(recipient1), + chain.TxFactory().WithGas(chain.GasLimitByMsgs(sendMsg)), + sendMsg, + ) + requireT.NoError(err) +} + // TestAssetNFTFreeze tests non-fungible token freezing. func TestAssetNFTFreeze(t *testing.T) { t.Parallel() diff --git a/proto/coreum/asset/nft/v1/event.proto b/proto/coreum/asset/nft/v1/event.proto index 519c43eae..66fdb32cf 100644 --- a/proto/coreum/asset/nft/v1/event.proto +++ b/proto/coreum/asset/nft/v1/event.proto @@ -35,6 +35,17 @@ message EventUnfrozen { string owner = 3; } +message EventClassFrozen { + string class_id = 1; + string account = 3; +} + +message EventClassUnfrozen { + string class_id = 1; + string account = 3; +} + + message EventAddedToWhitelist { string class_id = 1; string id = 2; diff --git a/proto/coreum/asset/nft/v1/genesis.proto b/proto/coreum/asset/nft/v1/genesis.proto index 2d4eb7305..f19c6a6cb 100644 --- a/proto/coreum/asset/nft/v1/genesis.proto +++ b/proto/coreum/asset/nft/v1/genesis.proto @@ -18,6 +18,7 @@ message GenesisState { repeated WhitelistedNFTAccounts whitelisted_nft_accounts = 4 [(gogoproto.nullable) = false, (gogoproto.customname) = "WhitelistedNFTAccounts"]; repeated BurntNFT burnt_nfts = 5 [(gogoproto.nullable) = false, (gogoproto.customname) = "BurntNFTs"]; repeated ClassWhitelistedAccounts class_whitelisted_accounts = 6 [(gogoproto.nullable) = false]; + repeated ClassFrozenAccounts class_frozen_accounts = 7 [(gogoproto.nullable) = false]; } message FrozenNFT { @@ -36,6 +37,11 @@ message ClassWhitelistedAccounts { repeated string accounts = 2; } +message ClassFrozenAccounts { + string classID = 1; + repeated string accounts = 2; +} + message BurntNFT { string classID = 1; repeated string nftIDs = 2; diff --git a/proto/coreum/asset/nft/v1/query.proto b/proto/coreum/asset/nft/v1/query.proto index 7f3162d73..431d24894 100644 --- a/proto/coreum/asset/nft/v1/query.proto +++ b/proto/coreum/asset/nft/v1/query.proto @@ -32,6 +32,16 @@ service Query { option (google.api.http).get = "/coreum/asset/nft/v1/classes/{class_id}/nfts/{id}/frozen"; } + // ClassFrozen queries to check if an account if frozen for an NFT class. + rpc ClassFrozen (QueryClassFrozenRequest) returns (QueryClassFrozenResponse) { + option (google.api.http).get = "/coreum/asset/nft/v1/classes/{class_id}/frozen/{account}"; + } + + // QueryClassFrozenAccountsRequest returns the list of accounts which are frozen to hold NFTs in this class. + rpc ClassFrozenAccounts (QueryClassFrozenAccountsRequest) returns (QueryClassFrozenAccountsResponse) { + option (google.api.http).get = "/coreum/asset/nft/v1/classes/{class_id}/frozen"; + } + // Whitelisted queries to check if an account is whitelited to hold an NFT or not. rpc Whitelisted (QueryWhitelistedRequest) returns (QueryWhitelistedResponse) { option (google.api.http).get = "/coreum/asset/nft/v1/classes/{class_id}/nfts/{id}/whitelisted/{account}"; @@ -99,6 +109,15 @@ message QueryFrozenResponse { bool frozen = 1; } +message QueryClassFrozenRequest { + string class_id = 1; + string account = 2; +} + +message QueryClassFrozenResponse { + bool frozen = 1; +} + message QueryWhitelistedRequest { string id = 1; string class_id = 2; @@ -134,6 +153,18 @@ message QueryClassWhitelistedAccountsResponse { repeated string accounts = 2; } +message QueryClassFrozenAccountsRequest { + // pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 1; + string class_id = 2; +} + +message QueryClassFrozenAccountsResponse { + // pagination defines the pagination in the response. + cosmos.base.query.v1beta1.PageResponse pagination = 1; + repeated string accounts = 2; +} + message QueryBurntNFTRequest { string class_id = 1; string nft_id = 2; diff --git a/proto/coreum/asset/nft/v1/tx.proto b/proto/coreum/asset/nft/v1/tx.proto index 66a087cd4..9d2f8c0d3 100644 --- a/proto/coreum/asset/nft/v1/tx.proto +++ b/proto/coreum/asset/nft/v1/tx.proto @@ -38,6 +38,12 @@ service Msg { // ie. if specific whitelist is granted for an NFT, that whitelist will // still be valid, ater we add and remove it from the class whitelist. rpc RemoveFromClassWhitelist(MsgRemoveFromClassWhitelist) returns (EmptyResponse); + // ClassFreeze freezes all NFTs of a class held by an account. + rpc ClassFreeze(MsgClassFreeze) returns (EmptyResponse); + // ClassUnfreeze removes class-freeze on an account for an NFT class. + // NOTE: + // class unfreeze does not affect the individual nft freeze. + rpc ClassUnfreeze(MsgClassUnfreeze) returns (EmptyResponse); // UpdateParams is a governance operation that sets the parameters of the module. // NOTE: all parameters must be provided. rpc UpdateParams(MsgUpdateParams) returns (EmptyResponse); @@ -89,6 +95,18 @@ message MsgBurn { string id = 3 [(gogoproto.customname) = "ID"]; } + message MsgClassFreeze { + string sender = 1; + string class_id = 2 [(gogoproto.customname) = "ClassID"]; + string account = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + } + + message MsgClassUnfreeze { + string sender = 1; + string class_id = 2 [(gogoproto.customname) = "ClassID"]; + string account = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + } + message MsgAddToWhitelist { string sender = 1; string class_id = 2 [(gogoproto.customname) = "ClassID"]; diff --git a/x/asset/nft/client/cli/query.go b/x/asset/nft/client/cli/query.go index f75c16f3e..da96a3867 100644 --- a/x/asset/nft/client/cli/query.go +++ b/x/asset/nft/client/cli/query.go @@ -34,6 +34,8 @@ func GetQueryCmd() *cobra.Command { CmdQueryClass(), CmdQueryClasses(), CmdQueryFrozen(), + CmdQueryClassFrozen(), + CmdQueryClassFrozenAccounts(), CmdQueryWhitelisted(), CmdQueryWhitelistedAccounts(), CmdQueryClassWhitelistedAccounts(), @@ -165,6 +167,90 @@ $ %[1]s query %s frozen [class-id] [id] return cmd } +// CmdQueryClassFrozen return the QueryClassFrozen cobra command. +func CmdQueryClassFrozen() *cobra.Command { + cmd := &cobra.Command{ + Use: "class-frozen [class-id] [account]", + Args: cobra.ExactArgs(2), + Short: "Query if non-fungible token class is frozen for account", + Long: strings.TrimSpace( + fmt.Sprintf(`Query if non-fungible token class is frozen for account. + +Example: +$ %[1]s query %s class-frozen [class-id] [account] +`, + version.AppName, types.ModuleName, + ), + ), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx := client.GetClientContextFromCmd(cmd) + queryClient := types.NewQueryClient(clientCtx) + + classID := args[0] + account := args[1] + res, err := queryClient.ClassFrozen(cmd.Context(), &types.QueryClassFrozenRequest{ + Account: account, + ClassId: classID, + }) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} + +// CmdQueryClassFrozenAccounts return the QueryClassFrozenAccounts cobra command. +// +//nolint:dupl // creating abstraction for cli here will make it less maintainable. +func CmdQueryClassFrozenAccounts() *cobra.Command { + cmd := &cobra.Command{ + Use: "class-frozen-accounts [class-id]", + Args: cobra.ExactArgs(1), + Short: "Query for frozen accounts for a class of non-fungible tokens", + Long: strings.TrimSpace( + fmt.Sprintf(`Query for frozen accounts for a class of non-fungible tokens. + +Example: +$ %s query %s class-frozen-accounts [class-id] +`, + version.AppName, types.ModuleName, + ), + ), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx := client.GetClientContextFromCmd(cmd) + queryClient := types.NewQueryClient(clientCtx) + + classID := args[0] + + pageReq, err := client.ReadPageRequest(cmd.Flags()) + if err != nil { + return err + } + + res, err := queryClient.ClassFrozenAccounts(cmd.Context(), &types.QueryClassFrozenAccountsRequest{ + Pagination: pageReq, + ClassId: classID, + }) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + flags.AddPaginationFlagsToCmd(cmd, "whitelisted accounts") + + return cmd +} + // CmdQueryWhitelisted return the CmdQueryWhitelisted cobra command. func CmdQueryWhitelisted() *cobra.Command { cmd := &cobra.Command{ @@ -252,6 +338,8 @@ $ %s query %s whitelisted-accounts [class-id] [id] } // CmdQueryClassWhitelistedAccounts return the CmdQueryWhitelistedAccounts cobra command. +// +//nolint:dupl // creating abstraction for cli here will make it less maintainable. func CmdQueryClassWhitelistedAccounts() *cobra.Command { cmd := &cobra.Command{ Use: "class-whitelisted-accounts [class-id]", diff --git a/x/asset/nft/client/cli/query_test.go b/x/asset/nft/client/cli/query_test.go index 98ae96039..87b3b7dd5 100644 --- a/x/asset/nft/client/cli/query_test.go +++ b/x/asset/nft/client/cli/query_test.go @@ -138,6 +138,7 @@ func TestCmdQueryParams(t *testing.T) { requireT.Equal(expectedMintFee, resp.Params.MintFee) } +//nolint:unparam // using constant values here will make this function less flexible. func mint( requireT *require.Assertions, ctx client.Context, diff --git a/x/asset/nft/client/cli/tx.go b/x/asset/nft/client/cli/tx.go index 2921fdaa9..36c9e51b3 100644 --- a/x/asset/nft/client/cli/tx.go +++ b/x/asset/nft/client/cli/tx.go @@ -39,6 +39,8 @@ func GetTxCmd() *cobra.Command { CmdTxBurn(), CmdTxFreeze(), CmdTxUnfreeze(), + CmdTxClassFreeze(), + CmdTxClassUnfreeze(), CmdTxWhitelist(), CmdTxUnwhitelist(), CmdTxClassWhitelist(), @@ -460,3 +462,83 @@ $ %s tx %s class-unwhitelist abc-%[3]s %[3]s --from [sender] return cmd } + +// CmdTxClassFreeze returns ClassFreeze cobra command. +func CmdTxClassFreeze() *cobra.Command { + cmd := &cobra.Command{ + Use: "class-freeze [class-id] [account] --from [sender]", + Args: cobra.ExactArgs(2), + Short: "Freeze an account for a class of non-fungible tokens", + Long: strings.TrimSpace( + fmt.Sprintf(`Freeze an account for a class of non-fungible tokens. + +Example: +$ %s tx %s class-freeze abc-%[3]s %[3]s --from [sender] +`, + version.AppName, types.ModuleName, constant.AddressSampleTest, + ), + ), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return errors.WithStack(err) + } + + sender := clientCtx.GetFromAddress() + classID := args[0] + account := args[1] + + msg := &types.MsgClassFreeze{ + Sender: sender.String(), + ClassID: classID, + Account: account, + } + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + + return cmd +} + +// CmdTxClassUnfreeze returns ClassUnfreeze cobra command. +func CmdTxClassUnfreeze() *cobra.Command { + cmd := &cobra.Command{ + Use: "class-unfreeze [class-id] [account] --from [sender]", + Args: cobra.ExactArgs(2), + Short: "Unfreeze an account for a class of non-fungible tokens", + Long: strings.TrimSpace( + fmt.Sprintf(`Unfreeze an account for a class of non-fungible tokens. + +Example: +$ %s tx %s class-unfreeze abc-%[3]s %[3]s --from [sender] +`, + version.AppName, types.ModuleName, constant.AddressSampleTest, + ), + ), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return errors.WithStack(err) + } + + sender := clientCtx.GetFromAddress() + classID := args[0] + account := args[1] + + msg := &types.MsgClassUnfreeze{ + Sender: sender.String(), + ClassID: classID, + Account: account, + } + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + + return cmd +} diff --git a/x/asset/nft/client/cli/tx_test.go b/x/asset/nft/client/cli/tx_test.go index 4b49c3946..2bb87ff67 100644 --- a/x/asset/nft/client/cli/tx_test.go +++ b/x/asset/nft/client/cli/tx_test.go @@ -263,6 +263,75 @@ func TestCmdClassWhitelist(t *testing.T) { requireT.False(whitelistedResp.Whitelisted) } +func TestCmdClassFreeze(t *testing.T) { + requireT := require.New(t) + testNetwork := network.New(t) + + symbol := "nft" + uuid.NewString()[:4] + validator := testNetwork.Validators[0] + ctx := validator.ClientCtx + account := sdk.AccAddress(secp256k1.GenPrivKey().PubKey().Address()) + + // create class + classID := issueClass( + requireT, + ctx, + symbol, + "class name", + "class description", + "https://my-class-meta.invalid/1", + "", + testNetwork, + "0.0", + types.ClassFeature_freezing, + ) + // mint nft + mint( + requireT, + ctx, + classID, + nftID, + "https://my-nft-meta.invalid/1", + "9309e7e6e96150afbf181d308fe88343ab1cbec391b7717150a7fb217b4cf0a9", + testNetwork, + ) + + // class-freeze + args := []string{classID, account.String()} + args = append(args, txValidator1Args(testNetwork)...) + _, err := coreumclitestutil.ExecTxCmd(ctx, testNetwork, cli.CmdTxClassFreeze(), args) + requireT.NoError(err) + + // query class frozen + var classFrozenResp types.QueryFrozenResponse + args = []string{classID, account.String()} + requireT.NoError(coreumclitestutil.ExecQueryCmd(ctx, cli.CmdQueryClassFrozen(), args, &classFrozenResp)) + requireT.True(classFrozenResp.Frozen) + + // query frozen + var frozenResp types.QueryFrozenResponse + args = []string{classID, nftID} + requireT.NoError(coreumclitestutil.ExecQueryCmd(ctx, cli.CmdQueryFrozen(), args, &frozenResp)) + requireT.False(frozenResp.Frozen) + + // query with pagination + var resPage types.QueryClassFrozenAccountsResponse + args = []string{classID} + requireT.NoError(coreumclitestutil.ExecQueryCmd(ctx, cli.CmdQueryClassFrozenAccounts(), args, &resPage)) + requireT.ElementsMatch([]string{account.String()}, resPage.Accounts) + + // unfreeze + args = []string{classID, account.String()} + args = append(args, txValidator1Args(testNetwork)...) + _, err = coreumclitestutil.ExecTxCmd(ctx, testNetwork, cli.CmdTxClassUnfreeze(), args) + requireT.NoError(err) + + // query class frozen + args = []string{classID, account.String()} + requireT.NoError(coreumclitestutil.ExecQueryCmd(ctx, cli.CmdQueryClassFrozen(), args, &classFrozenResp)) + requireT.False(classFrozenResp.Frozen) +} + func txValidator1Args(testNetwork *network.Network) []string { return []string{ fmt.Sprintf("--%s=%s", flags.FlagFrom, testNetwork.Validators[0].Address.String()), diff --git a/x/asset/nft/genesis.go b/x/asset/nft/genesis.go index c8da84305..005006e1f 100644 --- a/x/asset/nft/genesis.go +++ b/x/asset/nft/genesis.go @@ -63,6 +63,22 @@ func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) } } + for _, classFrozen := range genState.ClassFrozenAccounts { + if err := classFrozen.Validate(); err != nil { + panic(err) + } + for _, account := range classFrozen.Accounts { + if err := k.SetClassFrozen( + ctx, + classFrozen.ClassID, + sdk.MustAccAddressFromBech32(account), + true, + ); err != nil { + panic(err) + } + } + } + for _, burnt := range genState.BurntNFTs { if err := burnt.Validate(); err != nil { panic(err) @@ -97,6 +113,11 @@ func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { panic(err) } + classFrozen, _, err := k.GetAllClassFrozenAccounts(ctx, &query.PageRequest{Limit: query.MaxLimit}) + if err != nil { + panic(err) + } + burnt, _, err := k.GetBurntNFTs(ctx, &query.PageRequest{Limit: query.MaxLimit}) if err != nil { panic(err) @@ -108,6 +129,7 @@ func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { FrozenNFTs: frozen, WhitelistedNFTAccounts: whitelisted, ClassWhitelistedAccounts: classWhitelisted, + ClassFrozenAccounts: classFrozen, BurntNFTs: burnt, } } diff --git a/x/asset/nft/genesis_test.go b/x/asset/nft/genesis_test.go index 900d10949..90f4b1c29 100644 --- a/x/asset/nft/genesis_test.go +++ b/x/asset/nft/genesis_test.go @@ -119,6 +119,21 @@ func TestInitAndExportGenesis(t *testing.T) { ) } + // ClassFrozen + var classFrozen []types.ClassFrozenAccounts + for i := 0; i < 5; i++ { + classFrozen = append(classFrozen, + types.ClassFrozenAccounts{ + ClassID: fmt.Sprintf("classid%d-%s", i, issuer), + Accounts: []string{ + sdk.AccAddress(secp256k1.GenPrivKey().PubKey().Address()).String(), + sdk.AccAddress(secp256k1.GenPrivKey().PubKey().Address()).String(), + sdk.AccAddress(secp256k1.GenPrivKey().PubKey().Address()).String(), + }, + }, + ) + } + // Burnt NFTs var burnt []types.BurntNFT for i := 0; i < 5; i++ { @@ -137,6 +152,7 @@ func TestInitAndExportGenesis(t *testing.T) { FrozenNFTs: frozen, WhitelistedNFTAccounts: whitelisted, ClassWhitelistedAccounts: classWhitelisted, + ClassFrozenAccounts: classFrozen, BurntNFTs: burnt, } @@ -169,13 +185,24 @@ func TestInitAndExportGenesis(t *testing.T) { sort.Strings(st.Accounts) } + // sort whitelisting accounts for _, st := range genState.ClassWhitelistedAccounts { sort.Strings(st.Accounts) } for _, st := range exportedGenState.ClassWhitelistedAccounts { sort.Strings(st.Accounts) } + + // sort frozen accounts + for _, st := range genState.ClassFrozenAccounts { + sort.Strings(st.Accounts) + } + for _, st := range exportedGenState.ClassFrozenAccounts { + sort.Strings(st.Accounts) + } + assertT.ElementsMatch(genState.WhitelistedNFTAccounts, exportedGenState.WhitelistedNFTAccounts) assertT.ElementsMatch(genState.ClassWhitelistedAccounts, exportedGenState.ClassWhitelistedAccounts) + assertT.ElementsMatch(genState.ClassFrozenAccounts, exportedGenState.ClassFrozenAccounts) assertT.ElementsMatch(genState.BurntNFTs, exportedGenState.BurntNFTs) } diff --git a/x/asset/nft/keeper/grpc_query.go b/x/asset/nft/keeper/grpc_query.go index 55195e0fb..f4b07128f 100644 --- a/x/asset/nft/keeper/grpc_query.go +++ b/x/asset/nft/keeper/grpc_query.go @@ -13,14 +13,18 @@ import ( var _ types.QueryServer = QueryService{} // QueryKeeper defines subscope of keeper methods required by query service. +// +//nolint:interfacebloat // breaking down this interface is not beneficial. type QueryKeeper interface { GetParams(ctx sdk.Context) types.Params GetClass(ctx sdk.Context, classID string) (types.Class, error) GetClasses(ctx sdk.Context, issuer *sdk.AccAddress, pagination *query.PageRequest) ([]types.Class, *query.PageResponse, error) IsFrozen(ctx sdk.Context, classID, nftID string) (bool, error) + IsClassFrozen(ctx sdk.Context, classID string, account sdk.AccAddress) (bool, error) IsWhitelisted(ctx sdk.Context, classID, nftID string, account sdk.AccAddress) (bool, error) GetWhitelistedAccountsForNFT(ctx sdk.Context, classID, nftID string, q *query.PageRequest) ([]string, *query.PageResponse, error) GetClassWhitelistedAccounts(ctx sdk.Context, classID string, q *query.PageRequest) ([]string, *query.PageResponse, error) + GetClassFrozenAccounts(ctx sdk.Context, classID string, q *query.PageRequest) ([]string, *query.PageResponse, error) GetBurntByClass(ctx sdk.Context, classID string, q *query.PageRequest) (*query.PageResponse, []string, error) IsBurnt(ctx sdk.Context, classID, nftID string) (bool, error) } @@ -83,6 +87,18 @@ func (qs QueryService) Frozen(ctx context.Context, req *types.QueryFrozenRequest }, err } +// ClassFrozen queries to check if an account if frozen for an NFT class. +func (qs QueryService) ClassFrozen(ctx context.Context, req *types.QueryClassFrozenRequest) (*types.QueryClassFrozenResponse, error) { + accountAddress, err := sdk.AccAddressFromBech32(req.Account) + if err != nil { + return nil, sdkerrors.Wrap(types.ErrInvalidInput, "invalid account address") + } + frozen, err := qs.keeper.IsClassFrozen(sdk.UnwrapSDKContext(ctx), req.ClassId, accountAddress) + return &types.QueryClassFrozenResponse{ + Frozen: frozen, + }, err +} + // Whitelisted checks to see if an account is whitelisted for an NFT. func (qs QueryService) Whitelisted(ctx context.Context, req *types.QueryWhitelistedRequest) (*types.QueryWhitelistedResponse, error) { account, err := sdk.AccAddressFromBech32(req.Account) @@ -117,6 +133,15 @@ func (qs QueryService) ClassWhitelistedAccounts(ctx context.Context, req *types. }, err } +// ClassFrozenAccounts returns the list of accounts which are whitelited to hold this NFTs in this class. +func (qs QueryService) ClassFrozenAccounts(ctx context.Context, req *types.QueryClassFrozenAccountsRequest) (*types.QueryClassFrozenAccountsResponse, error) { + accounts, pageRes, err := qs.keeper.GetClassFrozenAccounts(sdk.UnwrapSDKContext(ctx), req.ClassId, req.Pagination) + return &types.QueryClassFrozenAccountsResponse{ + Pagination: pageRes, + Accounts: accounts, + }, err +} + // BurntNFT checks if an NFT is burnt or not. func (qs QueryService) BurntNFT(ctx context.Context, req *types.QueryBurntNFTRequest) (*types.QueryBurntNFTResponse, error) { isBurnt, err := qs.keeper.IsBurnt(sdk.UnwrapSDKContext(ctx), req.ClassId, req.NftId) diff --git a/x/asset/nft/keeper/keeper.go b/x/asset/nft/keeper/keeper.go index 45fc3b16e..99d734f60 100644 --- a/x/asset/nft/keeper/keeper.go +++ b/x/asset/nft/keeper/keeper.go @@ -502,6 +502,32 @@ func (k Keeper) SetFrozen(ctx sdk.Context, classID, nftID string, frozen bool) e return nil } +// ClassFreeze freezes a non-fungible token. +func (k Keeper) ClassFreeze(ctx sdk.Context, sender, account sdk.AccAddress, classID string) error { + return k.classFreezeOrUnfreeze(ctx, sender, account, classID, true) +} + +// ClassUnfreeze unfreezes a non-fungible token. +func (k Keeper) ClassUnfreeze(ctx sdk.Context, sender, account sdk.AccAddress, classID string) error { + return k.classFreezeOrUnfreeze(ctx, sender, account, classID, false) +} + +// SetClassFrozen marks the nft class as for an account, but does not make any checks +// should not be used directly outside the module except for genesis. +func (k Keeper) SetClassFrozen(ctx sdk.Context, classID string, account sdk.AccAddress, frozen bool) error { + key, err := types.CreateClassFreezingKey(classID, account) + if err != nil { + return err + } + s := ctx.KVStore(k.storeKey) + if frozen { + s.Set(key, types.StoreTrue) + } else { + s.Delete(key) + } + return nil +} + // IsFrozen return whether a non-fungible token is frozen or not. func (k Keeper) IsFrozen(ctx sdk.Context, classID, nftID string) (bool, error) { classDefinition, err := k.GetClassDefinition(ctx, classID) @@ -522,6 +548,39 @@ func (k Keeper) IsFrozen(ctx sdk.Context, classID, nftID string) (bool, error) { return false, err } + if bytes.Equal(ctx.KVStore(k.storeKey).Get(key), types.StoreTrue) { + return true, nil + } + + owner := k.nftKeeper.GetOwner(ctx, classID, nftID) + key, err = types.CreateClassFreezingKey(classID, owner) + if err != nil { + return false, err + } + + return bytes.Equal(ctx.KVStore(k.storeKey).Get(key), types.StoreTrue), nil +} + +// IsClassFrozen return whether an account is frozen for an NFT class . +func (k Keeper) IsClassFrozen(ctx sdk.Context, classID string, account sdk.AccAddress) (bool, error) { + classDefinition, err := k.GetClassDefinition(ctx, classID) + if err != nil { + return false, err + } + + if !classDefinition.IsFeatureEnabled(types.ClassFeature_freezing) { + return false, sdkerrors.Wrapf(types.ErrFeatureDisabled, `feature "freezing" is disabled`) + } + + if !k.nftKeeper.HasClass(ctx, classID) { + return false, sdkerrors.Wrapf(types.ErrNFTNotFound, "class with ID:%s not found", classID) + } + + key, err := types.CreateClassFreezingKey(classID, account) + if err != nil { + return false, err + } + return bytes.Equal(ctx.KVStore(k.storeKey).Get(key), types.StoreTrue), nil } @@ -558,6 +617,68 @@ func (k Keeper) GetFrozenNFTs(ctx sdk.Context, q *query.PageRequest) ([]types.Fr return frozen, pageRes, nil } +// GetAllClassFrozenAccounts returns all frozen accounts for all NFTs. +// +//nolint:dupl // although there is duplicaiton, merging the code under a common abstraction will make it less maintainable. +func (k Keeper) GetAllClassFrozenAccounts(ctx sdk.Context, q *query.PageRequest) ([]types.ClassFrozenAccounts, *query.PageResponse, error) { + mp := make(map[string][]string, 0) + pageRes, err := query.Paginate(prefix.NewStore(ctx.KVStore(k.storeKey), types.NFTClassFreezingKeyPrefix), + q, func(key, value []byte) error { + if !bytes.Equal(value, types.StoreTrue) { + return sdkerrors.Wrapf(types.ErrInvalidState, "value stored in whitelisting store is not %x, value %x", types.StoreTrue, value) + } + classID, account, err := types.ParseClassFreezingKey(key) + if err != nil { + return err + } + if !k.nftKeeper.HasClass(ctx, classID) { + return nil + } + + accountString := account.String() + mp[classID] = append(mp[classID], accountString) + return nil + }) + if err != nil { + return nil, nil, err + } + + frozen := make([]types.ClassFrozenAccounts, 0, len(mp)) + for classID, accounts := range mp { + frozen = append(frozen, types.ClassFrozenAccounts{ + ClassID: classID, + Accounts: accounts, + }) + } + + return frozen, pageRes, nil +} + +// GetClassFrozenAccounts returns all class frozen accounts for the class. +func (k Keeper) GetClassFrozenAccounts(ctx sdk.Context, classID string, q *query.PageRequest) ([]string, *query.PageResponse, error) { + compositeKey, err := store.JoinKeysWithLength([]byte(classID)) + if err != nil { + return nil, nil, sdkerrors.Wrapf(types.ErrInvalidKey, "failed to create a composite key for nft, err: %s", err) + } + key := store.JoinKeys(types.NFTClassFreezingKeyPrefix, compositeKey) + accounts := []string{} + pageRes, err := query.Paginate(prefix.NewStore(ctx.KVStore(k.storeKey), key), + q, func(key, value []byte) error { + if !bytes.Equal(value, types.StoreTrue) { + return sdkerrors.Wrapf(types.ErrInvalidState, "value stored in whitelisting store is not %x, value %x", types.StoreTrue, value) + } + + account := sdk.AccAddress(key[1:]) // the first byte contains the length prefix + accounts = append(accounts, account.String()) + return nil + }) + if err != nil { + return nil, nil, err + } + + return accounts, pageRes, nil +} + // IsWhitelisted checks to see if an account is whitelisted for an NFT. func (k Keeper) IsWhitelisted(ctx sdk.Context, classID, nftID string, account sdk.AccAddress) (bool, error) { classDefinition, err := k.GetClassDefinition(ctx, classID) @@ -665,6 +786,8 @@ func (k Keeper) GetWhitelistedAccounts(ctx sdk.Context, q *query.PageRequest) ([ } // GetAllClassWhitelistedAccounts returns all whitelisted accounts for all NFTs. +// +//nolint:dupl // although there is duplicaiton, merging the code under a common abstraction will make it less maintainable. func (k Keeper) GetAllClassWhitelistedAccounts(ctx sdk.Context, q *query.PageRequest) ([]types.ClassWhitelistedAccounts, *query.PageResponse, error) { mp := make(map[string][]string, 0) pageRes, err := query.Paginate(prefix.NewStore(ctx.KVStore(k.storeKey), types.NFTClassWhitelistingKeyPrefix), @@ -808,6 +931,17 @@ func (k Keeper) isNFTSendable(ctx sdk.Context, classID, nftID string) error { if frozen { return sdkerrors.Wrapf(cosmoserrors.ErrUnauthorized, "nft with classID:%s and ID:%s is frozen", classID, nftID) } + + classFrozen, err := k.IsClassFrozen(ctx, classID, owner) + if err != nil { + if errors.Is(err, types.ErrFeatureDisabled) { + return nil + } + return err + } + if classFrozen { + return sdkerrors.Wrapf(cosmoserrors.ErrUnauthorized, "nft with classID:%s and ID:%s is class frozen", classID, nftID) + } return nil } @@ -887,6 +1021,48 @@ func (k Keeper) freezeOrUnfreeze(ctx sdk.Context, sender sdk.AccAddress, classID return nil } +func (k Keeper) classFreezeOrUnfreeze(ctx sdk.Context, sender, account sdk.AccAddress, classID string, setFrozen bool) error { + classDefinition, err := k.GetClassDefinition(ctx, classID) + if err != nil { + return err + } + + if err = classDefinition.CheckFeatureAllowed(sender, types.ClassFeature_freezing); err != nil { + return err + } + + if classDefinition.Issuer == account.String() { + return sdkerrors.Wrap(cosmoserrors.ErrUnauthorized, "setting class-freezing for the nft class issuer is forbidden") + } + + if !k.nftKeeper.HasClass(ctx, classID) { + return sdkerrors.Wrapf(types.ErrClassNotFound, "classID:%s not found", classID) + } + + if err := k.SetClassFrozen(ctx, classID, account, setFrozen); err != nil { + return err + } + + var event proto.Message + if setFrozen { + event = &types.EventClassFrozen{ + ClassId: classID, + Account: account.String(), + } + } else { + event = &types.EventClassUnfrozen{ + ClassId: classID, + Account: account.String(), + } + } + + if err = ctx.EventManager().EmitTypedEvent(event); err != nil { + return sdkerrors.Wrapf(types.ErrInvalidState, "failed to emit event: %v, err: %s", event, err) + } + + return nil +} + func (k Keeper) addToWhitelistOrRemoveFromWhitelistClass(ctx sdk.Context, classID string, sender, account sdk.AccAddress, setWhitelisted bool) error { classDefinition, err := k.GetClassDefinition(ctx, classID) if err != nil { diff --git a/x/asset/nft/keeper/keeper_test.go b/x/asset/nft/keeper/keeper_test.go index d597bb25a..13e69afda 100644 --- a/x/asset/nft/keeper/keeper_test.go +++ b/x/asset/nft/keeper/keeper_test.go @@ -1054,6 +1054,185 @@ func TestKeeper_ClassWhitelist_NonExistent(t *testing.T) { requireT.ErrorIs(err, types.ErrClassNotFound) } +func TestKeeper_ClassFreeze(t *testing.T) { + requireT := require.New(t) + testApp := simapp.New() + ctx := testApp.NewContext(false, tmproto.Header{}) + assetNFTKeeper := testApp.AssetNFTKeeper + nftKeeper := testApp.NFTKeeper + + nftParams := types.Params{ + MintFee: sdk.NewInt64Coin(constant.DenomDev, 0), + } + requireT.NoError(assetNFTKeeper.SetParams(ctx, nftParams)) + + issuer := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address()) + classSettings := types.IssueClassSettings{ + Issuer: issuer, + Symbol: "symbol", + Features: []types.ClassFeature{ + types.ClassFeature_freezing, + }, + } + + classID, err := assetNFTKeeper.IssueClass(ctx, classSettings) + requireT.NoError(err) + + // class-freezing issuer is not allowed + err = assetNFTKeeper.ClassFreeze(ctx, issuer, issuer, classID) + requireT.Error(err) + requireT.ErrorIs(err, cosmoserrors.ErrUnauthorized) + + // mint NFT + recipient := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address()) + settings := types.MintSettings{ + Sender: issuer, + Recipient: recipient, + ClassID: classID, + ID: "my-id", + URI: "https://my-nft-meta.invalid/1", + URIHash: "content-hash", + } + + requireT.NoError(assetNFTKeeper.Mint(ctx, settings)) + nftID := settings.ID + + // class-freeze recipient + requireT.NoError(assetNFTKeeper.ClassFreeze(ctx, issuer, recipient, classID)) + + isClassFrozen, err := assetNFTKeeper.IsClassFrozen(ctx, classID, recipient) + requireT.NoError(err) + requireT.True(isClassFrozen) + + frozenAccounts, _, err := assetNFTKeeper.GetClassFrozenAccounts(ctx, classID, &query.PageRequest{}) + requireT.NoError(err) + requireT.ElementsMatch([]string{recipient.String()}, frozenAccounts) + + // transfer must be rejected + recipient2 := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address()) + err = nftKeeper.Transfer(ctx, classID, nftID, recipient2) + requireT.Error(err) + requireT.ErrorIs(err, cosmoserrors.ErrUnauthorized) + + // class-unfreeze + requireT.NoError(assetNFTKeeper.ClassUnfreeze(ctx, issuer, recipient, classID)) + + // transfer again, must succeed + err = nftKeeper.Transfer(ctx, classID, nftID, recipient2) + requireT.NoError(err) +} + +func TestKeeper_ClassFreeze_And_NFTFreeze(t *testing.T) { + requireT := require.New(t) + testApp := simapp.New() + ctx := testApp.NewContext(false, tmproto.Header{}) + assetNFTKeeper := testApp.AssetNFTKeeper + + issuer := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address()) + recipient := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address()) + classSettings := types.IssueClassSettings{ + Issuer: issuer, + Symbol: "symbol", + Features: []types.ClassFeature{ + types.ClassFeature_freezing, + }, + } + + classID, err := assetNFTKeeper.IssueClass(ctx, classSettings) + requireT.NoError(err) + + // mint 2 NFTs + settings := types.MintSettings{ + Sender: issuer, + Recipient: recipient, + ClassID: classID, + ID: "my-id", + URI: "https://my-nft-meta.invalid/1", + URIHash: "content-hash", + } + requireT.NoError(assetNFTKeeper.Mint(ctx, settings)) + nftID1 := settings.ID + + settings.ID += "2" + nftID2 := settings.ID + requireT.NoError(assetNFTKeeper.Mint(ctx, settings)) + + // freeze the recipient for nft1 + requireT.NoError(assetNFTKeeper.Freeze(ctx, issuer, classID, nftID1)) + assertFrozen(t, ctx, assetNFTKeeper, classID, nftID1, true) + assertFrozen(t, ctx, assetNFTKeeper, classID, nftID2, false) + + // freeze the whole class + requireT.NoError(assetNFTKeeper.ClassFreeze(ctx, issuer, recipient, classID)) + assertFrozen(t, ctx, assetNFTKeeper, classID, nftID1, true) + assertFrozen(t, ctx, assetNFTKeeper, classID, nftID2, true) + + // unfreeze the whole class + requireT.NoError(assetNFTKeeper.ClassUnfreeze(ctx, issuer, recipient, classID)) + assertFrozen(t, ctx, assetNFTKeeper, classID, nftID1, true) + assertFrozen(t, ctx, assetNFTKeeper, classID, nftID2, false) +} + +func TestKeeper_ClassFreeze_Unfreezable(t *testing.T) { + requireT := require.New(t) + testApp := simapp.New() + ctx := testApp.NewContext(false, tmproto.Header{}) + assetNFTKeeper := testApp.AssetNFTKeeper + + nftParams := types.Params{ + MintFee: sdk.NewInt64Coin(constant.DenomDev, 0), + } + requireT.NoError(assetNFTKeeper.SetParams(ctx, nftParams)) + + issuer := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address()) + account := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address()) + classSettings := types.IssueClassSettings{ + Issuer: issuer, + Symbol: "symbol", + Features: []types.ClassFeature{}, + } + + classID, err := assetNFTKeeper.IssueClass(ctx, classSettings) + requireT.NoError(err) + + requireT.NoError(err) + settings := types.MintSettings{ + Sender: issuer, + Recipient: issuer, + ClassID: classID, + ID: "my-id", + URI: "https://my-nft-meta.invalid/1", + URIHash: "content-hash", + } + + // mint NFT + requireT.NoError(assetNFTKeeper.Mint(ctx, settings)) + + // class freeze NFT + err = assetNFTKeeper.ClassFreeze(ctx, issuer, account, classID) + requireT.Error(err) + requireT.True(types.ErrFeatureDisabled.Is(err)) +} + +func TestKeeper_ClassFreeze_Nonexistent(t *testing.T) { + requireT := require.New(t) + testApp := simapp.New() + ctx := testApp.NewContext(false, tmproto.Header{}) + assetNFTKeeper := testApp.AssetNFTKeeper + issuer := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address()) + account := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address()) + + nftParams := types.Params{ + MintFee: sdk.NewInt64Coin(constant.DenomDev, 0), + } + requireT.NoError(assetNFTKeeper.SetParams(ctx, nftParams)) + + // try to class freeze when NFT does not exists + err := assetNFTKeeper.ClassFreeze(ctx, issuer, account, types.BuildClassID("symbol", issuer)) + requireT.Error(err) + requireT.ErrorIs(err, types.ErrClassNotFound) +} + func genNFTData(requireT *require.Assertions) *codectypes.Any { dataString := "metadata" dataValue, err := codectypes.NewAnyWithValue(&types.DataBytes{Data: []byte(dataString)}) @@ -1076,3 +1255,9 @@ func assertWhitelisting(t *testing.T, ctx sdk.Context, k keeper.Keeper, classID, require.NoError(t, err) require.EqualValues(t, isWhitelisted, expectedWhitelisting) } + +func assertFrozen(t *testing.T, ctx sdk.Context, k keeper.Keeper, classID, nftID string, expected bool) { + frozen, err := k.IsFrozen(ctx, classID, nftID) + require.NoError(t, err) + require.EqualValues(t, frozen, expected) +} diff --git a/x/asset/nft/keeper/msg_server.go b/x/asset/nft/keeper/msg_server.go index a33603585..465e32b2b 100644 --- a/x/asset/nft/keeper/msg_server.go +++ b/x/asset/nft/keeper/msg_server.go @@ -18,6 +18,8 @@ type MsgKeeper interface { Burn(ctx sdk.Context, owner sdk.AccAddress, classID, ID string) error Freeze(ctx sdk.Context, sender sdk.AccAddress, classID, nftID string) error Unfreeze(ctx sdk.Context, sender sdk.AccAddress, classID, nftID string) error + ClassFreeze(ctx sdk.Context, sender, account sdk.AccAddress, classID string) error + ClassUnfreeze(ctx sdk.Context, sender, account sdk.AccAddress, classID string) error AddToWhitelist(ctx sdk.Context, classID, nftID string, sender, account sdk.AccAddress) error RemoveFromWhitelist(ctx sdk.Context, classID, nftID string, sender, account sdk.AccAddress) error AddToClassWhitelist(ctx sdk.Context, classID string, sender, account sdk.AccAddress) error @@ -222,6 +224,44 @@ func (ms MsgServer) RemoveFromClassWhitelist(ctx context.Context, req *types.Msg return &types.EmptyResponse{}, nil } +// ClassFreeze freezes all NFTs of a class held by an account. +func (ms MsgServer) ClassFreeze(ctx context.Context, req *types.MsgClassFreeze) (*types.EmptyResponse, error) { + sender, err := sdk.AccAddressFromBech32(req.Sender) + if err != nil { + return nil, sdkerrors.Wrap(types.ErrInvalidInput, "invalid sender") + } + + account, err := sdk.AccAddressFromBech32(req.Account) + if err != nil { + return nil, sdkerrors.Wrap(types.ErrInvalidInput, "invalid account") + } + + if err := ms.keeper.ClassFreeze(sdk.UnwrapSDKContext(ctx), sender, account, req.ClassID); err != nil { + return nil, err + } + + return &types.EmptyResponse{}, nil +} + +// ClassUnfreeze removes class-freeze of all NFTs held by an account. +func (ms MsgServer) ClassUnfreeze(ctx context.Context, req *types.MsgClassUnfreeze) (*types.EmptyResponse, error) { + sender, err := sdk.AccAddressFromBech32(req.Sender) + if err != nil { + return nil, sdkerrors.Wrap(types.ErrInvalidInput, "invalid sender") + } + + account, err := sdk.AccAddressFromBech32(req.Account) + if err != nil { + return nil, sdkerrors.Wrap(types.ErrInvalidInput, "invalid account") + } + + if err := ms.keeper.ClassUnfreeze(sdk.UnwrapSDKContext(ctx), sender, account, req.ClassID); err != nil { + return nil, err + } + + return &types.EmptyResponse{}, nil +} + // UpdateParams is a governance operation that sets parameters of the module. func (ms MsgServer) UpdateParams(goCtx context.Context, req *types.MsgUpdateParams) (*types.EmptyResponse, error) { if err := ms.keeper.UpdateParams(sdk.UnwrapSDKContext(goCtx), req.Authority, req.Params); err != nil { diff --git a/x/asset/nft/types/codec.go b/x/asset/nft/types/codec.go index 543ee8b3d..7e87c0491 100644 --- a/x/asset/nft/types/codec.go +++ b/x/asset/nft/types/codec.go @@ -18,6 +18,10 @@ func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { &MsgUnfreeze{}, &MsgAddToWhitelist{}, &MsgRemoveFromWhitelist{}, + &MsgAddToClassWhitelist{}, + &MsgRemoveFromClassWhitelist{}, + &MsgClassFreeze{}, + &MsgClassUnfreeze{}, ) msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) } diff --git a/x/asset/nft/types/event.pb.go b/x/asset/nft/types/event.pb.go index f7b806e68..7b315f411 100644 --- a/x/asset/nft/types/event.pb.go +++ b/x/asset/nft/types/event.pb.go @@ -246,6 +246,110 @@ func (m *EventUnfrozen) GetOwner() string { return "" } +type EventClassFrozen struct { + ClassId string `protobuf:"bytes,1,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` + Account string `protobuf:"bytes,3,opt,name=account,proto3" json:"account,omitempty"` +} + +func (m *EventClassFrozen) Reset() { *m = EventClassFrozen{} } +func (m *EventClassFrozen) String() string { return proto.CompactTextString(m) } +func (*EventClassFrozen) ProtoMessage() {} +func (*EventClassFrozen) Descriptor() ([]byte, []int) { + return fileDescriptor_fef75aa7da633196, []int{3} +} +func (m *EventClassFrozen) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EventClassFrozen) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EventClassFrozen.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 *EventClassFrozen) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventClassFrozen.Merge(m, src) +} +func (m *EventClassFrozen) XXX_Size() int { + return m.Size() +} +func (m *EventClassFrozen) XXX_DiscardUnknown() { + xxx_messageInfo_EventClassFrozen.DiscardUnknown(m) +} + +var xxx_messageInfo_EventClassFrozen proto.InternalMessageInfo + +func (m *EventClassFrozen) GetClassId() string { + if m != nil { + return m.ClassId + } + return "" +} + +func (m *EventClassFrozen) GetAccount() string { + if m != nil { + return m.Account + } + return "" +} + +type EventClassUnfrozen struct { + ClassId string `protobuf:"bytes,1,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` + Account string `protobuf:"bytes,3,opt,name=account,proto3" json:"account,omitempty"` +} + +func (m *EventClassUnfrozen) Reset() { *m = EventClassUnfrozen{} } +func (m *EventClassUnfrozen) String() string { return proto.CompactTextString(m) } +func (*EventClassUnfrozen) ProtoMessage() {} +func (*EventClassUnfrozen) Descriptor() ([]byte, []int) { + return fileDescriptor_fef75aa7da633196, []int{4} +} +func (m *EventClassUnfrozen) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EventClassUnfrozen) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EventClassUnfrozen.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 *EventClassUnfrozen) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventClassUnfrozen.Merge(m, src) +} +func (m *EventClassUnfrozen) XXX_Size() int { + return m.Size() +} +func (m *EventClassUnfrozen) XXX_DiscardUnknown() { + xxx_messageInfo_EventClassUnfrozen.DiscardUnknown(m) +} + +var xxx_messageInfo_EventClassUnfrozen proto.InternalMessageInfo + +func (m *EventClassUnfrozen) GetClassId() string { + if m != nil { + return m.ClassId + } + return "" +} + +func (m *EventClassUnfrozen) GetAccount() string { + if m != nil { + return m.Account + } + return "" +} + type EventAddedToWhitelist struct { ClassId string `protobuf:"bytes,1,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` Id string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"` @@ -256,7 +360,7 @@ func (m *EventAddedToWhitelist) Reset() { *m = EventAddedToWhitelist{} } func (m *EventAddedToWhitelist) String() string { return proto.CompactTextString(m) } func (*EventAddedToWhitelist) ProtoMessage() {} func (*EventAddedToWhitelist) Descriptor() ([]byte, []int) { - return fileDescriptor_fef75aa7da633196, []int{3} + return fileDescriptor_fef75aa7da633196, []int{5} } func (m *EventAddedToWhitelist) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -316,7 +420,7 @@ func (m *EventRemovedFromWhitelist) Reset() { *m = EventRemovedFromWhite func (m *EventRemovedFromWhitelist) String() string { return proto.CompactTextString(m) } func (*EventRemovedFromWhitelist) ProtoMessage() {} func (*EventRemovedFromWhitelist) Descriptor() ([]byte, []int) { - return fileDescriptor_fef75aa7da633196, []int{4} + return fileDescriptor_fef75aa7da633196, []int{6} } func (m *EventRemovedFromWhitelist) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -375,7 +479,7 @@ func (m *EventAddedToClassWhitelist) Reset() { *m = EventAddedToClassWhi func (m *EventAddedToClassWhitelist) String() string { return proto.CompactTextString(m) } func (*EventAddedToClassWhitelist) ProtoMessage() {} func (*EventAddedToClassWhitelist) Descriptor() ([]byte, []int) { - return fileDescriptor_fef75aa7da633196, []int{5} + return fileDescriptor_fef75aa7da633196, []int{7} } func (m *EventAddedToClassWhitelist) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -427,7 +531,7 @@ func (m *EventRemovedFromClassWhitelist) Reset() { *m = EventRemovedFrom func (m *EventRemovedFromClassWhitelist) String() string { return proto.CompactTextString(m) } func (*EventRemovedFromClassWhitelist) ProtoMessage() {} func (*EventRemovedFromClassWhitelist) Descriptor() ([]byte, []int) { - return fileDescriptor_fef75aa7da633196, []int{6} + return fileDescriptor_fef75aa7da633196, []int{8} } func (m *EventRemovedFromClassWhitelist) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -474,6 +578,8 @@ func init() { proto.RegisterType((*EventClassIssued)(nil), "coreum.asset.nft.v1.EventClassIssued") proto.RegisterType((*EventFrozen)(nil), "coreum.asset.nft.v1.EventFrozen") proto.RegisterType((*EventUnfrozen)(nil), "coreum.asset.nft.v1.EventUnfrozen") + proto.RegisterType((*EventClassFrozen)(nil), "coreum.asset.nft.v1.EventClassFrozen") + proto.RegisterType((*EventClassUnfrozen)(nil), "coreum.asset.nft.v1.EventClassUnfrozen") proto.RegisterType((*EventAddedToWhitelist)(nil), "coreum.asset.nft.v1.EventAddedToWhitelist") proto.RegisterType((*EventRemovedFromWhitelist)(nil), "coreum.asset.nft.v1.EventRemovedFromWhitelist") proto.RegisterType((*EventAddedToClassWhitelist)(nil), "coreum.asset.nft.v1.EventAddedToClassWhitelist") @@ -483,40 +589,42 @@ func init() { func init() { proto.RegisterFile("coreum/asset/nft/v1/event.proto", fileDescriptor_fef75aa7da633196) } var fileDescriptor_fef75aa7da633196 = []byte{ - // 525 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x93, 0x41, 0x6f, 0xd3, 0x30, - 0x14, 0xc7, 0xdb, 0x74, 0x6b, 0x3a, 0x17, 0x26, 0x14, 0x06, 0xf2, 0x2a, 0x91, 0x94, 0x1e, 0xa6, - 0x5d, 0x48, 0x34, 0x76, 0xe0, 0xc4, 0x81, 0x6d, 0x54, 0xf4, 0x82, 0xa8, 0x45, 0x85, 0x84, 0x90, - 0x8a, 0x1b, 0xbb, 0xad, 0x45, 0x13, 0x57, 0xb6, 0x53, 0x28, 0x9f, 0x82, 0x8f, 0xb5, 0xe3, 0x8e, - 0x88, 0x43, 0x85, 0x52, 0xf1, 0x3d, 0x90, 0x5f, 0x32, 0x54, 0xd0, 0x0e, 0x4c, 0xea, 0x29, 0x7e, - 0xff, 0xf7, 0xfc, 0x7b, 0xf6, 0x3f, 0x7e, 0x28, 0x88, 0xa5, 0xe2, 0x59, 0x12, 0x51, 0xad, 0xb9, - 0x89, 0xd2, 0xb1, 0x89, 0x16, 0x27, 0x11, 0x5f, 0xf0, 0xd4, 0x84, 0x73, 0x25, 0x8d, 0xf4, 0xee, - 0x17, 0x05, 0x21, 0x14, 0x84, 0xe9, 0xd8, 0x84, 0x8b, 0x93, 0xd6, 0xc1, 0x44, 0x4e, 0x24, 0xe4, - 0x23, 0xbb, 0x2a, 0x4a, 0x5b, 0x8f, 0x6e, 0x62, 0xd9, 0x1d, 0x90, 0xee, 0xfc, 0x72, 0xd0, 0xbd, - 0x97, 0x96, 0x7c, 0x3e, 0xa3, 0x5a, 0xf7, 0xb4, 0xce, 0x38, 0xf3, 0x1e, 0x22, 0x47, 0x30, 0x5c, - 0x6d, 0x57, 0x8f, 0xf7, 0xce, 0xea, 0xf9, 0x2a, 0x70, 0x7a, 0x17, 0xc4, 0x11, 0x56, 0xaf, 0x0b, - 0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0xb5, 0xcf, 0xc4, 0x85, 0xb8, 0xc7, 0xbc, 0x7d, 0x30, - 0xbf, 0x30, 0xd8, 0x9a, 0x7e, 0x80, 0x76, 0xe5, 0xe7, 0x94, 0xab, 0xd2, 0xdb, 0x22, 0xe8, 0xbc, - 0x41, 0x77, 0x81, 0x37, 0x48, 0xc7, 0x5b, 0x22, 0x7e, 0x40, 0x0f, 0x80, 0xf8, 0x82, 0x31, 0xce, - 0xde, 0xca, 0x77, 0x53, 0x61, 0xf8, 0x4c, 0x68, 0x73, 0x1b, 0x32, 0x46, 0x2e, 0x8d, 0x63, 0x99, - 0xa5, 0xa6, 0x64, 0x5f, 0x87, 0x9d, 0x8f, 0xe8, 0x10, 0xe8, 0x84, 0x27, 0x72, 0xc1, 0x59, 0x57, - 0xc9, 0x64, 0xcb, 0x1d, 0xfa, 0xa8, 0xb5, 0x79, 0x7e, 0xf8, 0xb5, 0xff, 0xd5, 0x62, 0x03, 0xe9, - 0xfc, 0x8d, 0x1c, 0x20, 0xff, 0xdf, 0x43, 0x6f, 0x01, 0x7b, 0xd6, 0xbf, 0xcc, 0xfd, 0xea, 0x55, - 0xee, 0x57, 0x7f, 0xe6, 0x7e, 0xf5, 0xdb, 0xda, 0xaf, 0x5c, 0xad, 0xfd, 0xca, 0xf7, 0xb5, 0x5f, - 0x79, 0xff, 0x6c, 0xe3, 0x69, 0x9d, 0xc3, 0x7b, 0xed, 0xca, 0x2c, 0x65, 0xd4, 0xce, 0x45, 0x54, - 0x0e, 0xf2, 0xe2, 0x34, 0xfa, 0xb2, 0x31, 0xcd, 0xf0, 0xde, 0x46, 0x75, 0x98, 0xe6, 0xd3, 0xdf, - 0x01, 0x00, 0x00, 0xff, 0xff, 0xe6, 0x79, 0x4e, 0xe8, 0x3a, 0x04, 0x00, 0x00, + // 545 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x94, 0xc1, 0x6f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0xf3, 0x0f, 0x09, 0x15, 0xa5, 0xb7, 0x45, + 0xd0, 0x7b, 0x09, 0xfe, 0x37, 0xbc, 0x61, 0x32, 0xd9, 0x10, 0xf1, 0x59, 0xf5, 0x20, 0xfc, 0x7d, + 0x4c, 0x07, 0xd8, 0x38, 0x8a, 0x78, 0x9a, 0xa8, 0x12, 0x73, 0x19, 0xf6, 0x42, 0x00, 0x7f, 0x81, + 0x6e, 0x32, 0xdf, 0xf5, 0xa8, 0xb7, 0xe0, 0x8e, 0x41, 0x3d, 0x21, 0x84, 0x92, 0x57, 0xfc, 0xf5, + 0x8c, 0x29, 0x3a, 0x67, 0x52, 0xfd, 0xcb, 0x6e, 0xaf, 0xa7, 0xbf, 0x03, 0xfb, 0x86, 0x8e, 0x68, + 0xcc, 0x97, 0x94, 0xf4, 0x05, 0x8f, 0x37, 0xdc, 0x61, 0x00, 0x3a, 0xd5, 0xf9, 0x8d, 0x23, 0x37, + 0x6a, 0x51, 0x41, 0x5a, 0xbf, 0x23, 0x87, 0xc0, 0xfd, 0x73, 0xe8, 0x0d, 0x60, 0x4f, 0x06, 0xe7, + 0xb9, 0x5b, 0xbf, 0xc8, 0xdd, 0xfa, 0xb7, 0xdc, 0xad, 0x7f, 0x5e, 0xbb, 0xb5, 0x8b, 0xb5, 0x5b, + 0xfb, 0xb2, 0x76, 0x6b, 0x6f, 0x1e, 0x55, 0x8e, 0xfb, 0xa9, 0xb9, 0x43, 0x7d, 0x9e, 0x26, 0x04, + 0xeb, 0xbb, 0x1a, 0x94, 0x8f, 0xcb, 0xf2, 0x38, 0xf8, 0x58, 0x79, 0x61, 0xcc, 0x1d, 0x18, 0x37, + 0xcd, 0x0b, 0x73, 0xfc, 0x23, 0x00, 0x00, 0xff, 0xff, 0x73, 0x4f, 0xbd, 0xb6, 0xce, 0x04, 0x00, + 0x00, } func (m *EventClassIssued) Marshal() (dAtA []byte, err error) { @@ -707,6 +815,80 @@ func (m *EventUnfrozen) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *EventClassFrozen) 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 *EventClassFrozen) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EventClassFrozen) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Account) > 0 { + i -= len(m.Account) + copy(dAtA[i:], m.Account) + i = encodeVarintEvent(dAtA, i, uint64(len(m.Account))) + 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] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *EventClassUnfrozen) 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 *EventClassUnfrozen) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EventClassUnfrozen) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Account) > 0 { + i -= len(m.Account) + copy(dAtA[i:], m.Account) + i = encodeVarintEvent(dAtA, i, uint64(len(m.Account))) + 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] = 0xa + } + return len(dAtA) - i, nil +} + func (m *EventAddedToWhitelist) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -968,6 +1150,40 @@ func (m *EventUnfrozen) Size() (n int) { return n } +func (m *EventClassFrozen) 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.Account) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + return n +} + +func (m *EventClassUnfrozen) 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.Account) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + return n +} + func (m *EventAddedToWhitelist) Size() (n int) { if m == nil { return 0 @@ -1719,6 +1935,234 @@ func (m *EventUnfrozen) Unmarshal(dAtA []byte) error { } return nil } +func (m *EventClassFrozen) 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: EventClassFrozen: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EventClassFrozen: 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 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Account", 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.Account = 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 *EventClassUnfrozen) 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: EventClassUnfrozen: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EventClassUnfrozen: 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 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Account", 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.Account = 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 *EventAddedToWhitelist) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/x/asset/nft/types/genesis.go b/x/asset/nft/types/genesis.go index 43f604d98..9e7e95502 100644 --- a/x/asset/nft/types/genesis.go +++ b/x/asset/nft/types/genesis.go @@ -96,6 +96,20 @@ func (c ClassWhitelistedAccounts) Validate() error { return nil } +// Validate performs basic validation on the fields of WhitelistedNFTAccounts. +func (c ClassFrozenAccounts) Validate() error { + if _, _, err := DeconstructClassID(c.ClassID); err != nil { + return err + } + + for _, acc := range c.Accounts { + if _, err := sdk.AccAddressFromBech32(acc); err != nil { + return err + } + } + return nil +} + // Validate performs basic validation on the fields of BurntNFT. func (b BurntNFT) Validate() error { if _, _, err := DeconstructClassID(b.ClassID); err != nil { diff --git a/x/asset/nft/types/genesis.pb.go b/x/asset/nft/types/genesis.pb.go index 20f54286f..d949eb18e 100644 --- a/x/asset/nft/types/genesis.pb.go +++ b/x/asset/nft/types/genesis.pb.go @@ -33,6 +33,7 @@ type GenesisState struct { WhitelistedNFTAccounts []WhitelistedNFTAccounts `protobuf:"bytes,4,rep,name=whitelisted_nft_accounts,json=whitelistedNftAccounts,proto3" json:"whitelisted_nft_accounts"` BurntNFTs []BurntNFT `protobuf:"bytes,5,rep,name=burnt_nfts,json=burntNfts,proto3" json:"burnt_nfts"` ClassWhitelistedAccounts []ClassWhitelistedAccounts `protobuf:"bytes,6,rep,name=class_whitelisted_accounts,json=classWhitelistedAccounts,proto3" json:"class_whitelisted_accounts"` + ClassFrozenAccounts []ClassFrozenAccounts `protobuf:"bytes,7,rep,name=class_frozen_accounts,json=classFrozenAccounts,proto3" json:"class_frozen_accounts"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -110,6 +111,13 @@ func (m *GenesisState) GetClassWhitelistedAccounts() []ClassWhitelistedAccounts return nil } +func (m *GenesisState) GetClassFrozenAccounts() []ClassFrozenAccounts { + if m != nil { + return m.ClassFrozenAccounts + } + return nil +} + type FrozenNFT struct { ClassID string `protobuf:"bytes,1,opt,name=classID,proto3" json:"classID,omitempty"` NftIDs []string `protobuf:"bytes,2,rep,name=nftIDs,proto3" json:"nftIDs,omitempty"` @@ -274,6 +282,58 @@ func (m *ClassWhitelistedAccounts) GetAccounts() []string { return nil } +type ClassFrozenAccounts struct { + ClassID string `protobuf:"bytes,1,opt,name=classID,proto3" json:"classID,omitempty"` + Accounts []string `protobuf:"bytes,2,rep,name=accounts,proto3" json:"accounts,omitempty"` +} + +func (m *ClassFrozenAccounts) Reset() { *m = ClassFrozenAccounts{} } +func (m *ClassFrozenAccounts) String() string { return proto.CompactTextString(m) } +func (*ClassFrozenAccounts) ProtoMessage() {} +func (*ClassFrozenAccounts) Descriptor() ([]byte, []int) { + return fileDescriptor_3abcf08d60f6fbfd, []int{4} +} +func (m *ClassFrozenAccounts) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ClassFrozenAccounts) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ClassFrozenAccounts.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 *ClassFrozenAccounts) XXX_Merge(src proto.Message) { + xxx_messageInfo_ClassFrozenAccounts.Merge(m, src) +} +func (m *ClassFrozenAccounts) XXX_Size() int { + return m.Size() +} +func (m *ClassFrozenAccounts) XXX_DiscardUnknown() { + xxx_messageInfo_ClassFrozenAccounts.DiscardUnknown(m) +} + +var xxx_messageInfo_ClassFrozenAccounts proto.InternalMessageInfo + +func (m *ClassFrozenAccounts) GetClassID() string { + if m != nil { + return m.ClassID + } + return "" +} + +func (m *ClassFrozenAccounts) GetAccounts() []string { + if m != nil { + return m.Accounts + } + return nil +} + type BurntNFT struct { ClassID string `protobuf:"bytes,1,opt,name=classID,proto3" json:"classID,omitempty"` NftIDs []string `protobuf:"bytes,2,rep,name=nftIDs,proto3" json:"nftIDs,omitempty"` @@ -283,7 +343,7 @@ func (m *BurntNFT) Reset() { *m = BurntNFT{} } func (m *BurntNFT) String() string { return proto.CompactTextString(m) } func (*BurntNFT) ProtoMessage() {} func (*BurntNFT) Descriptor() ([]byte, []int) { - return fileDescriptor_3abcf08d60f6fbfd, []int{4} + return fileDescriptor_3abcf08d60f6fbfd, []int{5} } func (m *BurntNFT) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -331,45 +391,48 @@ func init() { proto.RegisterType((*FrozenNFT)(nil), "coreum.asset.nft.v1.FrozenNFT") proto.RegisterType((*WhitelistedNFTAccounts)(nil), "coreum.asset.nft.v1.WhitelistedNFTAccounts") proto.RegisterType((*ClassWhitelistedAccounts)(nil), "coreum.asset.nft.v1.ClassWhitelistedAccounts") + proto.RegisterType((*ClassFrozenAccounts)(nil), "coreum.asset.nft.v1.ClassFrozenAccounts") proto.RegisterType((*BurntNFT)(nil), "coreum.asset.nft.v1.BurntNFT") } func init() { proto.RegisterFile("coreum/asset/nft/v1/genesis.proto", fileDescriptor_3abcf08d60f6fbfd) } var fileDescriptor_3abcf08d60f6fbfd = []byte{ - // 507 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x53, 0x4d, 0x6f, 0xd3, 0x40, - 0x10, 0x8d, 0xd3, 0x34, 0xd4, 0x13, 0x0e, 0x74, 0xa9, 0xa2, 0x95, 0x51, 0xdd, 0x10, 0x71, 0xa8, - 0x84, 0xb0, 0xd5, 0xf6, 0x80, 0x90, 0xe0, 0x80, 0x1b, 0x05, 0xf5, 0x12, 0x8a, 0x5b, 0xa9, 0x12, - 0x97, 0xc8, 0x71, 0xd6, 0xa9, 0xa5, 0x66, 0x37, 0x78, 0xd7, 0xe1, 0xe3, 0xce, 0x9d, 0xff, 0xc4, - 0xa5, 0xc7, 0x1e, 0x39, 0x55, 0x28, 0xf9, 0x23, 0xc8, 0xb3, 0x8e, 0x71, 0x91, 0x53, 0x89, 0xdb, - 0xce, 0xcc, 0x9b, 0xf7, 0xf6, 0xed, 0xec, 0xc0, 0xd3, 0x50, 0x24, 0x2c, 0x9d, 0xba, 0x81, 0x94, - 0x4c, 0xb9, 0x3c, 0x52, 0xee, 0xfc, 0xc0, 0x9d, 0x30, 0xce, 0x64, 0x2c, 0x9d, 0x59, 0x22, 0x94, - 0x20, 0x8f, 0x35,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b, 0x3c, 0x3f, - 0x72, 0xbf, 0x94, 0x96, 0x5a, 0x7d, 0x9d, 0x31, 0x39, 0x6a, 0xe2, 0x52, 0x1f, 0xfd, 0x09, 0x00, - 0x00, 0xff, 0xff, 0x6a, 0xc5, 0x5d, 0xf6, 0x65, 0x04, 0x00, 0x00, + // 541 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0x4d, 0x6f, 0xd3, 0x40, + 0x10, 0x8d, 0xd3, 0x26, 0xad, 0x27, 0x1c, 0xe8, 0xa6, 0x44, 0x96, 0x51, 0xdd, 0x10, 0x71, 0x88, + 0x84, 0xb0, 0xd5, 0xf6, 0x80, 0x90, 0xe0, 0x80, 0x1b, 0x05, 0x55, 0x48, 0xa1, 0xb8, 0x95, 0x2a, + 0x71, 0x89, 0x1c, 0x67, 0x9d, 0x5a, 0x6a, 0x76, 0x83, 0x77, 0x1d, 0x3e, 0xee, 0xdc, 0xf9, 0x17, + 0xfc, 0x95, 0x1e, 0x7b, 0xe4, 0x54, 0xa1, 0xe4, 0x8f, 0x20, 0xef, 0x3a, 0xc6, 0x2d, 0xeb, 0x4a, + 0xf4, 0xe6, 0x99, 0x79, 0xf3, 0xde, 0xce, 0xbe, 0xf1, 0xc2, 0x93, 0x80, 0xc6, 0x38, 0x99, 0x3a, + 0x3e, 0x63, 0x98, 0x3b, 0x24, 0xe4, 0xce, 0x7c, 0xcf, 0x99, 0x60, 0x82, 0x59, 0xc4, 0xec, 0x59, + 0x4c, 0x39, 0x45, 0x4d, 0x09, 0xb1, 0x05, 0xc4, 0x26, 0x21, 0xb7, 0xe7, 0x7b, 0xe6, 0xf6, 0x84, + 0x4e, 0xa8, 0xa8, 0x3b, 0xe9, 0x97, 0x84, 0x9a, 0x6d, 0x15, 0xdb, 0xcc, 0x8f, 0xfd, 0x69, 0x46, + 0x66, 0xee, 0xa8, 0x10, 0x29, 0xa7, 0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34, + 0x3f, 0x70, 0xbe, 0x14, 0x5e, 0x21, 0xfe, 0x75, 0x86, 0xd9, 0xa8, 0x2e, 0x5e, 0xa1, 0x83, 0x3f, + 0x01, 0x00, 0x00, 0xff, 0xff, 0xc5, 0x38, 0x7d, 0x87, 0x16, 0x05, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -392,6 +455,20 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.ClassFrozenAccounts) > 0 { + for iNdEx := len(m.ClassFrozenAccounts) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.ClassFrozenAccounts[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a + } + } if len(m.ClassWhitelistedAccounts) > 0 { for iNdEx := len(m.ClassWhitelistedAccounts) - 1; iNdEx >= 0; iNdEx-- { { @@ -599,6 +676,45 @@ func (m *ClassWhitelistedAccounts) MarshalToSizedBuffer(dAtA []byte) (int, error return len(dAtA) - i, nil } +func (m *ClassFrozenAccounts) 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 *ClassFrozenAccounts) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ClassFrozenAccounts) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Accounts) > 0 { + for iNdEx := len(m.Accounts) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Accounts[iNdEx]) + copy(dAtA[i:], m.Accounts[iNdEx]) + i = encodeVarintGenesis(dAtA, i, uint64(len(m.Accounts[iNdEx]))) + 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 (m *BurntNFT) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -687,6 +803,12 @@ func (m *GenesisState) Size() (n int) { n += 1 + l + sovGenesis(uint64(l)) } } + if len(m.ClassFrozenAccounts) > 0 { + for _, e := range m.ClassFrozenAccounts { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } return n } @@ -751,6 +873,25 @@ func (m *ClassWhitelistedAccounts) Size() (n int) { return n } +func (m *ClassFrozenAccounts) 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)) + } + if len(m.Accounts) > 0 { + for _, s := range m.Accounts { + l = len(s) + n += 1 + l + sovGenesis(uint64(l)) + } + } + return n +} + func (m *BurntNFT) Size() (n int) { if m == nil { return 0 @@ -1008,6 +1149,40 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ClassFrozenAccounts", 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.ClassFrozenAccounts = append(m.ClassFrozenAccounts, ClassFrozenAccounts{}) + if err := m.ClassFrozenAccounts[len(m.ClassFrozenAccounts)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenesis(dAtA[iNdEx:]) @@ -1403,6 +1578,120 @@ func (m *ClassWhitelistedAccounts) Unmarshal(dAtA []byte) error { } return nil } +func (m *ClassFrozenAccounts) 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: ClassFrozenAccounts: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ClassFrozenAccounts: 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 Accounts", 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.Accounts = append(m.Accounts, string(dAtA[iNdEx:postIndex])) + 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 *BurntNFT) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/x/asset/nft/types/keys.go b/x/asset/nft/types/keys.go index b81182e19..65954b899 100644 --- a/x/asset/nft/types/keys.go +++ b/x/asset/nft/types/keys.go @@ -35,6 +35,8 @@ var ( ParamsKey = []byte{0x05} // NFTClassWhitelistingKeyPrefix defines the key prefix to track whitelisted account for class. NFTClassWhitelistingKeyPrefix = []byte{0x06} + // NFTClassFreezingKeyPrefix defines the key prefix to track frozen account for NFT class. + NFTClassFreezingKeyPrefix = []byte{0x07} ) // StoreTrue keeps a value used by stores to indicate that key is present. @@ -87,6 +89,29 @@ func ParseFreezingKey(key []byte) (string, string, error) { return string(parsedKeys[0]), string(parsedKeys[1]), nil } +// CreateClassFreezingKey constructs the key for the class freezing of NFT class. +func CreateClassFreezingKey(classID string, account sdk.AccAddress) ([]byte, error) { + compositeKey, err := store.JoinKeysWithLength([]byte(classID), account) + if err != nil { + return nil, sdkerrors.Wrapf(ErrInvalidKey, "failed to create a freezing key, err: %s", err) + } + + return store.JoinKeys(NFTClassFreezingKeyPrefix, compositeKey), nil +} + +// ParseClassFreezingKey parses key back to class id and account. +func ParseClassFreezingKey(key []byte) (string, sdk.AccAddress, error) { + parsedKeys, err := store.ParseLengthPrefixedKeys(key) + if err != nil { + return "", nil, sdkerrors.Wrapf(ErrInvalidKey, "failed to parse class freezing key, err: %s", err) + } + if len(parsedKeys) != 2 { + err = sdkerrors.Wrapf(ErrInvalidKey, "key must be composed to 2 length prefixed keys") + return "", nil, err + } + return string(parsedKeys[0]), parsedKeys[1], nil +} + // CreateWhitelistingKey constructs the key for the whitelisting of non-fungible token. func CreateWhitelistingKey(classID, nftID string, account sdk.AccAddress) ([]byte, error) { compositeKey, err := store.JoinKeysWithLength([]byte(classID), []byte(nftID), account) diff --git a/x/asset/nft/types/msgs.go b/x/asset/nft/types/msgs.go index 5599b622e..a5056fb42 100644 --- a/x/asset/nft/types/msgs.go +++ b/x/asset/nft/types/msgs.go @@ -23,6 +23,8 @@ const ( TypeMsgRemoveFromWhitelist = "remove-from-whitelist" TypeMsgAddToClassWhitelist = "class-whitelist" TypeMsgRemoveFromClassWhitelist = "remove-from-class-whitelist" + TypeMsgClassFreeze = "class-freeze" + TypeMsgClassUnfreeze = "class-unfreeze" TypeMsgUpdateParams = "update-params" ) @@ -41,6 +43,8 @@ var ( _ msgAndLegacyMsg = &MsgRemoveFromWhitelist{} _ msgAndLegacyMsg = &MsgAddToClassWhitelist{} _ msgAndLegacyMsg = &MsgRemoveFromClassWhitelist{} + _ msgAndLegacyMsg = &MsgClassFreeze{} + _ msgAndLegacyMsg = &MsgClassUnfreeze{} _ msgAndLegacyMsg = &MsgUpdateParams{} ) @@ -64,6 +68,8 @@ func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { cdc.RegisterConcrete(&MsgRemoveFromWhitelist{}, fmt.Sprintf("%s/MsgRemoveFromWhitelist", ModuleName), nil) cdc.RegisterConcrete(&MsgAddToClassWhitelist{}, fmt.Sprintf("%s/MsgAddToClassWhitelist", ModuleName), nil) cdc.RegisterConcrete(&MsgRemoveFromClassWhitelist{}, fmt.Sprintf("%s/MsgRemoveFromClassWhitelist", ModuleName), nil) + cdc.RegisterConcrete(&MsgClassFreeze{}, fmt.Sprintf("%s/MsgClassFreeze", ModuleName), nil) + cdc.RegisterConcrete(&MsgClassUnfreeze{}, fmt.Sprintf("%s/MsgClassUnfreeze", ModuleName), nil) cdc.RegisterConcrete(&MsgUpdateParams{}, fmt.Sprintf("%s/MsgUpdateParams", ModuleName), nil) } @@ -385,6 +391,84 @@ func (m MsgRemoveFromWhitelist) Type() string { return TypeMsgRemoveFromWhitelist } +// ValidateBasic checks that message fields are valid. +func (m *MsgClassFreeze) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(m.Sender); err != nil { + return sdkerrors.Wrapf(cosmoserrors.ErrInvalidAddress, "invalid sender account %s", m.Sender) + } + + if _, err := sdk.AccAddressFromBech32(m.Account); err != nil { + return sdkerrors.Wrapf(cosmoserrors.ErrInvalidAddress, "invalid account %s", m.Sender) + } + + if _, _, err := DeconstructClassID(m.ClassID); err != nil { + return sdkerrors.Wrap(ErrInvalidInput, err.Error()) + } + + return nil +} + +// GetSigners returns the required signers of this message type. +func (m *MsgClassFreeze) GetSigners() []sdk.AccAddress { + return []sdk.AccAddress{ + sdk.MustAccAddressFromBech32(m.Sender), + } +} + +// GetSignBytes returns sign bytes for LegacyMsg. +func (m MsgClassFreeze) GetSignBytes() []byte { + return sdk.MustSortJSON(moduleAminoCdc.MustMarshalJSON(&m)) +} + +// Route returns message route for LegacyMsg. +func (m MsgClassFreeze) Route() string { + return RouterKey +} + +// Type returns message type for LegacyMsg. +func (m MsgClassFreeze) Type() string { + return TypeMsgClassFreeze +} + +// ValidateBasic checks that message fields are valid. +func (m *MsgClassUnfreeze) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(m.Sender); err != nil { + return sdkerrors.Wrapf(cosmoserrors.ErrInvalidAddress, "invalid sender account %s", m.Sender) + } + + if _, err := sdk.AccAddressFromBech32(m.Account); err != nil { + return sdkerrors.Wrapf(cosmoserrors.ErrInvalidAddress, "invalid account %s", m.Sender) + } + + if _, _, err := DeconstructClassID(m.ClassID); err != nil { + return sdkerrors.Wrap(ErrInvalidInput, err.Error()) + } + + return nil +} + +// GetSigners returns the required signers of this message type. +func (m *MsgClassUnfreeze) GetSigners() []sdk.AccAddress { + return []sdk.AccAddress{ + sdk.MustAccAddressFromBech32(m.Sender), + } +} + +// GetSignBytes returns sign bytes for LegacyMsg. +func (m MsgClassUnfreeze) GetSignBytes() []byte { + return sdk.MustSortJSON(moduleAminoCdc.MustMarshalJSON(&m)) +} + +// Route returns message route for LegacyMsg. +func (m MsgClassUnfreeze) Route() string { + return RouterKey +} + +// Type returns message type for LegacyMsg. +func (m MsgClassUnfreeze) Type() string { + return TypeMsgClassUnfreeze +} + // ValidateBasic checks that message fields are valid. func (m MsgUpdateParams) ValidateBasic() error { if _, err := sdk.AccAddressFromBech32(m.Authority); err != nil { diff --git a/x/asset/nft/types/query.pb.go b/x/asset/nft/types/query.pb.go index f545c5c20..1a571a08e 100644 --- a/x/asset/nft/types/query.pb.go +++ b/x/asset/nft/types/query.pb.go @@ -406,6 +406,102 @@ func (m *QueryFrozenResponse) GetFrozen() bool { return false } +type QueryClassFrozenRequest struct { + ClassId string `protobuf:"bytes,1,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` + Account string `protobuf:"bytes,2,opt,name=account,proto3" json:"account,omitempty"` +} + +func (m *QueryClassFrozenRequest) Reset() { *m = QueryClassFrozenRequest{} } +func (m *QueryClassFrozenRequest) String() string { return proto.CompactTextString(m) } +func (*QueryClassFrozenRequest) ProtoMessage() {} +func (*QueryClassFrozenRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_97b36b7d05006cb3, []int{8} +} +func (m *QueryClassFrozenRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryClassFrozenRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryClassFrozenRequest.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 *QueryClassFrozenRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryClassFrozenRequest.Merge(m, src) +} +func (m *QueryClassFrozenRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryClassFrozenRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryClassFrozenRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryClassFrozenRequest proto.InternalMessageInfo + +func (m *QueryClassFrozenRequest) GetClassId() string { + if m != nil { + return m.ClassId + } + return "" +} + +func (m *QueryClassFrozenRequest) GetAccount() string { + if m != nil { + return m.Account + } + return "" +} + +type QueryClassFrozenResponse struct { + Frozen bool `protobuf:"varint,1,opt,name=frozen,proto3" json:"frozen,omitempty"` +} + +func (m *QueryClassFrozenResponse) Reset() { *m = QueryClassFrozenResponse{} } +func (m *QueryClassFrozenResponse) String() string { return proto.CompactTextString(m) } +func (*QueryClassFrozenResponse) ProtoMessage() {} +func (*QueryClassFrozenResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_97b36b7d05006cb3, []int{9} +} +func (m *QueryClassFrozenResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryClassFrozenResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryClassFrozenResponse.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 *QueryClassFrozenResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryClassFrozenResponse.Merge(m, src) +} +func (m *QueryClassFrozenResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryClassFrozenResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryClassFrozenResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryClassFrozenResponse proto.InternalMessageInfo + +func (m *QueryClassFrozenResponse) GetFrozen() bool { + if m != nil { + return m.Frozen + } + return false +} + type QueryWhitelistedRequest struct { Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` @@ -416,7 +512,7 @@ func (m *QueryWhitelistedRequest) Reset() { *m = QueryWhitelistedRequest func (m *QueryWhitelistedRequest) String() string { return proto.CompactTextString(m) } func (*QueryWhitelistedRequest) ProtoMessage() {} func (*QueryWhitelistedRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_97b36b7d05006cb3, []int{8} + return fileDescriptor_97b36b7d05006cb3, []int{10} } func (m *QueryWhitelistedRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -474,7 +570,7 @@ func (m *QueryWhitelistedResponse) Reset() { *m = QueryWhitelistedRespon func (m *QueryWhitelistedResponse) String() string { return proto.CompactTextString(m) } func (*QueryWhitelistedResponse) ProtoMessage() {} func (*QueryWhitelistedResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_97b36b7d05006cb3, []int{9} + return fileDescriptor_97b36b7d05006cb3, []int{11} } func (m *QueryWhitelistedResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -521,7 +617,7 @@ func (m *QueryWhitelistedAccountsForNFTRequest) Reset() { *m = QueryWhit func (m *QueryWhitelistedAccountsForNFTRequest) String() string { return proto.CompactTextString(m) } func (*QueryWhitelistedAccountsForNFTRequest) ProtoMessage() {} func (*QueryWhitelistedAccountsForNFTRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_97b36b7d05006cb3, []int{10} + return fileDescriptor_97b36b7d05006cb3, []int{12} } func (m *QueryWhitelistedAccountsForNFTRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -583,7 +679,7 @@ func (m *QueryWhitelistedAccountsForNFTResponse) Reset() { func (m *QueryWhitelistedAccountsForNFTResponse) String() string { return proto.CompactTextString(m) } func (*QueryWhitelistedAccountsForNFTResponse) ProtoMessage() {} func (*QueryWhitelistedAccountsForNFTResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_97b36b7d05006cb3, []int{11} + return fileDescriptor_97b36b7d05006cb3, []int{13} } func (m *QueryWhitelistedAccountsForNFTResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -636,7 +732,7 @@ func (m *QueryClassWhitelistedAccountsRequest) Reset() { *m = QueryClass func (m *QueryClassWhitelistedAccountsRequest) String() string { return proto.CompactTextString(m) } func (*QueryClassWhitelistedAccountsRequest) ProtoMessage() {} func (*QueryClassWhitelistedAccountsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_97b36b7d05006cb3, []int{12} + return fileDescriptor_97b36b7d05006cb3, []int{14} } func (m *QueryClassWhitelistedAccountsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -689,7 +785,7 @@ func (m *QueryClassWhitelistedAccountsResponse) Reset() { *m = QueryClas func (m *QueryClassWhitelistedAccountsResponse) String() string { return proto.CompactTextString(m) } func (*QueryClassWhitelistedAccountsResponse) ProtoMessage() {} func (*QueryClassWhitelistedAccountsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_97b36b7d05006cb3, []int{13} + return fileDescriptor_97b36b7d05006cb3, []int{15} } func (m *QueryClassWhitelistedAccountsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -732,6 +828,112 @@ func (m *QueryClassWhitelistedAccountsResponse) GetAccounts() []string { return nil } +type QueryClassFrozenAccountsRequest struct { + // pagination defines an optional pagination for the request. + Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` + ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` +} + +func (m *QueryClassFrozenAccountsRequest) Reset() { *m = QueryClassFrozenAccountsRequest{} } +func (m *QueryClassFrozenAccountsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryClassFrozenAccountsRequest) ProtoMessage() {} +func (*QueryClassFrozenAccountsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_97b36b7d05006cb3, []int{16} +} +func (m *QueryClassFrozenAccountsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryClassFrozenAccountsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryClassFrozenAccountsRequest.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 *QueryClassFrozenAccountsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryClassFrozenAccountsRequest.Merge(m, src) +} +func (m *QueryClassFrozenAccountsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryClassFrozenAccountsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryClassFrozenAccountsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryClassFrozenAccountsRequest proto.InternalMessageInfo + +func (m *QueryClassFrozenAccountsRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +func (m *QueryClassFrozenAccountsRequest) GetClassId() string { + if m != nil { + return m.ClassId + } + return "" +} + +type QueryClassFrozenAccountsResponse struct { + // pagination defines the pagination in the response. + Pagination *query.PageResponse `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` + Accounts []string `protobuf:"bytes,2,rep,name=accounts,proto3" json:"accounts,omitempty"` +} + +func (m *QueryClassFrozenAccountsResponse) Reset() { *m = QueryClassFrozenAccountsResponse{} } +func (m *QueryClassFrozenAccountsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryClassFrozenAccountsResponse) ProtoMessage() {} +func (*QueryClassFrozenAccountsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_97b36b7d05006cb3, []int{17} +} +func (m *QueryClassFrozenAccountsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryClassFrozenAccountsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryClassFrozenAccountsResponse.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 *QueryClassFrozenAccountsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryClassFrozenAccountsResponse.Merge(m, src) +} +func (m *QueryClassFrozenAccountsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryClassFrozenAccountsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryClassFrozenAccountsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryClassFrozenAccountsResponse proto.InternalMessageInfo + +func (m *QueryClassFrozenAccountsResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + +func (m *QueryClassFrozenAccountsResponse) GetAccounts() []string { + if m != nil { + return m.Accounts + } + return nil +} + type QueryBurntNFTRequest 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"` @@ -741,7 +943,7 @@ func (m *QueryBurntNFTRequest) Reset() { *m = QueryBurntNFTRequest{} } func (m *QueryBurntNFTRequest) String() string { return proto.CompactTextString(m) } func (*QueryBurntNFTRequest) ProtoMessage() {} func (*QueryBurntNFTRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_97b36b7d05006cb3, []int{14} + return fileDescriptor_97b36b7d05006cb3, []int{18} } func (m *QueryBurntNFTRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -792,7 +994,7 @@ func (m *QueryBurntNFTResponse) Reset() { *m = QueryBurntNFTResponse{} } func (m *QueryBurntNFTResponse) String() string { return proto.CompactTextString(m) } func (*QueryBurntNFTResponse) ProtoMessage() {} func (*QueryBurntNFTResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_97b36b7d05006cb3, []int{15} + return fileDescriptor_97b36b7d05006cb3, []int{19} } func (m *QueryBurntNFTResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -837,7 +1039,7 @@ func (m *QueryBurntNFTsInClassRequest) Reset() { *m = QueryBurntNFTsInCl func (m *QueryBurntNFTsInClassRequest) String() string { return proto.CompactTextString(m) } func (*QueryBurntNFTsInClassRequest) ProtoMessage() {} func (*QueryBurntNFTsInClassRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_97b36b7d05006cb3, []int{16} + return fileDescriptor_97b36b7d05006cb3, []int{20} } func (m *QueryBurntNFTsInClassRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -889,7 +1091,7 @@ func (m *QueryBurntNFTsInClassResponse) Reset() { *m = QueryBurntNFTsInC func (m *QueryBurntNFTsInClassResponse) String() string { return proto.CompactTextString(m) } func (*QueryBurntNFTsInClassResponse) ProtoMessage() {} func (*QueryBurntNFTsInClassResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_97b36b7d05006cb3, []int{17} + return fileDescriptor_97b36b7d05006cb3, []int{21} } func (m *QueryBurntNFTsInClassResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -941,12 +1143,16 @@ func init() { proto.RegisterType((*QueryClassesResponse)(nil), "coreum.asset.nft.v1.QueryClassesResponse") proto.RegisterType((*QueryFrozenRequest)(nil), "coreum.asset.nft.v1.QueryFrozenRequest") proto.RegisterType((*QueryFrozenResponse)(nil), "coreum.asset.nft.v1.QueryFrozenResponse") + proto.RegisterType((*QueryClassFrozenRequest)(nil), "coreum.asset.nft.v1.QueryClassFrozenRequest") + proto.RegisterType((*QueryClassFrozenResponse)(nil), "coreum.asset.nft.v1.QueryClassFrozenResponse") proto.RegisterType((*QueryWhitelistedRequest)(nil), "coreum.asset.nft.v1.QueryWhitelistedRequest") proto.RegisterType((*QueryWhitelistedResponse)(nil), "coreum.asset.nft.v1.QueryWhitelistedResponse") proto.RegisterType((*QueryWhitelistedAccountsForNFTRequest)(nil), "coreum.asset.nft.v1.QueryWhitelistedAccountsForNFTRequest") proto.RegisterType((*QueryWhitelistedAccountsForNFTResponse)(nil), "coreum.asset.nft.v1.QueryWhitelistedAccountsForNFTResponse") proto.RegisterType((*QueryClassWhitelistedAccountsRequest)(nil), "coreum.asset.nft.v1.QueryClassWhitelistedAccountsRequest") proto.RegisterType((*QueryClassWhitelistedAccountsResponse)(nil), "coreum.asset.nft.v1.QueryClassWhitelistedAccountsResponse") + proto.RegisterType((*QueryClassFrozenAccountsRequest)(nil), "coreum.asset.nft.v1.QueryClassFrozenAccountsRequest") + proto.RegisterType((*QueryClassFrozenAccountsResponse)(nil), "coreum.asset.nft.v1.QueryClassFrozenAccountsResponse") proto.RegisterType((*QueryBurntNFTRequest)(nil), "coreum.asset.nft.v1.QueryBurntNFTRequest") proto.RegisterType((*QueryBurntNFTResponse)(nil), "coreum.asset.nft.v1.QueryBurntNFTResponse") proto.RegisterType((*QueryBurntNFTsInClassRequest)(nil), "coreum.asset.nft.v1.QueryBurntNFTsInClassRequest") @@ -956,68 +1162,74 @@ func init() { func init() { proto.RegisterFile("coreum/asset/nft/v1/query.proto", fileDescriptor_97b36b7d05006cb3) } var fileDescriptor_97b36b7d05006cb3 = []byte{ - // 969 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x57, 0x41, 0x6f, 0x1b, 0x45, - 0x14, 0xce, 0x38, 0xd8, 0x49, 0x5f, 0x24, 0x04, 0xaf, 0x69, 0xeb, 0x6e, 0x13, 0x37, 0x6c, 0x4a, - 0x92, 0x56, 0x64, 0x47, 0x49, 0xd4, 0xd2, 0xa6, 0x40, 0x21, 0x15, 0x2e, 0x91, 0x10, 0xa4, 0x16, - 0x12, 0x12, 0x07, 0xd0, 0xda, 0x5e, 0xbb, 0x2b, 0x25, 0x3b, 0xae, 0x67, 0x36, 0x50, 0xa2, 0x48, - 0x14, 0xb8, 0x20, 0x81, 0x84, 0xc4, 0x0d, 0xc4, 0x81, 0x7f, 0xc0,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 0x3f, 0x95, 0x4e, 0xfc, 0x9d, 0x41, 0x39, 0xef, 0x81, 0xc7, 0x1b, 0x03, 0x26, 0x35, 0xdf, - 0xa0, 0xac, 0xd5, 0x27, 0x49, 0x25, 0x69, 0x37, 0xb5, 0xb4, 0xab, 0xb8, 0x32, 0xac, 0xb4, 0xa4, - 0xa0, 0x5f, 0x18, 0x8c, 0xc7, 0xaf, 0x24, 0xf6, 0xf9, 0xd4, 0x7a, 0x7c, 0xc4, 0xba, 0x32, 0x4c, - 0x28, 0x11, 0x7c, 0x43, 0x13, 0xbc, 0x8e, 0xd7, 0x86, 0x25, 0xa8, 0x9d, 0x84, 0xef, 0x98, 0x87, - 0x75, 0x17, 0x7f, 0x65, 0xf0, 0x42, 0xef, 0x4b, 0x8e, 0x4b, 0x83, 0x09, 0xf4, 0x38, 0x8f, 0xb5, - 0x7c, 0x9c, 0x14, 0xe2, 0x7e, 0x55, 0x73, 0xe7, 0xb8, 0x78, 0x2c, 0xee, 0x6b, 0x77, 0x1f, 0xed, - 0x55, 0xd8, 0xe3, 0xbd, 0x0a, 0xfb, 0x67, 0xaf, 0xc2, 0xbe, 0xdf, 0xaf, 0x8c, 0x3c, 0xde, 0xaf, - 0x8c, 0xfc, 0xb9, 0x5f, 0x19, 0xf9, 0xe8, 0xd5, 0xb6, 0xaf, 0xee, 0x85, 0x75, 0xa7, 0x21, 0xb6, - 0xf8, 0x6d, 0x5d, 0xb2, 0x2a, 0xc2, 0xa0, 0xa9, 0xdd, 0x24, 0xc6, 0xd8, 0x5e, 0xe1, 0x9f, 0x25, - 0x80, 0xd4, 0x83, 0x8e, 0x27, 0xeb, 0x25, 0xfd, 0xf7, 0x68, 0xe5, 0xff, 0x00, 0x00, 0x00, 0xff, - 0xff, 0xea, 0x1b, 0xdc, 0xba, 0xf7, 0x0d, 0x00, 0x00, + // 1057 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff,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xdc, 0x6f, 0x6a, 0xc1, 0x84, 0x7e, 0x60, 0x30, 0xea, 0x77, 0x24, 0x4c, + 0x78, 0xd6, 0x7a, 0x7a, 0xb6, 0x76, 0xb5, 0x1f, 0x53, 0x22, 0xf8, 0xaa, 0x24, 0x78, 0x0d, 0x57, + 0xfb, 0x25, 0x28, 0xbb, 0xb6, 0xb9, 0xab, 0x9a, 0xd8, 0x1e, 0xfe, 0xc4, 0xe0, 0xe9, 0xde, 0xae, + 0x89, 0x8b, 0xe9, 0x04, 0x7a, 0xba, 0xbc, 0xb6, 0x34, 0x88, 0x0b, 0x71, 0x5f, 0x91, 0xdc, 0x4d, + 0x5c, 0x18, 0x88, 0xfb, 0xfa, 0xdd, 0xc7, 0xfb, 0x05, 0xf6, 0x64, 0xbf, 0xc0, 0xfe, 0xda, 0x2f, + 0xb0, 0xaf, 0x0f, 0x0a, 0x43, 0x4f, 0x0e, 0x0a, 0x43, 0xbf, 0x1f, 0x14, 0x86, 0xde, 0x7b, 0xa9, + 0xe1, 0x78, 0xf7, 0xda, 0x15, 0xa3, 0xca, 0xb7, 0xcd, 0x5b, 0x32, 0x64, 0x89, 0xb7, 0xdd, 0x9a, + 0xec, 0xdc, 0x3e, 0xc6, 0xce, 0xb2, 0xf9, 0x51, 0x00, 0xc8, 0x7b, 0xd0, 0xb4, 0x45, 0x25, 0x27, + 0xff, 0x1f, 0x58, 0xfe, 0x37, 0x00, 0x00, 0xff, 0xff, 0xa5, 0x31, 0xb2, 0x2c, 0xf8, 0x10, 0x00, + 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1040,6 +1252,10 @@ type QueryClient interface { Classes(ctx context.Context, in *QueryClassesRequest, opts ...grpc.CallOption) (*QueryClassesResponse, error) // Frozen queries to check if an NFT is frozen or not. Frozen(ctx context.Context, in *QueryFrozenRequest, opts ...grpc.CallOption) (*QueryFrozenResponse, error) + // ClassFrozen queries to check if an account if frozen for an NFT class. + ClassFrozen(ctx context.Context, in *QueryClassFrozenRequest, opts ...grpc.CallOption) (*QueryClassFrozenResponse, error) + // QueryClassFrozenAccountsRequest returns the list of accounts which are frozen to hold NFTs in this class. + ClassFrozenAccounts(ctx context.Context, in *QueryClassFrozenAccountsRequest, opts ...grpc.CallOption) (*QueryClassFrozenAccountsResponse, error) // Whitelisted queries to check if an account is whitelited to hold an NFT or not. Whitelisted(ctx context.Context, in *QueryWhitelistedRequest, opts ...grpc.CallOption) (*QueryWhitelistedResponse, error) // WhitelistedAccountsForNFT returns the list of accounts which are whitelisted to hold this NFT. @@ -1096,6 +1312,24 @@ func (c *queryClient) Frozen(ctx context.Context, in *QueryFrozenRequest, opts . return out, nil } +func (c *queryClient) ClassFrozen(ctx context.Context, in *QueryClassFrozenRequest, opts ...grpc.CallOption) (*QueryClassFrozenResponse, error) { + out := new(QueryClassFrozenResponse) + err := c.cc.Invoke(ctx, "/coreum.asset.nft.v1.Query/ClassFrozen", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) ClassFrozenAccounts(ctx context.Context, in *QueryClassFrozenAccountsRequest, opts ...grpc.CallOption) (*QueryClassFrozenAccountsResponse, error) { + out := new(QueryClassFrozenAccountsResponse) + err := c.cc.Invoke(ctx, "/coreum.asset.nft.v1.Query/ClassFrozenAccounts", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *queryClient) Whitelisted(ctx context.Context, in *QueryWhitelistedRequest, opts ...grpc.CallOption) (*QueryWhitelistedResponse, error) { out := new(QueryWhitelistedResponse) err := c.cc.Invoke(ctx, "/coreum.asset.nft.v1.Query/Whitelisted", in, out, opts...) @@ -1151,6 +1385,10 @@ type QueryServer interface { Classes(context.Context, *QueryClassesRequest) (*QueryClassesResponse, error) // Frozen queries to check if an NFT is frozen or not. Frozen(context.Context, *QueryFrozenRequest) (*QueryFrozenResponse, error) + // ClassFrozen queries to check if an account if frozen for an NFT class. + ClassFrozen(context.Context, *QueryClassFrozenRequest) (*QueryClassFrozenResponse, error) + // QueryClassFrozenAccountsRequest returns the list of accounts which are frozen to hold NFTs in this class. + ClassFrozenAccounts(context.Context, *QueryClassFrozenAccountsRequest) (*QueryClassFrozenAccountsResponse, error) // Whitelisted queries to check if an account is whitelited to hold an NFT or not. Whitelisted(context.Context, *QueryWhitelistedRequest) (*QueryWhitelistedResponse, error) // WhitelistedAccountsForNFT returns the list of accounts which are whitelisted to hold this NFT. @@ -1179,6 +1417,12 @@ func (*UnimplementedQueryServer) Classes(ctx context.Context, req *QueryClassesR func (*UnimplementedQueryServer) Frozen(ctx context.Context, req *QueryFrozenRequest) (*QueryFrozenResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Frozen not implemented") } +func (*UnimplementedQueryServer) ClassFrozen(ctx context.Context, req *QueryClassFrozenRequest) (*QueryClassFrozenResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ClassFrozen not implemented") +} +func (*UnimplementedQueryServer) ClassFrozenAccounts(ctx context.Context, req *QueryClassFrozenAccountsRequest) (*QueryClassFrozenAccountsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ClassFrozenAccounts not implemented") +} func (*UnimplementedQueryServer) Whitelisted(ctx context.Context, req *QueryWhitelistedRequest) (*QueryWhitelistedResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Whitelisted not implemented") } @@ -1271,6 +1515,42 @@ func _Query_Frozen_Handler(srv interface{}, ctx context.Context, dec func(interf return interceptor(ctx, in, info, handler) } +func _Query_ClassFrozen_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryClassFrozenRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).ClassFrozen(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/coreum.asset.nft.v1.Query/ClassFrozen", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).ClassFrozen(ctx, req.(*QueryClassFrozenRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_ClassFrozenAccounts_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryClassFrozenAccountsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).ClassFrozenAccounts(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/coreum.asset.nft.v1.Query/ClassFrozenAccounts", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).ClassFrozenAccounts(ctx, req.(*QueryClassFrozenAccountsRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _Query_Whitelisted_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(QueryWhitelistedRequest) if err := dec(in); err != nil { @@ -1381,6 +1661,14 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "Frozen", Handler: _Query_Frozen_Handler, }, + { + MethodName: "ClassFrozen", + Handler: _Query_ClassFrozen_Handler, + }, + { + MethodName: "ClassFrozenAccounts", + Handler: _Query_ClassFrozenAccounts_Handler, + }, { MethodName: "Whitelisted", Handler: _Query_Whitelisted_Handler, @@ -1686,7 +1974,7 @@ func (m *QueryFrozenResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *QueryWhitelistedRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryClassFrozenRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1696,12 +1984,12 @@ func (m *QueryWhitelistedRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryWhitelistedRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryClassFrozenRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryWhitelistedRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryClassFrozenRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1711,26 +1999,19 @@ func (m *QueryWhitelistedRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) copy(dAtA[i:], m.Account) i = encodeVarintQuery(dAtA, i, uint64(len(m.Account))) i-- - dAtA[i] = 0x1a + 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))) i-- - dAtA[i] = 0x12 - } - if len(m.Id) > 0 { - i -= len(m.Id) - copy(dAtA[i:], m.Id) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Id))) - i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } -func (m *QueryWhitelistedResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryClassFrozenResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1740,19 +2021,19 @@ func (m *QueryWhitelistedResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryWhitelistedResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryClassFrozenResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryWhitelistedResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryClassFrozenResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.Whitelisted { + if m.Frozen { i-- - if m.Whitelisted { + if m.Frozen { dAtA[i] = 1 } else { dAtA[i] = 0 @@ -1763,7 +2044,7 @@ func (m *QueryWhitelistedResponse) MarshalToSizedBuffer(dAtA []byte) (int, error return len(dAtA) - i, nil } -func (m *QueryWhitelistedAccountsForNFTRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryWhitelistedRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1773,46 +2054,41 @@ func (m *QueryWhitelistedAccountsForNFTRequest) Marshal() (dAtA []byte, err erro return dAtA[:n], nil } -func (m *QueryWhitelistedAccountsForNFTRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryWhitelistedRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryWhitelistedAccountsForNFTRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryWhitelistedRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l + if len(m.Account) > 0 { + i -= len(m.Account) + copy(dAtA[i:], m.Account) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Account))) + i-- + dAtA[i] = 0x1a + } 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] = 0x1a + dAtA[i] = 0x12 } if len(m.Id) > 0 { i -= len(m.Id) copy(dAtA[i:], m.Id) i = encodeVarintQuery(dAtA, i, uint64(len(m.Id))) i-- - dAtA[i] = 0x12 - } - if m.Pagination != nil { - { - size, err := m.Pagination.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 *QueryWhitelistedAccountsForNFTResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryWhitelistedResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1822,22 +2098,104 @@ func (m *QueryWhitelistedAccountsForNFTResponse) Marshal() (dAtA []byte, err err return dAtA[:n], nil } -func (m *QueryWhitelistedAccountsForNFTResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryWhitelistedResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryWhitelistedAccountsForNFTResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryWhitelistedResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.Accounts) > 0 { - for iNdEx := len(m.Accounts) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Accounts[iNdEx]) - copy(dAtA[i:], m.Accounts[iNdEx]) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Accounts[iNdEx]))) - i-- + if m.Whitelisted { + i-- + if m.Whitelisted { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryWhitelistedAccountsForNFTRequest) 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 *QueryWhitelistedAccountsForNFTRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryWhitelistedAccountsForNFTRequest) 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] = 0x1a + } + if len(m.Id) > 0 { + i -= len(m.Id) + copy(dAtA[i:], m.Id) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Id))) + i-- + dAtA[i] = 0x12 + } + if m.Pagination != nil { + { + size, err := m.Pagination.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 *QueryWhitelistedAccountsForNFTResponse) 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 *QueryWhitelistedAccountsForNFTResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryWhitelistedAccountsForNFTResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Accounts) > 0 { + for iNdEx := len(m.Accounts) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Accounts[iNdEx]) + copy(dAtA[i:], m.Accounts[iNdEx]) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Accounts[iNdEx]))) + i-- dAtA[i] = 0x12 } } @@ -1942,6 +2300,92 @@ func (m *QueryClassWhitelistedAccountsResponse) MarshalToSizedBuffer(dAtA []byte return len(dAtA) - i, nil } +func (m *QueryClassFrozenAccountsRequest) 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 *QueryClassFrozenAccountsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryClassFrozenAccountsRequest) 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] = 0x12 + } + if m.Pagination != nil { + { + size, err := m.Pagination.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 *QueryClassFrozenAccountsResponse) 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 *QueryClassFrozenAccountsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryClassFrozenAccountsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Accounts) > 0 { + for iNdEx := len(m.Accounts) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Accounts[iNdEx]) + copy(dAtA[i:], m.Accounts[iNdEx]) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Accounts[iNdEx]))) + i-- + dAtA[i] = 0x12 + } + } + if m.Pagination != nil { + { + size, err := m.Pagination.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 *QueryBurntNFTRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -2218,6 +2662,35 @@ func (m *QueryFrozenResponse) Size() (n int) { return n } +func (m *QueryClassFrozenRequest) 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.Account) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryClassFrozenResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Frozen { + n += 2 + } + return n +} + func (m *QueryWhitelistedRequest) Size() (n int) { if m == nil { return 0 @@ -2327,6 +2800,42 @@ func (m *QueryClassWhitelistedAccountsResponse) Size() (n int) { return n } +func (m *QueryClassFrozenAccountsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.ClassId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryClassFrozenAccountsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + if len(m.Accounts) > 0 { + for _, s := range m.Accounts { + l = len(s) + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + func (m *QueryBurntNFTRequest) Size() (n int) { if m == nil { return 0 @@ -3118,7 +3627,7 @@ func (m *QueryFrozenResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryWhitelistedRequest) Unmarshal(dAtA []byte) error { +func (m *QueryClassFrozenRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3141,15 +3650,15 @@ func (m *QueryWhitelistedRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryWhitelistedRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryClassFrozenRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryWhitelistedRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryClassFrozenRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -3177,11 +3686,11 @@ func (m *QueryWhitelistedRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Id = string(dAtA[iNdEx:postIndex]) + m.ClassId = 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 Account", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -3209,20 +3718,204 @@ func (m *QueryWhitelistedRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ClassId = string(dAtA[iNdEx:postIndex]) + m.Account = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Account", wireType) + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } + 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 *QueryClassFrozenResponse) 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: QueryClassFrozenResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryClassFrozenResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Frozen", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Frozen = bool(v != 0) + 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 *QueryWhitelistedRequest) 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: QueryWhitelistedRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryWhitelistedRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Id", 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.Id = 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 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 + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Account", 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 @@ -3838,6 +4531,242 @@ func (m *QueryClassWhitelistedAccountsResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *QueryClassFrozenAccountsRequest) 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: QueryClassFrozenAccountsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryClassFrozenAccountsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", 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 m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + 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 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:]) + 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 *QueryClassFrozenAccountsResponse) 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: QueryClassFrozenAccountsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryClassFrozenAccountsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", 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 m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Accounts", 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.Accounts = append(m.Accounts, 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 *QueryBurntNFTRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/x/asset/nft/types/query.pb.gw.go b/x/asset/nft/types/query.pb.gw.go index b8afe2408..dee585388 100644 --- a/x/asset/nft/types/query.pb.gw.go +++ b/x/asset/nft/types/query.pb.gw.go @@ -217,6 +217,154 @@ func local_request_Query_Frozen_0(ctx context.Context, marshaler runtime.Marshal } +func request_Query_ClassFrozen_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryClassFrozenRequest + 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["account"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "account") + } + + protoReq.Account, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "account", err) + } + + msg, err := client.ClassFrozen(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_ClassFrozen_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryClassFrozenRequest + 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["account"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "account") + } + + protoReq.Account, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "account", err) + } + + msg, err := server.ClassFrozen(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_ClassFrozenAccounts_0 = &utilities.DoubleArray{Encoding: map[string]int{"class_id": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + +func request_Query_ClassFrozenAccounts_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryClassFrozenAccountsRequest + 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) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_ClassFrozenAccounts_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.ClassFrozenAccounts(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_ClassFrozenAccounts_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryClassFrozenAccountsRequest + 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) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_ClassFrozenAccounts_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.ClassFrozenAccounts(ctx, &protoReq) + return msg, metadata, err + +} + func request_Query_Whitelisted_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryWhitelistedRequest var metadata runtime.ServerMetadata @@ -727,6 +875,52 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + mux.Handle("GET", pattern_Query_ClassFrozen_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_ClassFrozen_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_ClassFrozen_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_ClassFrozenAccounts_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_ClassFrozenAccounts_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_ClassFrozenAccounts_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + mux.Handle("GET", pattern_Query_Whitelisted_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -963,6 +1157,46 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_ClassFrozen_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_ClassFrozen_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_ClassFrozen_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_ClassFrozenAccounts_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_ClassFrozenAccounts_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_ClassFrozenAccounts_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + mux.Handle("GET", pattern_Query_Whitelisted_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -1075,6 +1309,10 @@ var ( pattern_Query_Frozen_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5, 2, 6, 1, 0, 4, 1, 5, 7, 2, 8}, []string{"coreum", "asset", "nft", "v1", "classes", "class_id", "nfts", "id", "frozen"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_Query_ClassFrozen_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5, 2, 6, 1, 0, 4, 1, 5, 7}, []string{"coreum", "asset", "nft", "v1", "classes", "class_id", "frozen", "account"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_ClassFrozenAccounts_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5, 2, 6}, []string{"coreum", "asset", "nft", "v1", "classes", "class_id", "frozen"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_Query_Whitelisted_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5, 2, 6, 1, 0, 4, 1, 5, 7, 2, 8, 1, 0, 4, 1, 5, 9}, []string{"coreum", "asset", "nft", "v1", "classes", "class_id", "nfts", "id", "whitelisted", "account"}, "", runtime.AssumeColonVerbOpt(true))) pattern_Query_WhitelistedAccountsForNFT_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5, 2, 6, 1, 0, 4, 1, 5, 7, 2, 8}, []string{"coreum", "asset", "nft", "v1", "classes", "class_id", "nfts", "id", "whitelisted"}, "", runtime.AssumeColonVerbOpt(true))) @@ -1095,6 +1333,10 @@ var ( forward_Query_Frozen_0 = runtime.ForwardResponseMessage + forward_Query_ClassFrozen_0 = runtime.ForwardResponseMessage + + forward_Query_ClassFrozenAccounts_0 = runtime.ForwardResponseMessage + forward_Query_Whitelisted_0 = runtime.ForwardResponseMessage forward_Query_WhitelistedAccountsForNFT_0 = runtime.ForwardResponseMessage diff --git a/x/asset/nft/types/tx.pb.go b/x/asset/nft/types/tx.pb.go index ce0e79e63..5bdf3bc57 100644 --- a/x/asset/nft/types/tx.pb.go +++ b/x/asset/nft/types/tx.pb.go @@ -241,6 +241,84 @@ func (m *MsgUnfreeze) XXX_DiscardUnknown() { var xxx_messageInfo_MsgUnfreeze proto.InternalMessageInfo +type MsgClassFreeze 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"` + Account string `protobuf:"bytes,3,opt,name=account,proto3" json:"account,omitempty"` +} + +func (m *MsgClassFreeze) Reset() { *m = MsgClassFreeze{} } +func (m *MsgClassFreeze) String() string { return proto.CompactTextString(m) } +func (*MsgClassFreeze) ProtoMessage() {} +func (*MsgClassFreeze) Descriptor() ([]byte, []int) { + return fileDescriptor_e850acc149a7cfa7, []int{5} +} +func (m *MsgClassFreeze) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgClassFreeze) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgClassFreeze.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 *MsgClassFreeze) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgClassFreeze.Merge(m, src) +} +func (m *MsgClassFreeze) XXX_Size() int { + return m.Size() +} +func (m *MsgClassFreeze) XXX_DiscardUnknown() { + xxx_messageInfo_MsgClassFreeze.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgClassFreeze proto.InternalMessageInfo + +type MsgClassUnfreeze 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"` + Account string `protobuf:"bytes,3,opt,name=account,proto3" json:"account,omitempty"` +} + +func (m *MsgClassUnfreeze) Reset() { *m = MsgClassUnfreeze{} } +func (m *MsgClassUnfreeze) String() string { return proto.CompactTextString(m) } +func (*MsgClassUnfreeze) ProtoMessage() {} +func (*MsgClassUnfreeze) Descriptor() ([]byte, []int) { + return fileDescriptor_e850acc149a7cfa7, []int{6} +} +func (m *MsgClassUnfreeze) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgClassUnfreeze) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgClassUnfreeze.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 *MsgClassUnfreeze) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgClassUnfreeze.Merge(m, src) +} +func (m *MsgClassUnfreeze) XXX_Size() int { + return m.Size() +} +func (m *MsgClassUnfreeze) XXX_DiscardUnknown() { + xxx_messageInfo_MsgClassUnfreeze.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgClassUnfreeze proto.InternalMessageInfo + type MsgAddToWhitelist 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"` @@ -252,7 +330,7 @@ func (m *MsgAddToWhitelist) Reset() { *m = MsgAddToWhitelist{} } func (m *MsgAddToWhitelist) String() string { return proto.CompactTextString(m) } func (*MsgAddToWhitelist) ProtoMessage() {} func (*MsgAddToWhitelist) Descriptor() ([]byte, []int) { - return fileDescriptor_e850acc149a7cfa7, []int{5} + return fileDescriptor_e850acc149a7cfa7, []int{7} } func (m *MsgAddToWhitelist) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -292,7 +370,7 @@ func (m *MsgRemoveFromWhitelist) Reset() { *m = MsgRemoveFromWhitelist{} func (m *MsgRemoveFromWhitelist) String() string { return proto.CompactTextString(m) } func (*MsgRemoveFromWhitelist) ProtoMessage() {} func (*MsgRemoveFromWhitelist) Descriptor() ([]byte, []int) { - return fileDescriptor_e850acc149a7cfa7, []int{6} + return fileDescriptor_e850acc149a7cfa7, []int{8} } func (m *MsgRemoveFromWhitelist) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -331,7 +409,7 @@ func (m *MsgAddToClassWhitelist) Reset() { *m = MsgAddToClassWhitelist{} func (m *MsgAddToClassWhitelist) String() string { return proto.CompactTextString(m) } func (*MsgAddToClassWhitelist) ProtoMessage() {} func (*MsgAddToClassWhitelist) Descriptor() ([]byte, []int) { - return fileDescriptor_e850acc149a7cfa7, []int{7} + return fileDescriptor_e850acc149a7cfa7, []int{9} } func (m *MsgAddToClassWhitelist) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -370,7 +448,7 @@ func (m *MsgRemoveFromClassWhitelist) Reset() { *m = MsgRemoveFromClassW func (m *MsgRemoveFromClassWhitelist) String() string { return proto.CompactTextString(m) } func (*MsgRemoveFromClassWhitelist) ProtoMessage() {} func (*MsgRemoveFromClassWhitelist) Descriptor() ([]byte, []int) { - return fileDescriptor_e850acc149a7cfa7, []int{8} + return fileDescriptor_e850acc149a7cfa7, []int{10} } func (m *MsgRemoveFromClassWhitelist) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -408,7 +486,7 @@ func (m *MsgUpdateParams) Reset() { *m = MsgUpdateParams{} } func (m *MsgUpdateParams) String() string { return proto.CompactTextString(m) } func (*MsgUpdateParams) ProtoMessage() {} func (*MsgUpdateParams) Descriptor() ([]byte, []int) { - return fileDescriptor_e850acc149a7cfa7, []int{9} + return fileDescriptor_e850acc149a7cfa7, []int{11} } func (m *MsgUpdateParams) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -444,7 +522,7 @@ func (m *EmptyResponse) Reset() { *m = EmptyResponse{} } func (m *EmptyResponse) String() string { return proto.CompactTextString(m) } func (*EmptyResponse) ProtoMessage() {} func (*EmptyResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_e850acc149a7cfa7, []int{10} + return fileDescriptor_e850acc149a7cfa7, []int{12} } func (m *EmptyResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -479,6 +557,8 @@ func init() { proto.RegisterType((*MsgBurn)(nil), "coreum.asset.nft.v1.MsgBurn") proto.RegisterType((*MsgFreeze)(nil), "coreum.asset.nft.v1.MsgFreeze") proto.RegisterType((*MsgUnfreeze)(nil), "coreum.asset.nft.v1.MsgUnfreeze") + proto.RegisterType((*MsgClassFreeze)(nil), "coreum.asset.nft.v1.MsgClassFreeze") + proto.RegisterType((*MsgClassUnfreeze)(nil), "coreum.asset.nft.v1.MsgClassUnfreeze") proto.RegisterType((*MsgAddToWhitelist)(nil), "coreum.asset.nft.v1.MsgAddToWhitelist") proto.RegisterType((*MsgRemoveFromWhitelist)(nil), "coreum.asset.nft.v1.MsgRemoveFromWhitelist") proto.RegisterType((*MsgAddToClassWhitelist)(nil), "coreum.asset.nft.v1.MsgAddToClassWhitelist") @@ -490,64 +570,68 @@ func init() { func init() { proto.RegisterFile("coreum/asset/nft/v1/tx.proto", fileDescriptor_e850acc149a7cfa7) } var fileDescriptor_e850acc149a7cfa7 = []byte{ - // 906 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x56, 0x4f, 0x6f, 0x1b, 0x45, - 0x14, 0xf7, 0xda, 0xae, 0x1d, 0x3f, 0xf7, 0x8f, 0xba, 0x8d, 0xc2, 0x36, 0x0d, 0xb6, 0xb1, 0x50, - 0x14, 0xb5, 0xca, 0x2e, 0x4d, 0x25, 0x10, 0x48, 0x1c, 0xe2, 0x86, 0xa8, 0x96, 0xb0, 0x54, 0x96, - 0x46, 0x20, 0x84, 0x14, 0x4d, 0x76, 0xc7, 0xeb, 0x11, 0xde, 0x99, 0xd5, 0xcc, 0x6c, 0xa8, 0x39, - 0x22, 0x71, 0xa0, 0x27, 0x3e, 0x4a, 0x25, 0xf8, 0x10, 0x39, 0x56, 0x9c, 0x10, 0x07, 0x0b, 0x9c, - 0x43, 0x2f, 0x1c, 0xf9, 0x00, 0x68, 0x67, 0xd6, 0x8d, 0x5d, 0xed, 0x92, 0x15, 0xc2, 0x70, 0xb1, - 0xf7, 0xbd, 0xdf, 0x9b, 0xdf, 0x7b, 0xf3, 0x9b, 0xdd, 0x37, 0x0f, 0xb6, 0x3c, 0xc6, 0x71, 0x1c, - 0x3a, 0x48, 0x08, 0x2c, 0x1d, 0x3a, 0x94, 0xce, 0xe9, 0x7d, 0x47, 0x3e, 0xb5, 0x23, 0xce, 0x24, - 0x33, 0x6f, 0x69, 0xd4, 0x56, 0xa8, 0x4d, 0x87, 0xd2, 0x3e, 0xbd, 0xbf, 0x79, 0x13, 0x85, 0x84, - 0x32, 0x47, 0xfd, 0xea, 0xb8, 0xcd, 0x37, 0x3c, 0x26, 0x42, 0x26, 0x9c, 0x50, 0x04, 0xc9, 0xfa, - 0x50, 0x04, 0x29, 0x70, 0x5b, 0x03, 0xc7, 0xca, 0x72, 0xb4, 0x91, 0x42, 0xeb, 0x01, 0x0b, 0x98, - 0xf6, 0x27, 0x4f, 0xf3, 0x05, 0x01, 0x63, 0xc1, 0x18, 0x3b, 0xca, 0x3a, 0x89, 0x87, 0x0e, 0xa2, - 0x93, 0x14, 0x7a, 0x33, 0xab, 0xd4, 0xa4, 0x26, 0x0d, 0x77, 0xb2, 0xe0, 0x08, 0x71, 0x14, 0xa6, - 0x19, 0xbb, 0x7f, 0x96, 0xe1, 0xda, 0x40, 0x04, 0x7d, 0x21, 0x62, 0xfc, 0x70, 0x8c, 0x84, 0x30, - 0x37, 0xa0, 0x46, 0x12, 0x8b, 0x5b, 0x46, 0xc7, 0xd8, 0x69, 0xb8, 0xa9, 0x95, 0xf8, 0xc5, 0x24, - 0x3c, 0x61, 0x63, 0xab, 0xac, 0xfd, 0xda, 0x32, 0x4d, 0xa8, 0x52, 0x14, 0x62, 0xab, 0xa2, 0xbc, - 0xea, 0xd9, 0xec, 0x40, 0xd3, 0xc7, 0xc2, 0xe3, 0x24, 0x92, 0x84, 0x51, 0xab, 0xaa, 0xa0, 0x45, - 0x97, 0x79, 0x1b, 0x2a, 0x31, 0x27, 0xd6, 0x95, 0x04, 0xe9, 0xd5, 0x67, 0xd3, 0x76, 0xe5, 0xc8, - 0xed, 0xbb, 0x89, 0xcf, 0xdc, 0x86, 0xb5, 0x98, 0x93, 0xe3, 0x11, 0x12, 0x23, 0xab, 0xa6, 0xf0, - 0xe6, 0x6c, 0xda, 0xae, 0x1f, 0xb9, 0xfd, 0x47, 0x48, 0x8c, 0xdc, 0x7a, 0xcc, 0x49, 0xf2, 0x60, - 0xee, 0x40, 0xd5, 0x47, 0x12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, 0x90, 0xc5, 0xd4, 0x47, 0xc9, 0xb0, 0xe6, 0xa4, 0x53, 0xe4, 0xe9, 0x03, - 0xe7, 0xe9, 0xc2, 0x28, 0xa9, 0x46, 0x9b, 0x93, 0x9a, 0x1a, 0x06, 0x1e, 0xfc, 0x15, 0x00, 0x00, - 0xff, 0xff, 0xc9, 0xb3, 0xdc, 0xf0, 0x35, 0x0b, 0x00, 0x00, + // 966 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x57, 0xcf, 0x6f, 0x1b, 0x45, + 0x14, 0xf6, 0xda, 0xae, 0x7f, 0x3c, 0x37, 0x29, 0xdd, 0x46, 0x61, 0x9b, 0x06, 0xdb, 0x18, 0x88, + 0xa2, 0x56, 0xd9, 0xa5, 0xae, 0x04, 0x02, 0x89, 0x43, 0xdc, 0x10, 0xd5, 0x12, 0x96, 0xca, 0xd2, + 0x00, 0xaa, 0x90, 0xa2, 0xc9, 0xee, 0x78, 0x3d, 0xc2, 0xbb, 0x63, 0xcd, 0xcc, 0x86, 0x9a, 0x23, + 0x02, 0x0e, 0x3d, 0xf1, 0xa7, 0x54, 0x82, 0x2b, 0xf7, 0x1c, 0x2b, 0x4e, 0x88, 0x83, 0x05, 0xce, + 0xa1, 0x17, 0x8e, 0xfc, 0x01, 0x68, 0x67, 0xd6, 0xb1, 0x1d, 0x79, 0x93, 0xa5, 0x4a, 0xe8, 0xc5, + 0xde, 0x79, 0xdf, 0x9b, 0xef, 0x7d, 0xf3, 0x66, 0xf6, 0xbd, 0x59, 0x58, 0x77, 0x28, 0xc3, 0xa1, + 0x6f, 0x21, 0xce, 0xb1, 0xb0, 0x82, 0xae, 0xb0, 0x0e, 0xef, 0x5a, 0xe2, 0x89, 0x39, 0x60, 0x54, + 0x50, 0xfd, 0x86, 0x42, 0x4d, 0x89, 0x9a, 0x41, 0x57, 0x98, 0x87, 0x77, 0xd7, 0xae, 0x23, 0x9f, + 0x04, 0xd4, 0x92, 0xbf, 0xca, 0x6f, 0xed, 0x75, 0x87, 0x72, 0x9f, 0x72, 0xcb, 0xe7, 0x5e, 0x34, + 0xdf, 0xe7, 0x5e, 0x0c, 0xdc, 0x54, 0xc0, 0xbe, 0x1c, 0x59, 0x6a, 0x10, 0x43, 0x2b, 0x1e, 0xf5, + 0xa8, 0xb2, 0x47, 0x4f, 0x93, 0x09, 0x1e, 0xa5, 0x5e, 0x1f, 0x5b, 0x72, 0x74, 0x10, 0x76, 0x2d, + 0x14, 0x0c, 0x63, 0xe8, 0x8d, 0x45, 0x52, 0x23, 0x4d, 0x0a, 0xae, 0x2f, 0x82, 0x07, 0x88, 0x21, + 0x3f, 0x8e, 0xd8, 0xf8, 0x27, 0x0b, 0x4b, 0x1d, 0xee, 0xb5, 0x39, 0x0f, 0xf1, 0xfd, 0x3e, 0xe2, + 0x5c, 0x5f, 0x85, 0x02, 0x89, 0x46, 0xcc, 0xd0, 0xea, 0xda, 0x66, 0xd9, 0x8e, 0x47, 0x91, 0x9d, + 0x0f, 0xfd, 0x03, 0xda, 0x37, 0xb2, 0xca, 0xae, 0x46, 0xba, 0x0e, 0xf9, 0x00, 0xf9, 0xd8, 0xc8, + 0x49, 0xab, 0x7c, 0xd6, 0xeb, 0x50, 0x71, 0x31, 0x77, 0x18, 0x19, 0x08, 0x42, 0x03, 0x23, 0x2f, + 0xa1, 0x59, 0x93, 0x7e, 0x13, 0x72, 0x21, 0x23, 0xc6, 0x95, 0x08, 0x69, 0x15, 0xc7, 0xa3, 0x5a, + 0x6e, 0xcf, 0x6e, 0xdb, 0x91, 0x4d, 0xdf, 0x80, 0x52, 0xc8, 0xc8, 0x7e, 0x0f, 0xf1, 0x9e, 0x51, + 0x90, 0x78, 0x65, 0x3c, 0xaa, 0x15, 0xf7, 0xec, 0xf6, 0x03, 0xc4, 0x7b, 0x76, 0x31, 0x64, 0x24, + 0x7a, 0xd0, 0x37, 0x21, 0xef, 0x22, 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 0xce, 0xd4, 0x97, 0x70, 0x75, 0xae, + 0x50, 0xbd, 0x9d, 0x78, 0x52, 0x67, 0xbc, 0xd2, 0x30, 0xb7, 0xf6, 0x8e, 0xfe, 0xaa, 0x66, 0x8e, + 0xc6, 0x55, 0xed, 0xf9, 0xb8, 0xaa, 0xfd, 0x39, 0xae, 0x6a, 0x3f, 0x1d, 0x57, 0x33, 0xcf, 0x8f, + 0xab, 0x99, 0xdf, 0x8f, 0xab, 0x99, 0xc7, 0xef, 0xcf, 0xdc, 0x44, 0xef, 0x4b, 0xae, 0x5d, 0x1a, + 0x06, 0x2e, 0x8a, 0x2e, 0xdc, 0x56, 0xfc, 0x25, 0x70, 0x78, 0xcf, 0x7a, 0x32, 0xf3, 0x39, 0x20, + 0xaf, 0xa7, 0x07, 0x05, 0x79, 0xa1, 0xbb, 0xf7, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x5d, 0x2e, + 0x1c, 0xf8, 0xf9, 0x0c, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -585,6 +669,12 @@ type MsgClient interface { // ie. if specific whitelist is granted for an NFT, that whitelist will // still be valid, ater we add and remove it from the class whitelist. RemoveFromClassWhitelist(ctx context.Context, in *MsgRemoveFromClassWhitelist, opts ...grpc.CallOption) (*EmptyResponse, error) + // ClassFreeze freezes all NFTs of a class held by an account. + ClassFreeze(ctx context.Context, in *MsgClassFreeze, opts ...grpc.CallOption) (*EmptyResponse, error) + // ClassUnfreeze removes class-freeze on an account for an NFT class. + // NOTE: + // class unfreeze does not affect the individual nft freeze. + ClassUnfreeze(ctx context.Context, in *MsgClassUnfreeze, opts ...grpc.CallOption) (*EmptyResponse, error) // UpdateParams is a governance operation that sets the parameters of the module. // NOTE: all parameters must be provided. UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*EmptyResponse, error) @@ -679,6 +769,24 @@ func (c *msgClient) RemoveFromClassWhitelist(ctx context.Context, in *MsgRemoveF return out, nil } +func (c *msgClient) ClassFreeze(ctx context.Context, in *MsgClassFreeze, opts ...grpc.CallOption) (*EmptyResponse, error) { + out := new(EmptyResponse) + err := c.cc.Invoke(ctx, "/coreum.asset.nft.v1.Msg/ClassFreeze", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) ClassUnfreeze(ctx context.Context, in *MsgClassUnfreeze, opts ...grpc.CallOption) (*EmptyResponse, error) { + out := new(EmptyResponse) + err := c.cc.Invoke(ctx, "/coreum.asset.nft.v1.Msg/ClassUnfreeze", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*EmptyResponse, error) { out := new(EmptyResponse) err := c.cc.Invoke(ctx, "/coreum.asset.nft.v1.Msg/UpdateParams", in, out, opts...) @@ -713,6 +821,12 @@ type MsgServer interface { // ie. if specific whitelist is granted for an NFT, that whitelist will // still be valid, ater we add and remove it from the class whitelist. RemoveFromClassWhitelist(context.Context, *MsgRemoveFromClassWhitelist) (*EmptyResponse, error) + // ClassFreeze freezes all NFTs of a class held by an account. + ClassFreeze(context.Context, *MsgClassFreeze) (*EmptyResponse, error) + // ClassUnfreeze removes class-freeze on an account for an NFT class. + // NOTE: + // class unfreeze does not affect the individual nft freeze. + ClassUnfreeze(context.Context, *MsgClassUnfreeze) (*EmptyResponse, error) // UpdateParams is a governance operation that sets the parameters of the module. // NOTE: all parameters must be provided. UpdateParams(context.Context, *MsgUpdateParams) (*EmptyResponse, error) @@ -749,6 +863,12 @@ func (*UnimplementedMsgServer) AddToClassWhitelist(ctx context.Context, req *Msg func (*UnimplementedMsgServer) RemoveFromClassWhitelist(ctx context.Context, req *MsgRemoveFromClassWhitelist) (*EmptyResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method RemoveFromClassWhitelist not implemented") } +func (*UnimplementedMsgServer) ClassFreeze(ctx context.Context, req *MsgClassFreeze) (*EmptyResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ClassFreeze not implemented") +} +func (*UnimplementedMsgServer) ClassUnfreeze(ctx context.Context, req *MsgClassUnfreeze) (*EmptyResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ClassUnfreeze not implemented") +} func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*EmptyResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") } @@ -919,6 +1039,42 @@ func _Msg_RemoveFromClassWhitelist_Handler(srv interface{}, ctx context.Context, return interceptor(ctx, in, info, handler) } +func _Msg_ClassFreeze_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgClassFreeze) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).ClassFreeze(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/coreum.asset.nft.v1.Msg/ClassFreeze", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).ClassFreeze(ctx, req.(*MsgClassFreeze)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_ClassUnfreeze_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgClassUnfreeze) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).ClassUnfreeze(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/coreum.asset.nft.v1.Msg/ClassUnfreeze", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).ClassUnfreeze(ctx, req.(*MsgClassUnfreeze)) + } + return interceptor(ctx, in, info, handler) +} + func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(MsgUpdateParams) if err := dec(in); err != nil { @@ -977,6 +1133,14 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "RemoveFromClassWhitelist", Handler: _Msg_RemoveFromClassWhitelist_Handler, }, + { + MethodName: "ClassFreeze", + Handler: _Msg_ClassFreeze_Handler, + }, + { + MethodName: "ClassUnfreeze", + Handler: _Msg_ClassUnfreeze_Handler, + }, { MethodName: "UpdateParams", Handler: _Msg_UpdateParams_Handler, @@ -1300,6 +1464,94 @@ func (m *MsgUnfreeze) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *MsgClassFreeze) 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 *MsgClassFreeze) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgClassFreeze) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Account) > 0 { + i -= len(m.Account) + copy(dAtA[i:], m.Account) + i = encodeVarintTx(dAtA, i, uint64(len(m.Account))) + 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))) + 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 *MsgClassUnfreeze) 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 *MsgClassUnfreeze) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgClassUnfreeze) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Account) > 0 { + i -= len(m.Account) + copy(dAtA[i:], m.Account) + i = encodeVarintTx(dAtA, i, uint64(len(m.Account))) + 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))) + 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 *MsgAddToWhitelist) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1710,6 +1962,48 @@ func (m *MsgUnfreeze) Size() (n int) { return n } +func (m *MsgClassFreeze) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.ClassID) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Account) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgClassUnfreeze) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.ClassID) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Account) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + func (m *MsgAddToWhitelist) Size() (n int) { if m == nil { return 0 @@ -2929,6 +3223,298 @@ func (m *MsgUnfreeze) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgClassFreeze) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgClassFreeze: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgClassFreeze: 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) + } + 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 { + 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.ClassID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Account", 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.Account = 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 *MsgClassUnfreeze) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgClassUnfreeze: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgClassUnfreeze: 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) + } + 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 { + 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.ClassID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Account", 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.Account = 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 *MsgAddToWhitelist) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/x/deterministicgas/config.go b/x/deterministicgas/config.go index 2c11dd839..58dfa3846 100644 --- a/x/deterministicgas/config.go +++ b/x/deterministicgas/config.go @@ -87,6 +87,8 @@ func DefaultConfig() Config { MsgToMsgURL(&assetnfttypes.MsgMint{}): constantGasFunc(39000), MsgToMsgURL(&assetnfttypes.MsgFreeze{}): constantGasFunc(8000), MsgToMsgURL(&assetnfttypes.MsgUnfreeze{}): constantGasFunc(5000), + MsgToMsgURL(&assetnfttypes.MsgClassFreeze{}): constantGasFunc(8000), + MsgToMsgURL(&assetnfttypes.MsgClassUnfreeze{}): constantGasFunc(5000), MsgToMsgURL(&assetnfttypes.MsgAddToWhitelist{}): constantGasFunc(7000), MsgToMsgURL(&assetnfttypes.MsgRemoveFromWhitelist{}): constantGasFunc(3500), MsgToMsgURL(&assetnfttypes.MsgAddToClassWhitelist{}): constantGasFunc(7000), From acdc15a5fabc16eca68408fcd7bd7d8a9bca9c2e Mon Sep 17 00:00:00 2001 From: Milad Zahedi Date: Fri, 20 Oct 2023 10:52:19 +0330 Subject: [PATCH 2/4] pass linter --- x/asset/nft/keeper/msg_server.go | 2 ++ x/deterministicgas/config_test.go | 2 +- x/deterministicgas/spec/README.md | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/x/asset/nft/keeper/msg_server.go b/x/asset/nft/keeper/msg_server.go index 465e32b2b..ec1112aef 100644 --- a/x/asset/nft/keeper/msg_server.go +++ b/x/asset/nft/keeper/msg_server.go @@ -12,6 +12,8 @@ import ( var _ types.MsgServer = MsgServer{} // MsgKeeper defines subscope of keeper methods required by msg service. +// +//nolint:interfacebloat // We accept the fact that this interface declares more than 10 methods. type MsgKeeper interface { IssueClass(ctx sdk.Context, settings types.IssueClassSettings) (string, error) Mint(ctx sdk.Context, settings types.MintSettings) error diff --git a/x/deterministicgas/config_test.go b/x/deterministicgas/config_test.go index 9eb249113..56be3f761 100644 --- a/x/deterministicgas/config_test.go +++ b/x/deterministicgas/config_test.go @@ -191,7 +191,7 @@ func TestDeterministicGas_DeterministicMessages(t *testing.T) { // we assert length to be equal to exact number, so each change requires // explicit adjustment of tests. assert.Equal(t, 60, len(nondeterministicMsgs)) - assert.Equal(t, 48, len(deterministicMsgs)) + assert.Equal(t, 50, len(deterministicMsgs)) for _, sdkMsg := range deterministicMsgs { sdkMsg := sdkMsg diff --git a/x/deterministicgas/spec/README.md b/x/deterministicgas/spec/README.md index 155f7e24e..8f1a1ee8a 100644 --- a/x/deterministicgas/spec/README.md +++ b/x/deterministicgas/spec/README.md @@ -84,6 +84,8 @@ TotalGas = 65000 + 2 * 70000 + 2 * 1000 + max(0, 2050-2048) * 10 | `/coreum.asset.nft.v1.MsgAddToClassWhitelist` | 7000 | | `/coreum.asset.nft.v1.MsgAddToWhitelist` | 7000 | | `/coreum.asset.nft.v1.MsgBurn` | 26000 | +| `/coreum.asset.nft.v1.MsgClassFreeze` | 8000 | +| `/coreum.asset.nft.v1.MsgClassUnfreeze` | 5000 | | `/coreum.asset.nft.v1.MsgFreeze` | 8000 | | `/coreum.asset.nft.v1.MsgIssueClass` | 16000 | | `/coreum.asset.nft.v1.MsgMint` | 39000 | From 8a3cccc26a5e9ccdc160d4a32fdab71bafa39ecf Mon Sep 17 00:00:00 2001 From: Milad Zahedi Date: Mon, 23 Oct 2023 11:28:06 +0330 Subject: [PATCH 3/4] addressed PR comments --- x/asset/nft/keeper/keeper.go | 2 +- x/asset/nft/types/keys.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/x/asset/nft/keeper/keeper.go b/x/asset/nft/keeper/keeper.go index 99d734f60..4102b268f 100644 --- a/x/asset/nft/keeper/keeper.go +++ b/x/asset/nft/keeper/keeper.go @@ -962,7 +962,7 @@ func (k Keeper) isNFTReceivable(ctx sdk.Context, classID, nftID string, receiver } // always allow issuer to receive NFTs issued by them. - if classDefinition.Issuer == receiver.String() { + if classDefinition.IsIssuer(receiver) { return nil } diff --git a/x/asset/nft/types/keys.go b/x/asset/nft/types/keys.go index 65954b899..d7147644f 100644 --- a/x/asset/nft/types/keys.go +++ b/x/asset/nft/types/keys.go @@ -83,7 +83,7 @@ func ParseFreezingKey(key []byte) (string, string, error) { return "", "", sdkerrors.Wrapf(ErrInvalidKey, "failed to parse a freezing key, err: %s", err) } if len(parsedKeys) != 2 { - err = sdkerrors.Wrapf(ErrInvalidKey, "freezing key must be composed to 2 length prefixed keys") + err = sdkerrors.Wrapf(ErrInvalidKey, "freezing key must be composed of 2 length prefixed keys") return "", "", err } return string(parsedKeys[0]), string(parsedKeys[1]), nil @@ -106,7 +106,7 @@ func ParseClassFreezingKey(key []byte) (string, sdk.AccAddress, error) { return "", nil, sdkerrors.Wrapf(ErrInvalidKey, "failed to parse class freezing key, err: %s", err) } if len(parsedKeys) != 2 { - err = sdkerrors.Wrapf(ErrInvalidKey, "key must be composed to 2 length prefixed keys") + err = sdkerrors.Wrapf(ErrInvalidKey, "key must be composed of 2 length prefixed keys") return "", nil, err } return string(parsedKeys[0]), parsedKeys[1], nil @@ -185,7 +185,7 @@ func ParseBurningKey(key []byte) (string, string, error) { return "", "", sdkerrors.Wrapf(ErrInvalidKey, "failed to parse a burning key, err: %s", err) } if len(parsedKeys) != 2 { - err = sdkerrors.Wrapf(ErrInvalidKey, "burning key must be composed to 2 length prefixed keys") + err = sdkerrors.Wrapf(ErrInvalidKey, "burning key must be composed of 2 length prefixed keys") return "", "", err } return string(parsedKeys[0]), string(parsedKeys[1]), nil From 60986f4d098bcf8a598c27b2ccaf10531781c0ae Mon Sep 17 00:00:00 2001 From: Milad Zahedi Date: Tue, 24 Oct 2023 12:37:40 +0330 Subject: [PATCH 4/4] addresed PR comments --- x/asset/nft/keeper/keeper.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/x/asset/nft/keeper/keeper.go b/x/asset/nft/keeper/keeper.go index 71a40e67a..0fc3957be 100644 --- a/x/asset/nft/keeper/keeper.go +++ b/x/asset/nft/keeper/keeper.go @@ -947,25 +947,25 @@ func (k Keeper) isNFTSendable(ctx sdk.Context, classID, nftID string) error { return sdkerrors.Wrapf(cosmoserrors.ErrUnauthorized, "nft with classID:%s and ID:%s has sending disabled", classID, nftID) } - frozen, err := k.IsFrozen(ctx, classID, nftID) + isFrozen, err := k.IsFrozen(ctx, classID, nftID) if err != nil { if errors.Is(err, types.ErrFeatureDisabled) { return nil } return err } - if frozen { + if isFrozen { return sdkerrors.Wrapf(cosmoserrors.ErrUnauthorized, "nft with classID:%s and ID:%s is frozen", classID, nftID) } - classFrozen, err := k.IsClassFrozen(ctx, classID, owner) + isClassFrozen, err := k.IsClassFrozen(ctx, classID, owner) if err != nil { if errors.Is(err, types.ErrFeatureDisabled) { return nil } return err } - if classFrozen { + if isClassFrozen { return sdkerrors.Wrapf(cosmoserrors.ErrUnauthorized, "nft with classID:%s and ID:%s is class frozen", classID, nftID) } return nil