Skip to content

Commit

Permalink
add the fully qualified paths for the protos
Browse files Browse the repository at this point in the history
  • Loading branch information
faddat committed May 6, 2023
1 parent b0ef01e commit 795447c
Show file tree
Hide file tree
Showing 9 changed files with 1,827 additions and 0 deletions.
167 changes: 167 additions & 0 deletions proto/liquidstaking/distribution/v1/distribution.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
syntax = "proto3";
package liquidstaking.distribution.v1;

option go_package = "github.com/iqlusioninc/liquidity-staking-module/x/distribution/types";
option (gogoproto.equal_all) = true;

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

// Params defines the set of params for the distribution module.
message Params {
option (gogoproto.goproto_stringer) = false;
string community_tax = 1 [
(cosmos_proto.scalar) = "cosmos.Dec",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];
string base_proposer_reward = 2 [
(cosmos_proto.scalar) = "cosmos.Dec",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];
string bonus_proposer_reward = 3 [
(cosmos_proto.scalar) = "cosmos.Dec",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];
bool withdraw_addr_enabled = 4;
}

// ValidatorHistoricalRewards represents historical rewards for a validator.
// Height is implicit within the store key.
// Cumulative reward ratio is the sum from the zeroeth period
// until this period of rewards / tokens, per the spec.
// The reference count indicates the number of objects
// which might need to reference this historical entry at any point.
// ReferenceCount =
// number of outstanding delegations which ended the associated period (and
// might need to read that record)
// + number of slashes which ended the associated period (and might need to
// read that record)
// + one per validator for the zeroeth period, set on initialization
message ValidatorHistoricalRewards {
repeated cosmos.base.v1beta1.DecCoin cumulative_reward_ratio = 1
[(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins", (gogoproto.nullable) = false];
uint32 reference_count = 2;
}

// ValidatorCurrentRewards represents current rewards and current
// period for a validator kept as a running counter and incremented
// each block as long as the validator's tokens remain constant.
message ValidatorCurrentRewards {
repeated cosmos.base.v1beta1.DecCoin rewards = 1
[(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins", (gogoproto.nullable) = false];
uint64 period = 2;
}

// ValidatorAccumulatedCommission represents accumulated commission
// for a validator kept as a running counter, can be withdrawn at any time.
message ValidatorAccumulatedCommission {
repeated cosmos.base.v1beta1.DecCoin commission = 1
[(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins", (gogoproto.nullable) = false];
}

// ValidatorOutstandingRewards represents outstanding (un-withdrawn) rewards
// for a validator inexpensive to track, allows simple sanity checks.
message ValidatorOutstandingRewards {
repeated cosmos.base.v1beta1.DecCoin rewards = 1
[(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins", (gogoproto.nullable) = false];
}

// ValidatorSlashEvent represents a validator slash event.
// Height is implicit within the store key.
// This is needed to calculate appropriate amount of staking tokens
// for delegations which are withdrawn after a slash has occurred.
message ValidatorSlashEvent {
uint64 validator_period = 1;
string fraction = 2 [
(cosmos_proto.scalar) = "cosmos.Dec",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];
}

// ValidatorSlashEvents is a collection of ValidatorSlashEvent messages.
message ValidatorSlashEvents {
option (gogoproto.goproto_stringer) = false;
repeated ValidatorSlashEvent validator_slash_events = 1 [(gogoproto.nullable) = false];
}

// FeePool is the global fee pool for distribution.
message FeePool {
repeated cosmos.base.v1beta1.DecCoin community_pool = 1
[(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins"];
}

// CommunityPoolSpendProposal details a proposal for use of community funds,
// together with how many coins are proposed to be spent, and to which
// recipient account.
message CommunityPoolSpendProposal {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;
option (gogoproto.goproto_stringer) = false;
option (cosmos_proto.implements_interface) = "cosmos.gov.v1beta1.Content";

string title = 1;
string description = 2;
string recipient = 3;
repeated cosmos.base.v1beta1.Coin amount = 4
[(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"];
}

// DelegatorStartingInfo represents the starting info for a delegator reward
// period. It tracks the previous validator period, the delegation's amount of
// staking token, and the creation height (to check later on if any slashes have
// occurred). NOTE: Even though validators are slashed to whole staking tokens,
// the delegators within the validator may be left with less than a full token,
// thus sdk.Dec is used.
message DelegatorStartingInfo {
uint64 previous_period = 1;
string stake = 2 [
(cosmos_proto.scalar) = "cosmos.Dec",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];
uint64 height = 3 [(gogoproto.jsontag) = "creation_height"];
}

// DelegationDelegatorReward represents the properties
// of a delegator's delegation reward.
message DelegationDelegatorReward {
option (gogoproto.goproto_getters) = false;
option (gogoproto.goproto_stringer) = true;

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

repeated cosmos.base.v1beta1.DecCoin reward = 2
[(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 recordId = 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 {
option (gogoproto.goproto_getters) = false;
option (gogoproto.goproto_stringer) = true;
option (cosmos_proto.implements_interface) = "cosmos.gov.v1beta1.Content";

string title = 1;
string description = 2;
string recipient = 3;
string amount = 4;
string deposit = 5;
}
144 changes: 144 additions & 0 deletions proto/liquidstaking/distribution/v1/genesis.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
syntax = "proto3";
package liquidstaking.distribution.v1;

option go_package = "github.com/iqlusioninc/liquidity-staking-module/x/distribution/types";
option (gogoproto.equal_all) = true;

import "gogoproto/gogo.proto";
import "cosmos/base/v1beta1/coin.proto";
import "liquidstaking/distribution/v1/distribution.proto";
import "cosmos_proto/cosmos.proto";

// DelegatorWithdrawInfo is the address for where distributions rewards are
// withdrawn to by default this struct is only used at genesis to feed in
// default withdraw addresses.
message DelegatorWithdrawInfo {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;

// delegator_address is the address of the delegator.
string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];

// withdraw_address is the address to withdraw the delegation rewards to.
string withdraw_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
}

// ValidatorOutstandingRewardsRecord is used for import/export via genesis json.
message ValidatorOutstandingRewardsRecord {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;

// validator_address is the address of the validator.
string validator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];

// outstanding_rewards represents the oustanding rewards of a validator.
repeated cosmos.base.v1beta1.DecCoin outstanding_rewards = 2
[(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins", (gogoproto.nullable) = false];
}

// ValidatorAccumulatedCommissionRecord is used for import / export via genesis
// json.
message ValidatorAccumulatedCommissionRecord {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;

// validator_address is the address of the validator.
string validator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];

// accumulated is the accumulated commission of a validator.
ValidatorAccumulatedCommission accumulated = 2 [(gogoproto.nullable) = false];
}

// ValidatorHistoricalRewardsRecord is used for import / export via genesis
// json.
message ValidatorHistoricalRewardsRecord {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;

// validator_address is the address of the validator.
string validator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];

// period defines the period the historical rewards apply to.
uint64 period = 2;

// rewards defines the historical rewards of a validator.
ValidatorHistoricalRewards rewards = 3 [(gogoproto.nullable) = false];
}

// ValidatorCurrentRewardsRecord is used for import / export via genesis json.
message ValidatorCurrentRewardsRecord {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;

// validator_address is the address of the validator.
string validator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];

// rewards defines the current rewards of a validator.
ValidatorCurrentRewards rewards = 2 [(gogoproto.nullable) = false];
}

// DelegatorStartingInfoRecord used for import / export via genesis json.
message DelegatorStartingInfoRecord {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;

// delegator_address is the address of the delegator.
string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];

// validator_address is the address of the validator.
string validator_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];

// starting_info defines the starting info of a delegator.
DelegatorStartingInfo starting_info = 3 [(gogoproto.nullable) = false];
}

// ValidatorSlashEventRecord is used for import / export via genesis json.
message ValidatorSlashEventRecord {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;

// validator_address is the address of the validator.
string validator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// height defines the block height at which the slash event occured.
uint64 height = 2;
// period is the period of the slash event.
uint64 period = 3;
// validator_slash_event describes the slash event.
ValidatorSlashEvent validator_slash_event = 4 [(gogoproto.nullable) = false];
}

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

// params defines all the paramaters of the module.
Params params = 1 [(gogoproto.nullable) = false];

// fee_pool defines the fee pool at genesis.
FeePool fee_pool = 2 [(gogoproto.nullable) = false];

// fee_pool defines the delegator withdraw infos at genesis.
repeated DelegatorWithdrawInfo delegator_withdraw_infos = 3 [(gogoproto.nullable) = false];

// fee_pool defines the previous proposer at genesis.
string previous_proposer = 4 [(cosmos_proto.scalar) = "cosmos.AddressString"];

// fee_pool defines the outstanding rewards of all validators at genesis.
repeated ValidatorOutstandingRewardsRecord outstanding_rewards = 5 [(gogoproto.nullable) = false];

// fee_pool defines the accumulated commisions of all validators at genesis.
repeated ValidatorAccumulatedCommissionRecord validator_accumulated_commissions = 6 [(gogoproto.nullable) = false];

// fee_pool defines the historical rewards of all validators at genesis.
repeated ValidatorHistoricalRewardsRecord validator_historical_rewards = 7 [(gogoproto.nullable) = false];

// fee_pool defines the current rewards of all validators at genesis.
repeated ValidatorCurrentRewardsRecord validator_current_rewards = 8 [(gogoproto.nullable) = false];

// fee_pool defines the delegator starting infos at genesis.
repeated DelegatorStartingInfoRecord delegator_starting_infos = 9 [(gogoproto.nullable) = false];

// fee_pool defines the validator slash events at genesis.
repeated ValidatorSlashEventRecord validator_slash_events = 10 [(gogoproto.nullable) = false];
}
Loading

0 comments on commit 795447c

Please sign in to comment.