Skip to content

Commit

Permalink
Implement class freeze for NFTs
Browse files Browse the repository at this point in the history
  • Loading branch information
miladz68 committed Oct 19, 2023
1 parent d8f7622 commit 0bf0cbc
Show file tree
Hide file tree
Showing 27 changed files with 4,133 additions and 267 deletions.
159 changes: 159 additions & 0 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,17 @@
- [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)
- [EventUnfrozen](#coreum.asset.nft.v1.EventUnfrozen)

- [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)
Expand All @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -1264,6 +1273,22 @@ Msg defines the Msg service.



<a name="coreum.asset.nft.v1.EventClassFrozen"></a>

### EventClassFrozen



| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `class_id` | [string](#string) | | |
| `account` | [string](#string) | | |






<a name="coreum.asset.nft.v1.EventClassIssued"></a>

### EventClassIssued
Expand All @@ -1287,6 +1312,22 @@ EventClassIssued is emitted on MsgIssueClass.



<a name="coreum.asset.nft.v1.EventClassUnfrozen"></a>

### EventClassUnfrozen



| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `class_id` | [string](#string) | | |
| `account` | [string](#string) | | |






<a name="coreum.asset.nft.v1.EventFrozen"></a>

### EventFrozen
Expand Down Expand Up @@ -1386,6 +1427,22 @@ EventClassIssued is emitted on MsgIssueClass.



<a name="coreum.asset.nft.v1.ClassFrozenAccounts"></a>

### ClassFrozenAccounts



| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `classID` | [string](#string) | | |
| `accounts` | [string](#string) | repeated | |






<a name="coreum.asset.nft.v1.ClassWhitelistedAccounts"></a>

### ClassWhitelistedAccounts
Expand Down Expand Up @@ -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 | |



Expand Down Expand Up @@ -1637,6 +1695,69 @@ Params store gov manageable parameters.



<a name="coreum.asset.nft.v1.QueryClassFrozenAccountsRequest"></a>

### 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) | | |






<a name="coreum.asset.nft.v1.QueryClassFrozenAccountsResponse"></a>

### 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 | |






<a name="coreum.asset.nft.v1.QueryClassFrozenRequest"></a>

### QueryClassFrozenRequest



| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `class_id` | [string](#string) | | |
| `account` | [string](#string) | | |






<a name="coreum.asset.nft.v1.QueryClassFrozenResponse"></a>

### QueryClassFrozenResponse



| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `frozen` | [bool](#bool) | | |






<a name="coreum.asset.nft.v1.QueryClassRequest"></a>

### QueryClassRequest
Expand Down Expand Up @@ -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|
Expand Down Expand Up @@ -1948,6 +2071,40 @@ MsgBurn defines message for the Burn method.



<a name="coreum.asset.nft.v1.MsgClassFreeze"></a>

### MsgClassFreeze



| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `sender` | [string](#string) | | |
| `class_id` | [string](#string) | | |
| `account` | [string](#string) | | |






<a name="coreum.asset.nft.v1.MsgClassUnfreeze"></a>

### MsgClassUnfreeze



| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `sender` | [string](#string) | | |
| `class_id` | [string](#string) | | |
| `account` | [string](#string) | | |






<a name="coreum.asset.nft.v1.MsgFreeze"></a>

### MsgFreeze
Expand Down Expand Up @@ -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. | |

<!-- end services -->
Expand Down
129 changes: 129 additions & 0 deletions docs/static/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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": {
Expand Down
Loading

0 comments on commit 0bf0cbc

Please sign in to comment.