From 5ccd2bd8d2c7ae5cb8a68fa63dc0ed124f242b49 Mon Sep 17 00:00:00 2001 From: Mark Cherepovskyi <88227619+MarkCherepovskyi@users.noreply.github.com> Date: Thu, 1 Aug 2024 11:28:04 +0000 Subject: [PATCH] Implement docs for accumulator and nft modules (#5) * docs --- proto/cosmos/nft/tx.proto | 10 +- x/accumulator/README.md | 8 + x/accumulator/spec/01_concepts.md | 44 ++++ x/accumulator/spec/02_end_block.md | 24 ++ x/accumulator/spec/03_client.md | 70 ++++++ x/accumulator/spec/README.md | 17 ++ x/nft/README.md | 8 + x/nft/spec/01_concepts.md | 25 ++ x/nft/spec/02_state.md | 53 +++++ x/nft/spec/03_end_block.md | 32 +++ x/nft/spec/04_client.md | 369 +++++++++++++++++++++++++++++ x/nft/spec/README.md | 16 ++ x/nft/types/tx.pb.go | 172 +++++++------- 13 files changed, 754 insertions(+), 94 deletions(-) create mode 100644 x/accumulator/README.md create mode 100644 x/accumulator/spec/01_concepts.md create mode 100644 x/accumulator/spec/02_end_block.md create mode 100644 x/accumulator/spec/03_client.md create mode 100644 x/accumulator/spec/README.md create mode 100644 x/nft/README.md create mode 100644 x/nft/spec/01_concepts.md create mode 100644 x/nft/spec/02_state.md create mode 100644 x/nft/spec/03_end_block.md create mode 100644 x/nft/spec/04_client.md create mode 100644 x/nft/spec/README.md diff --git a/proto/cosmos/nft/tx.proto b/proto/cosmos/nft/tx.proto index 92d68b6cc..59aac43d9 100644 --- a/proto/cosmos/nft/tx.proto +++ b/proto/cosmos/nft/tx.proto @@ -12,16 +12,14 @@ option go_package = "github.com/cosmos/cosmos-sdk/x/nft/types"; // Msg defines the Msg service. service Msg { - // Balance queries the number of NFTs of a given class owned by the owner, same as balanceOf in ERC721 - rpc Undelegate(MsgUndelegate) returns (MsgUndelegateResponse); - - rpc Delegate(MsgDelegate) returns (MsgDelegateResponse); - - // Class queries an NFT class based on its id rpc Send(MsgSend) returns (MsgSendResponse); rpc Withdraw (MsgWithdrawal) returns (MsgWithdrawalResponse); + rpc Undelegate(MsgUndelegate) returns (MsgUndelegateResponse); + + rpc Delegate(MsgDelegate) returns (MsgDelegateResponse); + rpc Redelegate ( MsgRedelegate) returns (MsgRedelegateResponse); } diff --git a/x/accumulator/README.md b/x/accumulator/README.md new file mode 100644 index 000000000..3a74b12c2 --- /dev/null +++ b/x/accumulator/README.md @@ -0,0 +1,8 @@ + + +# Accumulator + +* [Accumulator](spec/README.md) - The accumulator module is designed to be the +primary accumulator and distributor of the native tokens in the system. \ No newline at end of file diff --git a/x/accumulator/spec/01_concepts.md b/x/accumulator/spec/01_concepts.md new file mode 100644 index 000000000..82f7e7e2d --- /dev/null +++ b/x/accumulator/spec/01_concepts.md @@ -0,0 +1,44 @@ + + +# Concepts + +## The accumulator module +The accumulator module is designed to be the primary accumulator and +distributor of the native tokens in the system. According to System +tokenomics, all native tokens issued in the system will be minted to the +accumulator module balance in the genesis block. By operating the +module configuration and business logic, the module will be able to +dispose of funds according to System tokenomics. + + +Token distribution requirements: +* All tokens should be issued to the accumulator module account in the +genesis block; +* Module should be configured to split all tokens into three treasures: + * community (admin) treasury; + * NFT shard treasury; + * validator treasury; +* Validator treasury will be used to cover validators' rewards with linear distribution during 48 months according to the voting power; +* NFT shard treasury will be used by the NFT module and implies the locking tokens till some data in the non-fungible token can be staked; +* Admin treasury will have the self-inner distribution partially configured in the genesis block. This distribution implies the following distribution flows: + * Tokens will be split into the launch and cliff parts; + * Launch part of tokens should be transferred to the admin’s + accounts in the genesis block; + * Cliff parts of tokens will have different unlock periods (period + after the distribution starts); + * Cliff parts can optionally follow the linear distribution during + the fixed period (by default - it should be the immediate + transfer to the receiver); + * Cliff parts receiver accounts can be optionally configured later + with the System master admin; + +Linear distribution or linear unlocking during a certain fixed period involves dividing the entire amount into several equal +parts and being able to transfer (or receive) these parts each time at the same interval. + + + + + + \ No newline at end of file diff --git a/x/accumulator/spec/02_end_block.md b/x/accumulator/spec/02_end_block.md new file mode 100644 index 000000000..fe227ed8a --- /dev/null +++ b/x/accumulator/spec/02_end_block.md @@ -0,0 +1,24 @@ + + +## Overview + +The `EndBlocker` function handles the vesting process for administrators (admins) by updating their vesting state at the end of each block. +This ensures that admins receive their allocated rewards based on the vesting schedule. Locked tokens are stored on accumulator pull address. + +## Purpose of EndBlocker + +The `EndBlocker` function updates the vesting state for each admin, distributing the rewards to their accounts based on the vesting schedule. + +### Key Steps + +1. **Retrieve Admins**: The function retrieves all admins. +2. **Check Vesting Period**: It checks if the current block time is greater than or equal to the last vesting time plus the vesting period. +3. **Check Vesting Counter**: It ensures that the vesting counter has not reached the maximum number of vesting periods. +4. **Distribute Rewards**: If both conditions are met, it distributes the reward to the admin's account. +5. **Increment Counter**: It increments the vesting counter and updates the last vesting time. + + +The `EndBlocker` function is crucial for maintaining the correct vesting state for admins, ensuring that they receive the amount that has +vested over time according to the specified schedule. \ No newline at end of file diff --git a/x/accumulator/spec/03_client.md b/x/accumulator/spec/03_client.md new file mode 100644 index 000000000..482e01d6a --- /dev/null +++ b/x/accumulator/spec/03_client.md @@ -0,0 +1,70 @@ + +# Client + +## Query + + +### Admins +This query returns list of admins + +#### CLI + +```sh +simd noaccumulator admins --flags" +``` + +Example: +``` +simd-cored query noaccumulator admins +``` +Example Output: + +``` +admins: ["bridge103n4cmjt2je8nqcxg9y9desyhy6m57u52kkuc4"] +pagination: + next_key: null + total: "0" +``` + +#### HTTP + +This query returns list of admins +``` +cosmos/cosmos-sdk/accumulator/admins +``` + +Example: +``` +http://localhost:1317/cosmos/cosmos-sdk/accumulator/admins +``` +Example Output +``` +{ + "admins": ["bridge103n4cmjt2je8nqcxg9y9desyhy6m57u52kkuc4"], + "pagination": { + "next_key": null, + "total": "0" + } +} +``` + + +## Message + +### AddAdmin + +This message is used to add a new admin to the `accumulator` module. + +```protobuf +message MsgAddAdmin { + string creator = 1; + string address = 2; + cosmos.base.v1beta1.Coin reward_per_period = 3 [(gogoproto.nullable) = false]; + int64 vesting_periods_count = 4; + string denom = 5; + int64 vesting_period = 6; +} + +message MsgAddAdminResponse {} +``` + diff --git a/x/accumulator/spec/README.md b/x/accumulator/spec/README.md new file mode 100644 index 000000000..89855b786 --- /dev/null +++ b/x/accumulator/spec/README.md @@ -0,0 +1,17 @@ + + +# `Accumulator` + +## Contents + +1 **[Concept](01_concepts.md)** + +2 **[End-Block](02_end_block.md)** + +3 **[Client](03_client.md)** + diff --git a/x/nft/README.md b/x/nft/README.md new file mode 100644 index 000000000..84b5a4f6f --- /dev/null +++ b/x/nft/README.md @@ -0,0 +1,8 @@ + + +# NFT + +* [NFT](spec/README.md) - The NFT module is primarily created for a special type of system of + non-fungible tokens that hold locked native tokens and can be staked diff --git a/x/nft/spec/01_concepts.md b/x/nft/spec/01_concepts.md new file mode 100644 index 000000000..8abe88020 --- /dev/null +++ b/x/nft/spec/01_concepts.md @@ -0,0 +1,25 @@ + + +# Concepts + +## The NFT module + +The NFT module is primarily created for a special type of system of +non-fungible tokens that hold locked native tokens and can be staked. + + +## Module requirements: +* The module implements the non-fungible token based methods; +* Module configuration implies the tokens distribution in the genesis +block as well as token mint by the System master admin in the future; +* From the architectural perspective - each token represents an independent balance with locked tokens and tokens available for withdrawal; +* Besides owner and metadata URL, each token is characterized by the number of locked tokens and unlock period during which tokens will be unlocked linearly; +* Each token can be delegated or undelegated using built-in methods, which means the standard delegation or undelegation of the whole token balance by the token owner; +* Each delegated token is able to collect rewards that can be immediately withdrawn by the token owner; +* If the token is not delegated and contains unlocked tokens - they can be immediately withdrawn from the token balance; +* If the token is delegated, it should not be able to transfer the token ownership; +* Token withdrawal implies the transfer of the corresponding amount of tokens from the NFT shard treasury to the token owner account; +* The locked amount in the minted NFTs can not exceed the amount in the NFT shard treasury; +* There should not be any other way to access the NFT shard treasury tokens besides withdrawing unlocked tokens from NFT. \ No newline at end of file diff --git a/x/nft/spec/02_state.md b/x/nft/spec/02_state.md new file mode 100644 index 000000000..54c1eb1b4 --- /dev/null +++ b/x/nft/spec/02_state.md @@ -0,0 +1,53 @@ +# State + +## NFT + +Each NFT is represented in the blockchain by a unique address. This address is used to store a balance and to stake this balance to a validator. To generate an NFT address, the following code snippet can be used: + +```go +sdk.Bech32ifyAddressBytes("bridge", address.Derive(authtypes.NewModuleAddress(acumulatortypes.ModuleName), []byte(strconv.FormatInt(id, 10)))) +``` + +The NFT object contains specific information to describe a token: + +```protobuf +message NFT { + string address = 1; + string owner = 2; + string uri = 3; + int64 vesting_period = 4; + cosmos.base.v1beta1.Coin reward_per_period = 5 [(gogoproto.nullable) = false]; + int64 vesting_periods_count = 6; + cosmos.base.v1beta1.Coin available_to_withdraw = 7 [(gogoproto.nullable) = false]; + int64 last_vesting_time = 8; + int64 vesting_counter = 9; + string denom = 10; +} +``` + +There are several commands to update the NFT store: + +- To add a new NFT or update an existing NFT, use `SetNFT(ctx sdk.Context, v types.NFT)`. +- To remove an NFT, use `RemoveNFT(ctx sdk.Context, address string)`, where `address` is the unique address of the NFT. +- To get an NFT by address, use `GetNFT(ctx sdk.Context, address string)`, where `address` is the unique address of the NFT. +- To get all NFTs, there are two methods (with and without pagination): + - `GetNFTsWithPagination(ctx sdk.Context, pagination *query.PageRequest) ([]types.NFT, *query.PageResponse, error)` + - `GetNFTs(ctx sdk.Context) (list []types.NFT)` + +## Owner + +The Owner struct matches the NFT holder (owner) address with the NFT address: + +```protobuf +message Owner { + string address = 1; + string nft_address = 2; +} +``` + +There are several commands to update the owner store: + +- To add a new NFT owner, use `SetOwnerNFT(ctx sdk.Context, owner, nftAddress string)`. This function creates a new branch in the store where the key is the owner address, and the leaf in this branch is the Owner object. +- To remove the NFT owner, use `RemoveOwnerNft(ctx sdk.Context, owner string, nftAddress string)`. +- To get all NFTs by owner address, use `GetAllNFTsByOwnerWithPagination(ctx sdk.Context, ownerAddress string, pagination *query.PageRequest) ([]types.NFT, *query.PageResponse, error)`. +- To get all addresses that hold any NFT `GetAllOwnersWithPagination(ctx sdk.Context, pagination *query.PageRequest) ([]string, *query.PageResponse, error)` \ No newline at end of file diff --git a/x/nft/spec/03_end_block.md b/x/nft/spec/03_end_block.md new file mode 100644 index 000000000..cf415ed1b --- /dev/null +++ b/x/nft/spec/03_end_block.md @@ -0,0 +1,32 @@ + +# End Block: NFT Vesting Update + +## Overview + +The `EndBlocker` function is responsible for updating the vesting state of each NFT at the end of each block. This ensures that NFT owners can only withdraw the available amount as per the vesting schedule. + +## NFT Vesting Information + +Each NFT contains vesting information structured as follows: + +- **Vesting Period**: The period (in seconds) between each vesting event. +- **Reward Per Period**: The amount of reward to be vested per period. +- **Vesting Periods Count**: The total number of vesting periods. +- **Available to Withdraw**: The amount available for withdrawal. +- **Last Vesting Time**: The timestamp of the last vesting event. +- **Vesting Counter**: The current count of how many periods have vested. + +## Purpose of EndBlocker + +The `EndBlocker` function updates the vesting state for each NFT, ensuring that the available amount to withdraw is updated based on the vesting schedule. + +### Key Steps + +1. **Retrieve NFTs**: The function retrieves all NFTs. +2. **Check Vesting Period**: It checks if the current block time is greater than or equal to the last vesting time plus the vesting period. +3. **Check Vesting Counter**: It ensures that the vesting counter has not reached the maximum number of vesting periods. +4. **Update Available Amount**: If both conditions are met, it calculates the new available amount to withdraw based on the reward per period and updates the `Available to Withdraw` field. +5. **Increment Counter**: It increments the vesting counter and updates the last vesting time. + diff --git a/x/nft/spec/04_client.md b/x/nft/spec/04_client.md new file mode 100644 index 000000000..77beb5d71 --- /dev/null +++ b/x/nft/spec/04_client.md @@ -0,0 +1,369 @@ + +# Client + +## Query + + +### CLI + +A user can query and interact with the `nft` module using the CLI. + +The `query` commands allow users to query `nft` state. + +```sh +simd query nft --help +``` + +#### nfts + +The `nfts` command allow users to query all nfts + +```sh +simd query nft nfts [flags] +``` + +Example: + +```sh +simd query nft nfts +``` + +Example Output: + +```sh +nft: +- address: bridge100mehmdwp8kwlj7aak450cu02u9d32cza95yrv8q776sytjfg3mstssj37 + available_to_withdraw: + amount: "0" + denom: abridge + denom: abridge + last_vesting_time: "1722244515" + owner: bridge103n4cmjt2je8nqcxg9y9desyhy6m57u52kkuc4 + reward_per_period: + amount: "800000000000000000000" + denom: abridge + uri: "" + vesting_counter: "2" + vesting_period: "86400" + vesting_periods_count: "100" +- address: bridge100rx5aqsunw3ta9nclsakkkj3t7sl5dzrza2gsw2n6hf62r2sswqvwcxa4 + available_to_withdraw: + amount: "0" + denom: abridge + denom: abridge + last_vesting_time: "1722244515" + owner: bridge103n4cmjt2je8nqcxg9y9desyhy6m57u52kkuc4 + reward_per_period: + amount: "800000000000000000000" + denom: abridge + uri: "" + vesting_counter: "2" + vesting_period: "86400" + vesting_periods_count: "100" +``` + +#### nft + +The `nft` command allow users to query the nft + +```sh +simd query nft nft [flags] +``` + +Example: + +```sh +simd query nft nft bridge100mehmdwp8kwlj7aak450cu02u9d32cza95yrv8q776sytjfg3mstssj37 +``` + +Example Output: + +```sh +- address: bridge100mehmdwp8kwlj7aak450cu02u9d32cza95yrv8q776sytjfg3mstssj37 + available_to_withdraw: + amount: "0" + denom: abridge + denom: abridge + last_vesting_time: "1722244515" + owner: bridge103n4cmjt2je8nqcxg9y9desyhy6m57u52kkuc4 + reward_per_period: + amount: "800000000000000000000" + denom: abridge + uri: "" + vesting_counter: "2" + vesting_period: "86400" + vesting_periods_count: "100" +``` + + + +#### owners + +The `owners` command allow users to query the addresses of nft holdres + +```sh +simd query nft owners [flags] +``` + +Example: + +```sh +simd query nft owners +``` + +Example Output: + +```sh +- owners: bridge100mehmdwp8kwlj7aak450cu02u9d32cza95yrv8q776sytjfg3mstssj37 +``` + +#### owner + +The `owner` command allow users to query the nfts by holder address + +```sh +simd query nft owners [flags] +``` + +Example: + +```sh +simd query nft owners +``` + +Example Output: + +```sh +- owners: bridge100mehmdwp8kwlj7aak450cu02u9d32cza95yrv8q776sytjfg3mstssj37 +``` + + +## HTTP + +A user can query and interact with the `nft` module using the HTTP. + +#### nfts + +The `nfts` endpoint allow users to query all nfts + +``` +/cosmos/nfts +``` + +Example: + +``` +curl -X GET "https://rpc-api.node1.devnet.bridgeless.com/cosmos/nfts" -H "accept: application/json" +``` + +Example Output: + +``` +{ + "nft": [ + { + "address": "bridge100mehmdwp8kwlj7aak450cu02u9d32cza95yrv8q776sytjfg3mstssj37", + "owner": "bridge103n4cmjt2je8nqcxg9y9desyhy6m57u52kkuc4", + "uri": "", + "vesting_period": "86400", + "reward_per_period": { + "denom": "abridge", + "amount": "800000000000000000000" + }, + "vesting_periods_count": "100", + "available_to_withdraw": { + "denom": "abridge", + "amount": "0" + }, + "last_vesting_time": "1722262887", + "vesting_counter": "2", + "denom": "abridge" + } + ] +} +``` + +#### nft + +The `nft` endpoint allow users to query the nft + +``` +/cosmos/nfts/{address} +``` + +Example: + +``` +curl -X GET "https://rpc-api.node1.devnet.bridgeless.com/cosmos/nfts/bridge100mehmdwp8kwlj7aak450cu02u9d32cza95yrv8q776sytjfg3mstssj37" -H "accept: application/json" +``` + +Example Output: + +``` +{ + "nft": { + "address": "bridge100mehmdwp8kwlj7aak450cu02u9d32cza95yrv8q776sytjfg3mstssj37", + "owner": "bridge103n4cmjt2je8nqcxg9y9desyhy6m57u52kkuc4", + "uri": "", + "vesting_period": "86400", + "reward_per_period": { + "denom": "abridge", + "amount": "800000000000000000000" + }, + "vesting_periods_count": "100", + "available_to_withdraw": { + "denom": "abridge", + "amount": "0" + }, + "last_vesting_time": "1722262887", + "vesting_counter": "2", + "denom": "abridge" + } +} +``` + + + +#### owners + +The `owners` endpoint allow users to query the addresses of nft holdres + +``` +/cosmos/owners +``` + +Example: + +``` +curl -X GET "https://rpc-api.node1.devnet.bridgeless.com/cosmos/owners" -H "accept: application/json" +``` + +Example Output: + +``` +{ + "owner": [ + "bridge103n4cmjt2je8nqcxg9y9desyhy6m57u52kkuc4", + "bridge10awan8e059lkt7ejyu6qlkwwngs6yxxe4x5lhslpdvqlcmy3nrasd6zl5f" + ], + "pagination": { + "next_key": null, + "total": "2" + } +} +``` + +#### owner + +The `owner` endpoint allow users to query the nfts by holder address + +```sh +/cosmos/nfts/{address} +``` + +Example: + +```sh +curl -X GET "https://rpc-api.node1.devnet.bridgeless.com/cosmos/nfts/bridge100mehmdwp8kwlj7aak450cu02u9d32cza95yrv8q776sytjfg3mstssj37" -H "accept: application/json" +``` + +Example Output: + +``` +{ + "nft": { + "address": "bridge100mehmdwp8kwlj7aak450cu02u9d32cza95yrv8q776sytjfg3mstssj37", + "owner": "bridge103n4cmjt2je8nqcxg9y9desyhy6m57u52kkuc4", + "uri": "", + "vesting_period": "86400", + "reward_per_period": { + "denom": "abridge", + "amount": "800000000000000000000" + }, + "vesting_periods_count": "100", + "available_to_withdraw": { + "denom": "abridge", + "amount": "0" + }, + "last_vesting_time": "1722262887", + "vesting_counter": "2", + "denom": "abridge" + } +} +``` + + +## Message + +```protobuf +service Msg { + rpc Send(MsgSend) returns (MsgSendResponse); + + rpc Withdraw (MsgWithdrawal) returns (MsgWithdrawalResponse); + + rpc Undelegate(MsgUndelegate) returns (MsgUndelegateResponse); + + rpc Delegate(MsgDelegate) returns (MsgDelegateResponse); + + rpc Redelegate ( MsgRedelegate) returns (MsgRedelegateResponse); +} +``` + +#### Send + +This message is used to change a nft owner +```protobuf +message MsgSend { + string creator = 1; + string address = 2; + string recipient = 3; + cosmos.base.v1beta1.Coin amount = 5 [(gogoproto.nullable) = false]; +} + +message MsgSendResponse {} +``` + +#### Withdrawal + +This message is used to withdraw available(unlocked) nft amount + +```protobuf +message MsgWithdrawal { + string creator = 1; + string address = 2; + cosmos.base.v1beta1.Coin amount = 5 [(gogoproto.nullable) = false]; +} + +message MsgWithdrawalResponse {} +``` + +#### Delegate + +This message is used to stake tokens from nft balance to a validator + +```protobuf +message MsgDelegate { + string creator = 1; + string address = 2; + string validator = 3; + cosmos.base.v1beta1.Coin amount = 5 [(gogoproto.nullable) = false]; +} + +message MsgDelegateResponse {} +``` + +#### Undelegate + +This message is used to unstake tokens from nft balance to a validator + +```protobuf + +message MsgUndelegate { + string creator = 1; + string address = 2; + string validator = 3; + cosmos.base.v1beta1.Coin amount = 5 [(gogoproto.nullable) = false]; +} + +message MsgUndelegateResponse {} +``` \ No newline at end of file diff --git a/x/nft/spec/README.md b/x/nft/spec/README.md new file mode 100644 index 000000000..d84864d01 --- /dev/null +++ b/x/nft/spec/README.md @@ -0,0 +1,16 @@ + + +# `nft` + +## Contents + +1. **[Concept](01_concepts.md)** +2. **[State](02_state.md)** +3. **[End-Block](03_end_block.md)** +4. **[Client](04_client.md)** + diff --git a/x/nft/types/tx.pb.go b/x/nft/types/tx.pb.go index 03319dd0d..211faf80d 100644 --- a/x/nft/types/tx.pb.go +++ b/x/nft/types/tx.pb.go @@ -567,40 +567,40 @@ func init() { func init() { proto.RegisterFile("cosmos/nft/tx.proto", fileDescriptor_5e5808dbd8674559) } var fileDescriptor_5e5808dbd8674559 = []byte{ - // 516 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x54, 0xbf, 0x6f, 0xd3, 0x40, - 0x14, 0x8e, 0xdb, 0xd0, 0x1f, 0xaf, 0x20, 0x44, 0x42, 0x15, 0xd7, 0x20, 0xa7, 0x64, 0xca, 0x82, - 0xad, 0x96, 0x01, 0xe6, 0xd0, 0x01, 0x21, 0xa5, 0x43, 0x2a, 0x84, 0xc4, 0x76, 0xb6, 0x5f, 0xae, - 0x16, 0xf1, 0x9d, 0xe5, 0xbb, 0x34, 0xad, 0xc4, 0x1f, 0xc1, 0xc0, 0x80, 0xf8, 0x7b, 0x18, 0x3a, - 0x76, 0x64, 0x42, 0x28, 0x19, 0xf8, 0x37, 0x90, 0xed, 0xf3, 0x39, 0xb1, 0xe9, 0x92, 0x2e, 0x9d, - 0xec, 0x7b, 0xdf, 0xe7, 0xe7, 0xef, 0xfb, 0xee, 0xee, 0x41, 0xdb, 0xe7, 0x22, 0xe2, 0xc2, 0x65, - 0x63, 0xe9, 0xca, 0x4b, 0x27, 0x4e, 0xb8, 0xe4, 0x2d, 0xc8, 0x8b, 0x0e, 0x1b, 0x4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, 0x7c, 0xea, 0xd3, 0x50, 0x9e, 0x4f, 0x3d, 0xc7, - 0xe7, 0x91, 0xab, 0x66, 0x69, 0xfe, 0x78, 0x29, 0x82, 0xcf, 0xee, 0x65, 0x3e, 0xd0, 0xaf, 0x62, - 0x14, 0xde, 0x56, 0x36, 0x3d, 0x5f, 0xfd, 0x0b, 0x00, 0x00, 0xff, 0xff, 0xda, 0xc0, 0x32, 0x96, - 0xeb, 0x05, 0x00, 0x00, + // 517 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x94, 0x4d, 0x6f, 0xd3, 0x4c, + 0x10, 0xc7, 0xe3, 0x36, 0x4f, 0x5f, 0xa6, 0x0f, 0x42, 0x38, 0x54, 0x71, 0x0c, 0x72, 0x4a, 0x4e, + 0xb9, 0xe0, 0x55, 0xcb, 0x01, 0xce, 0xa1, 0x07, 0x84, 0x94, 0x1e, 0x52, 0x21, 0x24, 0x6e, 0x6b, + 0x7b, 0xb2, 0xb5, 0x88, 0x77, 0x2d, 0xef, 0xa6, 0x69, 0x25, 0x3e, 0x04, 0x07, 0x0e, 0x88, 0xcf, + 0xc3, 0xa1, 0xc7, 0x1e, 0x39, 0x21, 0x94, 0x1c, 0xf8, 0x1a, 0x28, 0xf6, 0xfa, 0x25, 0x0e, 0xbd, + 0xa4, 0x17, 0x4e, 0xf1, 0xce, 0xff, 0x9f, 0xd9, 0xdf, 0xcc, 0xee, 0x0e, 0xb4, 0x7c, 0x21, 0x23, + 0x21, 0x09, 0x1f, 0x2b, 0xa2, 0xae, 0xdc, 0x38, 0x11, 0x4a, 0x98, 0x90, 0x05, 0x5d, 0x3e, 0x56, + 0xb6, 0xa3, 0x0d, 0x1e, 0x95, 0x48, 0x2e, 0x8f, 0x3d, 0x54, 0xf4, 0x98, 0xf8, 0x22, 0xe4, 0x99, + 0xd7, 0xee, 0x32, 0x21, 0xd8, 0x04, 0x49, 0xba, 0xf2, 0xa6, 0x63, 0xa2, 0xc2, 0x08, 0xa5, 0xa2, + 0x51, 0xac, 0x0d, 0x8f, 0x99, 0x60, 0x22, 0xfd, 0x24, 0xcb, 0x2f, 0x1d, 0x6d, 0x57, 0xf6, 0x8d, + 0x69, 0x42, 0x23, 0xa9, 0x85, 0x4e, 0x3d, 0x1f, 0xe5, 0xd7, 0x99, 0xd4, 0xfb, 0x04, 0x0f, 0x86, + 0x92, 0xbd, 0x0f, 0xd5, 0x45, 0x90, 0xd0, 0x19, 0x9d, 0x98, 0x16, 0xec, 0xfa, 0x09, 0x52, 0x25, + 0x12, 0xcb, 0x38, 0x32, 0xfa, 0xfb, 0xa3, 0x7c, 0xb9, 0x54, 0x68, 0x10, 0x24, 0x28, 0xa5, 0xb5, + 0x95, 0x29, 0x7a, 0x69, 0xbe, 0x84, 0x1d, 0x1a, 0x89, 0x29, 0x57, 0xd6, 0x7f, 0x47, 0x46, 0xff, + 0xe0, 0xa4, 0xe3, 0xea, 0x62, 0x97, 0x05, 0xba, 0xba, 0x40, 0xf7, 0xb5, 0x08, 0xf9, 0xa0, 0x79, + 0xf3, 0xb3, 0xdb, 0x18, 0x69, 0x7b, 0xaf, 0x0d, 0x87, 0x2b, 0xbb, 0x8f, 0x50, 0xc6, 0x82, 0x4b, + 0xec, 0x7d, 0x35, 0xe0, 0x60, 0x28, 0xd9, 0x29, 0x4e, 0x90, 0x51, 0x85, 0x1b, 0x51, 0x3d, 0x85, + 0xfd, 0x4b, 0x3a, 0x09, 0x83, 0xf4, 0x5f, 0xdb, 0xa9, 0x56, 0x06, 0x36, 0x67, 0x3e, 0x84, 0x56, + 0x85, 0xac, 0x20, 0xfe, 0x66, 0xa4, 0x9d, 0x7c, 0xc7, 0x83, 0x7f, 0x90, 0x39, 0xeb, 0x73, 0xc9, + 0x56, 0x50, 0x7f, 0x31, 0x60, 0x77, 0x28, 0xd9, 0x39, 0xf2, 0x60, 0x53, 0xde, 0x04, 0xfd, 0x30, + 0x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0xf3, 0xc5, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x15, 0x59, 0x4c, + 0x9e, 0xeb, 0x05, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -615,12 +615,10 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type MsgClient interface { - // Balance queries the number of NFTs of a given class owned by the owner, same as balanceOf in ERC721 - Undelegate(ctx context.Context, in *MsgUndelegate, opts ...grpc.CallOption) (*MsgUndelegateResponse, error) - Delegate(ctx context.Context, in *MsgDelegate, opts ...grpc.CallOption) (*MsgDelegateResponse, error) - // Class queries an NFT class based on its id Send(ctx context.Context, in *MsgSend, opts ...grpc.CallOption) (*MsgSendResponse, error) Withdraw(ctx context.Context, in *MsgWithdrawal, opts ...grpc.CallOption) (*MsgWithdrawalResponse, error) + Undelegate(ctx context.Context, in *MsgUndelegate, opts ...grpc.CallOption) (*MsgUndelegateResponse, error) + Delegate(ctx context.Context, in *MsgDelegate, opts ...grpc.CallOption) (*MsgDelegateResponse, error) Redelegate(ctx context.Context, in *MsgRedelegate, opts ...grpc.CallOption) (*MsgRedelegateResponse, error) } @@ -632,36 +630,36 @@ func NewMsgClient(cc grpc1.ClientConn) MsgClient { return &msgClient{cc} } -func (c *msgClient) Undelegate(ctx context.Context, in *MsgUndelegate, opts ...grpc.CallOption) (*MsgUndelegateResponse, error) { - out := new(MsgUndelegateResponse) - err := c.cc.Invoke(ctx, "/cosmos.nft.Msg/Undelegate", in, out, opts...) +func (c *msgClient) Send(ctx context.Context, in *MsgSend, opts ...grpc.CallOption) (*MsgSendResponse, error) { + out := new(MsgSendResponse) + err := c.cc.Invoke(ctx, "/cosmos.nft.Msg/Send", in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *msgClient) Delegate(ctx context.Context, in *MsgDelegate, opts ...grpc.CallOption) (*MsgDelegateResponse, error) { - out := new(MsgDelegateResponse) - err := c.cc.Invoke(ctx, "/cosmos.nft.Msg/Delegate", in, out, opts...) +func (c *msgClient) Withdraw(ctx context.Context, in *MsgWithdrawal, opts ...grpc.CallOption) (*MsgWithdrawalResponse, error) { + out := new(MsgWithdrawalResponse) + err := c.cc.Invoke(ctx, "/cosmos.nft.Msg/Withdraw", in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *msgClient) Send(ctx context.Context, in *MsgSend, opts ...grpc.CallOption) (*MsgSendResponse, error) { - out := new(MsgSendResponse) - err := c.cc.Invoke(ctx, "/cosmos.nft.Msg/Send", in, out, opts...) +func (c *msgClient) Undelegate(ctx context.Context, in *MsgUndelegate, opts ...grpc.CallOption) (*MsgUndelegateResponse, error) { + out := new(MsgUndelegateResponse) + err := c.cc.Invoke(ctx, "/cosmos.nft.Msg/Undelegate", in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *msgClient) Withdraw(ctx context.Context, in *MsgWithdrawal, opts ...grpc.CallOption) (*MsgWithdrawalResponse, error) { - out := new(MsgWithdrawalResponse) - err := c.cc.Invoke(ctx, "/cosmos.nft.Msg/Withdraw", in, out, opts...) +func (c *msgClient) Delegate(ctx context.Context, in *MsgDelegate, opts ...grpc.CallOption) (*MsgDelegateResponse, error) { + out := new(MsgDelegateResponse) + err := c.cc.Invoke(ctx, "/cosmos.nft.Msg/Delegate", in, out, opts...) if err != nil { return nil, err } @@ -679,12 +677,10 @@ func (c *msgClient) Redelegate(ctx context.Context, in *MsgRedelegate, opts ...g // MsgServer is the server API for Msg service. type MsgServer interface { - // Balance queries the number of NFTs of a given class owned by the owner, same as balanceOf in ERC721 - Undelegate(context.Context, *MsgUndelegate) (*MsgUndelegateResponse, error) - Delegate(context.Context, *MsgDelegate) (*MsgDelegateResponse, error) - // Class queries an NFT class based on its id Send(context.Context, *MsgSend) (*MsgSendResponse, error) Withdraw(context.Context, *MsgWithdrawal) (*MsgWithdrawalResponse, error) + Undelegate(context.Context, *MsgUndelegate) (*MsgUndelegateResponse, error) + Delegate(context.Context, *MsgDelegate) (*MsgDelegateResponse, error) Redelegate(context.Context, *MsgRedelegate) (*MsgRedelegateResponse, error) } @@ -692,18 +688,18 @@ type MsgServer interface { type UnimplementedMsgServer struct { } -func (*UnimplementedMsgServer) Undelegate(ctx context.Context, req *MsgUndelegate) (*MsgUndelegateResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Undelegate not implemented") -} -func (*UnimplementedMsgServer) Delegate(ctx context.Context, req *MsgDelegate) (*MsgDelegateResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Delegate not implemented") -} func (*UnimplementedMsgServer) Send(ctx context.Context, req *MsgSend) (*MsgSendResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Send not implemented") } func (*UnimplementedMsgServer) Withdraw(ctx context.Context, req *MsgWithdrawal) (*MsgWithdrawalResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Withdraw not implemented") } +func (*UnimplementedMsgServer) Undelegate(ctx context.Context, req *MsgUndelegate) (*MsgUndelegateResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Undelegate not implemented") +} +func (*UnimplementedMsgServer) Delegate(ctx context.Context, req *MsgDelegate) (*MsgDelegateResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Delegate not implemented") +} func (*UnimplementedMsgServer) Redelegate(ctx context.Context, req *MsgRedelegate) (*MsgRedelegateResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Redelegate not implemented") } @@ -712,74 +708,74 @@ func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) } -func _Msg_Undelegate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgUndelegate) +func _Msg_Send_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgSend) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(MsgServer).Undelegate(ctx, in) + return srv.(MsgServer).Send(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/cosmos.nft.Msg/Undelegate", + FullMethod: "/cosmos.nft.Msg/Send", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).Undelegate(ctx, req.(*MsgUndelegate)) + return srv.(MsgServer).Send(ctx, req.(*MsgSend)) } return interceptor(ctx, in, info, handler) } -func _Msg_Delegate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgDelegate) +func _Msg_Withdraw_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgWithdrawal) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(MsgServer).Delegate(ctx, in) + return srv.(MsgServer).Withdraw(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/cosmos.nft.Msg/Delegate", + FullMethod: "/cosmos.nft.Msg/Withdraw", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).Delegate(ctx, req.(*MsgDelegate)) + return srv.(MsgServer).Withdraw(ctx, req.(*MsgWithdrawal)) } return interceptor(ctx, in, info, handler) } -func _Msg_Send_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgSend) +func _Msg_Undelegate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUndelegate) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(MsgServer).Send(ctx, in) + return srv.(MsgServer).Undelegate(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/cosmos.nft.Msg/Send", + FullMethod: "/cosmos.nft.Msg/Undelegate", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).Send(ctx, req.(*MsgSend)) + return srv.(MsgServer).Undelegate(ctx, req.(*MsgUndelegate)) } return interceptor(ctx, in, info, handler) } -func _Msg_Withdraw_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgWithdrawal) +func _Msg_Delegate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgDelegate) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(MsgServer).Withdraw(ctx, in) + return srv.(MsgServer).Delegate(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/cosmos.nft.Msg/Withdraw", + FullMethod: "/cosmos.nft.Msg/Delegate", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).Withdraw(ctx, req.(*MsgWithdrawal)) + return srv.(MsgServer).Delegate(ctx, req.(*MsgDelegate)) } return interceptor(ctx, in, info, handler) } @@ -806,14 +802,6 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "cosmos.nft.Msg", HandlerType: (*MsgServer)(nil), Methods: []grpc.MethodDesc{ - { - MethodName: "Undelegate", - Handler: _Msg_Undelegate_Handler, - }, - { - MethodName: "Delegate", - Handler: _Msg_Delegate_Handler, - }, { MethodName: "Send", Handler: _Msg_Send_Handler, @@ -822,6 +810,14 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "Withdraw", Handler: _Msg_Withdraw_Handler, }, + { + MethodName: "Undelegate", + Handler: _Msg_Undelegate_Handler, + }, + { + MethodName: "Delegate", + Handler: _Msg_Delegate_Handler, + }, { MethodName: "Redelegate", Handler: _Msg_Redelegate_Handler,