-
Notifications
You must be signed in to change notification settings - Fork 29
/
proposal_handler.go
38 lines (30 loc) · 1.12 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
31
32
33
34
35
36
37
38
package token
import (
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
"github.com/ixofoundation/ixo-blockchain/v3/x/token/keeper"
"github.com/ixofoundation/ixo-blockchain/v3/x/token/types"
)
const (
TokenNftContractName = "token_nft"
TokenNftContractSymbol = "token"
)
// NewParamChangeProposalHandler creates a new governance Handler for a ParamChangeProposal
func NewTokenParamChangeProposalHandler(k keeper.Keeper) govtypes.Handler {
return func(ctx sdk.Context, content govtypes.Content) error {
switch c := content.(type) {
case *types.SetTokenContractCodes:
return handleTokenParameterChangeProposal(ctx, k, c)
default:
return sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "unrecognized param proposal content type: %T", c)
}
}
}
func handleTokenParameterChangeProposal(ctx sdk.Context, k keeper.Keeper, p *types.SetTokenContractCodes) error {
var xx types.Params
k.ParamSpace.GetParamSetIfExists(ctx, &xx)
xx.Ixo1155ContractCode = p.Ixo1155ContractCode
k.ParamSpace.SetParamSet(ctx, &xx)
return nil
}