Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix naming collision in x/token enums #589

Merged
merged 6 commits into from
Jul 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
* (x/foundation) [\#545](https://github.com/line/lbm-sdk/pull/545) fix genesis and support abstain
* (x/auth) [\#563](https://github.com/line/lbm-sdk/pull/563) fix unmarshal bug of `BaseAccountJSON`
* (client) [\#565](https://github.com/line/lbm-sdk/pull/565) fix the data race problem in `TestQueryABCIHeight`
* (x/token) [\#589](https://github.com/line/lbm-sdk/pull/589) fix naming collision in x/token enums

### Breaking Changes
* (proto) [\#564](https://github.com/line/lbm-sdk/pull/564) change gRPC path to original cosmos path
Expand Down
9 changes: 5 additions & 4 deletions client/docs/statik/statik.go

Large diffs are not rendered by default.

60 changes: 55 additions & 5 deletions client/docs/swagger-ui/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39703,8 +39703,14 @@ paths:
type: string
description: address of the grantee.
permission:
type: string
description: permission on the token class.
type: string
enum:
- PERMISSION_UNSPECIFIED
- PERMISSION_MODIFY
- PERMISSION_MINT
- PERMISSION_BURN
default: PERMISSION_UNSPECIFIED
description: Grant defines permission given to a grantee.
description: all the grants on the grantee.
pagination:
Expand Down Expand Up @@ -39850,8 +39856,14 @@ paths:
type: string
description: address of the grantee.
permission:
type: string
description: permission on the token class.
type: string
enum:
- PERMISSION_UNSPECIFIED
- PERMISSION_MODIFY
- PERMISSION_MINT
- PERMISSION_BURN
default: PERMISSION_UNSPECIFIED
description: Grant defines permission given to a grantee.
title: >-
QueryGrantResponse is the response type for the Query/Grant RPC
Expand Down Expand Up @@ -39896,6 +39908,11 @@ paths:
in: path
required: true
type: string
enum:
- PERMISSION_UNSPECIFIED
- PERMISSION_MODIFY
- PERMISSION_MINT
- PERMISSION_BURN
tags:
- Query
'/lbm/token/v1/token_classes/{contract_id}/minted':
Expand Down Expand Up @@ -64631,9 +64648,30 @@ definitions:
type: string
description: address of the grantee.
permission:
type: string
description: permission on the token class.
type: string
enum:
- PERMISSION_UNSPECIFIED
- PERMISSION_MODIFY
- PERMISSION_MINT
- PERMISSION_BURN
default: PERMISSION_UNSPECIFIED
description: Grant defines permission given to a grantee.
lbm.token.v1.Permission:
type: string
enum:
- PERMISSION_UNSPECIFIED
- PERMISSION_MODIFY
- PERMISSION_MINT
- PERMISSION_BURN
default: PERMISSION_UNSPECIFIED
description: |-
Permission enumerates the valid permissions on a token class.

- PERMISSION_UNSPECIFIED: unspecified defines the default permission which is invalid.
- PERMISSION_MODIFY: PERMISSION_MODIFY defines a permission to modify a contract.
- PERMISSION_MINT: PERMISSION_MINT defines a permission to mint tokens of a contract.
- PERMISSION_BURN: PERMISSION_BURN defines a permission to burn tokens of a contract.
lbm.token.v1.QueryApprovedResponse:
type: object
properties:
Expand Down Expand Up @@ -64689,8 +64727,14 @@ definitions:
type: string
description: address of the grantee.
permission:
type: string
description: permission on the token class.
type: string
enum:
- PERMISSION_UNSPECIFIED
- PERMISSION_MODIFY
- PERMISSION_MINT
- PERMISSION_BURN
default: PERMISSION_UNSPECIFIED
description: Grant defines permission given to a grantee.
title: |-
QueryGrantResponse is the response type for the Query/Grant RPC method
Expand All @@ -64707,8 +64751,14 @@ definitions:
type: string
description: address of the grantee.
permission:
type: string
description: permission on the token class.
type: string
enum:
- PERMISSION_UNSPECIFIED
- PERMISSION_MODIFY
- PERMISSION_MINT
- PERMISSION_BURN
default: PERMISSION_UNSPECIFIED
description: Grant defines permission given to a grantee.
description: all the grants on the grantee.
pagination:
Expand Down
93 changes: 55 additions & 38 deletions docs/core/proto-docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -915,6 +915,7 @@
- [Params](#lbm.token.v1.Params)
- [TokenClass](#lbm.token.v1.TokenClass)

- [LegacyPermission](#lbm.token.v1.LegacyPermission)
- [Permission](#lbm.token.v1.Permission)

- [lbm/token/v1/event.proto](#lbm/token/v1/event.proto)
Expand Down Expand Up @@ -13333,7 +13334,7 @@ Grant defines permission given to a grantee.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `grantee` | [string](#string) | | address of the grantee. |
| `permission` | [string](#string) | | permission on the token class. |
| `permission` | [Permission](#lbm.token.v1.Permission) | | permission on the token class. |



Expand Down Expand Up @@ -13389,17 +13390,33 @@ TokenClass defines token information.
<!-- end messages -->


<a name="lbm.token.v1.LegacyPermission"></a>

### LegacyPermission
Deprecated: use Permission

LegacyPermission enumerates the valid permissions on a token class.

| Name | Number | Description |
| ---- | ------ | ----------- |
| LEGACY_PERMISSION_UNSPECIFIED | 0 | unspecified defines the default permission which is invalid. |
| LEGACY_PERMISSION_MODIFY | 1 | modify defines a permission to modify a contract. |
| LEGACY_PERMISSION_MINT | 2 | mint defines a permission to mint tokens of a contract. |
| LEGACY_PERMISSION_BURN | 3 | burn defines a permission to burn tokens of a contract. |



<a name="lbm.token.v1.Permission"></a>

### Permission
Permission enumerates the valid permissions on a token class.

| Name | Number | Description |
| ---- | ------ | ----------- |
| unspecified | 0 | |
| modify | 1 | |
| mint | 2 | |
| burn | 3 | |
| PERMISSION_UNSPECIFIED | 0 | unspecified defines the default permission which is invalid. |
| PERMISSION_MODIFY | 1 | PERMISSION_MODIFY defines a permission to modify a contract. |
| PERMISSION_MINT | 2 | PERMISSION_MINT defines a permission to mint tokens of a contract. |
| PERMISSION_BURN | 3 | PERMISSION_BURN defines a permission to burn tokens of a contract. |


<!-- end enums -->
Expand Down Expand Up @@ -13429,7 +13446,7 @@ Since: 0.46.0 (finschia)
| ----- | ---- | ----- | ----------- |
| `contract_id` | [string](#string) | | contract id associated with the token class. |
| `grantee` | [string](#string) | | address of the grantee which abandons its grant. |
| `permission` | [string](#string) | | permission on the token class. |
| `permission` | [Permission](#lbm.token.v1.Permission) | | permission on the token class. |



Expand Down Expand Up @@ -13490,7 +13507,7 @@ Since: 0.46.0 (finschia)
| `contract_id` | [string](#string) | | contract id associated with the token class. |
| `granter` | [string](#string) | | address which granted the permission to `grantee`. it would be empty where the event is triggered by the issuance. |
| `grantee` | [string](#string) | | address of the grantee. |
| `permission` | [string](#string) | | permission on the token class. |
| `permission` | [Permission](#lbm.token.v1.Permission) | | permission on the token class. |



Expand Down Expand Up @@ -13605,47 +13622,47 @@ Since: 0.46.0 (finschia)

### AttributeKey
AttributeKey enumerates the valid attribute keys on x/token.
For the legacy events.

| Name | Number | Description |
| ---- | ------ | ----------- |
| unspecified | 0 | |
| name | 1 | |
| symbol | 2 | |
| meta | 3 | |
| contract_id | 4 | |
| owner | 5 | |
| amount | 6 | |
| decimals | 7 | |
| img_uri | 8 | |
| mintable | 9 | |
| from | 10 | |
| to | 11 | |
| perm | 12 | |
| approver | 13 | |
| proxy | 14 | |
| ATTRIBUTE_KEY_UNSPECIFIED | 0 | |
| ATTRIBUTE_KEY_NAME | 1 | |
| ATTRIBUTE_KEY_SYMBOL | 2 | |
| ATTRIBUTE_KEY_META | 3 | |
| ATTRIBUTE_KEY_CONTRACT_ID | 4 | |
| ATTRIBUTE_KEY_OWNER | 5 | |
| ATTRIBUTE_KEY_AMOUNT | 6 | |
| ATTRIBUTE_KEY_DECIMALS | 7 | |
| ATTRIBUTE_KEY_IMG_URI | 8 | |
| ATTRIBUTE_KEY_MINTABLE | 9 | |
| ATTRIBUTE_KEY_FROM | 10 | |
| ATTRIBUTE_KEY_TO | 11 | |
| ATTRIBUTE_KEY_PERM | 12 | |
| ATTRIBUTE_KEY_APPROVER | 13 | |
| ATTRIBUTE_KEY_PROXY | 14 | |



<a name="lbm.token.v1.EventType"></a>

### EventType
Deprecated: use typed events.

EventType enumerates the valid event types on x/token.
For the legacy events.

| Name | Number | Description |
| ---- | ------ | ----------- |
| unspecified | 0 | |
| issue | 1 | |
| mint | 2 | |
| burn | 3 | |
| burn_from | 4 | |
| modify_token | 5 | |
| transfer | 6 | |
| transfer_from | 7 | |
| grant_perm | 8 | |
| revoke_perm | 9 | |
| approve_token | 10 | |
| EVENT_TYPE_UNSPECIFIED | 0 | |
| EVENT_TYPE_ISSUE | 1 | |
| EVENT_TYPE_MINT | 2 | |
| EVENT_TYPE_BURN | 3 | |
| EVENT_TYPE_BURN_FROM | 4 | |
| EVENT_TYPE_MODIFY_TOKEN | 5 | |
| EVENT_TYPE_TRANSFER | 6 | |
| EVENT_TYPE_TRANSFER_FROM | 7 | |
| EVENT_TYPE_GRANT_PERM | 8 | |
| EVENT_TYPE_REVOKE_PERM | 9 | |
| EVENT_TYPE_APPROVE_TOKEN | 10 | |


<!-- end enums -->
Expand Down Expand Up @@ -13939,7 +13956,7 @@ Since: finschia
| ----- | ---- | ----- | ----------- |
| `contract_id` | [string](#string) | | contract id associated with the token class. |
| `grantee` | [string](#string) | | grantee which has permissions on the token class. |
| `permission` | [string](#string) | | a permission given to the grantee. |
| `permission` | [Permission](#lbm.token.v1.Permission) | | a permission given to the grantee. |



Expand Down Expand Up @@ -14212,7 +14229,7 @@ Since: 0.46.0 (finschia)
| ----- | ---- | ----- | ----------- |
| `contract_id` | [string](#string) | | contract id associated with the token class. |
| `grantee` | [string](#string) | | address of the grantee which abandons the permission. |
| `permission` | [string](#string) | | permission on the token class. |
| `permission` | [Permission](#lbm.token.v1.Permission) | | permission on the token class. |



Expand Down Expand Up @@ -14393,7 +14410,7 @@ Since: 0.46.0 (finschia)
| `contract_id` | [string](#string) | | contract id associated with the token class. |
| `granter` | [string](#string) | | address of the granter which must have the permission to give. |
| `grantee` | [string](#string) | | address of the grantee. |
| `permission` | [string](#string) | | permission on the token class. |
| `permission` | [Permission](#lbm.token.v1.Permission) | | permission on the token class. |



Expand Down
68 changes: 38 additions & 30 deletions proto/lbm/token/v1/event.proto
Original file line number Diff line number Diff line change
Expand Up @@ -7,40 +7,48 @@ import "lbm/token/v1/token.proto";

option go_package = "github.com/line/lbm-sdk/x/token";

// Deprecated: use typed events.
0Tech marked this conversation as resolved.
Show resolved Hide resolved
//
// EventType enumerates the valid event types on x/token.
// For the legacy events.
enum EventType {
unspecified = 0 [(gogoproto.enumvalue_customname) = "Unspecified"];
issue = 1 [(gogoproto.enumvalue_customname) = "IssueToken"];
mint = 2 [(gogoproto.enumvalue_customname) = "MintToken"];
burn = 3 [(gogoproto.enumvalue_customname) = "BurnToken"];
burn_from = 4 [(gogoproto.enumvalue_customname) = "BurnTokenFrom"];
modify_token = 5 [(gogoproto.enumvalue_customname) = "ModifyToken"];
transfer = 6 [(gogoproto.enumvalue_customname) = "Transfer"];
transfer_from = 7 [(gogoproto.enumvalue_customname) = "TransferFrom"];
grant_perm = 8 [(gogoproto.enumvalue_customname) = "GrantPermToken"];
revoke_perm = 9 [(gogoproto.enumvalue_customname) = "RevokePermToken"];
approve_token = 10 [(gogoproto.enumvalue_customname) = "ApproveToken"];
option (gogoproto.goproto_enum_stringer) = false;
option (gogoproto.goproto_enum_prefix) = false;

EVENT_TYPE_UNSPECIFIED = 0 [(gogoproto.enumvalue_customname) = "EventTypeUnspecified"];

EVENT_TYPE_ISSUE = 1 [(gogoproto.enumvalue_customname) = "EventTypeIssueToken"];
EVENT_TYPE_MINT = 2 [(gogoproto.enumvalue_customname) = "EventTypeMintToken"];
EVENT_TYPE_BURN = 3 [(gogoproto.enumvalue_customname) = "EventTypeBurnToken"];
EVENT_TYPE_BURN_FROM = 4 [(gogoproto.enumvalue_customname) = "EventTypeBurnTokenFrom"];
EVENT_TYPE_MODIFY_TOKEN = 5 [(gogoproto.enumvalue_customname) = "EventTypeModifyToken"];
EVENT_TYPE_TRANSFER = 6 [(gogoproto.enumvalue_customname) = "EventTypeTransfer"];
EVENT_TYPE_TRANSFER_FROM = 7 [(gogoproto.enumvalue_customname) = "EventTypeTransferFrom"];
EVENT_TYPE_GRANT_PERM = 8 [(gogoproto.enumvalue_customname) = "EventTypeGrantPermToken"];
EVENT_TYPE_REVOKE_PERM = 9 [(gogoproto.enumvalue_customname) = "EventTypeRevokePermToken"];
EVENT_TYPE_APPROVE_TOKEN = 10 [(gogoproto.enumvalue_customname) = "EventTypeApproveToken"];
}

// AttributeKey enumerates the valid attribute keys on x/token.
// For the legacy events.
enum AttributeKey {
unspecified = 0 [(gogoproto.enumvalue_customname) = "Unspecified"];
name = 1 [(gogoproto.enumvalue_customname) = "Name"];
symbol = 2 [(gogoproto.enumvalue_customname) = "Symbol"];
meta = 3 [(gogoproto.enumvalue_customname) = "Meta"];
contract_id = 4 [(gogoproto.enumvalue_customname) = "ContractID"];
owner = 5 [(gogoproto.enumvalue_customname) = "Owner"];
amount = 6 [(gogoproto.enumvalue_customname) = "Amount"];
decimals = 7 [(gogoproto.enumvalue_customname) = "Decimals"];
img_uri = 8 [(gogoproto.enumvalue_customname) = "ImageURI"];
mintable = 9 [(gogoproto.enumvalue_customname) = "Mintable"];
from = 10 [(gogoproto.enumvalue_customname) = "From"];
to = 11 [(gogoproto.enumvalue_customname) = "To"];
perm = 12 [(gogoproto.enumvalue_customname) = "Perm"];
approver = 13 [(gogoproto.enumvalue_customname) = "Approver"];
proxy = 14 [(gogoproto.enumvalue_customname) = "Proxy"];
option (gogoproto.goproto_enum_stringer) = false;
option (gogoproto.goproto_enum_prefix) = false;

ATTRIBUTE_KEY_UNSPECIFIED = 0 [(gogoproto.enumvalue_customname) = "AttributeKeyUnspecified"];

ATTRIBUTE_KEY_NAME = 1 [(gogoproto.enumvalue_customname) = "AttributeKeyName"];
ATTRIBUTE_KEY_SYMBOL = 2 [(gogoproto.enumvalue_customname) = "AttributeKeySymbol"];
ATTRIBUTE_KEY_META = 3 [(gogoproto.enumvalue_customname) = "AttributeKeyMeta"];
ATTRIBUTE_KEY_CONTRACT_ID = 4 [(gogoproto.enumvalue_customname) = "AttributeKeyContractID"];
ATTRIBUTE_KEY_OWNER = 5 [(gogoproto.enumvalue_customname) = "AttributeKeyOwner"];
ATTRIBUTE_KEY_AMOUNT = 6 [(gogoproto.enumvalue_customname) = "AttributeKeyAmount"];
ATTRIBUTE_KEY_DECIMALS = 7 [(gogoproto.enumvalue_customname) = "AttributeKeyDecimals"];
ATTRIBUTE_KEY_IMG_URI = 8 [(gogoproto.enumvalue_customname) = "AttributeKeyImageURI"];
ATTRIBUTE_KEY_MINTABLE = 9 [(gogoproto.enumvalue_customname) = "AttributeKeyMintable"];
ATTRIBUTE_KEY_FROM = 10 [(gogoproto.enumvalue_customname) = "AttributeKeyFrom"];
ATTRIBUTE_KEY_TO = 11 [(gogoproto.enumvalue_customname) = "AttributeKeyTo"];
ATTRIBUTE_KEY_PERM = 12 [(gogoproto.enumvalue_customname) = "AttributeKeyPerm"];
ATTRIBUTE_KEY_APPROVER = 13 [(gogoproto.enumvalue_customname) = "AttributeKeyApprover"];
ATTRIBUTE_KEY_PROXY = 14 [(gogoproto.enumvalue_customname) = "AttributeKeyProxy"];
}

// EventSent is emitted when tokens are transferred.
Expand Down Expand Up @@ -117,7 +125,7 @@ message EventGrant {
// address of the grantee.
string grantee = 3;
// permission on the token class.
string permission = 4;
Permission permission = 4;
}

// EventAbandon is emitted when a grantee abandons its permission.
Expand All @@ -129,7 +137,7 @@ message EventAbandon {
// address of the grantee which abandons its grant.
string grantee = 2;
// permission on the token class.
string permission = 3;
Permission permission = 3;
}

// EventMinted is emitted when tokens are minted.
Expand Down
2 changes: 1 addition & 1 deletion proto/lbm/token/v1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ message QueryGrantRequest {
// grantee which has permissions on the token class.
string grantee = 2;
// a permission given to the grantee.
string permission = 3;
Permission permission = 3;
}

// QueryGrantResponse is the response type for the Query/Grant RPC method
Expand Down
Loading