From 10620a758c773deb0f52770fb7a4360b437811fe Mon Sep 17 00:00:00 2001 From: Youngtaek Yoon Date: Tue, 6 Dec 2022 07:57:26 +0000 Subject: [PATCH 1/5] Refactor x/token proto --- proto/lbm/token/v1/event.proto | 38 +++++------ proto/lbm/token/v1/genesis.proto | 2 +- proto/lbm/token/v1/query.proto | 58 ++++++++-------- proto/lbm/token/v1/token.proto | 18 ++--- proto/lbm/token/v1/tx.proto | 114 +++++++++++++++---------------- 5 files changed, 115 insertions(+), 115 deletions(-) diff --git a/proto/lbm/token/v1/event.proto b/proto/lbm/token/v1/event.proto index 934628e090..288052479b 100644 --- a/proto/lbm/token/v1/event.proto +++ b/proto/lbm/token/v1/event.proto @@ -51,10 +51,10 @@ enum AttributeKey { ATTRIBUTE_KEY_PROXY = 14 [(gogoproto.enumvalue_customname) = "AttributeKeyProxy"]; } -// EventSent is emitted when tokens are transferred. +// EventSend is emitted when tokens are transferred. // // Since: 0.46.0 (finschia) -message EventSent { +message EventSend { // contract id associated with the token class. string contract_id = 1; // address which triggered the send. @@ -67,10 +67,10 @@ message EventSent { string amount = 5 [(gogoproto.customtype) = "github.com/line/lbm-sdk/types.Int", (gogoproto.nullable) = false]; } -// EventAuthorizedOperator is emitted when a holder authorizes an operator to manipulate its tokens. +// EventAuthorizeOperator is emitted when a holder authorizes an operator to manipulate its tokens. // // Since: 0.46.0 (finschia) -message EventAuthorizedOperator { +message EventAuthorizeOperator { // contract id associated with the token class. string contract_id = 1; // address of a holder which authorized the `operator` address as an operator. @@ -79,10 +79,10 @@ message EventAuthorizedOperator { string operator = 3; } -// EventRevokedOperator is emitted when an authorization is revoked. +// EventRevokeOperator is emitted when an authorization is revoked. // // Since: 0.46.0 (finschia) -message EventRevokedOperator { +message EventRevokeOperator { // contract id associated with the token class. string contract_id = 1; // address of a holder which revoked the `operator` address as an operator. @@ -91,10 +91,10 @@ message EventRevokedOperator { string operator = 3; } -// EventIssued is emitted when a new token class is created. +// EventCreateContract is emitted when a new token class is created. // // Since: 0.46.0 (finschia) -message EventIssued { +message EventCreateContract { // address which created the contract. string creator = 1; // contract id associated with the token class. @@ -113,12 +113,12 @@ message EventIssued { bool mintable = 8; } -// EventGranted is emitted when a granter grants its permission to a grantee. +// EventGrant is emitted when a granter grants its permission to a grantee. // // Info: `granter` would be empty if the permission is granted by an issuance. // // Since: 0.46.0 (finschia) -message EventGranted { +message EventGrant { // contract id associated with the token class. string contract_id = 1; // address which granted the permission to `grantee`. @@ -130,10 +130,10 @@ message EventGranted { Permission permission = 4; } -// EventRenounced is emitted when a grantee renounces its permission. +// EventRenounce is emitted when a grantee renounces its permission. // // Since: 0.46.0 (finschia) -message EventRenounced { +message EventRenounce { // contract id associated with the token class. string contract_id = 1; // address of the grantee which abandons its grant. @@ -142,10 +142,10 @@ message EventRenounced { Permission permission = 3; } -// EventMinted is emitted when tokens are minted. +// EventMint is emitted when tokens are minted. // // Since: 0.46.0 (finschia) -message EventMinted { +message EventMint { // contract id associated with the token class. string contract_id = 1; // address which triggered the mint. @@ -156,10 +156,10 @@ message EventMinted { string amount = 4 [(gogoproto.customtype) = "github.com/line/lbm-sdk/types.Int", (gogoproto.nullable) = false]; } -// EventBurned is emitted when tokens are burnt. +// EventBurn is emitted when tokens are burnt. // // Since: 0.46.0 (finschia) -message EventBurned { +message EventBurn { // contract id associated with the token class. string contract_id = 1; // address which triggered the burn. @@ -170,14 +170,14 @@ message EventBurned { string amount = 4 [(gogoproto.customtype) = "github.com/line/lbm-sdk/types.Int", (gogoproto.nullable) = false]; } -// EventModified is emitted when the information of a token class is modified. +// EventModifyContract is emitted when the information of a token class is modified. // // Since: 0.46.0 (finschia) -message EventModified { +message EventModifyContract { // contract id associated with the token class. string contract_id = 1; // address which triggered the modify. string operator = 2; // changes on the metadata of the class. - repeated Pair changes = 3 [(gogoproto.nullable) = false]; + repeated Attribute changes = 3 [(gogoproto.nullable) = false]; } diff --git a/proto/lbm/token/v1/genesis.proto b/proto/lbm/token/v1/genesis.proto index b9b4850ad0..c927adabb5 100644 --- a/proto/lbm/token/v1/genesis.proto +++ b/proto/lbm/token/v1/genesis.proto @@ -18,7 +18,7 @@ message GenesisState { repeated ContractBalances balances = 3 [(gogoproto.nullable) = false]; // classes defines the metadata of the differents tokens. - repeated TokenClass classes = 4 [(gogoproto.nullable) = false]; + repeated Contract contracts = 4 [(gogoproto.nullable) = false]; // grants defines the grant information. repeated ContractGrants grants = 5 [(gogoproto.nullable) = false]; diff --git a/proto/lbm/token/v1/query.proto b/proto/lbm/token/v1/query.proto index d47c5b4580..695583c6f6 100644 --- a/proto/lbm/token/v1/query.proto +++ b/proto/lbm/token/v1/query.proto @@ -18,7 +18,7 @@ service Query { // - ErrInvalidAddress // - `address` is of invalid format. rpc Balance(QueryBalanceRequest) returns (QueryBalanceResponse) { - option (google.api.http).get = "/lbm/token/v1/token_classes/{contract_id}/balances/{address}"; + option (google.api.http).get = "/lbm/token/v1/contracts/{contract_id}/balances/{address}"; } // Supply queries the number of tokens from the given contract id. @@ -28,7 +28,7 @@ service Query { // - ErrNotFound // - there is no token class of `contract_id`. rpc Supply(QuerySupplyRequest) returns (QuerySupplyResponse) { - option (google.api.http).get = "/lbm/token/v1/token_classes/{contract_id}/supply"; + option (google.api.http).get = "/lbm/token/v1/contracts/{contract_id}/supply"; } // Minted queries the number of minted tokens from the given contract id. @@ -38,7 +38,7 @@ service Query { // - ErrNotFound // - there is no token class of `contract_id`. rpc Minted(QueryMintedRequest) returns (QueryMintedResponse) { - option (google.api.http).get = "/lbm/token/v1/token_classes/{contract_id}/minted"; + option (google.api.http).get = "/lbm/token/v1/contracts/{contract_id}/minted"; } // Burnt queries the number of burnt tokens from the given contract id. @@ -48,32 +48,32 @@ service Query { // - ErrNotFound // - there is no token class of `contract_id`. rpc Burnt(QueryBurntRequest) returns (QueryBurntResponse) { - option (google.api.http).get = "/lbm/token/v1/token_classes/{contract_id}/burnt"; + option (google.api.http).get = "/lbm/token/v1/contracts/{contract_id}/burnt"; } - // TokenClass queries an token metadata based on its contract id. + // Contract queries an token metadata based on its contract id. // Throws: // - ErrInvalidRequest // - `contract_id` is of invalid format. // - ErrNotFound // - there is no token class of `contract_id`. - rpc TokenClass(QueryTokenClassRequest) returns (QueryTokenClassResponse) { - option (google.api.http).get = "/lbm/token/v1/token_classes/{contract_id}"; + rpc Contract(QueryContractRequest) returns (QueryContractResponse) { + option (google.api.http).get = "/lbm/token/v1/contracts/{contract_id}"; } - // TokenClasses queries all token metadata. - rpc TokenClasses(QueryTokenClassesRequest) returns (QueryTokenClassesResponse) { - option (google.api.http).get = "/lbm/token/v1/token_classes"; + // Contracts queries all token metadata. + rpc Contracts(QueryContractsRequest) returns (QueryContractsResponse) { + option (google.api.http).get = "/lbm/token/v1/contracts"; } - // GranteeGrants queries permissions on a given grantee. + // GrantsByGrantee queries permissions on a given grantee. // Throws: // - ErrInvalidRequest // - `contract_id` is of invalid format. // - ErrInvalidAddress // - `grantee` is of invalid format. - rpc GranteeGrants(QueryGranteeGrantsRequest) returns (QueryGranteeGrantsResponse) { - option (google.api.http).get = "/lbm/token/v1/token_classes/{contract_id}/grants/{grantee}"; + rpc GrantsByGrantee(QueryGrantsByGranteeRequest) returns (QueryGrantsByGranteeResponse) { + option (google.api.http).get = "/lbm/token/v1/contracts/{contract_id}/grants_by_grantee/{grantee}"; } // Approved queries authorization on a given proxy approver pair. @@ -84,7 +84,7 @@ service Query { // - `proxy` is of invalid format. // - `approver` is of invalid format. rpc Approved(QueryApprovedRequest) returns (QueryApprovedResponse) { - option (google.api.http).get = "/lbm/token/v1/token_classes/{contract_id}/accounts/{approver}/proxies/{proxy}"; + option (google.api.http).get = "/lbm/token/v1/contracts/{contract_id}/accounts/{approver}/proxies/{proxy}"; } // Approvers queries approvers on a given proxy. @@ -94,7 +94,7 @@ service Query { // - ErrInvalidAddress // - `proxy` is of invalid format. rpc Approvers(QueryApproversRequest) returns (QueryApproversResponse) { - option (google.api.http).get = "/lbm/token/v1/token_classes/{contract_id}/accounts/{address}/approvers"; + option (google.api.http).get = "/lbm/token/v1/contracts/{contract_id}/accounts/{address}/approvers"; } } @@ -148,33 +148,33 @@ message QueryBurntResponse { string amount = 1 [(gogoproto.customtype) = "github.com/line/lbm-sdk/types.Int", (gogoproto.nullable) = false]; } -// QueryTokenClassRequest is the request type for the Query/TokenClass RPC method -message QueryTokenClassRequest { +// QueryContractRequest is the request type for the Query/Contract RPC method +message QueryContractRequest { // contract id associated with the token class. string contract_id = 1; } -// QueryTokenClassResponse is the response type for the Query/TokenClass RPC method -message QueryTokenClassResponse { - TokenClass class = 1 [(gogoproto.nullable) = false]; +// QueryContractResponse is the response type for the Query/Contract RPC method +message QueryContractResponse { + Contract contract = 1 [(gogoproto.nullable) = false]; } -// QueryTokenClassesRequest is the request type for the Query/TokenClasses RPC method -message QueryTokenClassesRequest { +// QueryContractsRequest is the request type for the Query/Contracts RPC method +message QueryContractsRequest { // pagination defines an optional pagination for the request. cosmos.base.query.v1beta1.PageRequest pagination = 1; } -// QueryTokenClassesResponse is the response type for the Query/TokenClasses RPC method -message QueryTokenClassesResponse { +// QueryContractsResponse is the response type for the Query/Contracts RPC method +message QueryContractsResponse { // information of the token classes. - repeated TokenClass classes = 1 [(gogoproto.nullable) = false]; + repeated Contract contracts = 1 [(gogoproto.nullable) = false]; // pagination defines the pagination in the response. cosmos.base.query.v1beta1.PageResponse pagination = 2; } -// QueryGranteeGrantsRequest is the request type for the Query/GranteeGrants RPC method -message QueryGranteeGrantsRequest { +// QueryGrantsByGranteeRequest is the request type for the Query/GrantsByGrantee RPC method +message QueryGrantsByGranteeRequest { // contract id associated with the token class. string contract_id = 1; // grantee which has permissions on the token class. @@ -184,8 +184,8 @@ message QueryGranteeGrantsRequest { cosmos.base.query.v1beta1.PageRequest pagination = 3; } -// QueryGranteeGrantsResponse is the response type for the Query/GranteeGrants RPC method -message QueryGranteeGrantsResponse { +// QueryGrantsByGranteeResponse is the response type for the Query/GrantsByGrantee RPC method +message QueryGrantsByGranteeResponse { // all the grants on the grantee. repeated Grant grants = 1 [(gogoproto.nullable) = false]; // pagination defines the pagination in the response. diff --git a/proto/lbm/token/v1/token.proto b/proto/lbm/token/v1/token.proto index e4d51f9f7e..d1d75b5e89 100644 --- a/proto/lbm/token/v1/token.proto +++ b/proto/lbm/token/v1/token.proto @@ -10,16 +10,16 @@ import "gogoproto/gogo.proto"; // Params defines the parameters for the token module. message Params {} -// TokenClass defines token information. -message TokenClass { - // contract_id defines the unique identifier of the token class. - string contract_id = 1; +// Contract defines token information. +message Contract { + // id defines the unique identifier of the token class. + string id = 1; // name defines the human-readable name of the token class. mandatory (not ERC20 compliant). string name = 2; // symbol is an abbreviated name for token class. mandatory (not ERC20 compliant). string symbol = 3; - // image_uri is an uri for the image of the token class stored off chain. - string image_uri = 4; + // uri for the resource of the token class stored off chain. + string uri = 4; // meta is a brief description of token class. string meta = 5; // decimals is the number of decimals which one must divide the amount by to get its user representation. @@ -28,9 +28,9 @@ message TokenClass { bool mintable = 7; } -// Pair defines a key-value pair. -message Pair { - string field = 1; +// Attribute defines a key-value pair. +message Attribute { + string key = 1; string value = 2; } diff --git a/proto/lbm/token/v1/tx.proto b/proto/lbm/token/v1/tx.proto index d572080064..99256db136 100644 --- a/proto/lbm/token/v1/tx.proto +++ b/proto/lbm/token/v1/tx.proto @@ -20,7 +20,7 @@ service Msg { // - the balance of `from` does not have enough tokens to spend. rpc Send(MsgSend) returns (MsgSendResponse); - // TransferFrom defines a method to send tokens from one account to another account by the proxy. + // OperatorSend defines a method to send tokens from one account to another account by the proxy. // Fires: // - EventSent // - transfer_from (deprecated, not typed) @@ -30,7 +30,7 @@ service Msg { // - ErrInvalidRequest: // - the balance of `from` does not have enough tokens to spend. // Note: the approval has no value of limit (not ERC20 compliant). - rpc TransferFrom(MsgTransferFrom) returns (MsgTransferFromResponse); + rpc OperatorSend(MsgOperatorSend) returns (MsgOperatorSendResponse); // RevokeOperator revoke the authorization of the operator to send the holder's tokens. // Fires: @@ -43,7 +43,7 @@ service Msg { // Since: 0.46.0 (finschia) rpc RevokeOperator(MsgRevokeOperator) returns (MsgRevokeOperatorResponse); - // Approve allows one to send tokens on behalf of the approver. + // AuthorizeOperator allows one to send tokens on behalf of the approver. // Fires: // - EventAuthorizedOperator // - approve_token (deprecated, not typed) @@ -52,17 +52,17 @@ service Msg { // - there is no token class of `contract_id`. // - ErrInvalidRequest: // - `approver` has already authorized `proxy`. - rpc Approve(MsgApprove) returns (MsgApproveResponse); + rpc AuthorizeOperator(MsgAuthorizeOperator) returns (MsgAuthorizeOperatorResponse); - // Issue defines a method to create a class of token. + // CreateContract defines a method to create a class of token. // it grants `mint`, `burn` and `modify` permissions on the token class to its creator (see also `mintable`). // Fires: - // - EventIssue + // - EventCreateContract // - EventMinted // - issue (deprecated, not typed) - rpc Issue(MsgIssue) returns (MsgIssueResponse); + rpc CreateContract(MsgCreateContract) returns (MsgCreateContractResponse); - // GrantPermission allows one to mint or burn tokens or modify a token metadata. + // Grant allows one to mint or burn tokens or modify a token metadata. // Fires: // - EventGrant // - grant_perm (deprecated, not typed) @@ -71,16 +71,16 @@ service Msg { // - `granter` does not have `permission`. // - ErrInvalidRequest // - `grantee` already has `permission`. - rpc GrantPermission(MsgGrantPermission) returns (MsgGrantPermissionResponse); + rpc Grant(MsgGrant) returns (MsgGrantResponse); - // RevokePermission abandons a permission. + // Renounce abandons a permission. // Fires: // - EventAbandon // - revoke_perm (deprecated, not typed) // Throws: // - ErrUnauthorized // - `grantee` does not have `permission`. - rpc RevokePermission(MsgRevokePermission) returns (MsgRevokePermissionResponse); + rpc Renounce(MsgRenounce) returns (MsgRenounceResponse); // Mint defines a method to mint tokens. // Fires: @@ -102,7 +102,7 @@ service Msg { // - the balance of `from` does not have enough tokens to burn. rpc Burn(MsgBurn) returns (MsgBurnResponse); - // BurnFrom defines a method to burn tokens by the proxy. + // OperatorBurn defines a method to burn tokens by the proxy. // Fires: // - EventBurned // - burn_from (deprecated, not typed) @@ -112,9 +112,9 @@ service Msg { // - the approver has not authorized `proxy`. // - ErrInvalidRequest: // - the balance of `from` does not have enough tokens to burn. - rpc BurnFrom(MsgBurnFrom) returns (MsgBurnFromResponse); + rpc OperatorBurn(MsgOperatorBurn) returns (MsgOperatorBurnResponse); - // Modify defines a method to modify a token class. + // ModifyContract defines a method to modify a token class. // Fires: // - EventModified // - modify_token (deprecated, not typed) @@ -123,7 +123,7 @@ service Msg { // - the proxy does not have `modify` permission. // - ErrNotFound // - there is no token class of `contract_id`. - rpc Modify(MsgModify) returns (MsgModifyResponse); + rpc ModifyContract(MsgModifyContract) returns (MsgModifyContractResponse); } // MsgSend defines the Msg/Send request type. @@ -151,7 +151,7 @@ message MsgSend { // MsgSendResponse defines the Msg/Send response type. message MsgSendResponse {} -// MsgTransferFrom defines the Msg/TransferFrom request type. +// MsgOperatorSend defines the Msg/OperatorSend request type. // Throws: // - ErrInvalidAddress // - `proxy` is of invalid format. @@ -162,11 +162,11 @@ message MsgSendResponse {} // - `amount` is not positive. // // Signer: `proxy` -message MsgTransferFrom { +message MsgOperatorSend { // contract id associated with the token class. string contract_id = 1; // the address of the proxy. - string proxy = 2; + string operator = 2; // the address which the transfer is from. string from = 3; // the address which the transfer is to. @@ -175,8 +175,8 @@ message MsgTransferFrom { string amount = 5 [(gogoproto.customtype) = "github.com/line/lbm-sdk/types.Int", (gogoproto.nullable) = false]; } -// MsgTransferFromResponse defines the Msg/TransferFrom response type. -message MsgTransferFromResponse {} +// MsgOperatorSendResponse defines the Msg/OperatorSend response type. +message MsgOperatorSendResponse {} // MsgRevokeOperator defines the Msg/RevokeOperator request type. // @@ -204,7 +204,7 @@ message MsgRevokeOperator { // Since: 0.46.0 (finschia) message MsgRevokeOperatorResponse {} -// MsgApprove defines the Msg/Approve request type. +// MsgAuthorizeOperator defines the Msg/AuthorizeOperator request type. // // Throws: // - ErrInvalidAddress @@ -214,19 +214,19 @@ message MsgRevokeOperatorResponse {} // - `contract_id` is of invalid format. // // Signer: `approver` -message MsgApprove { +message MsgAuthorizeOperator { // contract id associated with the token class. string contract_id = 1; // address of the token approver which approves the authorization. - string approver = 2; + string holder = 2; // address of the proxy which the authorization is granted to. - string proxy = 3; + string operator = 3; } -// MsgApproveResponse defines the Msg/Approve response type. -message MsgApproveResponse {} +// MsgAuthorizeOperatorResponse defines the Msg/AuthorizeOperator response type. +message MsgAuthorizeOperatorResponse {} -// MsgIssue defines the Msg/Issue request type. +// MsgCreateContract defines the Msg/CreateContract request type. // // Throws: // - ErrInvalidAddress @@ -242,13 +242,13 @@ message MsgApproveResponse {} // - `amount` is not positive. // // Signer: `owner` -message MsgIssue { +message MsgCreateContract { // name defines the human-readable name of the token class. mandatory (not ERC20 compliant). string name = 1; // symbol is an abbreviated name for token class. mandatory (not ERC20 compliant). string symbol = 2; - // image_uri is an uri for the image of the token class stored off chain. - string image_uri = 3; + // uri for the resource of the token class stored off chain. + string uri = 3; // meta is a brief description of token class. string meta = 4; // decimals is the number of decimals which one must divide the amount by to get its user representation. @@ -257,7 +257,7 @@ message MsgIssue { bool mintable = 6; // the address which all permissions on the token class will be granted to (not a permanent property). - string owner = 7; + string creator = 7; // the address to send the minted token to. mandatory. string to = 8; @@ -265,13 +265,13 @@ message MsgIssue { string amount = 9 [(gogoproto.customtype) = "github.com/line/lbm-sdk/types.Int", (gogoproto.nullable) = false]; } -// MsgIssueResponse defines the Msg/Issue response type. -message MsgIssueResponse { +// MsgCreateContractResponse defines the Msg/CreateContract response type. +message MsgCreateContractResponse { // id of the new token class. - string id = 1; + string contract_id = 1; } -// MsgGrantPermission defines the Msg/GrantPermission request type. +// MsgGrant defines the Msg/Grant request type. // // Throws: // - ErrInvalidAddress @@ -282,21 +282,21 @@ message MsgIssueResponse { // - `permission` is not a valid permission. // // Signer: `granter` -message MsgGrantPermission { +message MsgGrant { // contract id associated with the token class. string contract_id = 1; // address of the granter which must have the permission to give. - string from = 2; + string granter = 2; // address of the grantee. - string to = 3; + string grantee = 3; // permission on the token class. string permission = 4; } -// MsgGrantPermissionResponse defines the Msg/GrantPermission response type. -message MsgGrantPermissionResponse {} +// MsgGrantResponse defines the Msg/Grant response type. +message MsgGrantResponse {} -// MsgRevokePermission defines the Msg/RevokePermission request type. +// MsgRenounce defines the Msg/Renounce request type. // // Throws: // - ErrInvalidAddress @@ -306,17 +306,17 @@ message MsgGrantPermissionResponse {} // - `permission` is not a valid permission. // // Signer: `grantee` -message MsgRevokePermission { +message MsgRenounce { // contract id associated with the token class. string contract_id = 1; // address of the grantee which abandons the permission. - string from = 2; + string grantee = 2; // permission on the token class. string permission = 3; } -// MsgRevokePermissionResponse defines the Msg/RevokePermission response type. -message MsgRevokePermissionResponse {} +// MsgRenounceResponse defines the Msg/Renounce response type. +message MsgRenounceResponse {} // MsgMint defines the Msg/Mint request type. // @@ -333,7 +333,7 @@ message MsgMint { // contract id associated with the token class. string contract_id = 1; // address which triggers the mint. - string from = 2; + string operator = 2; // recipient of the tokens. string to = 3; // number of tokens to mint. @@ -365,7 +365,7 @@ message MsgBurn { // MsgBurnResponse defines the Msg/Burn response type. message MsgBurnResponse {} -// MsgBurnFrom defines the Msg/BurnFrom request type. +// MsgOperatorBurn defines the Msg/OperatorBurn request type. // // Throws: // - ErrInvalidAddress @@ -376,21 +376,21 @@ message MsgBurnResponse {} // - `amount` is not positive. // // Signer: `proxy` -message MsgBurnFrom { +message MsgOperatorBurn { // contract id associated with the token class. string contract_id = 1; // address which triggers the burn. - string proxy = 2; + string operator = 2; // address which the tokens will be burnt from. string from = 3; // the amount of the burn. string amount = 4 [(gogoproto.customtype) = "github.com/line/lbm-sdk/types.Int", (gogoproto.nullable) = false]; } -// MsgBurnFromResponse defines the Msg/BurnFrom response type. -message MsgBurnFromResponse {} +// MsgOperatorBurnResponse defines the Msg/OperatorBurn response type. +message MsgOperatorBurnResponse {} -// MsgModify defines the Msg/Modify request type. +// MsgModifyContract defines the Msg/ModifyContract request type. // // Throws: // - ErrInvalidAddress @@ -402,14 +402,14 @@ message MsgBurnFromResponse {} // - `changes` is empty. // // Signer: `owner` -message MsgModify { +message MsgModifyContract { // contract id associated with the contract. string contract_id = 1; // the address of the grantee which must have modify permission. - string owner = 2; + string operator = 2; // changes to apply. - repeated Pair changes = 3 [(gogoproto.nullable) = false]; + repeated Attribute changes = 3 [(gogoproto.nullable) = false]; } -// MsgModifyResponse defines the Msg/Modify response type. -message MsgModifyResponse {} +// MsgModifyContractResponse defines the Msg/ModifyContract response type. +message MsgModifyContractResponse {} From 11c92c60073592e161b406d82dd3faf4cbc5ca23 Mon Sep 17 00:00:00 2001 From: Youngtaek Yoon Date: Tue, 6 Dec 2022 10:52:04 +0000 Subject: [PATCH 2/5] Refactor x/collection proto --- proto/lbm/collection/v1/collection.proto | 16 +- proto/lbm/collection/v1/event.proto | 66 ++++---- proto/lbm/collection/v1/query.proto | 88 +++++----- proto/lbm/collection/v1/tx.proto | 204 +++++++++++------------ 4 files changed, 183 insertions(+), 191 deletions(-) diff --git a/proto/lbm/collection/v1/collection.proto b/proto/lbm/collection/v1/collection.proto index 0e8ede1ea0..0bbb3608b2 100644 --- a/proto/lbm/collection/v1/collection.proto +++ b/proto/lbm/collection/v1/collection.proto @@ -17,13 +17,13 @@ message Params { // Contract defines the information of the contract for the collection. message Contract { // contract_id defines the unique identifier of the contract. - string contract_id = 1; + string id = 1; // name defines the human-readable name of the contract. string name = 2; // meta is a brief description of the contract. string meta = 3; - // base img uri is an uri for the contract image stored off chain. - string base_img_uri = 4; + // uri for the relevant resource stored off chain. + string uri = 4; } // FTClass defines the class of fungible token. @@ -121,7 +121,7 @@ message TokenType { // contract id associated with the contract. string contract_id = 1; // token type defines the unique identifier of the token type. - string token_type = 2; + string class_id = 2; // name defines the human-readable name of the token type. string name = 3; // meta is a brief description of the token type. @@ -203,11 +203,3 @@ message Attribute { string key = 1; string value = 2; } - -// Deprecated: use Attribute -// -// Change defines a field-value pair. -message Change { - string field = 1; - string value = 2; -} diff --git a/proto/lbm/collection/v1/event.proto b/proto/lbm/collection/v1/event.proto index 7a569248b1..0a9671e539 100644 --- a/proto/lbm/collection/v1/event.proto +++ b/proto/lbm/collection/v1/event.proto @@ -74,10 +74,10 @@ enum AttributeKey { ATTRIBUTE_KEY_NEW_ROOT_TOKEN_ID = 19 [(gogoproto.enumvalue_customname) = "AttributeKeyNewRoot"]; } -// EventSent is emitted when tokens are transferred. +// EventSend is emitted when tokens are transferred. // // Since: 0.46.0 (finschia) -message EventSent { +message EventSend { // contract id associated with the contract. string contract_id = 1; // address which triggered the send. @@ -90,10 +90,10 @@ message EventSent { repeated Coin amount = 5 [(gogoproto.nullable) = false]; } -// EventAuthorizedOperator is emitted when a holder authorizes an operator to manipulate its tokens. +// EventAuthorizeOperator is emitted when a holder authorizes an operator to manipulate its tokens. // // Since: 0.46.0 (finschia) -message EventAuthorizedOperator { +message EventAuthorizeOperator { // contract id associated with the contract. string contract_id = 1; // address of a holder which authorized the `operator` address as an operator. @@ -102,10 +102,10 @@ message EventAuthorizedOperator { string operator = 3; } -// EventRevokedOperator is emitted when an authorization is revoked. +// EventRevokeOperator is emitted when an authorization is revoked. // // Since: 0.46.0 (finschia) -message EventRevokedOperator { +message EventRevokeOperator { // contract id associated with the contract. string contract_id = 1; // address of a holder which revoked the `operator` address as an operator. @@ -114,10 +114,10 @@ message EventRevokedOperator { string operator = 3; } -// EventCreatedContract is emitted when a new contract is created. +// EventCreateContract is emitted when a new contract is created. // // Since: 0.46.0 (finschia) -message EventCreatedContract { +message EventCreateContract { // address which created the contract. string creator = 1; // contract id associated with the contract. @@ -127,13 +127,13 @@ message EventCreatedContract { // metadata of the contract. string meta = 4; // uri for the contract image stored off chain. - string base_img_uri = 5; + string uri = 5; } -// EventCreatedFTClass is emitted when a new fungible token class is created. +// EventCreateFTClass is emitted when a new fungible token class is created. // // Since: 0.46.0 (finschia) -message EventCreatedFTClass { +message EventCreateFTClass { // contract id associated with the contract. string contract_id = 1; // address which triggered the create. @@ -150,10 +150,10 @@ message EventCreatedFTClass { bool mintable = 7; } -// EventCreatedNFTClass is emitted when a new non-fungible token class is created. +// EventCreateNFTClass is emitted when a new non-fungible token class is created. // // Since: 0.46.0 (finschia) -message EventCreatedNFTClass { +message EventCreateNFTClass { // contract id associated with the contract. string contract_id = 1; // address which triggered the create. @@ -166,12 +166,12 @@ message EventCreatedNFTClass { string meta = 5; } -// EventGranted is emitted when a granter grants its permission to a grantee. +// EventGrant is emitted when a granter grants its permission to a grantee. // // Info: `granter` would be empty if the permission is granted by an issuance. // // Since: 0.46.0 (finschia) -message EventGranted { +message EventGrant { // contract id associated with the contract. string contract_id = 1; // address of the granter which grants the permission. @@ -182,10 +182,10 @@ message EventGranted { Permission permission = 4; } -// EventRenounced is emitted when a grantee renounced its permission. +// EventRenounce is emitted when a grantee renounced its permission. // // Since: 0.46.0 (finschia) -message EventRenounced { +message EventRenounce { // contract id associated with the contract. string contract_id = 1; // address of the grantee which abandons its grant. @@ -194,10 +194,10 @@ message EventRenounced { Permission permission = 3; } -// EventMintedFT is emitted when fungible tokens are minted. +// EventMintFT is emitted when fungible tokens are minted. // // Since: 0.46.0 (finschia) -message EventMintedFT { +message EventMintFT { // contract id associated with the contract. string contract_id = 1; // address which triggered the mint. @@ -208,10 +208,10 @@ message EventMintedFT { repeated Coin amount = 4 [(gogoproto.nullable) = false]; } -// EventMintedNFT is emitted when non-fungible tokens are minted. +// EventMintNFT is emitted when non-fungible tokens are minted. // // Since: 0.46.0 (finschia) -message EventMintedNFT { +message EventMintNFT { // contract id associated with the contract. string contract_id = 1; // address which triggered the mint. @@ -222,10 +222,10 @@ message EventMintedNFT { repeated NFT tokens = 4 [(gogoproto.nullable) = false]; } -// EventBurned is emitted when tokens are burnt. +// EventBurn is emitted when tokens are burnt. // // Since: 0.46.0 (finschia) -message EventBurned { +message EventBurn { // contract id associated with the contract. string contract_id = 1; // address which triggered the burn. @@ -236,10 +236,10 @@ message EventBurned { repeated Coin amount = 4 [(gogoproto.nullable) = false]; } -// EventModifiedContract is emitted when the information of a contract is modified. +// EventModifyContract is emitted when the information of a contract is modified. // // Since: 0.46.0 (finschia) -message EventModifiedContract { +message EventModifyContract { // contract id associated with the contract. string contract_id = 1; // address which triggered the modify. @@ -248,10 +248,10 @@ message EventModifiedContract { repeated Attribute changes = 3 [(gogoproto.nullable) = false]; } -// EventModifiedTokenClass is emitted when the information of a token class is modified. +// EventModifyTokenClass is emitted when the information of a token class is modified. // // Since: 0.46.0 (finschia) -message EventModifiedTokenClass { +message EventModifyTokenClass { // contract id associated with the contract. string contract_id = 1; // address which triggered the modify. @@ -264,10 +264,10 @@ message EventModifiedTokenClass { string type_name = 5; } -// EventModifiedNFT is emitted when the information of a non-fungible token is modified. +// EventModifyNFT is emitted when the information of a non-fungible token is modified. // // Since: 0.46.0 (finschia) -message EventModifiedNFT { +message EventModifyNFT { // contract id associated with the contract. string contract_id = 1; // address which triggered the modify. @@ -278,10 +278,10 @@ message EventModifiedNFT { repeated Attribute changes = 4 [(gogoproto.nullable) = false]; } -// EventAttached is emitted when a token is attached to another. +// EventAttach is emitted when a token is attached to another. // // Since: 0.46.0 (finschia) -message EventAttached { +message EventAttach { // contract id associated with the contract. string contract_id = 1; // address which triggered the attach. @@ -294,10 +294,10 @@ message EventAttached { string target = 5; } -// EventDetached is emitted when a token is detached from its parent. +// EventDetach is emitted when a token is detached from its parent. // // Since: 0.46.0 (finschia) -message EventDetached { +message EventDetach { // contract id associated with the contract. string contract_id = 1; // address which triggered the detach. diff --git a/proto/lbm/collection/v1/query.proto b/proto/lbm/collection/v1/query.proto index 0193c79126..41bf9ff593 100644 --- a/proto/lbm/collection/v1/query.proto +++ b/proto/lbm/collection/v1/query.proto @@ -74,7 +74,7 @@ service Query { // - ErrNotFound // - there is no token class of `class_id`. rpc NFTSupply(QueryNFTSupplyRequest) returns (QueryNFTSupplyResponse) { - option (google.api.http).get = "/lbm/collection/v1/contracts/{contract_id}/token_types/{token_type}/supply"; + option (google.api.http).get = "/lbm/collection/v1/contracts/{contract_id}/nft_classes/{class_id}/supply"; } // NFTMinted queries the number of minted tokens from a given contract id and token type. @@ -85,7 +85,7 @@ service Query { // - ErrNotFound // - there is no token class of `class_id`. rpc NFTMinted(QueryNFTMintedRequest) returns (QueryNFTMintedResponse) { - option (google.api.http).get = "/lbm/collection/v1/contracts/{contract_id}/token_types/{token_type}/minted"; + option (google.api.http).get = "/lbm/collection/v1/contracts/{contract_id}/nft_classes/{class_id}/minted"; } // NFTBurnt queries the number of burnt tokens from a given contract id and token type. @@ -96,7 +96,7 @@ service Query { // - ErrNotFound // - there is no token class of `class_id`. rpc NFTBurnt(QueryNFTBurntRequest) returns (QueryNFTBurntResponse) { - option (google.api.http).get = "/lbm/collection/v1/contracts/{contract_id}/token_types/{token_type}/burnt"; + option (google.api.http).get = "/lbm/collection/v1/contracts/{contract_id}/nft_classes/{class_id}/burnt"; } // Contract queries a contract metadata based on its contract id. @@ -109,7 +109,7 @@ service Query { option (google.api.http).get = "/lbm/collection/v1/contracts/{contract_id}"; } - // TokenClassTypeName queries the fully qualified message type name of a token class from its class id. + // ClassTypeName queries the fully qualified message type name of a token class from its class id. // Throws: // - ErrInvalidRequest // - `contract_id` is of invalid format. @@ -117,29 +117,29 @@ service Query { // - ErrNotFound // - there is no token class of `class_id`. // Since: 0.46.0 (finschia) - rpc TokenClassTypeName(QueryTokenClassTypeNameRequest) returns (QueryTokenClassTypeNameResponse) { - option (google.api.http).get = "/lbm/collection/v1/contracts/{contract_id}/token_classes/{class_id}/type_name"; + rpc ClassTypeName(QueryClassTypeNameRequest) returns (QueryClassTypeNameResponse) { + option (google.api.http).get = "/lbm/collection/v1/contracts/{contract_id}/classes/{class_id}/type_name"; } - // TokenType queries metadata of a token type. + // NFTClass queries metadata of a token type. // Throws: // - ErrInvalidRequest // - `contract_id` is of invalid format. // - `class_id` is of invalid format. // - ErrNotFound // - there is no token class of `class_id`. - rpc TokenType(QueryTokenTypeRequest) returns (QueryTokenTypeResponse) { - option (google.api.http).get = "/lbm/collection/v1/contracts/{contract_id}/token_types/{token_type}"; + rpc NFTClass(QueryNFTClassRequest) returns (QueryNFTClassResponse) { + option (google.api.http).get = "/lbm/collection/v1/contracts/{contract_id}/nft_classes/{class_id}"; } - // TokenTypes queries metadata of all the token types. + // NFTClasses queries metadata of all the token types. // Throws: // - ErrInvalidRequest // - `contract_id` is of invalid format. // - ErrNotFound // - there is no token contract of `contract_id`. - rpc TokenTypes(QueryTokenTypesRequest) returns (QueryTokenTypesResponse) { - option (google.api.http).get = "/lbm/collection/v1/contracts/{contract_id}/token_types"; + rpc NFTClasses(QueryNFTClassesRequest) returns (QueryNFTClassesResponse) { + option (google.api.http).get = "/lbm/collection/v1/contracts/{contract_id}/nft_classes"; } // Token queries a metadata of a token from its token id. @@ -153,15 +153,15 @@ service Query { option (google.api.http).get = "/lbm/collection/v1/contracts/{contract_id}/tokens/{token_id}"; } - // TokensWithTokenType queries all token metadata with token type. + // NFTsByClassID queries all token metadata with token type. // Throws: // - ErrInvalidRequest // - `contract_id` is of invalid format. // - `token_type` is of invalid format. // - ErrNotFound // - there is no contract of `contract_id`. - rpc TokensWithTokenType(QueryTokensWithTokenTypeRequest) returns (QueryTokensWithTokenTypeResponse) { - option (google.api.http).get = "/lbm/collection/v1/contracts/{contract_id}/token_types/{token_type}/tokens"; + rpc NFTsByClassID(QueryNFTsByClassIDRequest) returns (QueryNFTsByClassIDResponse) { + option (google.api.http).get = "/lbm/collection/v1/contracts/{contract_id}/nfts_by_class_id/{class_id}"; } // Tokens queries all token metadata. @@ -206,13 +206,13 @@ service Query { option (google.api.http).get = "/lbm/collection/v1/contracts/{contract_id}/nfts/{token_id}/children"; } - // GranteeGrants queries all permissions on a given grantee. + // GrantsByGrantee queries all permissions on a given grantee. // Throws: // - ErrInvalidRequest // - `contract_id` is of invalid format. // - ErrInvalidAddress // - `grantee` is of invalid format. - rpc GranteeGrants(QueryGranteeGrantsRequest) returns (QueryGranteeGrantsResponse) { + rpc GrantsByGrantee(QueryGrantsByGranteeRequest) returns (QueryGrantsByGranteeResponse) { option (google.api.http).get = "/lbm/collection/v1/contracts/{contract_id}/grants/{grantee}"; } @@ -323,7 +323,7 @@ message QueryNFTSupplyRequest { // contract id associated with the contract. string contract_id = 1; // token type associated with the token type. - string token_type = 2; + string class_id = 2; } // QueryNFTSupplyResponse is the response type for the Query/NFTSupply RPC method. @@ -337,7 +337,7 @@ message QueryNFTMintedRequest { // contract id associated with the contract. string contract_id = 1; // token type associated with the token type. - string token_type = 2; + string class_id = 2; } // QueryNFTMintedResponse is the response type for the Query/NFTMinted RPC method. @@ -351,7 +351,7 @@ message QueryNFTBurntRequest { // contract id associated with the contract. string contract_id = 1; // token type associated with the token type. - string token_type = 2; + string class_id = 2; } // QueryNFTBurntResponse is the response type for the Query/NFTBurnt RPC method. @@ -372,40 +372,40 @@ message QueryContractResponse { Contract contract = 1 [(gogoproto.nullable) = false]; } -// QueryTokenClassTypeNameRequest is the request type for the Query/TokenClassTypeName RPC method. +// QueryClassTypeNameRequest is the request type for the Query/ClassTypeName RPC method. // // Since: 0.46.0 (finschia) -message QueryTokenClassTypeNameRequest { +message QueryClassTypeNameRequest { // contract id associated with the contract. string contract_id = 1; // class id associated with the token class. string class_id = 2; } -// QueryTokenClassTypeNameResponse is the response type for the Query/TokenClassTypeName RPC method. +// QueryClassTypeNameResponse is the response type for the Query/ClassTypeName RPC method. // // Since: 0.46.0 (finschia) -message QueryTokenClassTypeNameResponse { +message QueryClassTypeNameResponse { // type name of the token class. string name = 1; } -// QueryTokenTypeRequest is the request type for the Query/TokenType RPC method. -message QueryTokenTypeRequest { +// QueryNFTClassRequest is the request type for the Query/NFTClass RPC method. +message QueryNFTClassRequest { // contract id associated with the contract. string contract_id = 1; // token type associated with the token type. - string token_type = 2; + string class_id = 2; } -// QueryTokenTypeResponse is the response type for the Query/TokenType RPC method. -message QueryTokenTypeResponse { +// QueryNFTClassResponse is the response type for the Query/NFTClass RPC method. +message QueryNFTClassResponse { // token type is the information of the token type. - TokenType token_type = 1 [(gogoproto.nullable) = false]; + TokenType class = 1 [(gogoproto.nullable) = false]; } -// QueryTokenTypesRequest is the request type for the Query/TokenTypes RPC method. -message QueryTokenTypesRequest { +// QueryNFTClassesRequest is the request type for the Query/NFTClasses RPC method. +message QueryNFTClassesRequest { // contract id associated with the contract. string contract_id = 1; @@ -413,10 +413,10 @@ message QueryTokenTypesRequest { cosmos.base.query.v1beta1.PageRequest pagination = 2; } -// QueryTokenTypesResponse is the response type for the Query/TokenTypes RPC method. -message QueryTokenTypesResponse { +// QueryNFTClassesResponse is the response type for the Query/NFTClasses RPC method. +message QueryNFTClassesResponse { // token types is the informations of all the token types. - repeated TokenType token_types = 1 [(gogoproto.nullable) = false]; + repeated TokenType classes = 1 [(gogoproto.nullable) = false]; // pagination defines the pagination in the response. cosmos.base.query.v1beta1.PageResponse pagination = 2; @@ -436,19 +436,19 @@ message QueryTokenResponse { google.protobuf.Any token = 1 [(gogoproto.nullable) = false]; } -// QueryTokensWithTokenTypeRequest is the request type for the Query/TokensWithTokenType RPC method. -message QueryTokensWithTokenTypeRequest { +// QueryNFTsByClassIDRequest is the request type for the Query/NFTsByClassID RPC method. +message QueryNFTsByClassIDRequest { // contract id associated with the contract. string contract_id = 1; // token type associated with the token type. - string token_type = 2; + string class_id = 2; // pagination defines an optional pagination for the request. cosmos.base.query.v1beta1.PageRequest pagination = 3; } -// QueryTokensWithTokenTypeResponse is the response type for the Query/TokensWithTokenType RPC method. -message QueryTokensWithTokenTypeResponse { +// QueryNFTsByClassIDResponse is the response type for the Query/NFTsByClassID RPC method. +message QueryNFTsByClassIDResponse { // informations of all the tokens. repeated google.protobuf.Any tokens = 1 [(gogoproto.nullable) = false]; @@ -524,8 +524,8 @@ message QueryChildrenResponse { cosmos.base.query.v1beta1.PageResponse pagination = 2; } -// QueryGranteeGrantsRequest is the request type for the Query/GranteeGrants RPC method. -message QueryGranteeGrantsRequest { +// QueryGrantsByGranteeRequest is the request type for the Query/GrantsByGrantee RPC method. +message QueryGrantsByGranteeRequest { // contract id associated with the contract. string contract_id = 1; // the address of the grantee. @@ -535,8 +535,8 @@ message QueryGranteeGrantsRequest { cosmos.base.query.v1beta1.PageRequest pagination = 3; } -// QueryGranteeGrantsResponse is the response type for the Query/GranteeGrants RPC method. -message QueryGranteeGrantsResponse { +// QueryGrantsByGranteeResponse is the response type for the Query/GrantsByGrantee RPC method. +message QueryGrantsByGranteeResponse { repeated Grant grants = 1 [(gogoproto.nullable) = false]; // pagination defines the pagination in the response. diff --git a/proto/lbm/collection/v1/tx.proto b/proto/lbm/collection/v1/tx.proto index 2015c061c6..7d0c1af0a0 100644 --- a/proto/lbm/collection/v1/tx.proto +++ b/proto/lbm/collection/v1/tx.proto @@ -11,16 +11,16 @@ option (gogoproto.equal_all) = false; // Msg defines the collection Msg service. service Msg { - // TransferFT defines a method to send fungible tokens from one account to another account. + // SendFT defines a method to send fungible tokens from one account to another account. // Fires: // - EventSent // - transfer_ft (deprecated, not typed) // Throws: // - ErrInvalidRequest: // - the balance of `from` does not have enough tokens to spend. - rpc TransferFT(MsgTransferFT) returns (MsgTransferFTResponse); + rpc Send(MsgSendFT) returns (MsgSendFTResponse); - // TransferFTFrom defines a method to send fungible tokens from one account to another account by the proxy. + // OperatorSendFT defines a method to send fungible tokens from one account to another account by the proxy. // Fires: // - EventSent // - transfer_ft_from (deprecated, not typed) @@ -29,9 +29,9 @@ service Msg { // - the approver has not authorized the proxy. // - ErrInvalidRequest: // - the balance of `from` does not have enough tokens to spend. - rpc TransferFTFrom(MsgTransferFTFrom) returns (MsgTransferFTFromResponse); + rpc OperatorSendFT(MsgOperatorSendFT) returns (MsgOperatorSendFTResponse); - // TransferNFT defines a method to send non-fungible tokens from one account to another account. + // SendNFT defines a method to send non-fungible tokens from one account to another account. // Fires: // - EventSent // - transfer_nft (deprecated, not typed) @@ -39,9 +39,9 @@ service Msg { // Throws: // - ErrInvalidRequest: // - the balance of `from` does not have enough tokens to spend. - rpc TransferNFT(MsgTransferNFT) returns (MsgTransferNFTResponse); + rpc SendNFT(MsgSendNFT) returns (MsgSendNFTResponse); - // TransferNFTFrom defines a method to send non-fungible tokens from one account to another account by the proxy. + // OperatorSendNFT defines a method to send non-fungible tokens from one account to another account by the proxy. // Fires: // - EventSent // - transfer_nft_from (deprecated, not typed) @@ -51,9 +51,9 @@ service Msg { // - the approver has not authorized the proxy. // - ErrInvalidRequest: // - the balance of `from` does not have enough tokens to spend. - rpc TransferNFTFrom(MsgTransferNFTFrom) returns (MsgTransferNFTFromResponse); + rpc OperatorSendNFT(MsgOperatorSendNFT) returns (MsgOperatorSendNFTResponse); - // Approve allows one to send tokens on behalf of the approver. + // AuthorizeOperator allows one to send tokens on behalf of the approver. // Fires: // - EventAuthorizedOperator // - approve_collection (deprecated, not typed) @@ -62,9 +62,9 @@ service Msg { // - there is no contract of `contract_id`. // - ErrInvalidRequest: // - `approver` has already authorized `proxy`. - rpc Approve(MsgApprove) returns (MsgApproveResponse); + rpc AuthorizeOperator(MsgAuthorizeOperator) returns (MsgAuthorizeOperatorResponse); - // Disapprove revokes the authorization of the proxy to send the approver's token. + // RevokeOperator revokes the authorization of the proxy to send the approver's token. // Fires: // - EventRevokedOperator // - disapprove_collection (deprecated, not typed) @@ -72,7 +72,7 @@ service Msg { // - ErrNotFound: // - there is no contract of `contract_id`. // - there is no authorization by `approver` to `proxy`. - rpc Disapprove(MsgDisapprove) returns (MsgDisapproveResponse); + rpc RevokeOperator(MsgRevokeOperator) returns (MsgRevokeOperatorResponse); // CreateContract defines a method to create a contract for collection. // it grants `mint`, `burn`, `modify` and `issue` permissions on the contract to its creator. @@ -81,20 +81,20 @@ service Msg { // - create_collection (deprecated, not typed) rpc CreateContract(MsgCreateContract) returns (MsgCreateContractResponse); - // IssueFT defines a method to create a class of fungible token. + // CreateFTClass defines a method to create a class of fungible token. // Fires: // - EventCreatedFTClass // - EventMintedFT // - issue_ft (deprecated, not typed) // Note: it does not grant any permissions to its issuer. - rpc IssueFT(MsgIssueFT) returns (MsgIssueFTResponse); + rpc CreateFTClass(MsgCreateFTClass) returns (MsgCreateFTClassResponse); - // IssueNFT defines a method to create a class of non-fungible token. + // CreateNFTClass defines a method to create a class of non-fungible token. // Fires: // - EventCreatedNFTClass // - issue_nft (deprecated, not typed) // Note: it DOES grant `mint` and `burn` permissions to its issuer. - rpc IssueNFT(MsgIssueNFT) returns (MsgIssueNFTResponse); + rpc CreateNFTClass(MsgCreateNFTClass) returns (MsgCreateNFTClassResponse); // MintFT defines a method to mint fungible tokens. // Fires: @@ -127,7 +127,7 @@ service Msg { // - the balance of `from` does not have enough tokens to burn. rpc BurnFT(MsgBurnFT) returns (MsgBurnFTResponse); - // BurnFTFrom defines a method to burn fungible tokens of the approver by the proxy. + // OperatorBurnFT defines a method to burn fungible tokens of the approver by the proxy. // Fires: // - EventBurned // - burn_ft_from (deprecated, not typed) @@ -139,7 +139,7 @@ service Msg { // - the approver has not authorized `proxy`. // - ErrInvalidRequest: // - the balance of `from` does not have enough tokens to burn. - rpc BurnFTFrom(MsgBurnFTFrom) returns (MsgBurnFTFromResponse); + rpc OperatorBurnFT(MsgOperatorBurnFT) returns (MsgOperatorBurnFTResponse); // BurnNFT defines a method to burn non-fungible tokens. // Fires: @@ -154,7 +154,7 @@ service Msg { // - the balance of `from` does not have enough tokens to burn. rpc BurnNFT(MsgBurnNFT) returns (MsgBurnNFTResponse); - // BurnNFTFrom defines a method to burn non-fungible tokens of the approver by the proxy. + // OperatorBurnNFT defines a method to burn non-fungible tokens of the approver by the proxy. // Fires: // - EventBurned // - burn_ft_from (deprecated, not typed) @@ -166,7 +166,7 @@ service Msg { // - the approver has not authorized `proxy`. // - ErrInvalidRequest: // - the balance of `from` does not have enough tokens to burn. - rpc BurnNFTFrom(MsgBurnNFTFrom) returns (MsgBurnNFTFromResponse); + rpc OperatorBurnNFT(MsgOperatorBurnNFT) returns (MsgOperatorBurnNFTResponse); // Modify defines a method to modify metadata. // Fires: @@ -185,7 +185,7 @@ service Msg { // - there is no token of `token_id`. rpc Modify(MsgModify) returns (MsgModifyResponse); - // GrantPermission allows one to mint or burn tokens or modify metadata. + // Grant allows one to mint or burn tokens or modify metadata. // Fires: // - EventGranted // - grant_perm (deprecated, not typed) @@ -194,16 +194,16 @@ service Msg { // - `granter` does not have `permission`. // - ErrInvalidRequest // - `grantee` already has `permission`. - rpc GrantPermission(MsgGrantPermission) returns (MsgGrantPermissionResponse); + rpc Grant(MsgGrant) returns (MsgGrantResponse); - // RevokePermission abandons a permission. + // Renounce abandons a permission. // Fires: // - EventRenounced // - revoke_perm (deprecated, not typed) // Throws: // - ErrUnauthorized // - `grantee` does not have `permission`. - rpc RevokePermission(MsgRevokePermission) returns (MsgRevokePermissionResponse); + rpc Renounce(MsgRenounce) returns (MsgRenounceResponse); // Attach defines a method to attach a token to another token. // Fires: @@ -229,7 +229,7 @@ service Msg { // - `owner` does not owns `token_id`. rpc Detach(MsgDetach) returns (MsgDetachResponse); - // AttachFrom defines a method to attach a token to another token by proxy. + // OperatorAttach defines a method to attach a token to another token by proxy. // Fires: // - EventAttach // - attach_from (deprecated, not typed) @@ -243,9 +243,9 @@ service Msg { // - `subject` is not root. // - `subject` is an ancestor of `target`, which creates a cycle as a result. // - depth of `to` exceeds an app-specific limit. - rpc AttachFrom(MsgAttachFrom) returns (MsgAttachFromResponse); + rpc OperatorAttach(MsgOperatorAttach) returns (MsgOperatorAttachResponse); - // DetachFrom defines a method to detach a token from another token by proxy. + // OperatorDetach defines a method to detach a token from another token by proxy. // Fires: // - EventDetach // - detach_from (deprecated, not typed) @@ -255,11 +255,11 @@ service Msg { // - the approver has not authorized `proxy`. // - ErrInvalidRequest // - `owner` does not owns `subject`. - rpc DetachFrom(MsgDetachFrom) returns (MsgDetachFromResponse); + rpc OperatorDetach(MsgOperatorDetach) returns (MsgOperatorDetachResponse); } -// MsgTransferFT is the Msg/TransferFT request type. -message MsgTransferFT { +// MsgSendFT is the Msg/SendFT request type. +message MsgSendFT { // contract id associated with the contract. string contract_id = 1; // the address which the transfer is from. @@ -271,15 +271,15 @@ message MsgTransferFT { repeated Coin amount = 4 [(gogoproto.nullable) = false]; } -// MsgTransferFTResponse is the Msg/TransferFT response type. -message MsgTransferFTResponse {} +// MsgSendFTResponse is the Msg/SendFT response type. +message MsgSendFTResponse {} -// MsgTransferFTFrom is the Msg/TransferFTFrom request type. -message MsgTransferFTFrom { +// MsgOperatorSendFT is the Msg/OperatorSendFT request type. +message MsgOperatorSendFT { // contract id associated with the contract. string contract_id = 1; // the address of the proxy. - string proxy = 2; + string operator = 2; // the address which the transfer is from. string from = 3; // the address which the transfer is to. @@ -289,11 +289,11 @@ message MsgTransferFTFrom { repeated Coin amount = 5 [(gogoproto.nullable) = false]; } -// MsgTransferFTFromResponse is the Msg/TransferFTFrom response type. -message MsgTransferFTFromResponse {} +// MsgOperatorSendFTResponse is the Msg/OperatorSendFT response type. +message MsgOperatorSendFTResponse {} -// MsgTransferNFT is the Msg/TransferNFT request type. -message MsgTransferNFT { +// MsgSendNFT is the Msg/SendNFT request type. +message MsgSendNFT { // contract id associated with the contract. string contract_id = 1; // the address which the transfer is from. @@ -304,15 +304,15 @@ message MsgTransferNFT { repeated string token_ids = 4; } -// MsgTransferNFTResponse is the Msg/TransferNFT response type. -message MsgTransferNFTResponse {} +// MsgSendNFTResponse is the Msg/SendNFT response type. +message MsgSendNFTResponse {} -// MsgTransferNFTFrom is the Msg/TransferNFTFrom request type. -message MsgTransferNFTFrom { +// MsgOperatorSendNFT is the Msg/OperatorSendNFT request type. +message MsgOperatorSendNFT { // contract id associated with the contract. string contract_id = 1; // the address of the proxy. - string proxy = 2; + string operator = 2; // the address which the transfer is from. string from = 3; // the address which the transfer is to. @@ -321,34 +321,34 @@ message MsgTransferNFTFrom { repeated string token_ids = 5; } -// MsgTransferNFTFromResponse is the Msg/TransferNFTFrom response type. -message MsgTransferNFTFromResponse {} +// MsgOperatorSendNFTResponse is the Msg/OperatorSendNFT response type. +message MsgOperatorSendNFTResponse {} -// MsgApprove is the Msg/Approve request type. -message MsgApprove { +// MsgAuthorizeOperator is the Msg/AuthorizeOperator request type. +message MsgAuthorizeOperator { // contract id associated with the contract. string contract_id = 1; // address of the approver who allows the manipulation of its token. - string approver = 2; + string holder = 2; // address which the manipulation is allowed to. - string proxy = 3; + string operator = 3; } -// MsgApproveResponse is the Msg/Approve response type. -message MsgApproveResponse {} +// MsgAuthorizeOperatorResponse is the Msg/AuthorizeOperator response type. +message MsgAuthorizeOperatorResponse {} -// MsgDisapprove is the Msg/Disapprove request type. -message MsgDisapprove { +// MsgRevokeOperator is the Msg/RevokeOperator request type. +message MsgRevokeOperator { // contract id associated with the contract. string contract_id = 1; // address of the approver who allows the manipulation of its token. - string approver = 2; + string holder = 2; // address which the manipulation is allowed to. - string proxy = 3; + string operator = 3; } -// MsgDisapproveResponse is the Msg/Disapprove response type. -message MsgDisapproveResponse {} +// MsgRevokeOperatorResponse is the Msg/RevokeOperator response type. +message MsgRevokeOperatorResponse {} // MsgCreateContract is the Msg/CreateContract request type. // @@ -363,12 +363,12 @@ message MsgDisapproveResponse {} // Signer: `owner` message MsgCreateContract { // address which all the permissions on the contract will be granted to (not a permanent property). - string owner = 1; + string creator = 1; // name defines the human-readable name of the contract. string name = 2; - // base img uri is an uri for the contract image stored off chain. - string base_img_uri = 3; + // uri for the resource of the contract stored off chain. + string uri = 3; // meta is a brief description of the contract. string meta = 4; } @@ -376,10 +376,10 @@ message MsgCreateContract { // MsgCreateContractResponse is the Msg/CreateContract response type. message MsgCreateContractResponse { // id of the new contract. - string id = 1; + string contract_id = 1; } -// MsgIssueFT is the Msg/IssueFT request type. +// MsgCreateFTClass is the Msg/CreateFTClass request type. // // Throws: // - ErrInvalidAddress @@ -395,7 +395,7 @@ message MsgCreateContractResponse { // - `mintable` == false, amount == 1 and decimals == 0 (weird, but for the backward compatibility). // // Signer: `owner` -message MsgIssueFT { +message MsgCreateFTClass { // contract id associated with the contract. string contract_id = 1; // name defines the human-readable name of the token type. @@ -408,7 +408,7 @@ message MsgIssueFT { bool mintable = 5; // the address of the grantee which must have the permission to issue a token. - string owner = 6; + string operator = 6; // the address to send the minted tokens to. mandatory. string to = 7; @@ -418,13 +418,13 @@ message MsgIssueFT { string amount = 8 [(gogoproto.customtype) = "github.com/line/lbm-sdk/types.Int", (gogoproto.nullable) = false]; } -// MsgIssueFTResponse is the Msg/IssueFT response type. -message MsgIssueFTResponse { +// MsgCreateFTClassResponse is the Msg/CreateFTClass response type. +message MsgCreateFTClassResponse { // id of the new token type. - string id = 1; + string class_id = 1; } -// MsgIssueNFT is the Msg/IssueNFT request type. +// MsgCreateNFTClass is the Msg/CreateNFTClass request type. // // Throws: // - ErrInvalidAddress @@ -435,7 +435,7 @@ message MsgIssueFTResponse { // - `meta` exceeds the app-specific limit in length. // // Signer: `owner` -message MsgIssueNFT { +message MsgCreateNFTClass { // contract id associated with the contract. string contract_id = 1; // name defines the human-readable name of the token type. @@ -444,13 +444,13 @@ message MsgIssueNFT { string meta = 3; // the address of the grantee which must have the permission to issue a token. - string owner = 4; + string operator = 4; } -// MsgIssueNFTResponse is the Msg/IssueNFT response type. -message MsgIssueNFTResponse { +// MsgCreateNFTClassResponse is the Msg/CreateNFTClass response type. +message MsgCreateNFTClassResponse { // id of the new token type. - string id = 1; + string class_id = 1; } // MsgMintFT is the Msg/MintFT request type. @@ -468,7 +468,7 @@ message MsgMintFT { // contract id associated with the contract. string contract_id = 1; // address of the grantee which has the permission for the mint. - string from = 2; + string operator = 2; // address which the minted tokens will be sent to. string to = 3; // the amount of the mint. @@ -495,7 +495,7 @@ message MsgMintNFT { // contract id associated with the contract. string contract_id = 1; // address of the grantee which has the permission for the mint. - string from = 2; + string operator = 2; // address which the minted token will be sent to. string to = 3; // parameters for the minted tokens. @@ -505,7 +505,7 @@ message MsgMintNFT { // MsgMintNFTResponse is the Msg/MintNFT response type. message MsgMintNFTResponse { // ids of the new non-fungible tokens. - repeated string ids = 1; + repeated string token_ids = 1; } // MintNFTParam defines a parameter for minting nft. @@ -536,8 +536,8 @@ message MsgBurnFT { // MsgBurnFTResponse is the Msg/BurnFT response type. message MsgBurnFTResponse {} -// MsgBurnFTFrom is the Msg/BurnFTFrom request type. -message MsgBurnFTFrom { +// MsgOperatorBurnFT is the Msg/OperatorBurnFT request type. +message MsgOperatorBurnFT { // contract id associated with the contract. string contract_id = 1; // address which triggers the burn. @@ -551,8 +551,8 @@ message MsgBurnFTFrom { repeated Coin amount = 4 [(gogoproto.nullable) = false]; } -// MsgBurnFTFromResponse is the Msg/BurnFTFrom response type. -message MsgBurnFTFromResponse {} +// MsgOperatorBurnFTResponse is the Msg/OperatorBurnFT response type. +message MsgOperatorBurnFTResponse {} // MsgBurnNFT is the Msg/BurnNFT request type. message MsgBurnNFT { @@ -569,8 +569,8 @@ message MsgBurnNFT { // MsgBurnNFTResponse is the Msg/BurnNFT response type. message MsgBurnNFTResponse {} -// MsgBurnNFTFrom is the Msg/BurnNFTFrom request type. -message MsgBurnNFTFrom { +// MsgOperatorBurnNFT is the Msg/OperatorBurnNFT request type. +message MsgOperatorBurnNFT { // contract id associated with the contract. string contract_id = 1; // address which triggers the burn. @@ -584,8 +584,8 @@ message MsgBurnNFTFrom { repeated string token_ids = 4; } -// MsgBurnNFTFromResponse is the Msg/BurnNFTFrom response type. -message MsgBurnNFTFromResponse {} +// MsgOperatorBurnNFTResponse is the Msg/OperatorBurnNFT response type. +message MsgOperatorBurnNFTResponse {} // MsgModify is the Msg/Modify request type. message MsgModify { @@ -603,14 +603,14 @@ message MsgModify { // changes to apply. // on modifying collection: name, base_img_uri, meta. // on modifying token type and token: name, meta. - repeated Change changes = 5 [(gogoproto.nullable) = false]; + repeated Attribute changes = 5 [(gogoproto.nullable) = false]; } // MsgModifyResponse is the Msg/Modify response type. message MsgModifyResponse {} -// MsgGrantPermission is the Msg/GrantPermission request type. -message MsgGrantPermission { +// MsgGrant is the Msg/Grant request type. +message MsgGrant { // contract id associated with the contract. string contract_id = 1; // address of the granter which must have the permission to give. @@ -621,11 +621,11 @@ message MsgGrantPermission { string permission = 4; } -// MsgGrantPermissionResponse is the Msg/GrantPermission response type. -message MsgGrantPermissionResponse {} +// MsgGrantResponse is the Msg/Grant response type. +message MsgGrantResponse {} -// MsgRevokePermission is the Msg/RevokePermission request type. -message MsgRevokePermission { +// MsgRenounce is the Msg/Renounce request type. +message MsgRenounce { // contract id associated with the contract. string contract_id = 1; // address of the grantee which abandons the permission. @@ -634,8 +634,8 @@ message MsgRevokePermission { string permission = 3; } -// MsgRevokePermissionResponse is the Msg/RevokePermission response type. -message MsgRevokePermissionResponse {} +// MsgRenounceResponse is the Msg/Renounce response type. +message MsgRenounceResponse {} // MsgAttach is the Msg/Attach request type. // @@ -685,8 +685,8 @@ message MsgDetach { // MsgDetachResponse is the Msg/Detach response type. message MsgDetachResponse {} -// MsgAttachFrom is the Msg/AttachFrom request type. -message MsgAttachFrom { +// MsgOperatorAttach is the Msg/OperatorAttach request type. +message MsgOperatorAttach { // contract id associated with the contract. string contract_id = 1; // address of the proxy. @@ -699,11 +699,11 @@ message MsgAttachFrom { string to_token_id = 5; } -// MsgAttachFromResponse is the Msg/AttachFrom response type. -message MsgAttachFromResponse {} +// MsgOperatorAttachResponse is the Msg/OperatorAttach response type. +message MsgOperatorAttachResponse {} -// MsgDetachFrom is the Msg/DetachFrom request type. -message MsgDetachFrom { +// MsgOperatorDetach is the Msg/OperatorDetach request type. +message MsgOperatorDetach { // contract id associated with the contract. string contract_id = 1; // address of the proxy. @@ -714,5 +714,5 @@ message MsgDetachFrom { string token_id = 4; } -// MsgDetachFromResponse is the Msg/DetachFrom response type. -message MsgDetachFromResponse {} +// MsgOperatorDetachResponse is the Msg/OperatorDetach response type. +message MsgOperatorDetachResponse {} From f7e07c7743daf8c4dd8f068f1dbe94cce742e0e3 Mon Sep 17 00:00:00 2001 From: Youngtaek Yoon Date: Wed, 4 Jan 2023 09:37:08 +0000 Subject: [PATCH 3/5] Modify comment --- proto/lbm/collection/v1/event.proto | 39 ++++++++++++++++------------- proto/lbm/collection/v1/tx.proto | 5 ++-- proto/lbm/token/v1/event.proto | 37 ++++++++++++++------------- proto/lbm/token/v1/tx.proto | 1 + 4 files changed, 44 insertions(+), 38 deletions(-) diff --git a/proto/lbm/collection/v1/event.proto b/proto/lbm/collection/v1/event.proto index 0a9671e539..360b1e4742 100644 --- a/proto/lbm/collection/v1/event.proto +++ b/proto/lbm/collection/v1/event.proto @@ -78,7 +78,7 @@ enum AttributeKey { // // Since: 0.46.0 (finschia) message EventSend { - // contract id associated with the contract. + // id associated with the contract. string contract_id = 1; // address which triggered the send. string operator = 2; @@ -94,7 +94,7 @@ message EventSend { // // Since: 0.46.0 (finschia) message EventAuthorizeOperator { - // contract id associated with the contract. + // id associated with the contract. string contract_id = 1; // address of a holder which authorized the `operator` address as an operator. string holder = 2; @@ -106,7 +106,7 @@ message EventAuthorizeOperator { // // Since: 0.46.0 (finschia) message EventRevokeOperator { - // contract id associated with the contract. + // id associated with the contract. string contract_id = 1; // address of a holder which revoked the `operator` address as an operator. string holder = 2; @@ -120,7 +120,7 @@ message EventRevokeOperator { message EventCreateContract { // address which created the contract. string creator = 1; - // contract id associated with the contract. + // id associated with the contract. string contract_id = 2; // name of the contract. string name = 3; @@ -134,7 +134,7 @@ message EventCreateContract { // // Since: 0.46.0 (finschia) message EventCreateFTClass { - // contract id associated with the contract. + // id associated with the contract. string contract_id = 1; // address which triggered the create. string operator = 2; @@ -154,7 +154,7 @@ message EventCreateFTClass { // // Since: 0.46.0 (finschia) message EventCreateNFTClass { - // contract id associated with the contract. + // id associated with the contract. string contract_id = 1; // address which triggered the create. string operator = 2; @@ -172,7 +172,7 @@ message EventCreateNFTClass { // // Since: 0.46.0 (finschia) message EventGrant { - // contract id associated with the contract. + // id associated with the contract. string contract_id = 1; // address of the granter which grants the permission. string granter = 2; @@ -186,7 +186,7 @@ message EventGrant { // // Since: 0.46.0 (finschia) message EventRenounce { - // contract id associated with the contract. + // id associated with the contract. string contract_id = 1; // address of the grantee which abandons its grant. string grantee = 2; @@ -198,7 +198,7 @@ message EventRenounce { // // Since: 0.46.0 (finschia) message EventMintFT { - // contract id associated with the contract. + // id associated with the contract. string contract_id = 1; // address which triggered the mint. string operator = 2; @@ -212,7 +212,7 @@ message EventMintFT { // // Since: 0.46.0 (finschia) message EventMintNFT { - // contract id associated with the contract. + // id associated with the contract. string contract_id = 1; // address which triggered the mint. string operator = 2; @@ -226,7 +226,7 @@ message EventMintNFT { // // Since: 0.46.0 (finschia) message EventBurn { - // contract id associated with the contract. + // id associated with the contract. string contract_id = 1; // address which triggered the burn. string operator = 2; @@ -240,11 +240,12 @@ message EventBurn { // // Since: 0.46.0 (finschia) message EventModifyContract { - // contract id associated with the contract. + // id associated with the contract. string contract_id = 1; // address which triggered the modify. string operator = 2; // changes of the attributes applied. + // refer to the comments on MsgModify for the possible keys. repeated Attribute changes = 3 [(gogoproto.nullable) = false]; } @@ -252,13 +253,14 @@ message EventModifyContract { // // Since: 0.46.0 (finschia) message EventModifyTokenClass { - // contract id associated with the contract. + // id associated with the contract. string contract_id = 1; // address which triggered the modify. string operator = 2; // class id associated with the token class. string class_id = 3; // changes of the attributes applied. + // refer to the comments on MsgModify for the possible keys. repeated Attribute changes = 4 [(gogoproto.nullable) = false]; // type name of the token class. string type_name = 5; @@ -268,13 +270,14 @@ message EventModifyTokenClass { // // Since: 0.46.0 (finschia) message EventModifyNFT { - // contract id associated with the contract. + // id associated with the contract. string contract_id = 1; // address which triggered the modify. string operator = 2; // token id associated with the non-fungible token. string token_id = 3; // changes of the attributes applied. + // refer to the comments on MsgModify for the possible keys. repeated Attribute changes = 4 [(gogoproto.nullable) = false]; } @@ -282,7 +285,7 @@ message EventModifyNFT { // // Since: 0.46.0 (finschia) message EventAttach { - // contract id associated with the contract. + // id associated with the contract. string contract_id = 1; // address which triggered the attach. string operator = 2; @@ -298,7 +301,7 @@ message EventAttach { // // Since: 0.46.0 (finschia) message EventDetach { - // contract id associated with the contract. + // id associated with the contract. string contract_id = 1; // address which triggered the detach. string operator = 2; @@ -314,7 +317,7 @@ message EventDetach { // // Since: 0.46.0 (finschia) message EventOwnerChanged { - // contract id associated with the contract. + // id associated with the contract. string contract_id = 1; // token id associated with the token. string token_id = 2; @@ -328,7 +331,7 @@ message EventOwnerChanged { // // Since: 0.46.0 (finschia) message EventRootChanged { - // contract id associated with the contract. + // id associated with the contract. string contract_id = 1; // token id associated with the token. string token_id = 2; diff --git a/proto/lbm/collection/v1/tx.proto b/proto/lbm/collection/v1/tx.proto index 7d0c1af0a0..023b042edf 100644 --- a/proto/lbm/collection/v1/tx.proto +++ b/proto/lbm/collection/v1/tx.proto @@ -601,8 +601,9 @@ message MsgModify { // Note: if token type is of FTs, the index cannot be empty. string token_index = 4; // changes to apply. - // on modifying collection: name, base_img_uri, meta. - // on modifying token type and token: name, meta. + // possible keys: + // on modifying collection: name, uri, meta + // on modifying token type and token: name, meta repeated Attribute changes = 5 [(gogoproto.nullable) = false]; } diff --git a/proto/lbm/token/v1/event.proto b/proto/lbm/token/v1/event.proto index 288052479b..19ddd19441 100644 --- a/proto/lbm/token/v1/event.proto +++ b/proto/lbm/token/v1/event.proto @@ -55,7 +55,7 @@ enum AttributeKey { // // Since: 0.46.0 (finschia) message EventSend { - // contract id associated with the token class. + // id associated with the token contract. string contract_id = 1; // address which triggered the send. string operator = 2; @@ -71,7 +71,7 @@ message EventSend { // // Since: 0.46.0 (finschia) message EventAuthorizeOperator { - // contract id associated with the token class. + // id associated with the token contract. string contract_id = 1; // address of a holder which authorized the `operator` address as an operator. string holder = 2; @@ -83,7 +83,7 @@ message EventAuthorizeOperator { // // Since: 0.46.0 (finschia) message EventRevokeOperator { - // contract id associated with the token class. + // id associated with the token contract. string contract_id = 1; // address of a holder which revoked the `operator` address as an operator. string holder = 2; @@ -91,21 +91,21 @@ message EventRevokeOperator { string operator = 3; } -// EventCreateContract is emitted when a new token class is created. +// EventCreateContract is emitted when a new token contract is created. // // Since: 0.46.0 (finschia) message EventCreateContract { // address which created the contract. string creator = 1; - // contract id associated with the token class. + // id associated with the token contract. string contract_id = 2; - // name defines the human-readable name of the token class. + // name defines the human-readable name of the token contract. string name = 3; - // symbol is an abbreviated name for token class. + // symbol is an abbreviated name for token contract. string symbol = 4; - // uri is an uri for the resource of the token class stored off chain. + // uri is an uri for the resource of the token contract stored off chain. string uri = 5; - // meta is a brief description of token class. + // meta is a brief description of token contract. string meta = 6; // decimals is the number of decimals which one must divide the amount by to get its user representation. int32 decimals = 7; @@ -119,14 +119,14 @@ message EventCreateContract { // // Since: 0.46.0 (finschia) message EventGrant { - // contract id associated with the token class. + // id associated with the token contract. string contract_id = 1; // address which granted the permission to `grantee`. // it would be empty where the event is triggered by the issuance. string granter = 2; // address of the grantee. string grantee = 3; - // permission on the token class. + // permission on the token contract. Permission permission = 4; } @@ -134,11 +134,11 @@ message EventGrant { // // Since: 0.46.0 (finschia) message EventRenounce { - // contract id associated with the token class. + // id associated with the token contract. string contract_id = 1; // address of the grantee which abandons its grant. string grantee = 2; - // permission on the token class. + // permission on the token contract. Permission permission = 3; } @@ -146,7 +146,7 @@ message EventRenounce { // // Since: 0.46.0 (finschia) message EventMint { - // contract id associated with the token class. + // id associated with the token contract. string contract_id = 1; // address which triggered the mint. string operator = 2; @@ -160,7 +160,7 @@ message EventMint { // // Since: 0.46.0 (finschia) message EventBurn { - // contract id associated with the token class. + // id associated with the token contract. string contract_id = 1; // address which triggered the burn. string operator = 2; @@ -170,14 +170,15 @@ message EventBurn { string amount = 4 [(gogoproto.customtype) = "github.com/line/lbm-sdk/types.Int", (gogoproto.nullable) = false]; } -// EventModifyContract is emitted when the information of a token class is modified. +// EventModifyContract is emitted when the information of a token contract is modified. // // Since: 0.46.0 (finschia) message EventModifyContract { - // contract id associated with the token class. + // id associated with the token contract. string contract_id = 1; // address which triggered the modify. string operator = 2; - // changes on the metadata of the class. + // changes on the metadata of the contract. + // refer to the comments on MsgModify for the possible keys. repeated Attribute changes = 3 [(gogoproto.nullable) = false]; } diff --git a/proto/lbm/token/v1/tx.proto b/proto/lbm/token/v1/tx.proto index 99256db136..2d7609e4cd 100644 --- a/proto/lbm/token/v1/tx.proto +++ b/proto/lbm/token/v1/tx.proto @@ -408,6 +408,7 @@ message MsgModifyContract { // the address of the grantee which must have modify permission. string operator = 2; // changes to apply. + // possible keys: name, uri, meta repeated Attribute changes = 3 [(gogoproto.nullable) = false]; } From 6e76ea78720bce8efdf0db9f1251a7e034bc70a6 Mon Sep 17 00:00:00 2001 From: Youngtaek Yoon Date: Wed, 4 Jan 2023 10:40:26 +0000 Subject: [PATCH 4/5] Revert changes on token_type --- proto/lbm/collection/v1/collection.proto | 2 +- proto/lbm/collection/v1/query.proto | 128 ++++++++--------------- 2 files changed, 44 insertions(+), 86 deletions(-) diff --git a/proto/lbm/collection/v1/collection.proto b/proto/lbm/collection/v1/collection.proto index 0bbb3608b2..f3afaa41f3 100644 --- a/proto/lbm/collection/v1/collection.proto +++ b/proto/lbm/collection/v1/collection.proto @@ -121,7 +121,7 @@ message TokenType { // contract id associated with the contract. string contract_id = 1; // token type defines the unique identifier of the token type. - string class_id = 2; + string token_type = 2; // name defines the human-readable name of the token type. string name = 3; // meta is a brief description of the token type. diff --git a/proto/lbm/collection/v1/query.proto b/proto/lbm/collection/v1/query.proto index 41bf9ff593..6c073d4cd6 100644 --- a/proto/lbm/collection/v1/query.proto +++ b/proto/lbm/collection/v1/query.proto @@ -19,9 +19,7 @@ service Query { // - `contract_id` is of invalid format. // - ErrInvalidAddress // - `address` is of invalid format. - rpc Balance(QueryBalanceRequest) returns (QueryBalanceResponse) { - option (google.api.http).get = "/lbm/collection/v1/contracts/{contract_id}/balances/{address}/{token_id}"; - } + rpc Balance(QueryBalanceRequest) returns (QueryBalanceResponse) {} // AllBalances queries the balance of all token classes for a single account. // Throws: @@ -29,9 +27,7 @@ service Query { // - `contract_id` is of invalid format. // - ErrInvalidAddress // - `address` is of invalid format. - rpc AllBalances(QueryAllBalancesRequest) returns (QueryAllBalancesResponse) { - option (google.api.http).get = "/lbm/collection/v1/contracts/{contract_id}/balances/{address}"; - } + rpc AllBalances(QueryAllBalancesRequest) returns (QueryAllBalancesResponse) {} // FTSupply queries the number of tokens from a given contract id and token id. // Throws: @@ -40,9 +36,7 @@ service Query { // - `class_id` is of invalid format. // - ErrNotFound // - there is no token class of `class_id`. - rpc FTSupply(QueryFTSupplyRequest) returns (QueryFTSupplyResponse) { - option (google.api.http).get = "/lbm/collection/v1/contracts/{contract_id}/fts/{token_id}/supply"; - } + rpc FTSupply(QueryFTSupplyRequest) returns (QueryFTSupplyResponse) {} // FTMinted queries the number of minted tokens from a given contract id and token id. // Throws: @@ -51,9 +45,7 @@ service Query { // - `class_id` is of invalid format. // - ErrNotFound // - there is no token class of `class_id`. - rpc FTMinted(QueryFTMintedRequest) returns (QueryFTMintedResponse) { - option (google.api.http).get = "/lbm/collection/v1/contracts/{contract_id}/fts/{token_id}/minted"; - } + rpc FTMinted(QueryFTMintedRequest) returns (QueryFTMintedResponse) {} // FTBurnt queries the number of burnt tokens from a given contract id and token id. // Throws: @@ -62,9 +54,7 @@ service Query { // - `class_id` is of invalid format. // - ErrNotFound // - there is no token class of `class_id`. - rpc FTBurnt(QueryFTBurntRequest) returns (QueryFTBurntResponse) { - option (google.api.http).get = "/lbm/collection/v1/contracts/{contract_id}/fts/{token_id}/burnt"; - } + rpc FTBurnt(QueryFTBurntRequest) returns (QueryFTBurntResponse) {} // NFTSupply queries the number of tokens from a given contract id and token type. // Throws: @@ -73,9 +63,7 @@ service Query { // - `class_id` is of invalid format. // - ErrNotFound // - there is no token class of `class_id`. - rpc NFTSupply(QueryNFTSupplyRequest) returns (QueryNFTSupplyResponse) { - option (google.api.http).get = "/lbm/collection/v1/contracts/{contract_id}/nft_classes/{class_id}/supply"; - } + rpc NFTSupply(QueryNFTSupplyRequest) returns (QueryNFTSupplyResponse) {} // NFTMinted queries the number of minted tokens from a given contract id and token type. // Throws: @@ -84,9 +72,7 @@ service Query { // - `class_id` is of invalid format. // - ErrNotFound // - there is no token class of `class_id`. - rpc NFTMinted(QueryNFTMintedRequest) returns (QueryNFTMintedResponse) { - option (google.api.http).get = "/lbm/collection/v1/contracts/{contract_id}/nft_classes/{class_id}/minted"; - } + rpc NFTMinted(QueryNFTMintedRequest) returns (QueryNFTMintedResponse) {} // NFTBurnt queries the number of burnt tokens from a given contract id and token type. // Throws: @@ -95,9 +81,7 @@ service Query { // - `class_id` is of invalid format. // - ErrNotFound // - there is no token class of `class_id`. - rpc NFTBurnt(QueryNFTBurntRequest) returns (QueryNFTBurntResponse) { - option (google.api.http).get = "/lbm/collection/v1/contracts/{contract_id}/nft_classes/{class_id}/burnt"; - } + rpc NFTBurnt(QueryNFTBurntRequest) returns (QueryNFTBurntResponse) {} // Contract queries a contract metadata based on its contract id. // Throws: @@ -105,9 +89,7 @@ service Query { // - `contract_id` is of invalid format. // - ErrNotFound // - there is no contract of `contract_id`. - rpc Contract(QueryContractRequest) returns (QueryContractResponse) { - option (google.api.http).get = "/lbm/collection/v1/contracts/{contract_id}"; - } + rpc Contract(QueryContractRequest) returns (QueryContractResponse) {} // ClassTypeName queries the fully qualified message type name of a token class from its class id. // Throws: @@ -117,30 +99,24 @@ service Query { // - ErrNotFound // - there is no token class of `class_id`. // Since: 0.46.0 (finschia) - rpc ClassTypeName(QueryClassTypeNameRequest) returns (QueryClassTypeNameResponse) { - option (google.api.http).get = "/lbm/collection/v1/contracts/{contract_id}/classes/{class_id}/type_name"; - } + rpc ClassTypeName(QueryClassTypeNameRequest) returns (QueryClassTypeNameResponse) {} - // NFTClass queries metadata of a token type. + // TokenType queries metadata of a token type. // Throws: // - ErrInvalidRequest // - `contract_id` is of invalid format. // - `class_id` is of invalid format. // - ErrNotFound // - there is no token class of `class_id`. - rpc NFTClass(QueryNFTClassRequest) returns (QueryNFTClassResponse) { - option (google.api.http).get = "/lbm/collection/v1/contracts/{contract_id}/nft_classes/{class_id}"; - } + rpc TokenType(QueryTokenTypeRequest) returns (QueryTokenTypeResponse) {} - // NFTClasses queries metadata of all the token types. + // TokenTypes queries metadata of all the token types. // Throws: // - ErrInvalidRequest // - `contract_id` is of invalid format. // - ErrNotFound // - there is no token contract of `contract_id`. - rpc NFTClasses(QueryNFTClassesRequest) returns (QueryNFTClassesResponse) { - option (google.api.http).get = "/lbm/collection/v1/contracts/{contract_id}/nft_classes"; - } + rpc TokenTypes(QueryTokenTypesRequest) returns (QueryTokenTypesResponse) {} // Token queries a metadata of a token from its token id. // Throws: @@ -149,20 +125,16 @@ service Query { // - `token_id` is of invalid format. // - ErrNotFound // - there is no token of `token_id`. - rpc Token(QueryTokenRequest) returns (QueryTokenResponse) { - option (google.api.http).get = "/lbm/collection/v1/contracts/{contract_id}/tokens/{token_id}"; - } + rpc Token(QueryTokenRequest) returns (QueryTokenResponse) {} - // NFTsByClassID queries all token metadata with token type. + // TokensWithTokenType queries all token metadata with token type. // Throws: // - ErrInvalidRequest // - `contract_id` is of invalid format. // - `token_type` is of invalid format. // - ErrNotFound // - there is no contract of `contract_id`. - rpc NFTsByClassID(QueryNFTsByClassIDRequest) returns (QueryNFTsByClassIDResponse) { - option (google.api.http).get = "/lbm/collection/v1/contracts/{contract_id}/nfts_by_class_id/{class_id}"; - } + rpc TokensWithTokenType(QueryTokensWithTokenTypeRequest) returns (QueryTokensWithTokenTypeResponse) {} // Tokens queries all token metadata. // Throws: @@ -170,9 +142,7 @@ service Query { // - `contract_id` is of invalid format. // - ErrNotFound // - there is no contract of `contract_id`. - rpc Tokens(QueryTokensRequest) returns (QueryTokensResponse) { - option (google.api.http).get = "/lbm/collection/v1/contracts/{contract_id}/tokens"; - } + rpc Tokens(QueryTokensRequest) returns (QueryTokensResponse) {} // Root queries the root of a given nft. // Throws: @@ -181,9 +151,7 @@ service Query { // - `token_id` is of invalid format. // - ErrNotFound // - there is no token of `token_id`. - rpc Root(QueryRootRequest) returns (QueryRootResponse) { - option (google.api.http).get = "/lbm/collection/v1/contracts/{contract_id}/nfts/{token_id}/root"; - } + rpc Root(QueryRootRequest) returns (QueryRootResponse) {} // Parent queries the parent of a given nft. // Throws: @@ -193,18 +161,14 @@ service Query { // - ErrNotFound // - there is no token of `token_id`. // - token is the root. - rpc Parent(QueryParentRequest) returns (QueryParentResponse) { - option (google.api.http).get = "/lbm/collection/v1/contracts/{contract_id}/nfts/{token_id}/parent"; - } + rpc Parent(QueryParentRequest) returns (QueryParentResponse) {} // Children queries the children of a given nft. // Throws: // - ErrInvalidRequest // - `contract_id` is of invalid format. // - `token_id` is of invalid format. - rpc Children(QueryChildrenRequest) returns (QueryChildrenResponse) { - option (google.api.http).get = "/lbm/collection/v1/contracts/{contract_id}/nfts/{token_id}/children"; - } + rpc Children(QueryChildrenRequest) returns (QueryChildrenResponse) {} // GrantsByGrantee queries all permissions on a given grantee. // Throws: @@ -212,9 +176,7 @@ service Query { // - `contract_id` is of invalid format. // - ErrInvalidAddress // - `grantee` is of invalid format. - rpc GrantsByGrantee(QueryGrantsByGranteeRequest) returns (QueryGrantsByGranteeResponse) { - option (google.api.http).get = "/lbm/collection/v1/contracts/{contract_id}/grants/{grantee}"; - } + rpc GrantsByGrantee(QueryGrantsByGranteeRequest) returns (QueryGrantsByGranteeResponse) {} // Approved queries whether the proxy is approved by the approver. // Throws: @@ -225,9 +187,7 @@ service Query { // - `approver` is of invalid format. // - ErrNotFound // - there is no authorization given by `approver` to `proxy`. - rpc Approved(QueryApprovedRequest) returns (QueryApprovedResponse) { - option (google.api.http).get = "/lbm/collection/v1/contracts/{contract_id}/accounts/{address}/proxies/{approver}"; - } + rpc Approved(QueryApprovedRequest) returns (QueryApprovedResponse) {} // Approvers queries approvers of a given proxy. // Throws: @@ -235,9 +195,7 @@ service Query { // - `contract_id` is of invalid format. // - ErrInvalidAddress // - `proxy` is of invalid format. - rpc Approvers(QueryApproversRequest) returns (QueryApproversResponse) { - option (google.api.http).get = "/lbm/collection/v1/contracts/{contract_id}/accounts/{address}/approvers"; - } + rpc Approvers(QueryApproversRequest) returns (QueryApproversResponse) {} } // QueryBalanceRequest is the request type for the Query/Balance RPC method. @@ -323,7 +281,7 @@ message QueryNFTSupplyRequest { // contract id associated with the contract. string contract_id = 1; // token type associated with the token type. - string class_id = 2; + string token_type = 2; } // QueryNFTSupplyResponse is the response type for the Query/NFTSupply RPC method. @@ -337,7 +295,7 @@ message QueryNFTMintedRequest { // contract id associated with the contract. string contract_id = 1; // token type associated with the token type. - string class_id = 2; + string token_type = 2; } // QueryNFTMintedResponse is the response type for the Query/NFTMinted RPC method. @@ -351,7 +309,7 @@ message QueryNFTBurntRequest { // contract id associated with the contract. string contract_id = 1; // token type associated with the token type. - string class_id = 2; + string token_type = 2; } // QueryNFTBurntResponse is the response type for the Query/NFTBurnt RPC method. @@ -390,22 +348,22 @@ message QueryClassTypeNameResponse { string name = 1; } -// QueryNFTClassRequest is the request type for the Query/NFTClass RPC method. -message QueryNFTClassRequest { +// QueryTokenTypeRequest is the request type for the Query/TokenType RPC method. +message QueryTokenTypeRequest { // contract id associated with the contract. string contract_id = 1; // token type associated with the token type. - string class_id = 2; + string token_type = 2; } -// QueryNFTClassResponse is the response type for the Query/NFTClass RPC method. -message QueryNFTClassResponse { +// QueryTokenTypeResponse is the response type for the Query/TokenType RPC method. +message QueryTokenTypeResponse { // token type is the information of the token type. - TokenType class = 1 [(gogoproto.nullable) = false]; + TokenType token_type = 1 [(gogoproto.nullable) = false]; } -// QueryNFTClassesRequest is the request type for the Query/NFTClasses RPC method. -message QueryNFTClassesRequest { +// QueryTokenTypesRequest is the request type for the Query/TokenTypes RPC method. +message QueryTokenTypesRequest { // contract id associated with the contract. string contract_id = 1; @@ -413,10 +371,10 @@ message QueryNFTClassesRequest { cosmos.base.query.v1beta1.PageRequest pagination = 2; } -// QueryNFTClassesResponse is the response type for the Query/NFTClasses RPC method. -message QueryNFTClassesResponse { +// QueryTokenTypesResponse is the response type for the Query/TokenTypes RPC method. +message QueryTokenTypesResponse { // token types is the informations of all the token types. - repeated TokenType classes = 1 [(gogoproto.nullable) = false]; + repeated TokenType token_types = 1 [(gogoproto.nullable) = false]; // pagination defines the pagination in the response. cosmos.base.query.v1beta1.PageResponse pagination = 2; @@ -436,19 +394,19 @@ message QueryTokenResponse { google.protobuf.Any token = 1 [(gogoproto.nullable) = false]; } -// QueryNFTsByClassIDRequest is the request type for the Query/NFTsByClassID RPC method. -message QueryNFTsByClassIDRequest { +// QueryTokensWithTokenTypeRequest is the request type for the Query/TokensWithTokenType RPC method. +message QueryTokensWithTokenTypeRequest { // contract id associated with the contract. string contract_id = 1; // token type associated with the token type. - string class_id = 2; + string token_type = 2; // pagination defines an optional pagination for the request. cosmos.base.query.v1beta1.PageRequest pagination = 3; } -// QueryNFTsByClassIDResponse is the response type for the Query/NFTsByClassID RPC method. -message QueryNFTsByClassIDResponse { +// QueryTokensWithTokenTypeResponse is the response type for the Query/TokensWithTokenType RPC method. +message QueryTokensWithTokenTypeResponse { // informations of all the tokens. repeated google.protobuf.Any tokens = 1 [(gogoproto.nullable) = false]; From efbbd1f62443c03f06da8865547cc4aa5d315cae Mon Sep 17 00:00:00 2001 From: Youngtaek Yoon Date: Wed, 4 Jan 2023 10:52:09 +0000 Subject: [PATCH 5/5] Rename a fieid to token_type --- proto/lbm/collection/v1/tx.proto | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/proto/lbm/collection/v1/tx.proto b/proto/lbm/collection/v1/tx.proto index 023b042edf..c0e280d179 100644 --- a/proto/lbm/collection/v1/tx.proto +++ b/proto/lbm/collection/v1/tx.proto @@ -449,8 +449,8 @@ message MsgCreateNFTClass { // MsgCreateNFTClassResponse is the Msg/CreateNFTClass response type. message MsgCreateNFTClassResponse { - // id of the new token type. - string class_id = 1; + // the new token type. + string token_type = 1; } // MsgMintFT is the Msg/MintFT request type.