Skip to content

Commit efbcb58

Browse files
committed
add liquidstake protos
1 parent 0440fd7 commit efbcb58

4 files changed

Lines changed: 445 additions & 0 deletions

File tree

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
syntax = "proto3";
2+
package pstake.liquidstake.v1beta1;
3+
4+
import "gogoproto/gogo.proto";
5+
import "pstake/liquidstake/v1beta1/liquidstake.proto";
6+
7+
option go_package = "github.com/persistenceOne/persistenceCore/v16/x/liquidstake/types";
8+
option (gogoproto.equal_all) = true;
9+
10+
// GenesisState defines the liquidstake module's genesis state.
11+
message GenesisState {
12+
option (gogoproto.equal) = false;
13+
option (gogoproto.goproto_getters) = false;
14+
15+
// params defines all the parameters for the liquidstake module
16+
Params params = 1 [ (gogoproto.nullable) = false ];
17+
18+
repeated LiquidValidator liquid_validators = 2
19+
[ (gogoproto.nullable) = false ];
20+
}
Lines changed: 214 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,214 @@
1+
syntax = "proto3";
2+
3+
package pstake.liquidstake.v1beta1;
4+
5+
import "gogoproto/gogo.proto";
6+
import "cosmos_proto/cosmos.proto";
7+
8+
option go_package = "github.com/persistenceOne/persistenceCore/v16/x/liquidstake/types";
9+
10+
// Params defines the set of params for the liquidstake module.
11+
message Params {
12+
option (gogoproto.goproto_getters) = false;
13+
option (gogoproto.goproto_stringer) = false;
14+
15+
// LiquidBondDenom specifies the denomination of the token receiving after
16+
// liquid stake, The value is calculated through NetAmount.
17+
string liquid_bond_denom = 1;
18+
19+
// WhitelistedValidators specifies the validators elected to become Active
20+
// Liquid Validators.
21+
repeated WhitelistedValidator whitelisted_validators = 2
22+
[ (gogoproto.nullable) = false ];
23+
24+
// UnstakeFeeRate specifies the fee rate when liquid unstake is requested,
25+
// unbonded by subtracting it from unbondingAmount
26+
string unstake_fee_rate = 3 [
27+
(gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
28+
(gogoproto.nullable) = false
29+
];
30+
31+
// LsmDisabled allows to block any msgs that convert staked tokens into
32+
// stkXPRT through LSM.
33+
bool lsm_disabled = 4;
34+
35+
// MinLiquidStakingAmount specifies the minimum number of coins to be staked
36+
// to the active liquid validators on liquid staking to minimize decimal loss
37+
// and consider gas efficiency.
38+
string min_liquid_stake_amount = 5 [
39+
(gogoproto.customtype) = "cosmossdk.io/math.Int",
40+
(gogoproto.nullable) = false
41+
];
42+
43+
// CwLockedPoolAddress defines the bech32-encoded address of
44+
// a CW smart-contract representing a time locked LP (e.g. Superfluid LP).
45+
string cw_locked_pool_address = 6
46+
[ (cosmos_proto.scalar) = "cosmos.AddressString" ];
47+
48+
// FeeAccountAddress defines the bech32-encoded address of
49+
// a an account responsible for accumulating protocol fees.
50+
string fee_account_address = 7
51+
[ (cosmos_proto.scalar) = "cosmos.AddressString" ];
52+
53+
// AutocompoundFeeRate specifies the fee rate for auto redelegating the stake
54+
// rewards. The fee is taken in favour of the fee account (see
55+
// FeeAccountAddress).
56+
string autocompound_fee_rate = 8 [
57+
(gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
58+
(gogoproto.nullable) = false
59+
];
60+
61+
// WhitelistAdminAddress the bech32-encoded address of an admin authority
62+
// that is allowed to update whitelisted validators or pause liquidstaking
63+
// module entirely. The key is controlled by an offchain process that is
64+
// selecting validators based on a criteria. Pausing of the module can be
65+
// required during important migrations or failures.
66+
string whitelist_admin_address = 9
67+
[ (cosmos_proto.scalar) = "cosmos.AddressString" ];
68+
69+
// ModulePaused is a safety toggle that allows to stop main module functions
70+
// such as stake/unstake/stake-to-lp and the BeginBlocker logic.
71+
bool module_paused = 10;
72+
}
73+
74+
// ValidatorStatus enumerates the status of a liquid validator.
75+
enum ValidatorStatus {
76+
option (gogoproto.goproto_enum_prefix) = false;
77+
78+
// VALIDATOR_STATUS_UNSPECIFIED defines the unspecified invalid status.
79+
VALIDATOR_STATUS_UNSPECIFIED = 0
80+
[ (gogoproto.enumvalue_customname) = "ValidatorStatusUnspecified" ];
81+
// VALIDATOR_STATUS_ACTIVE defines the active, valid status
82+
VALIDATOR_STATUS_ACTIVE = 1
83+
[ (gogoproto.enumvalue_customname) = "ValidatorStatusActive" ];
84+
// VALIDATOR_STATUS_INACTIVE defines the inactive, invalid status
85+
VALIDATOR_STATUS_INACTIVE = 2
86+
[ (gogoproto.enumvalue_customname) = "ValidatorStatusInactive" ];
87+
}
88+
89+
// WhitelistedValidator consists of the validator operator address and the
90+
// target weight, which is a value for calculating the real weight to be derived
91+
// according to the active status.
92+
message WhitelistedValidator {
93+
option (gogoproto.goproto_getters) = false;
94+
95+
// validator_address defines the bech32-encoded address that whitelisted
96+
// validator
97+
string validator_address = 1
98+
[ (cosmos_proto.scalar) = "cosmos.AddressString" ];
99+
100+
// target_weight specifies the target weight for liquid staking, unstaking
101+
// amount, which is a value for calculating the real weight to be derived
102+
// according to the active status
103+
string target_weight = 2 [
104+
(gogoproto.customtype) = "cosmossdk.io/math.Int",
105+
(gogoproto.nullable) = false
106+
];
107+
}
108+
109+
// LiquidValidator defines a Validator that can be the target of LiquidStaking
110+
// and LiquidUnstaking, Active, Weight, etc. fields are derived as functions to
111+
// deal with by maintaining consistency with the state of the staking module.
112+
message LiquidValidator {
113+
option (gogoproto.equal) = false;
114+
option (gogoproto.goproto_getters) = false;
115+
116+
// operator_address defines the address of the validator's operator; bech
117+
// encoded in JSON.
118+
string operator_address = 1
119+
[ (cosmos_proto.scalar) = "cosmos.AddressString" ];
120+
}
121+
122+
// LiquidValidatorState is type LiquidValidator with state added to return to
123+
// query results.
124+
message LiquidValidatorState {
125+
option (gogoproto.equal) = false;
126+
option (gogoproto.goproto_getters) = false;
127+
128+
// operator_address defines the address of the validator's operator; bech
129+
// encoded in JSON.
130+
string operator_address = 1
131+
[ (cosmos_proto.scalar) = "cosmos.AddressString" ];
132+
133+
// weight specifies the weight for liquid staking, unstaking amount
134+
string weight = 2 [
135+
(gogoproto.customtype) = "cosmossdk.io/math.Int",
136+
(gogoproto.nullable) = false
137+
];
138+
139+
// status is the liquid validator status
140+
ValidatorStatus status = 3;
141+
142+
// del_shares define the delegation shares of the validator
143+
string del_shares = 4 [
144+
(gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
145+
(gogoproto.nullable) = false
146+
];
147+
148+
// liquid_tokens define the token amount worth of delegation shares of the
149+
// validator (slashing applied amount)
150+
string liquid_tokens = 5 [
151+
(gogoproto.customtype) = "cosmossdk.io/math.Int",
152+
(gogoproto.nullable) = false
153+
];
154+
}
155+
156+
// NetAmountState is type for net amount raw data and mint rate, This is a value
157+
// that depends on the several module state every time, so it is used only for
158+
// calculation and query and is not stored in kv.
159+
message NetAmountState {
160+
option (gogoproto.equal) = false;
161+
option (gogoproto.goproto_getters) = true;
162+
163+
// mint_rate is stkXPRTTotalSupply / NetAmount
164+
string mint_rate = 1 [
165+
(gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
166+
(gogoproto.nullable) = false
167+
];
168+
169+
// btoken_total_supply returns the total supply of stk/uxprt (stkXPRT denom)
170+
string stkxprt_total_supply = 2 [
171+
(gogoproto.customtype) = "cosmossdk.io/math.Int",
172+
(gogoproto.nullable) = false
173+
];
174+
175+
// net_amount is proxy account's native token balance + total liquid tokens +
176+
// total remaining rewards + total unbonding balance
177+
string net_amount = 3 [
178+
(gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
179+
(gogoproto.nullable) = false
180+
];
181+
182+
// total_del_shares define the delegation shares of all liquid validators
183+
string total_del_shares = 4 [
184+
(gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
185+
(gogoproto.nullable) = false
186+
];
187+
188+
// total_liquid_tokens define the token amount worth of delegation shares of
189+
// all liquid validator (slashing applied amount)
190+
string total_liquid_tokens = 5 [
191+
(gogoproto.customtype) = "cosmossdk.io/math.Int",
192+
(gogoproto.nullable) = false
193+
];
194+
195+
// total_remaining_rewards define the sum of remaining rewards of proxy
196+
// account by all liquid validators
197+
string total_remaining_rewards = 6 [
198+
(gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
199+
(gogoproto.nullable) = false
200+
];
201+
202+
// total_unbonding_balance define the unbonding balance of proxy account by
203+
// all liquid validator (slashing applied amount)
204+
string total_unbonding_balance = 7 [
205+
(gogoproto.customtype) = "cosmossdk.io/math.Int",
206+
(gogoproto.nullable) = false
207+
];
208+
209+
// proxy_acc_balance define the balance of proxy account for the native token
210+
string proxy_acc_balance = 8 [
211+
(gogoproto.customtype) = "cosmossdk.io/math.Int",
212+
(gogoproto.nullable) = false
213+
];
214+
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
syntax = "proto3";
2+
package pstake.liquidstake.v1beta1;
3+
4+
import "google/api/annotations.proto";
5+
import "pstake/liquidstake/v1beta1/liquidstake.proto";
6+
import "gogoproto/gogo.proto";
7+
8+
option go_package = "github.com/persistenceOne/persistenceCore/v16/x/liquidstake/types";
9+
10+
// Query defines the gRPC query service for the liquidstake module.
11+
service Query {
12+
// Params returns parameters of the liquidstake module.
13+
rpc Params(QueryParamsRequest) returns (QueryParamsResponse) {
14+
option (google.api.http).get = "/pstake/liquidstake/v1beta1/params";
15+
}
16+
17+
// LiquidValidators returns liquid validators with states of the liquidstake
18+
// module.
19+
rpc LiquidValidators(QueryLiquidValidatorsRequest)
20+
returns (QueryLiquidValidatorsResponse) {
21+
option (google.api.http).get = "/pstake/liquidstake/v1beta1/validators";
22+
}
23+
24+
// States returns states of the liquidstake module.
25+
rpc States(QueryStatesRequest) returns (QueryStatesResponse) {
26+
option (google.api.http).get = "/pstake/liquidstake/v1beta1/states";
27+
}
28+
}
29+
30+
// QueryParamsRequest is the request type for the Query/Params RPC method.
31+
message QueryParamsRequest {}
32+
33+
// QueryParamsResponse is the response type for the Query/Params RPC method.
34+
message QueryParamsResponse {
35+
Params params = 1 [ (gogoproto.nullable) = false ];
36+
}
37+
38+
// QueryLiquidValidatorsRequest is the request type for the
39+
// Query/LiquidValidators RPC method.
40+
message QueryLiquidValidatorsRequest {}
41+
42+
// QueryLiquidValidatorsResponse is the response type for the
43+
// Query/LiquidValidators RPC method.
44+
message QueryLiquidValidatorsResponse {
45+
repeated LiquidValidatorState liquid_validators = 1
46+
[ (gogoproto.nullable) = false ];
47+
}
48+
49+
// QueryStatesRequest is the request type for the Query/States RPC method.
50+
message QueryStatesRequest {}
51+
52+
// QueryStatesResponse is the response type for the Query/States RPC method.
53+
message QueryStatesResponse {
54+
NetAmountState net_amount_state = 1 [ (gogoproto.nullable) = false ];
55+
}

0 commit comments

Comments
 (0)