forked from cosmos/interchain-security
-
Notifications
You must be signed in to change notification settings - Fork 0
/
proposal_handler.go
30 lines (26 loc) · 1.08 KB
/
proposal_handler.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package provider
import (
errorsmod "cosmossdk.io/errors"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"
"github.com/cosmos/interchain-security/v3/x/ccv/provider/keeper"
"github.com/cosmos/interchain-security/v3/x/ccv/provider/types"
)
// NewProviderProposalHandler defines the handler for consumer addition,
// consumer removal, and consumer reward denom proposals.
// Passed proposals are executed during EndBlock.
func NewProviderProposalHandler(k keeper.Keeper) govv1beta1.Handler {
return func(ctx sdk.Context, content govv1beta1.Content) error {
switch c := content.(type) {
case *types.ConsumerAdditionProposal:
return k.HandleConsumerAdditionProposal(ctx, c)
case *types.ConsumerRemovalProposal:
return k.HandleConsumerRemovalProposal(ctx, c)
case *types.ChangeRewardDenomsProposal:
return k.HandleConsumerRewardDenomProposal(ctx, c)
default:
return errorsmod.Wrapf(sdkerrors.ErrUnknownRequest, "unrecognized ccv proposal content type: %T", c)
}
}
}