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

chore: update pstake protos #64

Merged
merged 1 commit into from
Dec 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "persistenceonejs",
"version": "2.3.0-rc2",
"version": "2.4.0-rc0",
"description": "Client side JS libraries for persistenceSDK transaction generation, signing and broadcasting.",
"main": "main/index.js",
"module": "module/index.js",
Expand Down
20 changes: 20 additions & 0 deletions proto/pstake/liquidstake/v1beta1/genesis.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
syntax = "proto3";
package pstake.liquidstake.v1beta1;

import "gogoproto/gogo.proto";
import "pstake/liquidstake/v1beta1/liquidstake.proto";

option go_package = "github.com/persistenceOne/pstake-native/v2/x/liquidstake/types";
option (gogoproto.equal_all) = true;

// GenesisState defines the liquidstake module's genesis state.
message GenesisState {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;

// params defines all the parameters for the liquidstake module
Params params = 1 [ (gogoproto.nullable) = false ];

repeated LiquidValidator liquid_validators = 2
[ (gogoproto.nullable) = false ];
}
195 changes: 195 additions & 0 deletions proto/pstake/liquidstake/v1beta1/liquidstake.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,195 @@
syntax = "proto3";

package pstake.liquidstake.v1beta1;

import "gogoproto/gogo.proto";
import "cosmos_proto/cosmos.proto";
import "cosmos/base/v1beta1/coin.proto";
import "google/protobuf/timestamp.proto";

option go_package = "github.com/persistenceOne/pstake-native/v2/x/liquidstake/types";

// Params defines the set of params for the liquidstake module.
message Params {
option (gogoproto.goproto_getters) = false;
option (gogoproto.goproto_stringer) = false;

// LiquidBondDenom specifies the denomination of the token receiving after
// liquid stake, The value is calculated through NetAmount.
string liquid_bond_denom = 1;

// WhitelistedValidators specifies the validators elected to become Active
// Liquid Validators.
repeated WhitelistedValidator whitelisted_validators = 2
[ (gogoproto.nullable) = false ];

// UnstakeFeeRate specifies the fee rate when liquid unstake is requested,
// unbonded by subtracting it from unbondingAmount
string unstake_fee_rate = 3 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];

// LsmDisabled allows to block any msgs that convert staked tokens into
// stkXPRT through LSM.
bool lsm_disabled = 4;

// MinLiquidStakingAmount specifies the minimum number of coins to be staked
// to the active liquid validators on liquid staking to minimize decimal loss
// and consider gas efficiency.
string min_liquid_stake_amount = 5 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.nullable) = false
];

// cw_locked_pool_address defines the bech32-encoded address of
// a CW smart-contract representing a time locked LP (e.g. Superfluid LP).
string cw_locked_pool_address = 6
[ (cosmos_proto.scalar) = "cosmos.AddressString" ];
}

// ValidatorStatus enumerates the status of a liquid validator.
enum ValidatorStatus {
option (gogoproto.goproto_enum_prefix) = false;

// VALIDATOR_STATUS_UNSPECIFIED defines the unspecified invalid status.
VALIDATOR_STATUS_UNSPECIFIED = 0
[ (gogoproto.enumvalue_customname) = "ValidatorStatusUnspecified" ];
// VALIDATOR_STATUS_ACTIVE defines the active, valid status
VALIDATOR_STATUS_ACTIVE = 1
[ (gogoproto.enumvalue_customname) = "ValidatorStatusActive" ];
// VALIDATOR_STATUS_INACTIVE defines the inactive, invalid status
VALIDATOR_STATUS_INACTIVE = 2
[ (gogoproto.enumvalue_customname) = "ValidatorStatusInactive" ];
}

// WhitelistedValidator consists of the validator operator address and the
// target weight, which is a value for calculating the real weight to be derived
// according to the active status. In the case of inactive, it is calculated as
// zero.
message WhitelistedValidator {
option (gogoproto.goproto_getters) = false;

// validator_address defines the bech32-encoded address that whitelisted
// validator
string validator_address = 1
[ (cosmos_proto.scalar) = "cosmos.AddressString" ];


// target_weight specifies the target weight for liquid staking, unstaking
// amount, which is a value for calculating the real weight to be derived
// according to the active status
string target_weight = 2 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.nullable) = false
];
}

// LiquidValidator defines a Validator that can be the target of LiquidStaking
// and LiquidUnstaking, Active, Weight, etc. fields are derived as functions to
// deal with by maintaining consistency with the state of the staking module.
message LiquidValidator {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;

// operator_address defines the address of the validator's operator; bech
// encoded in JSON.
string operator_address = 1
[ (cosmos_proto.scalar) = "cosmos.AddressString" ];

}

// LiquidValidatorState is type LiquidValidator with state added to return to
// query results.
message LiquidValidatorState {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;

// operator_address defines the address of the validator's operator; bech
// encoded in JSON.
string operator_address = 1
[ (cosmos_proto.scalar) = "cosmos.AddressString" ];


// weight specifies the weight for liquid staking, unstaking amount
string weight = 2 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.nullable) = false
];

// status is the liquid validator status
ValidatorStatus status = 3;

// del_shares define the delegation shares of the validator
string del_shares = 4 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];

// liquid_tokens define the token amount worth of delegation shares of the
// validator (slashing applied amount)
string liquid_tokens = 5 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.nullable) = false
];
}

// NetAmountState is type for net amount raw data and mint rate, This is a value
// that depends on the several module state every time, so it is used only for
// calculation and query and is not stored in kv.
message NetAmountState {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = true;

// mint_rate is stkXPRTTotalSupply / NetAmount
string mint_rate = 1 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];

// btoken_total_supply returns the total supply of stk/uxprt (stkXPRT denom)
string stkxprt_total_supply = 2 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.nullable) = false
];

// net_amount is proxy account's native token balance + total liquid tokens +
// total remaining rewards + total unbonding balance
string net_amount = 3 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];

// total_del_shares define the delegation shares of all liquid validators
string total_del_shares = 4 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];

// total_liquid_tokens define the token amount worth of delegation shares of
// all liquid validator (slashing applied amount)
string total_liquid_tokens = 5 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.nullable) = false
];

// total_remaining_rewards define the sum of remaining rewards of proxy
// account by all liquid validators
string total_remaining_rewards = 6 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];

// total_unbonding_balance define the unbonding balance of proxy account by
// all liquid validator (slashing applied amount)
string total_unbonding_balance = 7 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.nullable) = false
];

// proxy_acc_balance define the balance of proxy account for the native token
string proxy_acc_balance = 8 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.nullable) = false
];
}
55 changes: 55 additions & 0 deletions proto/pstake/liquidstake/v1beta1/query.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
syntax = "proto3";
package pstake.liquidstake.v1beta1;

import "google/api/annotations.proto";
import "pstake/liquidstake/v1beta1/liquidstake.proto";
import "gogoproto/gogo.proto";

option go_package = "github.com/persistenceOne/pstake-native/v2/x/liquidstake/types";

// Query defines the gRPC query service for the liquidstake module.
service Query {
// Params returns parameters of the liquidstake module.
rpc Params(QueryParamsRequest) returns (QueryParamsResponse) {
option (google.api.http).get = "/pstake/liquidstake/v1beta1/params";
}

// LiquidValidators returns liquid validators with states of the liquidstake
// module.
rpc LiquidValidators(QueryLiquidValidatorsRequest)
returns (QueryLiquidValidatorsResponse) {
option (google.api.http).get = "/pstake/liquidstake/v1beta1/validators";
}

// States returns states of the liquidstake module.
rpc States(QueryStatesRequest) returns (QueryStatesResponse) {
option (google.api.http).get = "/pstake/liquidstake/v1beta1/states";
}
}

// QueryParamsRequest is the request type for the Query/Params RPC method.
message QueryParamsRequest {}

// QueryParamsResponse is the response type for the Query/Params RPC method.
message QueryParamsResponse {
Params params = 1 [ (gogoproto.nullable) = false ];
}

// QueryLiquidValidatorsRequest is the request type for the
// Query/LiquidValidators RPC method.
message QueryLiquidValidatorsRequest {}

// QueryLiquidValidatorsResponse is the response type for the
// Query/LiquidValidators RPC method.
message QueryLiquidValidatorsResponse {
repeated LiquidValidatorState liquid_validators = 1
[ (gogoproto.nullable) = false ];
}

// QueryStatesRequest is the request type for the Query/States RPC method.
message QueryStatesRequest {}

// QueryStatesResponse is the response type for the Query/States RPC method.
message QueryStatesResponse {
NetAmountState net_amount_state = 1 [ (gogoproto.nullable) = false ];
}
103 changes: 103 additions & 0 deletions proto/pstake/liquidstake/v1beta1/tx.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
syntax = "proto3";
package pstake.liquidstake.v1beta1;

import "gogoproto/gogo.proto";
import "cosmos_proto/cosmos.proto";
import "cosmos/base/v1beta1/coin.proto";
import "cosmos/msg/v1/msg.proto";
import "google/protobuf/timestamp.proto";
import "pstake/liquidstake/v1beta1/liquidstake.proto";

option go_package = "github.com/persistenceOne/pstake-native/v2/x/liquidstake/types";

// Msg defines the liquid staking Msg service.
service Msg {
// LiquidStake defines a method for performing a delegation of coins
// from a delegator to whitelisted validators.
rpc LiquidStake(MsgLiquidStake) returns (MsgLiquidStakeResponse);

// LiquidUnstake defines a method for performing an undelegation of liquid
// staking from a delegate.
rpc LiquidUnstake(MsgLiquidUnstake) returns (MsgLiquidUnstakeResponse);

// StakeToLP defines a method for LSM-transfer of staked XPRT
// into stkXPRT with locking into an LP.
rpc StakeToLP(MsgStakeToLP) returns (MsgStakeToLPResponse);

// UpdateParams defines a method to update the module params.
rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse);
}

// MsgLiquidStake defines a SDK message for performing a liquid stake of coins
// from a delegator to whitelisted validators.
message MsgLiquidStake {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;
option (cosmos.msg.v1.signer) = "delegator_address";

string delegator_address = 1
[ (cosmos_proto.scalar) = "cosmos.AddressString" ];

cosmos.base.v1beta1.Coin amount = 2 [ (gogoproto.nullable) = false ];
}

// MsgLiquidStakeResponse defines the MsgLiquidStake response type.
message MsgLiquidStakeResponse {}

// MsgStakeToLP defines a SDK message for performing an LSM-transfer of staked
// XPRT into stkXPRT with locking into an LP.
message MsgStakeToLP {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;
option (cosmos.msg.v1.signer) = "delegator_address";

string delegator_address = 1
[ (cosmos_proto.scalar) = "cosmos.AddressString" ];


string validator_address = 2
[ (cosmos_proto.scalar) = "cosmos.AddressString" ];

cosmos.base.v1beta1.Coin staked_amount = 3 [ (gogoproto.nullable) = false ];
cosmos.base.v1beta1.Coin liquid_amount = 4 [ (gogoproto.nullable) = false ];
}

// MsgStakeToLPResponse defines the MsgStakeToLP response type.
message MsgStakeToLPResponse {}

// MsgLiquidUnstake defines a SDK message for performing an undelegation of
// liquid staking from a delegate.
message MsgLiquidUnstake {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;
option (cosmos.msg.v1.signer) = "delegator_address";

string delegator_address = 1
[ (cosmos_proto.scalar) = "cosmos.AddressString" ];

cosmos.base.v1beta1.Coin amount = 2 [ (gogoproto.nullable) = false ];
}

// MsgLiquidUnstakeResponse defines the MsgLiquidUnstake response type.
message MsgLiquidUnstakeResponse {
google.protobuf.Timestamp completion_time = 1
[ (gogoproto.nullable) = false, (gogoproto.stdtime) = true ];
}

message MsgUpdateParams {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;
option (cosmos.msg.v1.signer) = "authority";

// authority is the address that controls the module (defaults to x/gov unless
// overwritten).
string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];

// params defines the parameters to update.
//
// NOTE: All parameters must be supplied.
Params params = 2 [ (gogoproto.nullable) = false ];
}

// MsgUpdateParamsResponse defines the response structure for executing a
message MsgUpdateParamsResponse {}
Loading