mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-12-23 23:05:18 +00:00
make builds pass
This commit is contained in:
parent
54c2e44a2d
commit
cae6cb196c
@ -1,12 +1,12 @@
|
||||
package committee
|
||||
|
||||
func BeginBlocker() {
|
||||
// TODO much the same as the current gov endblocker does
|
||||
// func BeginBlocker() {
|
||||
// // TODO much the same as the current gov endblocker does
|
||||
|
||||
// Get all active proposals
|
||||
// If voting periods are over, tally up the results
|
||||
// If a proposal passes run it through the correct handler
|
||||
// Handler need to be registered in app.go as they are for the current gov module
|
||||
handler := keeper.Router().GetRoute(proposal.ProposalRoute())
|
||||
err := handler(ctx, proposal.Content)
|
||||
}
|
||||
// // Get all active proposals
|
||||
// // If voting periods are over, tally up the results
|
||||
// // If a proposal passes run it through the correct handler
|
||||
// // Handler need to be registered in app.go as they are for the current gov module
|
||||
// handler := keeper.Router().GetRoute(proposal.ProposalRoute())
|
||||
// err := handler(ctx, proposal.Content)
|
||||
// }
|
||||
|
@ -1,13 +1,14 @@
|
||||
package committee
|
||||
|
||||
// committee, subcommittee, council, caucus, commission, synod, board
|
||||
|
||||
/*
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
|
||||
"github.com/kava-labs/kava/x/committee/keeper"
|
||||
|
||||
"github.com/kava-labs/kava/x/committee/types"
|
||||
)
|
||||
|
||||
@ -45,3 +46,4 @@ func handleMsgVote(ctx sdk.Context, k keeper.Keeper, msg types.MsgVote) sdk.Resu
|
||||
|
||||
return sdk.Result{}
|
||||
}
|
||||
*/
|
||||
|
@ -1,4 +1,4 @@
|
||||
package types
|
||||
package keeper
|
||||
|
||||
import (
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
@ -29,20 +29,20 @@ type Keeper struct {
|
||||
|
||||
*/
|
||||
|
||||
func (k Keeper) SubmitProposal(ctx sdk.Context, msg types.MsgSubmitProposal) sdk.Error {
|
||||
func (k Keeper) SubmitProposal(ctx sdk.Context, proposal types.Proposal) sdk.Error {
|
||||
// TODO Limit proposals to only be submitted by group members
|
||||
|
||||
// Check group has permissions to enact proposal. As long as one permission allows the proposal then it goes through. Its the OR of all permissions.
|
||||
committee, _ := k.GetCommittee(ctx, msg.CommitteeID)
|
||||
committee, _ := k.GetCommittee(ctx, proposal.CommitteeID)
|
||||
hasPermissions := false
|
||||
for _, p := range committee.Permissions {
|
||||
if p.Allows(msg.Proposal) {
|
||||
if p.Allows(proposal) {
|
||||
hasPermissions = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if !hasPermissions {
|
||||
return sdk.ErrInternal("committee does not have permissions to enact proposal").Result()
|
||||
return sdk.ErrInternal("committee does not have permissions to enact proposal")
|
||||
}
|
||||
|
||||
// TODO validate proposal by running it with cached context like how gov does it
|
||||
@ -59,3 +59,26 @@ func (k Keeper) AddVote(ctx sdk.Context, msg types.MsgVote) sdk.Error {
|
||||
*/
|
||||
return nil
|
||||
}
|
||||
|
||||
// --------------------
|
||||
|
||||
func (k Keeper) GetCommittee(ctx sdk.Context, committeeID uint64) (types.Committee, bool) {
|
||||
return types.Committee{}, false
|
||||
}
|
||||
func (k Keeper) SetCommittee(ctx sdk.Context, committee types.Committee) {
|
||||
|
||||
}
|
||||
|
||||
func (k Keeper) GetVote(ctx sdk.Context, voteID uint64) (types.Vote, bool) {
|
||||
return types.Vote{}, false
|
||||
}
|
||||
func (k Keeper) SetVote(ctx sdk.Context, vote types.Vote) {
|
||||
|
||||
}
|
||||
|
||||
func (k Keeper) GetProposal(ctx sdk.Context, proposalID uint64) (types.Proposal, bool) {
|
||||
return types.Proposal{}, false
|
||||
}
|
||||
func (k Keeper) SetProposal(ctx sdk.Context, proposal types.Proposal) {
|
||||
|
||||
}
|
||||
|
@ -11,10 +11,10 @@ import (
|
||||
// Allow only changes to inflation_rate
|
||||
type InflationRateChangePermission struct{}
|
||||
|
||||
var _ types.Permission = InflationRateChangePermission
|
||||
var _ Permission = InflationRateChangePermission{}
|
||||
|
||||
func (InflationRateChangePermission) Allows(p gov.Proposal) bool {
|
||||
pcp, ok := p.Content.(params.ParameterChangeProposal)
|
||||
func (InflationRateChangePermission) Allows(p gov.Content) bool {
|
||||
pcp, ok := p.(params.ParameterChangeProposal)
|
||||
if !ok {
|
||||
return false
|
||||
}
|
||||
@ -29,7 +29,7 @@ func (InflationRateChangePermission) Allows(p gov.Proposal) bool {
|
||||
// Allow only shutdown of the CDP Deposit msg
|
||||
type ShutdownCDPDepsitPermission struct{}
|
||||
|
||||
var _ types.Permission = ShutdownCDPDepsitPermission
|
||||
var _ Permission = ShutdownCDPDepsitPermission{}
|
||||
|
||||
func (ShutdownCDPDepsitPermission) Allows(p gov.Content) bool {
|
||||
sdp, ok := p.(sdtypes.ShutdownProposal)
|
||||
@ -46,13 +46,13 @@ func (ShutdownCDPDepsitPermission) Allows(p gov.Content) bool {
|
||||
|
||||
// Same as above but the route isn't static
|
||||
type GeneralShutdownPermission struct {
|
||||
MsgRoute cbtypes.MsgRoute
|
||||
MsgRoute sdtypes.MsgRoute
|
||||
}
|
||||
|
||||
var _ types.Permission = GeneralShutdownPermission
|
||||
var _ Permission = GeneralShutdownPermission{}
|
||||
|
||||
func (perm GeneralShutdownPermission) Allows(p gov.Content) bool {
|
||||
sdp, ok := p.Content.(sdtypes.ShutdownProposal)
|
||||
sdp, ok := p.(sdtypes.ShutdownProposal)
|
||||
if !ok {
|
||||
return false
|
||||
}
|
||||
|
@ -22,8 +22,9 @@ type Permission interface {
|
||||
type Proposal struct {
|
||||
gov.Content
|
||||
ID uint64
|
||||
committeeID uint64
|
||||
CommitteeID uint64
|
||||
// TODO
|
||||
// could store votes on the proposal object
|
||||
}
|
||||
|
||||
type Vote struct {
|
||||
@ -31,3 +32,7 @@ type Vote struct {
|
||||
Voter sdk.AccAddress
|
||||
Option byte
|
||||
}
|
||||
|
||||
// Genesis -------------------
|
||||
// Ok just to dump everything to json and reload - if time involved then begin blocker will take care of closing expired proposals. And it won't enact proposals because they would've been immediately enacted before the halt if they passed.
|
||||
// committee, proposals, votes
|
||||
|
Loading…
Reference in New Issue
Block a user