Skip to content

Commit

Permalink
delete voting period
Browse files Browse the repository at this point in the history
  • Loading branch information
yutianwu committed Mar 28, 2019
1 parent d47acdd commit 1afab6b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 29 deletions.
9 changes: 4 additions & 5 deletions x/gov/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ type GenesisState struct {
TallyingProcedure TallyingProcedure `json:"tallying_procedure"`
}

func NewGenesisState(startingProposalID int64, dp DepositProcedure, vp VotingProcedure, tp TallyingProcedure) GenesisState {
func NewGenesisState(startingProposalID int64, dp DepositProcedure, tp TallyingProcedure) GenesisState {
return GenesisState{
StartingProposalID: startingProposalID,
DepositProcedure: dp,
Expand All @@ -34,10 +34,9 @@ func DefaultGenesisState() GenesisState {
MaxDepositPeriod: time.Duration(2*7*24) * time.Hour, // 2 weeks
},
TallyingProcedure: TallyingProcedure{
Quorum: sdk.NewDecWithPrec(334, 3),
Threshold: sdk.NewDecWithPrec(5, 1),
Veto: sdk.NewDecWithPrec(334, 3),
GovernancePenalty: sdk.NewDecWithPrec(1, 2),
Quorum: sdk.NewDecWithPrec(334, 3),
Threshold: sdk.NewDecWithPrec(5, 1),
Veto: sdk.NewDecWithPrec(334, 3),
},
}
}
Expand Down
15 changes: 0 additions & 15 deletions x/gov/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,13 @@ const (
// Parameter store key
var (
ParamStoreKeyDepositProcedure = []byte("depositprocedure")
ParamStoreKeyVotingProcedure = []byte("votingprocedure")
ParamStoreKeyTallyingProcedure = []byte("tallyingprocedure")
)

// Type declaration for parameters
func ParamTypeTable() params.TypeTable {
return params.NewTypeTable(
ParamStoreKeyDepositProcedure, DepositProcedure{},
ParamStoreKeyVotingProcedure, VotingProcedure{},
ParamStoreKeyTallyingProcedure, TallyingProcedure{},
)
}
Expand Down Expand Up @@ -281,14 +279,6 @@ func (keeper Keeper) GetDepositProcedure(ctx sdk.Context) DepositProcedure {
return depositProcedure
}

// Returns the current Voting Procedure from the global param store
// nolint: errcheck
func (keeper Keeper) GetVotingProcedure(ctx sdk.Context) VotingProcedure {
var votingProcedure VotingProcedure
keeper.paramSpace.Get(ctx, ParamStoreKeyVotingProcedure, &votingProcedure)
return votingProcedure
}

// Returns the current Tallying Procedure from the global param store
// nolint: errcheck
func (keeper Keeper) GetTallyingProcedure(ctx sdk.Context) TallyingProcedure {
Expand All @@ -302,11 +292,6 @@ func (keeper Keeper) setDepositProcedure(ctx sdk.Context, depositProcedure Depos
keeper.paramSpace.Set(ctx, ParamStoreKeyDepositProcedure, &depositProcedure)
}

// nolint: errcheck
func (keeper Keeper) setVotingProcedure(ctx sdk.Context, votingProcedure VotingProcedure) {
keeper.paramSpace.Set(ctx, ParamStoreKeyVotingProcedure, &votingProcedure)
}

// nolint: errcheck
func (keeper Keeper) setTallyingProcedure(ctx sdk.Context, tallyingProcedure TallyingProcedure) {
keeper.paramSpace.Set(ctx, ParamStoreKeyTallyingProcedure, &tallyingProcedure)
Expand Down
12 changes: 3 additions & 9 deletions x/gov/procedures.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,7 @@ type DepositProcedure struct {

// Procedure around Tallying votes in governance
type TallyingProcedure struct {
Quorum sdk.Dec `json:"quorum"` // Minimum percentage of total stake needed to vote for a result to be considered valid
Threshold sdk.Dec `json:"threshold"` // Minimum propotion of Yes votes for proposal to pass. Initial value: 0.5
Veto sdk.Dec `json:"veto"` // Minimum value of Veto votes to Total votes ratio for proposal to be vetoed. Initial value: 1/3
GovernancePenalty sdk.Dec `json:"governance_penalty"` // Penalty if validator does not vote
}

// Procedure around Voting in governance
type VotingProcedure struct {
VotingPeriod time.Duration `json:"voting_period"` // Length of the voting period.
Quorum sdk.Dec `json:"quorum"` // Minimum percentage of total stake needed to vote for a result to be considered valid
Threshold sdk.Dec `json:"threshold"` // Minimum propotion of Yes votes for proposal to pass. Initial value: 0.5
Veto sdk.Dec `json:"veto"` // Minimum value of Veto votes to Total votes ratio for proposal to be vetoed. Initial value: 1/3
}

0 comments on commit 1afab6b

Please sign in to comment.