0g-chain/x/shutdown/proposal_handler.go

31 lines
772 B
Go
Raw Normal View History

2020-03-04 19:16:27 +00:00
package shutdown
import (
"fmt"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/gov"
"github.com/kava-labs/kava/x/shutdown/keeper"
"github.com/kava-labs/kava/x/shutdown/types"
)
func NewShutdownProposalHandler(k keeper.Keeper) gov.Handler {
return func(ctx sdk.Context, content gov.Content) sdk.Error {
switch c := content.(type) {
case types.ShutdownProposal:
return handleShutdownProposal(ctx, k, c)
default:
errMsg := fmt.Sprintf("unrecognized %s proposal content type: %T", types.ModuleName, c)
return sdk.ErrUnknownRequest(errMsg)
}
}
}
func handleShutdownProposal(ctx sdk.Context, k keeper.Keeper, c types.ShutdownProposal) sdk.Error {
// TODO validate proposal
k.SetMsgRoutes(ctx, c.MsgRoutes)
return nil
}