Skip to content

Commit

Permalink
chore: deprecate legacy features on x/token,collection (Finschia#1201)
Browse files Browse the repository at this point in the history
* Deprecate all the x/token features

* Deprecate x/collection fungible token features

* Deprecate x/collection attach features

* Update CHANGELOG.md

* Lint

* Apply feedbacks on the PR
  • Loading branch information
0Tech committed Jan 5, 2024
1 parent a1bab87 commit 3babbe5
Show file tree
Hide file tree
Showing 31 changed files with 1,191 additions and 681 deletions.
7 changes: 6 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,12 @@ issues:
- text: "SA1019: codec.LegacyAmino is deprecated"
linters:
- staticcheck
- text: "SA1019: collection."
- path: x/collection
text: "SA1019: collection."
linters:
- staticcheck
- path: x/token
text: "SA1019: token."
linters:
- staticcheck
- path: "legacy"
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,4 @@ Ref: https://keepachangelog.com/en/1.0.0/
### Document Updates
* (docs) [\#1059](https://github.com/Finschia/finschia-sdk/pull/1059) create ERRORS.md for x/module
* (docs) [\#1083](https://github.com/Finschia/finschia-sdk/pull/1083) Add detailed explanation about default events
* (x/token,collection) [#1201](https://github.com/Finschia/finschia-sdk/pull/1201) Deprecate legacy features on x/token,collection
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ lint: golangci-lint
find . -name '*.go' -type f -not -path "*.git*" | xargs gofmt -d -s

golangci-lint:
@go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.51.2
@go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.55.2

lint-fix: golangci-lint
golangci-lint run --fix --out-format=tab --issues-exit-code=0
Expand Down
2 changes: 1 addition & 1 deletion baseapp/testutil/messages.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 4 additions & 6 deletions docs/core/proto-docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -9063,8 +9063,6 @@ Contract defines the information of the contract for the collection.
<a name="lbm.collection.v1.FT"></a>

### FT
Deprecated: use FTClass

FT defines the information of fungible token.


Expand Down Expand Up @@ -9188,8 +9186,8 @@ Params defines the parameters for the collection module.

| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `depth_limit` | [uint32](#uint32) | | |
| `width_limit` | [uint32](#uint32) | | |
| `depth_limit` | [uint32](#uint32) | | **Deprecated.** |
| `width_limit` | [uint32](#uint32) | | **Deprecated.** |



Expand Down Expand Up @@ -9841,7 +9839,7 @@ GenesisState defines the collection module's genesis state.
| `next_token_ids` | [ContractNextTokenIDs](#lbm.collection.v1.ContractNextTokenIDs) | repeated | next ids for (non-fungible) tokens. |
| `balances` | [ContractBalances](#lbm.collection.v1.ContractBalances) | repeated | balances is an array containing the balances of all the accounts. |
| `nfts` | [ContractNFTs](#lbm.collection.v1.ContractNFTs) | repeated | nfts is an array containing the nfts. |
| `parents` | [ContractTokenRelations](#lbm.collection.v1.ContractTokenRelations) | repeated | parents represents the parents of (non-fungible) tokens. |
| `parents` | [ContractTokenRelations](#lbm.collection.v1.ContractTokenRelations) | repeated | **Deprecated.** parents represents the parents of (non-fungible) tokens. |
| `grants` | [ContractGrants](#lbm.collection.v1.ContractGrants) | repeated | grants defines the grant information. |
| `authorizations` | [ContractAuthorizations](#lbm.collection.v1.ContractAuthorizations) | repeated | authorizations defines the approve information. |
| `supplies` | [ContractStatistics](#lbm.collection.v1.ContractStatistics) | repeated | supplies represents the total supplies of tokens. |
Expand All @@ -9861,7 +9859,7 @@ NextClassIDs defines the next class ids of the contract.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `contract_id` | [string](#string) | | contract id associated with the contract. |
| `fungible` | [string](#string) | | id for the fungible tokens. |
| `fungible` | [string](#string) | | **Deprecated.** id for the fungible tokens. |
| `non_fungible` | [string](#string) | | id for the non-fungible tokens. |


Expand Down
11 changes: 6 additions & 5 deletions proto/lbm/collection/v1/collection.proto
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import "cosmos_proto/cosmos.proto";

// Params defines the parameters for the collection module.
message Params {
uint32 depth_limit = 1;
uint32 width_limit = 2;
uint32 depth_limit = 1 [deprecated = true];
uint32 width_limit = 2 [deprecated = true];
}

// Contract defines the information of the contract for the collection.
Expand All @@ -30,6 +30,7 @@ message Contract {
//
// Since: 0.46.0 (finschia)
message FTClass {
option deprecated = true;
option (gogoproto.goproto_getters) = true;
option (cosmos_proto.implements_interface) = "TokenClass";

Expand Down Expand Up @@ -94,10 +95,9 @@ message OwnerNFT {
string owner = 5;
}

// Deprecated: use FTClass
//
// FT defines the information of fungible token.
message FT {
option deprecated = true;
option (cosmos_proto.implements_interface) = "Token";

// contract id associated with the contract.
Expand Down Expand Up @@ -140,7 +140,8 @@ message Coin {
// token id associated with the token.
string token_id = 1;
// amount of the token.
string amount = 2 [(gogoproto.customtype) = "github.com/Finschia/finschia-sdk/types.Int", (gogoproto.nullable) = false];
string amount = 2
[(gogoproto.customtype) = "github.com/Finschia/finschia-sdk/types.Int", (gogoproto.nullable) = false];
}

// Grant defines permission given to a grantee.
Expand Down
12 changes: 12 additions & 0 deletions proto/lbm/collection/v1/event.proto
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ message EventCreatedContract {
//
// Since: 0.46.0 (finschia)
message EventCreatedFTClass {
option deprecated = true;

// contract id associated with the contract.
string contract_id = 1;
// address which triggered the create.
Expand Down Expand Up @@ -147,6 +149,8 @@ message EventRenounced {
//
// Since: 0.46.0 (finschia)
message EventMintedFT {
option deprecated = true;

// contract id associated with the contract.
string contract_id = 1;
// address which triggered the mint.
Expand Down Expand Up @@ -236,6 +240,8 @@ message EventModifiedNFT {
//
// Since: 0.46.0 (finschia)
message EventAttached {
option deprecated = true;

// contract id associated with the contract.
string contract_id = 1;
// address which triggered the attach.
Expand All @@ -252,6 +258,8 @@ message EventAttached {
//
// Since: 0.46.0 (finschia)
message EventDetached {
option deprecated = true;

// contract id associated with the contract.
string contract_id = 1;
// address which triggered the detach.
Expand All @@ -268,6 +276,8 @@ message EventDetached {
//
// Since: 0.46.0 (finschia)
message EventOwnerChanged {
option deprecated = true;

// contract id associated with the contract.
string contract_id = 1;
// token id associated with the token.
Expand All @@ -282,6 +292,8 @@ message EventOwnerChanged {
//
// Since: 0.46.0 (finschia)
message EventRootChanged {
option deprecated = true;

// contract id associated with the contract.
string contract_id = 1;
// token id associated with the token.
Expand Down
20 changes: 15 additions & 5 deletions proto/lbm/collection/v1/genesis.proto
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ message GenesisState {
repeated ContractNFTs nfts = 7 [(gogoproto.nullable) = false];

// parents represents the parents of (non-fungible) tokens.
repeated ContractTokenRelations parents = 8 [(gogoproto.nullable) = false];
repeated ContractTokenRelations parents = 8 [deprecated = true, (gogoproto.nullable) = false];

// grants defines the grant information.
repeated ContractGrants grants = 9 [(gogoproto.nullable) = false];
Expand Down Expand Up @@ -70,7 +70,8 @@ message ClassStatistics {
// class id associated with the token class.
string class_id = 1;
// statistics
string amount = 2 [(gogoproto.nullable) = false, (gogoproto.customtype) = "github.com/Finschia/finschia-sdk/types.Int"];
string amount = 2
[(gogoproto.nullable) = false, (gogoproto.customtype) = "github.com/Finschia/finschia-sdk/types.Int"];
}

// Balance defines a balance of an address.
Expand Down Expand Up @@ -119,9 +120,14 @@ message NextClassIDs {
// contract id associated with the contract.
string contract_id = 1;
// id for the fungible tokens.
string fungible = 2 [(gogoproto.customtype) = "github.com/Finschia/finschia-sdk/types.Uint", (gogoproto.nullable) = false];
string fungible = 2 [
deprecated = true,
(gogoproto.customtype) = "github.com/Finschia/finschia-sdk/types.Uint",
(gogoproto.nullable) = false
];
// id for the non-fungible tokens.
string non_fungible = 3 [(gogoproto.customtype) = "github.com/Finschia/finschia-sdk/types.Uint", (gogoproto.nullable) = false];
string non_fungible = 3
[(gogoproto.customtype) = "github.com/Finschia/finschia-sdk/types.Uint", (gogoproto.nullable) = false];
}

// ContractNextTokenIDs defines the next token ids belong to a contract.
Expand All @@ -140,6 +146,8 @@ message NextTokenID {

// ContractTokenRelations defines token relations belong to a contract.
message ContractTokenRelations {
option deprecated = true;

// contract id associated with the contract.
string contract_id = 1;
// relations
Expand All @@ -148,8 +156,10 @@ message ContractTokenRelations {

// TokenRelation defines relations between two tokens.
message TokenRelation {
option deprecated = true;

// self
string self = 1;
// other
string other = 2;
}
}
Loading

0 comments on commit 3babbe5

Please sign in to comment.