Skip to content

Commit

Permalink
add ics & lsm
Browse files Browse the repository at this point in the history
  • Loading branch information
ctrl-Felix committed Nov 27, 2023
1 parent 66ef45b commit 359a461
Show file tree
Hide file tree
Showing 9 changed files with 467 additions and 22 deletions.
2 changes: 1 addition & 1 deletion configs/cosmos.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"https://github.com/cosmos/cosmos-sdk.git": {
"include": true,
"branch": "v0.45.16-ics",
"branch": "v0.45.16-ics-lsm",
"paths": ["proto/cosmos"]
},
"https://github.com/cometbft/cometbft.git": {
Expand Down
22 changes: 11 additions & 11 deletions src/cosmospy_protobuf/cosmos/base/store/v1beta1/listening.proto
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ message StoreKVPair {
// BlockMetadata contains all the abci event data of a block
// the file streamer dump them into files together with the state changes.
message BlockMetadata {
// DeliverTx encapulate deliver tx request and response.
message DeliverTx {
tendermint.abci.RequestDeliverTx request = 1;
tendermint.abci.ResponseDeliverTx response = 2;
}
tendermint.abci.RequestBeginBlock request_begin_block = 1;
tendermint.abci.ResponseBeginBlock response_begin_block = 2;
repeated DeliverTx deliver_txs = 3;
tendermint.abci.RequestEndBlock request_end_block = 4;
tendermint.abci.ResponseEndBlock response_end_block = 5;
tendermint.abci.ResponseCommit response_commit = 6;
// DeliverTx encapulate deliver tx request and response.
message DeliverTx {
tendermint.abci.RequestDeliverTx request = 1;
tendermint.abci.ResponseDeliverTx response = 2;
}
tendermint.abci.RequestBeginBlock request_begin_block = 1;
tendermint.abci.ResponseBeginBlock response_begin_block = 2;
repeated DeliverTx deliver_txs = 3;
tendermint.abci.RequestEndBlock request_end_block = 4;
tendermint.abci.ResponseEndBlock response_end_block = 5;
tendermint.abci.ResponseCommit response_commit = 6;
}
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 src/cosmospy_protobuf/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 src/cosmospy_protobuf/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
28 changes: 28 additions & 0 deletions src/cosmospy_protobuf/cosmos/staking/v1beta1/genesis.proto
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ option go_package = "github.com/cosmos/cosmos-sdk/x/staking/types";

import "gogoproto/gogo.proto";
import "cosmos/staking/v1beta1/staking.proto";
import "google/protobuf/timestamp.proto";

// GenesisState defines the staking module's genesis state.
message GenesisState {
Expand Down Expand Up @@ -38,6 +39,33 @@ message GenesisState {
repeated Redelegation redelegations = 7 [(gogoproto.nullable) = false];

bool exported = 8;

// store tokenize share records to provide reward to record owners
repeated TokenizeShareRecord tokenize_share_records = 9 [(gogoproto.nullable) = false];

// last tokenize share record id, used for next share record id calculation
uint64 last_tokenize_share_record_id = 10;

// total number of liquid staked tokens at genesis
bytes total_liquid_staked_tokens = 11 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.moretags) = "yaml:\"total_liquid_staked_tokens\"",
(gogoproto.nullable) = false
];

// tokenize shares locks at genesis
repeated TokenizeShareLock tokenize_share_locks = 12 [(gogoproto.nullable) = false];
}

// TokenizeSharesLock required for specifying account locks at genesis
message TokenizeShareLock {
// Address of the account that is locked
string address = 1;
// Status of the lock (LOCKED or LOCK_EXPIRING)
string status = 2;
// Completion time if the lock is expiring
google.protobuf.Timestamp completion_time = 3
[(gogoproto.nullable) = false, (gogoproto.stdtime) = true, (gogoproto.moretags) = "yaml:\"completion_time\""];
}

// LastValidatorPower required for validator set update logic.
Expand Down
144 changes: 141 additions & 3 deletions src/cosmospy_protobuf/cosmos/staking/v1beta1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import "cosmos/base/query/v1beta1/pagination.proto";
import "gogoproto/gogo.proto";
import "google/api/annotations.proto";
import "cosmos/staking/v1beta1/staking.proto";
import "cosmos/base/v1beta1/coin.proto";

option go_package = "github.com/cosmos/cosmos-sdk/x/staking/types";

Expand Down Expand Up @@ -90,6 +91,50 @@ service Query {
rpc Params(QueryParamsRequest) returns (QueryParamsResponse) {
option (google.api.http).get = "/cosmos/staking/v1beta1/params";
}

// Query for individual tokenize share record information by share by id
rpc TokenizeShareRecordById(QueryTokenizeShareRecordByIdRequest) returns (QueryTokenizeShareRecordByIdResponse) {
option (google.api.http).get = "/cosmos/staking/v1beta1/tokenize_share_record_by_id/{id}";
}

// Query for individual tokenize share record information by share denom
rpc TokenizeShareRecordByDenom(QueryTokenizeShareRecordByDenomRequest)
returns (QueryTokenizeShareRecordByDenomResponse) {
option (google.api.http).get = "/cosmos/staking/v1beta1/tokenize_share_record_by_denom/{denom}";
}

// Query tokenize share records by address
rpc TokenizeShareRecordsOwned(QueryTokenizeShareRecordsOwnedRequest)
returns (QueryTokenizeShareRecordsOwnedResponse) {
option (google.api.http).get = "/cosmos/staking/v1beta1/tokenize_share_record_owned/{owner}";
}

// Query for all tokenize share records
rpc AllTokenizeShareRecords(QueryAllTokenizeShareRecordsRequest) returns (QueryAllTokenizeShareRecordsResponse) {
option (google.api.http).get = "/cosmos/staking/v1beta1/tokenize_share_records";
}

// Query for last tokenize share record id
rpc LastTokenizeShareRecordId(QueryLastTokenizeShareRecordIdRequest)
returns (QueryLastTokenizeShareRecordIdResponse) {
option (google.api.http).get = "/cosmos/staking/v1beta1/last_tokenize_share_record_id";
}

// Query for total tokenized staked assets
rpc TotalTokenizeSharedAssets(QueryTotalTokenizeSharedAssetsRequest)
returns (QueryTotalTokenizeSharedAssetsResponse) {
option (google.api.http).get = "/cosmos/staking/v1beta1/total_tokenize_shared_assets";
}

// Query for total liquid staked (including tokenized shares or owned by an liquid staking provider)
rpc TotalLiquidStaked(QueryTotalLiquidStaked) returns (QueryTotalLiquidStakedResponse) {
option (google.api.http).get = "/cosmos/staking/v1beta1/total_liquid_staked";
}

// Query tokenize share locks
rpc TokenizeShareLockInfo(QueryTokenizeShareLockInfo) returns (QueryTokenizeShareLockInfoResponse) {
option (google.api.http).get = "/cosmos/staking/v1beta1/tokenize_share_lock_info/{address}";
}
}

// QueryValidatorsRequest is request type for Query/Validators RPC method.
Expand Down Expand Up @@ -118,7 +163,7 @@ message QueryValidatorRequest {

// QueryValidatorResponse is response type for the Query/Validator RPC method
message QueryValidatorResponse {
// validator defines the the validator info.
// validator defines the validator info.
Validator validator = 1 [(gogoproto.nullable) = false];
}

Expand Down Expand Up @@ -288,7 +333,7 @@ message QueryDelegatorValidatorsRequest {
// QueryDelegatorValidatorsResponse is response type for the
// Query/DelegatorValidators RPC method.
message QueryDelegatorValidatorsResponse {
// validators defines the the validators' info of a delegator.
// validators defines the validators' info of a delegator.
repeated Validator validators = 1 [(gogoproto.nullable) = false];

// pagination defines the pagination in the response.
Expand All @@ -311,7 +356,7 @@ message QueryDelegatorValidatorRequest {
// QueryDelegatorValidatorResponse response type for the
// Query/DelegatorValidator RPC method.
message QueryDelegatorValidatorResponse {
// validator defines the the validator info.
// validator defines the validator info.
Validator validator = 1 [(gogoproto.nullable) = false];
}

Expand Down Expand Up @@ -346,3 +391,96 @@ message QueryParamsResponse {
// params holds all the parameters of this module.
Params params = 1 [(gogoproto.nullable) = false];
}

// QueryTokenizeShareRecordByIdRequest is request type for the
// Query/QueryTokenizeShareRecordById RPC method.
message QueryTokenizeShareRecordByIdRequest {
uint64 id = 1;
}

// QueryTokenizeShareRecordByIdRequest is response type for the
// Query/QueryTokenizeShareRecordById RPC method.
message QueryTokenizeShareRecordByIdResponse {
TokenizeShareRecord record = 1 [(gogoproto.nullable) = false];
}

// QueryTokenizeShareRecordByDenomRequest is request type for the
// Query/QueryTokenizeShareRecordByDenom RPC method.
message QueryTokenizeShareRecordByDenomRequest {
string denom = 1;
}

// QueryTokenizeShareRecordByDenomResponse is response type for the
// Query/QueryTokenizeShareRecordByDenom RPC method.
message QueryTokenizeShareRecordByDenomResponse {
TokenizeShareRecord record = 1 [(gogoproto.nullable) = false];
}

// QueryTokenizeShareRecordsOwnedRequest is request type for the
// Query/QueryTokenizeShareRecordsOwned RPC method.
message QueryTokenizeShareRecordsOwnedRequest {
string owner = 1;
}

// QueryTokenizeShareRecordsOwnedResponse is response type for the
// Query/QueryTokenizeShareRecordsOwned RPC method.
message QueryTokenizeShareRecordsOwnedResponse {
repeated TokenizeShareRecord records = 1 [(gogoproto.nullable) = false];
}

// QueryAllTokenizeShareRecordsRequest is request type for the
// Query/QueryAllTokenizeShareRecords RPC method.
message QueryAllTokenizeShareRecordsRequest {
// pagination defines an optional pagination for the request.
cosmos.base.query.v1beta1.PageRequest pagination = 1;
}

// QueryAllTokenizeShareRecordsResponse is response type for the
// Query/QueryAllTokenizeShareRecords RPC method.
message QueryAllTokenizeShareRecordsResponse {
repeated TokenizeShareRecord records = 1 [(gogoproto.nullable) = false];
// pagination defines the pagination in the response.
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}

// QueryLastTokenizeShareRecordIdRequest is request type for the
// Query/QueryLastTokenizeShareRecordId RPC method.
message QueryLastTokenizeShareRecordIdRequest {}

// QueryLastTokenizeShareRecordIdResponse is response type for the
// Query/QueryLastTokenizeShareRecordId RPC method.
message QueryLastTokenizeShareRecordIdResponse {
uint64 id = 1;
}

// QueryTotalTokenizeSharedAssetsRequest is request type for the
// Query/QueryTotalTokenizeSharedAssets RPC method.
message QueryTotalTokenizeSharedAssetsRequest {}

// QueryTotalTokenizeSharedAssetsResponse is response type for the
// Query/QueryTotalTokenizeSharedAssets RPC method.
message QueryTotalTokenizeSharedAssetsResponse {
cosmos.base.v1beta1.Coin value = 1 [(gogoproto.nullable) = false];
}

// QueryTotalLiquidStakedRequest is request type for the
// Query/QueryQueryTotalLiquidStaked RPC method.
message QueryTotalLiquidStaked {}

// QueryTotalLiquidStakedResponse is response type for the
// Query/QueryQueryTotalLiquidStaked RPC method.
message QueryTotalLiquidStakedResponse {
string tokens = 1;
}

// QueryTokenizeShareLockInfo queries the tokenize share lock information
// associated with given account
message QueryTokenizeShareLockInfo {
string address = 1;
}
// QueryTokenizeShareLockInfoResponse is the response from the
// QueryTokenizeShareLockInfo query
message QueryTokenizeShareLockInfoResponse {
string status = 1;
string expiration_time = 2;
}
Loading

0 comments on commit 359a461

Please sign in to comment.