mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-11-14 03:55:19 +00:00
31 lines
772 B
Go
31 lines
772 B
Go
|
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
|
||
|
}
|