Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

LSM Distribution #18

Merged
merged 13 commits into from
Jul 10, 2023
113 changes: 112 additions & 1 deletion docs/core/proto-docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@
- [DelegatorStartingInfo](#cosmos.distribution.v1beta1.DelegatorStartingInfo)
- [FeePool](#cosmos.distribution.v1beta1.FeePool)
- [Params](#cosmos.distribution.v1beta1.Params)
- [TokenizeShareRecordReward](#cosmos.distribution.v1beta1.TokenizeShareRecordReward)
- [ValidatorAccumulatedCommission](#cosmos.distribution.v1beta1.ValidatorAccumulatedCommission)
- [ValidatorCurrentRewards](#cosmos.distribution.v1beta1.ValidatorCurrentRewards)
- [ValidatorHistoricalRewards](#cosmos.distribution.v1beta1.ValidatorHistoricalRewards)
Expand Down Expand Up @@ -282,6 +283,8 @@
- [QueryDelegatorWithdrawAddressResponse](#cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressResponse)
- [QueryParamsRequest](#cosmos.distribution.v1beta1.QueryParamsRequest)
- [QueryParamsResponse](#cosmos.distribution.v1beta1.QueryParamsResponse)
- [QueryTokenizeShareRecordRewardRequest](#cosmos.distribution.v1beta1.QueryTokenizeShareRecordRewardRequest)
- [QueryTokenizeShareRecordRewardResponse](#cosmos.distribution.v1beta1.QueryTokenizeShareRecordRewardResponse)
- [QueryValidatorCommissionRequest](#cosmos.distribution.v1beta1.QueryValidatorCommissionRequest)
- [QueryValidatorCommissionResponse](#cosmos.distribution.v1beta1.QueryValidatorCommissionResponse)
- [QueryValidatorOutstandingRewardsRequest](#cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsRequest)
Expand All @@ -296,8 +299,12 @@
- [MsgFundCommunityPoolResponse](#cosmos.distribution.v1beta1.MsgFundCommunityPoolResponse)
- [MsgSetWithdrawAddress](#cosmos.distribution.v1beta1.MsgSetWithdrawAddress)
- [MsgSetWithdrawAddressResponse](#cosmos.distribution.v1beta1.MsgSetWithdrawAddressResponse)
- [MsgWithdrawAllTokenizeShareRecordReward](#cosmos.distribution.v1beta1.MsgWithdrawAllTokenizeShareRecordReward)
- [MsgWithdrawAllTokenizeShareRecordRewardResponse](#cosmos.distribution.v1beta1.MsgWithdrawAllTokenizeShareRecordRewardResponse)
- [MsgWithdrawDelegatorReward](#cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward)
- [MsgWithdrawDelegatorRewardResponse](#cosmos.distribution.v1beta1.MsgWithdrawDelegatorRewardResponse)
- [MsgWithdrawTokenizeShareRecordReward](#cosmos.distribution.v1beta1.MsgWithdrawTokenizeShareRecordReward)
- [MsgWithdrawTokenizeShareRecordRewardResponse](#cosmos.distribution.v1beta1.MsgWithdrawTokenizeShareRecordRewardResponse)
- [MsgWithdrawValidatorCommission](#cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission)
- [MsgWithdrawValidatorCommissionResponse](#cosmos.distribution.v1beta1.MsgWithdrawValidatorCommissionResponse)

Expand Down Expand Up @@ -3920,6 +3927,22 @@ Params defines the set of params for the distribution module.



<a name="cosmos.distribution.v1beta1.TokenizeShareRecordReward"></a>

### TokenizeShareRecordReward
TokenizeShareRecordReward represents the properties of tokenize share


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `record_id` | [uint64](#uint64) | | |
| `reward` | [cosmos.base.v1beta1.DecCoin](#cosmos.base.v1beta1.DecCoin) | repeated | |






<a name="cosmos.distribution.v1beta1.ValidatorAccumulatedCommission"></a>

### ValidatorAccumulatedCommission
Expand Down Expand Up @@ -4389,6 +4412,39 @@ QueryParamsResponse is the response type for the Query/Params RPC method.



<a name="cosmos.distribution.v1beta1.QueryTokenizeShareRecordRewardRequest"></a>

### QueryTokenizeShareRecordRewardRequest
QueryTokenizeShareRecordRewardRequest is the request type for the Query/TokenizeShareRecordReward RPC
method.


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






<a name="cosmos.distribution.v1beta1.QueryTokenizeShareRecordRewardResponse"></a>

### QueryTokenizeShareRecordRewardResponse
QueryTokenizeShareRecordRewardResponse is the response type for the Query/TokenizeShareRecordReward
RPC method.


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `rewards` | [TokenizeShareRecordReward](#cosmos.distribution.v1beta1.TokenizeShareRecordReward) | repeated | rewards defines all the rewards accrued by a delegator. |
| `total` | [cosmos.base.v1beta1.DecCoin](#cosmos.base.v1beta1.DecCoin) | repeated | total defines the sum of all the rewards. |






<a name="cosmos.distribution.v1beta1.QueryValidatorCommissionRequest"></a>

### QueryValidatorCommissionRequest
Expand Down Expand Up @@ -4511,6 +4567,7 @@ Query defines the gRPC querier service for distribution module.
| `DelegatorValidators` | [QueryDelegatorValidatorsRequest](#cosmos.distribution.v1beta1.QueryDelegatorValidatorsRequest) | [QueryDelegatorValidatorsResponse](#cosmos.distribution.v1beta1.QueryDelegatorValidatorsResponse) | DelegatorValidators queries the validators of a delegator. | GET|/cosmos/distribution/v1beta1/delegators/{delegator_address}/validators|
| `DelegatorWithdrawAddress` | [QueryDelegatorWithdrawAddressRequest](#cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressRequest) | [QueryDelegatorWithdrawAddressResponse](#cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressResponse) | DelegatorWithdrawAddress queries withdraw address of a delegator. | GET|/cosmos/distribution/v1beta1/delegators/{delegator_address}/withdraw_address|
| `CommunityPool` | [QueryCommunityPoolRequest](#cosmos.distribution.v1beta1.QueryCommunityPoolRequest) | [QueryCommunityPoolResponse](#cosmos.distribution.v1beta1.QueryCommunityPoolResponse) | CommunityPool queries the community pool coins. | GET|/cosmos/distribution/v1beta1/community_pool|
| `TokenizeShareRecordReward` | [QueryTokenizeShareRecordRewardRequest](#cosmos.distribution.v1beta1.QueryTokenizeShareRecordRewardRequest) | [QueryTokenizeShareRecordRewardResponse](#cosmos.distribution.v1beta1.QueryTokenizeShareRecordRewardResponse) | TokenizeShareRecordReward queries the tokenize share record rewards | GET|/cosmos/distribution/v1beta1/{owner_address}/tokenize_share_record_rewards|

<!-- end services -->

Expand Down Expand Up @@ -4577,6 +4634,32 @@ MsgSetWithdrawAddressResponse defines the Msg/SetWithdrawAddress response type.



<a name="cosmos.distribution.v1beta1.MsgWithdrawAllTokenizeShareRecordReward"></a>

### MsgWithdrawAllTokenizeShareRecordReward
MsgWithdrawAllTokenizeShareRecordReward withdraws tokenize share rewards or all
records owned by the designated owner


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






<a name="cosmos.distribution.v1beta1.MsgWithdrawAllTokenizeShareRecordRewardResponse"></a>

### MsgWithdrawAllTokenizeShareRecordRewardResponse
MsgWithdrawAllTokenizeShareRecordRewardResponse defines the Msg/WithdrawTokenizeShareRecordReward response type.






<a name="cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward"></a>

### MsgWithdrawDelegatorReward
Expand Down Expand Up @@ -4604,6 +4687,32 @@ MsgWithdrawDelegatorRewardResponse defines the Msg/WithdrawDelegatorReward respo



<a name="cosmos.distribution.v1beta1.MsgWithdrawTokenizeShareRecordReward"></a>

### MsgWithdrawTokenizeShareRecordReward
MsgWithdrawTokenizeShareRecordReward withdraws tokenize share rewards for a specific record


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `owner_address` | [string](#string) | | |
| `record_id` | [uint64](#uint64) | | |






<a name="cosmos.distribution.v1beta1.MsgWithdrawTokenizeShareRecordRewardResponse"></a>

### MsgWithdrawTokenizeShareRecordRewardResponse
MsgWithdrawTokenizeShareRecordReward defines the Msg/WithdrawTokenizeShareRecordReward response type.






<a name="cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission"></a>

### MsgWithdrawValidatorCommission
Expand Down Expand Up @@ -4646,6 +4755,8 @@ Msg defines the distribution Msg service.
| `SetWithdrawAddress` | [MsgSetWithdrawAddress](#cosmos.distribution.v1beta1.MsgSetWithdrawAddress) | [MsgSetWithdrawAddressResponse](#cosmos.distribution.v1beta1.MsgSetWithdrawAddressResponse) | SetWithdrawAddress defines a method to change the withdraw address for a delegator (or validator self-delegation). | |
| `WithdrawDelegatorReward` | [MsgWithdrawDelegatorReward](#cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward) | [MsgWithdrawDelegatorRewardResponse](#cosmos.distribution.v1beta1.MsgWithdrawDelegatorRewardResponse) | WithdrawDelegatorReward defines a method to withdraw rewards of delegator from a single validator. | |
| `WithdrawValidatorCommission` | [MsgWithdrawValidatorCommission](#cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission) | [MsgWithdrawValidatorCommissionResponse](#cosmos.distribution.v1beta1.MsgWithdrawValidatorCommissionResponse) | WithdrawValidatorCommission defines a method to withdraw the full commission to the validator address. | |
| `WithdrawTokenizeShareRecordReward` | [MsgWithdrawTokenizeShareRecordReward](#cosmos.distribution.v1beta1.MsgWithdrawTokenizeShareRecordReward) | [MsgWithdrawTokenizeShareRecordRewardResponse](#cosmos.distribution.v1beta1.MsgWithdrawTokenizeShareRecordRewardResponse) | WithdrawTokenizeShareRecordReward defines a method to withdraw reward for an owning TokenizeShareRecord | |
| `WithdrawAllTokenizeShareRecordReward` | [MsgWithdrawAllTokenizeShareRecordReward](#cosmos.distribution.v1beta1.MsgWithdrawAllTokenizeShareRecordReward) | [MsgWithdrawAllTokenizeShareRecordRewardResponse](#cosmos.distribution.v1beta1.MsgWithdrawAllTokenizeShareRecordRewardResponse) | WithdrawAllTokenizeShareRecordReward defines a method to withdraw reward for all owning TokenizeShareRecord | |
| `FundCommunityPool` | [MsgFundCommunityPool](#cosmos.distribution.v1beta1.MsgFundCommunityPool) | [MsgFundCommunityPoolResponse](#cosmos.distribution.v1beta1.MsgFundCommunityPoolResponse) | FundCommunityPool defines a method to allow an account to directly fund the community pool. | |

<!-- end services -->
Expand Down Expand Up @@ -7855,7 +7966,7 @@ Query defines the gRPC querier service.
| `Params` | [QueryParamsRequest](#cosmos.staking.v1beta1.QueryParamsRequest) | [QueryParamsResponse](#cosmos.staking.v1beta1.QueryParamsResponse) | Parameters queries the staking parameters. | GET|/cosmos/staking/v1beta1/params|
| `TokenizeShareRecordById` | [QueryTokenizeShareRecordByIdRequest](#cosmos.staking.v1beta1.QueryTokenizeShareRecordByIdRequest) | [QueryTokenizeShareRecordByIdResponse](#cosmos.staking.v1beta1.QueryTokenizeShareRecordByIdResponse) | Query for individual tokenize share record information by share by id | GET|/cosmos/staking/v1beta1/tokenize_share_record_by_id/{id}|
| `TokenizeShareRecordByDenom` | [QueryTokenizeShareRecordByDenomRequest](#cosmos.staking.v1beta1.QueryTokenizeShareRecordByDenomRequest) | [QueryTokenizeShareRecordByDenomResponse](#cosmos.staking.v1beta1.QueryTokenizeShareRecordByDenomResponse) | Query for individual tokenize share record information by share denom | GET|/cosmos/staking/v1beta1/tokenize_share_record_by_denom/{denom}|
| `TokenizeShareRecordsOwned` | [QueryTokenizeShareRecordsOwnedRequest](#cosmos.staking.v1beta1.QueryTokenizeShareRecordsOwnedRequest) | [QueryTokenizeShareRecordsOwnedResponse](#cosmos.staking.v1beta1.QueryTokenizeShareRecordsOwnedResponse) | Query tokenize share records by address | GET|/cosmos/staking/v1beta1/tokenize_share_record_by_owner/{owner}|
| `TokenizeShareRecordsOwned` | [QueryTokenizeShareRecordsOwnedRequest](#cosmos.staking.v1beta1.QueryTokenizeShareRecordsOwnedRequest) | [QueryTokenizeShareRecordsOwnedResponse](#cosmos.staking.v1beta1.QueryTokenizeShareRecordsOwnedResponse) | Query tokenize share records by address | GET|/cosmos/staking/v1beta1/tokenize_share_record_owned/{owner}|
| `AllTokenizeShareRecords` | [QueryAllTokenizeShareRecordsRequest](#cosmos.staking.v1beta1.QueryAllTokenizeShareRecordsRequest) | [QueryAllTokenizeShareRecordsResponse](#cosmos.staking.v1beta1.QueryAllTokenizeShareRecordsResponse) | Query for all tokenize share records | GET|/cosmos/staking/v1beta1/tokenize_share_records|
| `LastTokenizeShareRecordId` | [QueryLastTokenizeShareRecordIdRequest](#cosmos.staking.v1beta1.QueryLastTokenizeShareRecordIdRequest) | [QueryLastTokenizeShareRecordIdResponse](#cosmos.staking.v1beta1.QueryLastTokenizeShareRecordIdResponse) | Query for last tokenize share record id | GET|/cosmos/staking/v1beta1/last_tokenize_share_record_id|
| `TotalTokenizeSharedAssets` | [QueryTotalTokenizeSharedAssetsRequest](#cosmos.staking.v1beta1.QueryTotalTokenizeSharedAssetsRequest) | [QueryTotalTokenizeSharedAssetsResponse](#cosmos.staking.v1beta1.QueryTotalTokenizeSharedAssetsResponse) | Query for total tokenized staked assets | GET|/cosmos/staking/v1beta1/total_tokenize_shared_assets|
Expand Down
11 changes: 11 additions & 0 deletions proto/cosmos/distribution/v1beta1/distribution.proto
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,17 @@ message DelegationDelegatorReward {
[(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins", (gogoproto.nullable) = false];
}

// TokenizeShareRecordReward represents the properties of tokenize share
message TokenizeShareRecordReward {
option (gogoproto.goproto_getters) = false;
option (gogoproto.goproto_stringer) = true;

uint64 record_id = 1;

repeated cosmos.base.v1beta1.DecCoin reward = 2
[(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins", (gogoproto.nullable) = false];
}

// CommunityPoolSpendProposalWithDeposit defines a CommunityPoolSpendProposal
// with a deposit
message CommunityPoolSpendProposalWithDeposit {
Expand Down
25 changes: 25 additions & 0 deletions proto/cosmos/distribution/v1beta1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ service Query {
rpc CommunityPool(QueryCommunityPoolRequest) returns (QueryCommunityPoolResponse) {
option (google.api.http).get = "/cosmos/distribution/v1beta1/community_pool";
}

// TokenizeShareRecordReward queries the tokenize share record rewards
rpc TokenizeShareRecordReward(QueryTokenizeShareRecordRewardRequest)
returns (QueryTokenizeShareRecordRewardResponse) {
option (google.api.http).get = "/cosmos/distribution/v1beta1/{owner_address}/tokenize_share_record_rewards";
}
}

// QueryParamsRequest is the request type for the Query/Params RPC method.
Expand Down Expand Up @@ -216,3 +222,22 @@ message QueryCommunityPoolResponse {
repeated cosmos.base.v1beta1.DecCoin pool = 1
[(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins", (gogoproto.nullable) = false];
}

// QueryTokenizeShareRecordRewardRequest is the request type for the Query/TokenizeShareRecordReward RPC
// method.
message QueryTokenizeShareRecordRewardRequest {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;

string owner_address = 1 [(gogoproto.moretags) = "yaml:\"owner_address\""];
}

// QueryTokenizeShareRecordRewardResponse is the response type for the Query/TokenizeShareRecordReward
// RPC method.
message QueryTokenizeShareRecordRewardResponse {
// rewards defines all the rewards accrued by a delegator.
repeated TokenizeShareRecordReward rewards = 1 [(gogoproto.nullable) = false];
// total defines the sum of all the rewards.
repeated cosmos.base.v1beta1.DecCoin total = 2
[(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins"];
}
32 changes: 32 additions & 0 deletions proto/cosmos/distribution/v1beta1/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ service Msg {
// full commission to the validator address.
rpc WithdrawValidatorCommission(MsgWithdrawValidatorCommission) returns (MsgWithdrawValidatorCommissionResponse);

// WithdrawTokenizeShareRecordReward defines a method to withdraw reward for an owning TokenizeShareRecord
rpc WithdrawTokenizeShareRecordReward(MsgWithdrawTokenizeShareRecordReward)
returns (MsgWithdrawTokenizeShareRecordRewardResponse);

// WithdrawAllTokenizeShareRecordReward defines a method to withdraw reward for all owning TokenizeShareRecord
rpc WithdrawAllTokenizeShareRecordReward(MsgWithdrawAllTokenizeShareRecordReward)
returns (MsgWithdrawAllTokenizeShareRecordRewardResponse);

// FundCommunityPool defines a method to allow an account to directly
// fund the community pool.
rpc FundCommunityPool(MsgFundCommunityPool) returns (MsgFundCommunityPoolResponse);
Expand Down Expand Up @@ -64,6 +72,30 @@ message MsgWithdrawValidatorCommission {
// MsgWithdrawValidatorCommissionResponse defines the Msg/WithdrawValidatorCommission response type.
message MsgWithdrawValidatorCommissionResponse {}

// MsgWithdrawTokenizeShareRecordReward withdraws tokenize share rewards for a specific record
message MsgWithdrawTokenizeShareRecordReward {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;

string owner_address = 1 [(gogoproto.moretags) = "yaml:\"owner_address\""];
uint64 record_id = 2;
}

// MsgWithdrawTokenizeShareRecordReward defines the Msg/WithdrawTokenizeShareRecordReward response type.
message MsgWithdrawTokenizeShareRecordRewardResponse {}

// MsgWithdrawAllTokenizeShareRecordReward withdraws tokenize share rewards or all
// records owned by the designated owner
message MsgWithdrawAllTokenizeShareRecordReward {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;

string owner_address = 1 [(gogoproto.moretags) = "yaml:\"owner_address\""];
}

// MsgWithdrawAllTokenizeShareRecordRewardResponse defines the Msg/WithdrawTokenizeShareRecordReward response type.
message MsgWithdrawAllTokenizeShareRecordRewardResponse {}

// MsgFundCommunityPool allows an account to directly
// fund the community pool.
message MsgFundCommunityPool {
Expand Down
2 changes: 1 addition & 1 deletion proto/cosmos/staking/v1beta1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ service Query {
// Query tokenize share records by address
rpc TokenizeShareRecordsOwned(QueryTokenizeShareRecordsOwnedRequest)
returns (QueryTokenizeShareRecordsOwnedResponse) {
option (google.api.http).get = "/cosmos/staking/v1beta1/tokenize_share_record_by_owner/{owner}";
option (google.api.http).get = "/cosmos/staking/v1beta1/tokenize_share_record_owned/{owner}";
}

// Query for all tokenize share records
Expand Down
3 changes: 1 addition & 2 deletions proto/cosmos/staking/v1beta1/staking.proto
Original file line number Diff line number Diff line change
Expand Up @@ -405,8 +405,7 @@ message ValidatorUpdates {

// TokenizeShareRecord represents a tokenized delegation
message TokenizeShareRecord {
option (gogoproto.description) = true;
option (gogoproto.equal) = true;
option (gogoproto.equal) = true;

uint64 id = 1;
string owner = 2;
Expand Down
Loading