Skip to content

Commit

Permalink
Format protos
Browse files Browse the repository at this point in the history
  • Loading branch information
zmanian committed Oct 22, 2023
1 parent d003fa1 commit da8c84f
Show file tree
Hide file tree
Showing 6 changed files with 426 additions and 8 deletions.
11 changes: 11 additions & 0 deletions proto/cosmos/distribution/v1beta1/distribution.proto
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,17 @@ message FeePool {
];
}

// 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];
}

// CommunityPoolSpendProposal details a proposal for use of community funds,
// together with how many coins are proposed to be spent, and to which
// recipient account.
Expand Down
36 changes: 34 additions & 2 deletions proto/cosmos/distribution/v1beta1/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@ service Msg {
//
// Since: cosmos-sdk 0.47
rpc CommunityPoolSpend(MsgCommunityPoolSpend) returns (MsgCommunityPoolSpendResponse);

// 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);
}

// MsgSetWithdrawAddress sets the withdraw address for
Expand Down Expand Up @@ -162,15 +170,39 @@ message MsgCommunityPoolSpend {
option (amino.name) = "cosmos-sdk/distr/MsgCommunityPoolSpend";

// authority is the address that controls the module (defaults to x/gov unless overwritten).
string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
string recipient = 2;
string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
string recipient = 2;
repeated cosmos.base.v1beta1.Coin amount = 3 [
(gogoproto.nullable) = false,
(amino.dont_omitempty) = true,
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"
];
}

// 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 {}

// MsgCommunityPoolSpendResponse defines the response to executing a
// MsgCommunityPoolSpend message.
//
Expand Down
28 changes: 28 additions & 0 deletions proto/cosmos/staking/v1beta1/genesis.proto
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import "gogoproto/gogo.proto";
import "cosmos/staking/v1beta1/staking.proto";
import "cosmos_proto/cosmos.proto";
import "amino/amino.proto";
import "google/protobuf/timestamp.proto";

// GenesisState defines the staking module's genesis state.
message GenesisState {
Expand Down Expand Up @@ -37,9 +38,36 @@ message GenesisState {
// redelegations defines the redelegations active at genesis.
repeated Redelegation redelegations = 7 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true];

// 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];

bool exported = 8;
}

// 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.
message LastValidatorPower {
option (gogoproto.equal) = false;
Expand Down
137 changes: 137 additions & 0 deletions proto/cosmos/staking/v1beta1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,50 @@ service Query {
"{validator_addr}";
}

// 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}";
}

// HistoricalInfo queries the historical info for given height.
rpc HistoricalInfo(QueryHistoricalInfoRequest) returns (QueryHistoricalInfoResponse) {
option (cosmos.query.v1.module_query_safe) = true;
Expand Down Expand Up @@ -385,3 +429,96 @@ message QueryParamsResponse {
// params holds all the parameters of this module.
Params params = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true];
}

// 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;
}
72 changes: 69 additions & 3 deletions proto/cosmos/staking/v1beta1/staking.proto
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,7 @@ message Validator {
[(gogoproto.nullable) = false, (amino.dont_omitempty) = true, (gogoproto.stdtime) = true];
// commission defines the commission parameters.
Commission commission = 10 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true];
// min_self_delegation is the validator's self declared minimum self delegation.
//
// Since: cosmos-sdk 0.46
// Deprecated: This field has been deprecated with LSM in favor of the validator bond
string min_self_delegation = 11 [
(cosmos_proto.scalar) = "cosmos.Int",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
Expand All @@ -135,6 +133,19 @@ message Validator {

// list of unbonding ids, each uniquely identifing an unbonding of this validator
repeated uint64 unbonding_ids = 13;

// Number of shares self bonded from the validator
string validator_bond_shares = 14 [
(gogoproto.moretags) = "yaml:\"validator_bond_shares\"",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];
// Number of shares either tokenized or owned by a liquid staking provider
string liquid_shares = 15 [
(gogoproto.moretags) = "yaml:\"liquid_shares\"",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];
}

// BondStatus is the status of a validator.
Expand Down Expand Up @@ -213,6 +224,8 @@ message Delegation {
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];
// has this delegation been marked as a validator self bond.
bool validator_bond = 4;
}

// UnbondingDelegation stores all of a single delegator's unbonding bonds
Expand Down Expand Up @@ -330,6 +343,28 @@ message Params {
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];

// validator_bond_factor is required as a safety check for tokenizing shares and
// delegations from liquid staking providers
string validator_bond_factor = 7 [
(gogoproto.moretags) = "yaml:\"validator_bond_factor\"",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];
// global_liquid_staking_cap represents a cap on the portion of stake that
// comes from liquid staking providers
string global_liquid_staking_cap = 8 [
(gogoproto.moretags) = "yaml:\"global_liquid_staking_cap\"",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];
// validator_liquid_staking_cap represents a cap on the portion of stake that
// comes from liquid staking providers for a specific validator
string validator_liquid_staking_cap = 9 [
(gogoproto.moretags) = "yaml:\"validator_liquid_staking_cap\"",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];
}

// DelegationResponse is equivalent to Delegation except that it contains a
Expand Down Expand Up @@ -403,3 +438,34 @@ enum Infraction {
message ValidatorUpdates {
repeated tendermint.abci.ValidatorUpdate updates = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true];
}

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

uint64 id = 1;
string owner = 2;
string module_account = 3; // module account take the role of delegator
string validator = 4; // validator delegated to for tokenize share record creation
}

// PendingTokenizeShareAuthorizations stores a list of addresses that have their
// tokenize share enablement in progress
message PendingTokenizeShareAuthorizations {
repeated string addresses = 1;
}

// TokenizeShareLockStatus indicates whether the address is able to tokenize shares
enum TokenizeShareLockStatus {
option (gogoproto.goproto_enum_prefix) = false;

// UNSPECIFIED defines an empty tokenize share lock status
TOKENIZE_SHARE_LOCK_STATUS_UNSPECIFIED = 0;
// LOCKED indicates the account is locked and cannot tokenize shares
TOKENIZE_SHARE_LOCK_STATUS_LOCKED = 1;
// UNLOCKED indicates the account is unlocked and can tokenize shares
TOKENIZE_SHARE_LOCK_STATUS_UNLOCKED = 2;
// LOCK_EXPIRING indicates the account is unable to tokenize shares, but
// will be able to tokenize shortly (after 1 unbonding period)
TOKENIZE_SHARE_LOCK_STATUS_LOCK_EXPIRING = 3;
}
Loading

0 comments on commit da8c84f

Please sign in to comment.