From 857a641bd24dffc5dbd4b25cf847e3608ad295ff Mon Sep 17 00:00:00 2001 From: Dreamer <745124335@qq.com> Date: Thu, 15 Jun 2023 13:41:19 +0800 Subject: [PATCH 1/4] regenerate proto file --- modules/token/genesis.go | 4 +- modules/token/handler_test.go | 2 +- modules/token/keeper/fees.go | 8 +- modules/token/keeper/grpc_query.go | 6 +- modules/token/keeper/grpc_query_test.go | 12 +- modules/token/keeper/keeper.go | 3 + modules/token/keeper/keeper_test.go | 2 +- modules/token/keeper/msg_server.go | 92 +++-- modules/token/keeper/params.go | 19 + modules/token/keeper/token.go | 12 - modules/token/types/v1/codec.go | 2 + modules/token/types/v1/genesis.go | 2 +- modules/token/types/v1/msgs.go | 53 ++- modules/token/types/v1/params.go | 14 +- modules/token/types/v1/params_test.go | 4 +- modules/token/types/v1/query.pb.go | 103 ++--- modules/token/types/v1/tx.pb.go | 492 +++++++++++++++++++++--- proto/token/v1/query.proto | 13 +- proto/token/v1/tx.proto | 64 ++- simapp/app.go | 1 + 20 files changed, 735 insertions(+), 173 deletions(-) create mode 100644 modules/token/keeper/params.go diff --git a/modules/token/genesis.go b/modules/token/genesis.go index e4089276..3058cf4a 100644 --- a/modules/token/genesis.go +++ b/modules/token/genesis.go @@ -15,7 +15,7 @@ func InitGenesis(ctx sdk.Context, k keeper.Keeper, data v1.GenesisState) { panic(err.Error()) } - k.SetParamSet(ctx, data.Params) + k.SetParam(ctx, data.Params) // init tokens for _, token := range data.Tokens { @@ -43,7 +43,7 @@ func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *v1.GenesisState { tokens = append(tokens, *t) } return &v1.GenesisState{ - Params: k.GetParamSet(ctx), + Params: k.GetParam(ctx), Tokens: tokens, BurnedCoins: k.GetAllBurnCoin(ctx), } diff --git a/modules/token/handler_test.go b/modules/token/handler_test.go index 308222e7..1e2a30c4 100644 --- a/modules/token/handler_test.go +++ b/modules/token/handler_test.go @@ -54,7 +54,7 @@ func (suite *HandlerSuite) SetupTest() { suite.bk = app.BankKeeper // set params - suite.keeper.SetParamSet(suite.ctx, v1.DefaultParams()) + suite.keeper.SetParam(suite.ctx, v1.DefaultParams()) // init tokens to addr err := suite.bk.MintCoins(suite.ctx, types.ModuleName, initCoin) diff --git a/modules/token/keeper/fees.go b/modules/token/keeper/fees.go index dda12643..5bbd68f0 100644 --- a/modules/token/keeper/fees.go +++ b/modules/token/keeper/fees.go @@ -56,12 +56,14 @@ func (k Keeper) GetTokenMintFee(ctx sdk.Context, symbol string) (sdk.Coin, error } mintFee := sdk.NewDecFromInt(fee.Amount).Mul(params.MintTokenFeeRatio).TruncateInt() - return token.ToMinCoin(sdk.NewDecCoinFromDec(params.IssueTokenBaseFee.Denom, sdk.NewDecFromInt(mintFee))) + return token.ToMinCoin( + sdk.NewDecCoinFromDec(params.IssueTokenBaseFee.Denom, sdk.NewDecFromInt(mintFee)), + ) } func (k Keeper) calcTokenIssueFee(ctx sdk.Context, symbol string) (sdk.Coin, v1.Params) { // get params - params := k.GetParamSet(ctx) + params := k.GetParam(ctx) issueTokenBaseFee := params.IssueTokenBaseFee // compute the fee @@ -74,7 +76,7 @@ func (k Keeper) calcTokenIssueFee(ctx sdk.Context, symbol string) (sdk.Coin, v1. // feeHandler handles the fee of token func feeHandler(ctx sdk.Context, k Keeper, feeAcc sdk.AccAddress, fee sdk.Coin) error { - params := k.GetParamSet(ctx) + params := k.GetParam(ctx) tokenTaxRate := params.TokenTaxRate // compute community tax and burned coin diff --git a/modules/token/keeper/grpc_query.go b/modules/token/keeper/grpc_query.go index b3db9a8a..a03c4454 100644 --- a/modules/token/keeper/grpc_query.go +++ b/modules/token/keeper/grpc_query.go @@ -76,7 +76,7 @@ func (k Keeper) Tokens( pageRes, err = query.Paginate( tokenStore, shapePageRequest(req.Pagination), - func(key []byte, value []byte) error { + func(_ []byte, value []byte) error { var token v1.Token k.cdc.MustUnmarshal(value, &token) tokens = append(tokens, &token) @@ -88,7 +88,7 @@ func (k Keeper) Tokens( } } else { tokenStore := prefix.NewStore(store, types.KeyTokens(owner, "")) - pageRes, err = query.Paginate(tokenStore, shapePageRequest(req.Pagination), func(key []byte, value []byte) error { + pageRes, err = query.Paginate(tokenStore, shapePageRequest(req.Pagination), func(_ []byte, value []byte) error { var symbol gogotypes.StringValue k.cdc.MustUnmarshal(value, &symbol) token, err := k.GetToken(ctx, symbol.Value) @@ -151,7 +151,7 @@ func (k Keeper) Params( req *v1.QueryParamsRequest, ) (*v1.QueryParamsResponse, error) { ctx := sdk.UnwrapSDKContext(c) - params := k.GetParamSet(ctx) + params := k.GetParam(ctx) return &v1.QueryParamsResponse{Params: params}, nil } diff --git a/modules/token/keeper/grpc_query_test.go b/modules/token/keeper/grpc_query_test.go index 91e8fa9f..1160a1a3 100644 --- a/modules/token/keeper/grpc_query_test.go +++ b/modules/token/keeper/grpc_query_test.go @@ -22,11 +22,17 @@ func (suite *KeeperTestSuite) TestGRPCQueryToken() { _ = suite.app.TokenKeeper.AddToken(ctx, token) // Query token - tokenResp1, err := queryClient.Token(gocontext.Background(), &v1.QueryTokenRequest{Denom: "btc"}) + tokenResp1, err := queryClient.Token( + gocontext.Background(), + &v1.QueryTokenRequest{Denom: "btc"}, + ) suite.Require().NoError(err) suite.Require().NotNil(tokenResp1) - tokenResp2, err := queryClient.Token(gocontext.Background(), &v1.QueryTokenRequest{Denom: "satoshi"}) + tokenResp2, err := queryClient.Token( + gocontext.Background(), + &v1.QueryTokenRequest{Denom: "satoshi"}, + ) suite.Require().NoError(err) suite.Require().NotNil(tokenResp2) @@ -56,7 +62,7 @@ func (suite *KeeperTestSuite) TestGRPCQueryParams() { queryClient := v1.NewQueryClient(queryHelper) paramsResp, err := queryClient.Params(gocontext.Background(), &v1.QueryParamsRequest{}) - params := app.TokenKeeper.GetParamSet(ctx) + params := app.TokenKeeper.GetParam(ctx) suite.Require().NoError(err) suite.Equal(params, paramsResp.Params) } diff --git a/modules/token/keeper/keeper.go b/modules/token/keeper/keeper.go index e73f87c7..2d2ed460 100644 --- a/modules/token/keeper/keeper.go +++ b/modules/token/keeper/keeper.go @@ -23,6 +23,7 @@ type Keeper struct { paramSpace paramstypes.Subspace blockedAddrs map[string]bool feeCollectorName string + authority string registry v1.SwapRegistry } @@ -33,6 +34,7 @@ func NewKeeper( bankKeeper types.BankKeeper, blockedAddrs map[string]bool, feeCollectorName string, + authority string, ) Keeper { // set KeyTable if it has not already been set if !paramSpace.HasKeyTable() { @@ -47,6 +49,7 @@ func NewKeeper( feeCollectorName: feeCollectorName, blockedAddrs: blockedAddrs, registry: make(v1.SwapRegistry), + authority: authority, } } diff --git a/modules/token/keeper/keeper_test.go b/modules/token/keeper/keeper_test.go index 06a6f687..3a3a36da 100644 --- a/modules/token/keeper/keeper_test.go +++ b/modules/token/keeper/keeper_test.go @@ -51,7 +51,7 @@ func (suite *KeeperTestSuite) SetupTest() { suite.app = app // set params - suite.keeper.SetParamSet(suite.ctx, v1.DefaultParams()) + suite.keeper.SetParam(suite.ctx, v1.DefaultParams()) // init tokens to addr err := suite.bk.MintCoins(suite.ctx, types.ModuleName, initCoin) diff --git a/modules/token/keeper/msg_server.go b/modules/token/keeper/msg_server.go index 6328addb..a77d7369 100644 --- a/modules/token/keeper/msg_server.go +++ b/modules/token/keeper/msg_server.go @@ -11,7 +11,7 @@ import ( ) type msgServer struct { - Keeper + k Keeper } var _ v1.MsgServer = msgServer{} @@ -19,27 +19,30 @@ var _ v1.MsgServer = msgServer{} // NewMsgServerImpl returns an implementation of the token MsgServer interface // for the provided Keeper. func NewMsgServerImpl(keeper Keeper) v1.MsgServer { - return &msgServer{Keeper: keeper} + return &msgServer{k: keeper} } -func (m msgServer) IssueToken(goCtx context.Context, msg *v1.MsgIssueToken) (*v1.MsgIssueTokenResponse, error) { +func (m msgServer) IssueToken( + goCtx context.Context, + msg *v1.MsgIssueToken, +) (*v1.MsgIssueTokenResponse, error) { owner, err := sdk.AccAddressFromBech32(msg.Owner) if err != nil { return nil, err } - if m.Keeper.blockedAddrs[msg.Owner] { + if m.k.blockedAddrs[msg.Owner] { return nil, sdkerrors.Wrapf(sdkerrors.ErrUnauthorized, "%s is a module account", msg.Owner) } ctx := sdk.UnwrapSDKContext(goCtx) // handle fee for token - if err := m.Keeper.DeductIssueTokenFee(ctx, owner, msg.Symbol); err != nil { + if err := m.k.DeductIssueTokenFee(ctx, owner, msg.Symbol); err != nil { return nil, err } - if err := m.Keeper.IssueToken( + if err := m.k.IssueToken( ctx, msg.Symbol, msg.Name, msg.MinUnit, msg.Scale, msg.InitialSupply, msg.MaxSupply, msg.Mintable, owner, ); err != nil { @@ -62,7 +65,10 @@ func (m msgServer) IssueToken(goCtx context.Context, msg *v1.MsgIssueToken) (*v1 return &v1.MsgIssueTokenResponse{}, nil } -func (m msgServer) EditToken(goCtx context.Context, msg *v1.MsgEditToken) (*v1.MsgEditTokenResponse, error) { +func (m msgServer) EditToken( + goCtx context.Context, + msg *v1.MsgEditToken, +) (*v1.MsgEditTokenResponse, error) { owner, err := sdk.AccAddressFromBech32(msg.Owner) if err != nil { return nil, err @@ -70,7 +76,7 @@ func (m msgServer) EditToken(goCtx context.Context, msg *v1.MsgEditToken) (*v1.M ctx := sdk.UnwrapSDKContext(goCtx) - if err := m.Keeper.EditToken( + if err := m.k.EditToken( ctx, msg.Symbol, msg.Name, msg.MaxSupply, msg.Mintable, owner, ); err != nil { @@ -93,7 +99,10 @@ func (m msgServer) EditToken(goCtx context.Context, msg *v1.MsgEditToken) (*v1.M return &v1.MsgEditTokenResponse{}, nil } -func (m msgServer) MintToken(goCtx context.Context, msg *v1.MsgMintToken) (*v1.MsgMintTokenResponse, error) { +func (m msgServer) MintToken( + goCtx context.Context, + msg *v1.MsgMintToken, +) (*v1.MsgMintTokenResponse, error) { owner, err := sdk.AccAddressFromBech32(msg.Owner) if err != nil { return nil, err @@ -110,21 +119,21 @@ func (m msgServer) MintToken(goCtx context.Context, msg *v1.MsgMintToken) (*v1.M recipient = owner } - if m.Keeper.blockedAddrs[recipient.String()] { + if m.k.blockedAddrs[recipient.String()] { return nil, sdkerrors.Wrapf(sdkerrors.ErrUnauthorized, "%s is a module account", recipient) } ctx := sdk.UnwrapSDKContext(goCtx) - symbol, err := m.Keeper.getSymbolByMinUnit(ctx, msg.Coin.Denom) + symbol, err := m.k.getSymbolByMinUnit(ctx, msg.Coin.Denom) if err != nil { return nil, err } - if err := m.Keeper.DeductMintTokenFee(ctx, owner, symbol); err != nil { + if err := m.k.DeductMintTokenFee(ctx, owner, symbol); err != nil { return nil, err } - if err := m.Keeper.MintToken(ctx, msg.Coin, recipient, owner); err != nil { + if err := m.k.MintToken(ctx, msg.Coin, recipient, owner); err != nil { return nil, err } @@ -144,14 +153,17 @@ func (m msgServer) MintToken(goCtx context.Context, msg *v1.MsgMintToken) (*v1.M return &v1.MsgMintTokenResponse{}, nil } -func (m msgServer) BurnToken(goCtx context.Context, msg *v1.MsgBurnToken) (*v1.MsgBurnTokenResponse, error) { +func (m msgServer) BurnToken( + goCtx context.Context, + msg *v1.MsgBurnToken, +) (*v1.MsgBurnTokenResponse, error) { owner, err := sdk.AccAddressFromBech32(msg.Sender) if err != nil { return nil, err } ctx := sdk.UnwrapSDKContext(goCtx) - if err := m.Keeper.BurnToken(ctx, msg.Coin, owner); err != nil { + if err := m.k.BurnToken(ctx, msg.Coin, owner); err != nil { return nil, err } @@ -170,7 +182,10 @@ func (m msgServer) BurnToken(goCtx context.Context, msg *v1.MsgBurnToken) (*v1.M return &v1.MsgBurnTokenResponse{}, nil } -func (m msgServer) TransferTokenOwner(goCtx context.Context, msg *v1.MsgTransferTokenOwner) (*v1.MsgTransferTokenOwnerResponse, error) { +func (m msgServer) TransferTokenOwner( + goCtx context.Context, + msg *v1.MsgTransferTokenOwner, +) (*v1.MsgTransferTokenOwnerResponse, error) { srcOwner, err := sdk.AccAddressFromBech32(msg.SrcOwner) if err != nil { return nil, err @@ -181,13 +196,17 @@ func (m msgServer) TransferTokenOwner(goCtx context.Context, msg *v1.MsgTransfer return nil, err } - if m.Keeper.blockedAddrs[msg.DstOwner] { - return nil, sdkerrors.Wrapf(sdkerrors.ErrUnauthorized, "%s is a module account", msg.DstOwner) + if m.k.blockedAddrs[msg.DstOwner] { + return nil, sdkerrors.Wrapf( + sdkerrors.ErrUnauthorized, + "%s is a module account", + msg.DstOwner, + ) } ctx := sdk.UnwrapSDKContext(goCtx) - if err := m.Keeper.TransferTokenOwner(ctx, msg.Symbol, srcOwner, dstOwner); err != nil { + if err := m.k.TransferTokenOwner(ctx, msg.Symbol, srcOwner, dstOwner); err != nil { return nil, err } @@ -208,7 +227,10 @@ func (m msgServer) TransferTokenOwner(goCtx context.Context, msg *v1.MsgTransfer return &v1.MsgTransferTokenOwnerResponse{}, nil } -func (m msgServer) SwapFeeToken(goCtx context.Context, msg *v1.MsgSwapFeeToken) (*v1.MsgSwapFeeTokenResponse, error) { +func (m msgServer) SwapFeeToken( + goCtx context.Context, + msg *v1.MsgSwapFeeToken, +) (*v1.MsgSwapFeeTokenResponse, error) { sender, err := sdk.AccAddressFromBech32(msg.Sender) if err != nil { return nil, err @@ -221,13 +243,17 @@ func (m msgServer) SwapFeeToken(goCtx context.Context, msg *v1.MsgSwapFeeToken) return nil, err } - if m.Keeper.blockedAddrs[msg.Recipient] { - return nil, sdkerrors.Wrapf(sdkerrors.ErrUnauthorized, "%s is a module account", recipient) + if m.k.blockedAddrs[msg.Recipient] { + return nil, sdkerrors.Wrapf( + sdkerrors.ErrUnauthorized, + "%s is a module account", + recipient, + ) } } ctx := sdk.UnwrapSDKContext(goCtx) - feePaid, feeGot, err := m.Keeper.SwapFeeToken(ctx, msg.FeePaid, sender, recipient) + feePaid, feeGot, err := m.k.SwapFeeToken(ctx, msg.FeePaid, sender, recipient) if err != nil { return nil, err } @@ -251,3 +277,23 @@ func (m msgServer) SwapFeeToken(goCtx context.Context, msg *v1.MsgSwapFeeToken) FeeGot: feeGot, }, nil } + +func (m msgServer) UpdateParams( + goCtx context.Context, + msg *v1.MsgUpdateParams, +) (*v1.MsgUpdateParamsResponse, error) { + if m.k.authority != msg.Authority { + return nil, sdkerrors.Wrapf( + sdkerrors.ErrUnauthorized, + "invalid authority; expected %s, got %s", + m.k.authority, + msg.Authority, + ) + } + + // ctx := sdk.UnwrapSDKContext(goCtx) + // if err := m.k.SetParamSet(ctx, msg.Params); err != nil { + // return nil, err + // } + return &v1.MsgUpdateParamsResponse{}, nil +} diff --git a/modules/token/keeper/params.go b/modules/token/keeper/params.go new file mode 100644 index 00000000..6827d428 --- /dev/null +++ b/modules/token/keeper/params.go @@ -0,0 +1,19 @@ +package keeper + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + + v1 "github.com/irisnet/irismod/modules/token/types/v1" +) + +// GetParam returns token params from the global param store +func (k Keeper) GetParam(ctx sdk.Context) v1.Params { + var p v1.Params + k.paramSpace.GetParamSet(ctx, &p) + return p +} + +// SetParam sets token params to the global param store +func (k Keeper) SetParam(ctx sdk.Context, params v1.Params) { + k.paramSpace.SetParamSet(ctx, ¶ms) +} diff --git a/modules/token/keeper/token.go b/modules/token/keeper/token.go index fc5ba97f..a856df5c 100644 --- a/modules/token/keeper/token.go +++ b/modules/token/keeper/token.go @@ -183,18 +183,6 @@ func (k Keeper) GetAllBurnCoin(ctx sdk.Context) []sdk.Coin { return coins } -// GetParamSet returns token params from the global param store -func (k Keeper) GetParamSet(ctx sdk.Context) v1.Params { - var p v1.Params - k.paramSpace.GetParamSet(ctx, &p) - return p -} - -// SetParamSet sets token params to the global param store -func (k Keeper) SetParamSet(ctx sdk.Context, params v1.Params) { - k.paramSpace.SetParamSet(ctx, ¶ms) -} - func (k Keeper) setWithOwner(ctx sdk.Context, owner sdk.AccAddress, symbol string) { store := ctx.KVStore(k.storeKey) diff --git a/modules/token/types/v1/codec.go b/modules/token/types/v1/codec.go index 0c585c7a..4966b4cf 100644 --- a/modules/token/types/v1/codec.go +++ b/modules/token/types/v1/codec.go @@ -29,6 +29,7 @@ func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { cdc.RegisterConcrete(&MsgBurnToken{}, "irismod/token/v1/MsgBurnToken", nil) cdc.RegisterConcrete(&MsgTransferTokenOwner{}, "irismod/token/v1/MsgTransferTokenOwner", nil) cdc.RegisterConcrete(&MsgSwapFeeToken{}, "irismod/token/v1/MsgSwapFeeToken", nil) + cdc.RegisterConcrete(&MsgUpdateParams{}, "irismod/token/MsgUpdateParams", nil) } func RegisterInterfaces(registry types.InterfaceRegistry) { @@ -39,6 +40,7 @@ func RegisterInterfaces(registry types.InterfaceRegistry) { &MsgBurnToken{}, &MsgTransferTokenOwner{}, &MsgSwapFeeToken{}, + &MsgUpdateParams{}, ) registry.RegisterInterface( "irismod.token.v1.TokenI", diff --git a/modules/token/types/v1/genesis.go b/modules/token/types/v1/genesis.go index 36669c1f..3a7356e9 100644 --- a/modules/token/types/v1/genesis.go +++ b/modules/token/types/v1/genesis.go @@ -66,7 +66,7 @@ func GetNativeToken() Token { // ValidateGenesis validates the provided token genesis state to ensure the // expected invariants holds. func ValidateGenesis(data GenesisState) error { - if err := ValidateParams(data.Params); err != nil { + if err := data.Params.Validate(); err != nil { return err } diff --git a/modules/token/types/v1/msgs.go b/modules/token/types/v1/msgs.go index 2a45a797..7166afe6 100644 --- a/modules/token/types/v1/msgs.go +++ b/modules/token/types/v1/msgs.go @@ -28,6 +28,7 @@ var ( _ sdk.Msg = &MsgBurnToken{} _ sdk.Msg = &MsgTransferTokenOwner{} _ sdk.Msg = &MsgSwapFeeToken{} + _ sdk.Msg = &MsgUpdateParams{} ) // NewMsgIssueToken - construct token issue msg. @@ -123,12 +124,20 @@ func (msg MsgTransferTokenOwner) GetSigners() []sdk.AccAddress { func (msg MsgTransferTokenOwner) ValidateBasic() error { srcOwner, err := sdk.AccAddressFromBech32(msg.SrcOwner) if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid source owner address (%s)", err) + return sdkerrors.Wrapf( + sdkerrors.ErrInvalidAddress, + "invalid source owner address (%s)", + err, + ) } dstOwner, err := sdk.AccAddressFromBech32(msg.DstOwner) if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid destination owner address (%s)", err) + return sdkerrors.Wrapf( + sdkerrors.ErrInvalidAddress, + "invalid destination owner address (%s)", + err, + ) } // check if the `DstOwner` is same as the original owner @@ -151,7 +160,12 @@ func (msg MsgTransferTokenOwner) Route() string { return MsgRoute } func (msg MsgTransferTokenOwner) Type() string { return TypeMsgTransferTokenOwner } // NewMsgEditToken creates a MsgEditToken -func NewMsgEditToken(name, symbol string, maxSupply uint64, mintable tokentypes.Bool, owner string) *MsgEditToken { +func NewMsgEditToken( + name, symbol string, + maxSupply uint64, + mintable tokentypes.Bool, + owner string, +) *MsgEditToken { return &MsgEditToken{ Name: name, Symbol: symbol, @@ -234,7 +248,11 @@ func (msg MsgMintToken) ValidateBasic() error { // check the reception if len(msg.To) > 0 { if _, err := sdk.AccAddressFromBech32(msg.To); err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid mint reception address (%s)", err) + return sdkerrors.Wrapf( + sdkerrors.ErrInvalidAddress, + "invalid mint reception address (%s)", + err, + ) } } @@ -302,9 +320,34 @@ func (msg MsgSwapFeeToken) ValidateBasic() error { if len(msg.Recipient) != 0 { if _, err := sdk.AccAddressFromBech32(msg.Recipient); err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid recipient address (%s)", err) + return sdkerrors.Wrapf( + sdkerrors.ErrInvalidAddress, + "invalid recipient address (%s)", + err, + ) } } return tokentypes.ValidateCoin(msg.FeePaid) } + +// GetSignBytes returns the raw bytes for a MsgUpdateParams message that +// the expected signer needs to sign. +func (m *MsgUpdateParams) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(m) + return sdk.MustSortJSON(bz) +} + +// ValidateBasic executes sanity validation on the provided data +func (m *MsgUpdateParams) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(m.Authority); err != nil { + return sdkerrors.Wrap(err, "invalid authority address") + } + return m.Params.Validate() +} + +// GetSigners returns the expected signers for a MsgUpdateParams message +func (m *MsgUpdateParams) GetSigners() []sdk.AccAddress { + addr, _ := sdk.AccAddressFromBech32(m.Authority) + return []sdk.AccAddress{addr} +} diff --git a/modules/token/types/v1/params.go b/modules/token/types/v1/params.go index 81bc59b5..1ea63c36 100644 --- a/modules/token/types/v1/params.go +++ b/modules/token/types/v1/params.go @@ -19,8 +19,16 @@ var ( func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { return paramtypes.ParamSetPairs{ paramtypes.NewParamSetPair(KeyTokenTaxRate, &p.TokenTaxRate, validateTaxRate), - paramtypes.NewParamSetPair(KeyIssueTokenBaseFee, &p.IssueTokenBaseFee, validateIssueTokenBaseFee), - paramtypes.NewParamSetPair(KeyMintTokenFeeRatio, &p.MintTokenFeeRatio, validateMintTokenFeeRatio), + paramtypes.NewParamSetPair( + KeyIssueTokenBaseFee, + &p.IssueTokenBaseFee, + validateIssueTokenBaseFee, + ), + paramtypes.NewParamSetPair( + KeyMintTokenFeeRatio, + &p.MintTokenFeeRatio, + validateMintTokenFeeRatio, + ), } } @@ -51,7 +59,7 @@ func DefaultParams() Params { } // ValidateParams validates the given params -func ValidateParams(p Params) error { +func (p Params) Validate() error { if err := validateTaxRate(p.TokenTaxRate); err != nil { return err } diff --git a/modules/token/types/v1/params_test.go b/modules/token/types/v1/params_test.go index d01ed4d4..f9fb9f04 100644 --- a/modules/token/types/v1/params_test.go +++ b/modules/token/types/v1/params_test.go @@ -77,9 +77,9 @@ func TestValidateParams(t *testing.T) { for _, tc := range tests { if tc.expectPass { - require.Nil(t, ValidateParams(tc.Params), "test: %v", tc.testCase) + require.Nil(t, tc.Params.Validate(), "test: %v", tc.testCase) } else { - require.NotNil(t, ValidateParams(tc.Params), "test: %v", tc.testCase) + require.NotNil(t, tc.Params.Validate(), "test: %v", tc.testCase) } } } diff --git a/modules/token/types/v1/query.pb.go b/modules/token/types/v1/query.pb.go index 8f2fa254..b5c495e7 100644 --- a/modules/token/types/v1/query.pb.go +++ b/modules/token/types/v1/query.pb.go @@ -81,7 +81,7 @@ func (m *QueryTokenRequest) GetDenom() string { // QueryTokenResponse is response type for the Query/Token RPC method type QueryTokenResponse struct { - Token *types.Any `protobuf:"bytes,1,opt,name=Token,proto3" json:"Token,omitempty"` + Token *types.Any `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"` } func (m *QueryTokenResponse) Reset() { *m = QueryTokenResponse{} } @@ -180,7 +180,7 @@ func (m *QueryTokensRequest) GetPagination() *query.PageRequest { // QueryTokensResponse is response type for the Query/Tokens RPC method type QueryTokensResponse struct { - Tokens []*types.Any `protobuf:"bytes,1,rep,name=Tokens,proto3" json:"Tokens,omitempty"` + Tokens []*types.Any `protobuf:"bytes,1,rep,name=tokens,proto3" json:"tokens,omitempty"` Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } @@ -525,55 +525,56 @@ func init() { func init() { proto.RegisterFile("token/v1/query.proto", fileDescriptor_5bbd8bb8d8ab2018) } var fileDescriptor_5bbd8bb8d8ab2018 = []byte{ - // 759 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0xc1, 0x6b, 0x13, 0x4d, - 0x14, 0xcf, 0xb6, 0x4d, 0xbe, 0x74, 0xda, 0x43, 0xbf, 0xf9, 0xf2, 0xd5, 0x34, 0x94, 0x6d, 0xd8, - 0xd6, 0x36, 0x16, 0xba, 0x43, 0x2a, 0x88, 0x7a, 0x33, 0x85, 0x88, 0x08, 0x52, 0x83, 0x27, 0x11, - 0xc2, 0xa6, 0x99, 0xae, 0x4b, 0xb3, 0x33, 0xe9, 0xce, 0x6c, 0x6b, 0xd0, 0x22, 0x88, 0x07, 0x8f, - 0x82, 0x37, 0xff, 0x0e, 0xff, 0x88, 0xe2, 0xa9, 0xe0, 0xc5, 0x53, 0x91, 0xd6, 0x7f,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- 0x00, 0x07, 0x16, 0xab, 0xb4, 0x38, 0x32, 0x06, 0x4a, 0xba, 0xba, 0x64, 0x05, 0x2f, 0x0f, 0xef, - 0xd9, 0xec, 0xe3, 0x01, 0xd9, 0x56, 0x85, 0xf7, 0x51, 0xce, 0x68, 0x69, 0x68, 0xe7, 0x29, 0xcd, - 0x0e, 0xed, 0x3c, 0x2d, 0xe1, 0x51, 0x9d, 0x83, 0x58, 0x5f, 0x5b, 0x68, 0xb2, 0x2f, 0x2a, 0xbc, - 0x32, 0x74, 0xa0, 0x69, 0x3d, 0x96, 0x2a, 0x97, 0x07, 0x02, 0x85, 0x25, 0x4d, 0xc1, 0xc6, 0xf3, - 0x17, 0x4d, 0x42, 0x7a, 0x9d, 0xa6, 0x12, 0x62, 0xed, 0xfe, 0xe1, 0x89, 0x6d, 0x1d, 0x9d, 0xd8, - 0xd6, 0x97, 0x13, 0xdb, 0x7a, 0x7b, 0x6a, 0x67, 0x8e, 0x4e, 0xed, 0xcc, 0xe7, 0x53, 0x3b, 0xf3, - 0xb8, 0x3a, 0xb0, 0xe5, 0x0a, 0x81, 0x51, 0xd9, 0x47, 0x0a, 0x79, 0x3b, 0xee, 0x50, 0x01, 0x88, - 0x7a, 0xe3, 0xd5, 0x57, 0x31, 0xa7, 0xdf, 0xde, 0xeb, 0x3f, 0x03, 0x00, 0x00, 0xff, 0xff, 0xdf, - 0x69, 0x2e, 0x72, 0x97, 0x07, 0x00, 0x00, + // 780 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0xcf, 0x4f, 0x13, 0x4d, + 0x18, 0xee, 0x02, 0xed, 0x57, 0x06, 0x0e, 0x7c, 0xf3, 0xf5, 0xc3, 0xb2, 0x92, 0x85, 0x2c, 0xf2, + 0x33, 0x61, 0x27, 0x85, 0xc4, 0xa8, 0x37, 0x4b, 0x52, 0x63, 0x4c, 0x0c, 0x36, 0x9e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b, 0xcf, 0x07, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/modules/token/types/v1/tx.pb.go b/modules/token/types/v1/tx.pb.go index 7e58c07a..1549c502 100644 --- a/modules/token/types/v1/tx.pb.go +++ b/modules/token/types/v1/tx.pb.go @@ -6,7 +6,9 @@ package v1 import ( context "context" fmt "fmt" + _ "github.com/cosmos/cosmos-proto" types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/cosmos-sdk/types/msgservice" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" @@ -500,6 +502,92 @@ func (m *MsgSwapFeeTokenResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgSwapFeeTokenResponse proto.InternalMessageInfo +// MsgUpdateParams is the Msg/UpdateParams request type. +// +// Since: cosmos-sdk 0.47 +type MsgUpdateParams struct { + // authority is the address that controls the module (defaults to token unless + // overwritten). + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // params defines the token parameters to update. + // + // NOTE: All parameters must be supplied. + Params Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params"` +} + +func (m *MsgUpdateParams) Reset() { *m = MsgUpdateParams{} } +func (m *MsgUpdateParams) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParams) ProtoMessage() {} +func (*MsgUpdateParams) Descriptor() ([]byte, []int) { + return fileDescriptor_87c1c1bb1b0f75ea, []int{12} +} +func (m *MsgUpdateParams) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateParams.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUpdateParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParams.Merge(m, src) +} +func (m *MsgUpdateParams) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateParams) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParams.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateParams proto.InternalMessageInfo + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +// +// Since: cosmos-sdk 0.47 +type MsgUpdateParamsResponse struct { +} + +func (m *MsgUpdateParamsResponse) Reset() { *m = MsgUpdateParamsResponse{} } +func (m *MsgUpdateParamsResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParamsResponse) ProtoMessage() {} +func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_87c1c1bb1b0f75ea, []int{13} +} +func (m *MsgUpdateParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateParamsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUpdateParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParamsResponse.Merge(m, src) +} +func (m *MsgUpdateParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*MsgIssueToken)(nil), "irismod.token.v1.MsgIssueToken") proto.RegisterType((*MsgIssueTokenResponse)(nil), "irismod.token.v1.MsgIssueTokenResponse") @@ -513,57 +601,69 @@ func init() { proto.RegisterType((*MsgBurnTokenResponse)(nil), "irismod.token.v1.MsgBurnTokenResponse") proto.RegisterType((*MsgSwapFeeToken)(nil), "irismod.token.v1.MsgSwapFeeToken") proto.RegisterType((*MsgSwapFeeTokenResponse)(nil), "irismod.token.v1.MsgSwapFeeTokenResponse") + proto.RegisterType((*MsgUpdateParams)(nil), "irismod.token.v1.MsgUpdateParams") + proto.RegisterType((*MsgUpdateParamsResponse)(nil), "irismod.token.v1.MsgUpdateParamsResponse") } func init() { proto.RegisterFile("token/v1/tx.proto", fileDescriptor_87c1c1bb1b0f75ea) } var fileDescriptor_87c1c1bb1b0f75ea = []byte{ - // 706 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x55, 0xcd, 0x6e, 0xd3, 0x40, - 0x18, 0x8c, 0x9b, 0x34, 0x4d, 0x3e, 0xda, 0x02, 0xab, 0xd2, 0xa6, 0x86, 0x3a, 0x21, 0x12, 0x10, - 0x2e, 0xb6, 0xd2, 0x1e, 0x40, 0x1c, 0x83, 0x00, 0x71, 0x88, 0x8a, 0x92, 0xc2, 0x01, 0x90, 0x22, - 0xc7, 0xde, 0x98, 0x15, 0xf6, 0xae, 0xe5, 0xdd, 0xf4, 0xe7, 0xcc, 0x0b, 0xf0, 0x1c, 0x3c, 0x07, - 0x87, 0x1e, 0x7b, 0xe4, 0x54, 0x41, 0xcb, 0x53, 0x70, 0x42, 0x5e, 0xbb, 0x1b, 0xa7, 0x71, 0x69, - 0x2b, 0x6e, 0xde, 0x9d, 0xcf, 0xf3, 0xcd, 0x37, 0x3b, 0x5e, 0xc3, 0x6d, 0xc1, 0x3e, 0x63, 0x6a, - 0xed, 0xb6, 0x2d, 0xb1, 0x6f, 0x86, 0x11, 0x13, 0x0c, 0xdd, 0x22, 0x11, 0xe1, 0x01, 0x73, 0x4d, - 0x09, 0x99, 0xbb, 0x6d, 0x7d, 0xc5, 0x63, 0x1e, 0x93, 0xa0, 0x15, 0x3f, 0x25, 0x75, 0xba, 0xe1, - 0x30, 0x1e, 0x30, 0x6e, 0x0d, 0x6d, 0x8e,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xbe, 0xde, 0x55, 0x14, 0xff, 0xcb, - 0xca, 0xf2, 0x17, 0xb6, 0xf5, 0x37, 0x00, 0x00, 0xff, 0xff, 0xb9, 0x67, 0x69, 0xbd, 0x1f, 0x07, - 0x00, 0x00, + // 875 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x56, 0xcf, 0x8f, 0xdb, 0x44, + 0x14, 0x8e, 0x37, 0x3f, 0x36, 0x99, 0xed, 0x2e, 0x30, 0x0a, 0x5d, 0xc7, 0x50, 0x27, 0x44, 0x02, + 0x42, 0x25, 0x6c, 0xb2, 0x2b, 0x15, 0x94, 0x1b, 0x41, 0x80, 0x38, 0x44, 0xad, 0x92, 0x96, 0x03, + 0x42, 0x8a, 0x26, 0xf1, 0xc4, 0x1d, 0x11, 0xcf, 0x58, 0x9e, 0xc9, 0x76, 0x73, 0x43, 0x3d, 0x72, + 0x29, 0x88, 0xff, 0x82, 0x53, 0x0f, 0xfc, 0x11, 0x7b, 0xac, 0x38, 0x71, 0xaa, 0x60, 0xf7, 0x50, + 0x89, 0x3f, 0x81, 0x13, 0xf2, 0xcc, 0xc4, 0x76, 0x36, 0xde, 0x5f, 0xe5, 0xe6, 0x99, 0xef, 0xf3, + 0x7b, 0xdf, 0x7c, 0xef, 0xbd, 0xb1, 0xc1, 0x5b, 0x82, 0xfd, 0x80, 0xa9, 0x7b, 0xd4, 0x75, 0xc5, + 0xb1, 0x13, 0x46, 0x4c, 0x30, 0xf8, 0x26, 0x89, 0x08, 0x0f, 0x98, 0xe7, 0x48, 0xc8, 0x39, 0xea, + 0x5a, 0x75, 0x9f, 0xf9, 0x4c, 0x82, 0x6e, 0xfc, 0xa4, 0x78, 0x96, 0x3d, 0x65, 0x3c, 0x60, 0xdc, + 0x9d, 0x20, 0x8e, 0xdd, 0xa3, 0xee, 0x04, 0x0b, 0xd4, 0x75, 0xa7, 0x8c, 0x50, 0x8d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x9a, 0x95, + 0xb4, 0x3a, 0xe8, 0xc1, 0xb3, 0x32, 0x28, 0x0e, 0xb8, 0x0f, 0xbf, 0x05, 0x20, 0x73, 0xbb, 0x37, + 0x37, 0x13, 0xad, 0x5d, 0x79, 0xd6, 0x87, 0x57, 0x10, 0x12, 0x23, 0x47, 0xa0, 0x96, 0x5e, 0x2c, + 0x76, 0xee, 0x5b, 0x09, 0x6e, 0x7d, 0x70, 0x39, 0x9e, 0x0d, 0x9a, 0x0e, 0x6a, 0x7e, 0xd0, 0x04, + 0xbf, 0x20, 0xe8, 0xc6, 0x5c, 0xc5, 0x41, 0xd3, 0x99, 0xca, 0x0f, 0x9a, 0xe0, 0x17, 0x04, 0xdd, + 0x98, 0x07, 0x48, 0x01, 0xcc, 0xf9, 0x1c, 0xe4, 0xbb, 0xb7, 0x49, 0xb4, 0xdc, 0x6b, 0x12, 0x93, + 0x7c, 0xdf, 0x83, 0x5b, 0x6b, 0xb3, 0xf7, 0x5e, 0x6e, 0x80, 0x2c, 0xc5, 0xfa, 0xe8, 0x4a, 0x4a, + 0x36, 0xfa, 0x5a, 0x5f, 0xe7, 0x47, 0xcf, 0x52, 0x2e, 0x88, 0x9e, 0xd7, 0x8a, 0x56, 0xf9, 0xc7, + 0x57, 0xcf, 0xef, 0x1a, 0xfd, 0xfb, 0x27, 0x7f, 0xdb, 0x85, 0x93, 0x53, 0xdb, 0x78, 0x71, 0x6a, + 0x1b, 0x7f, 0x9d, 0xda, 0xc6, 0xcf, 0x67, 0x76, 0xe1, 0xc5, 0x99, 0x5d, 0xf8, 0xf3, 0xcc, 0x2e, + 0x7c, 0xd7, 0xbd, 0xd9, 0xa7, 0x23, 0xfe, 0x2d, 0xaa, 0xc8, 0x7f, 0x98, 0xc3, 0xff, 0x02, 0x00, + 0x00, 0xff, 0xff, 0x0f, 0x68, 0xf6, 0xca, 0x6a, 0x09, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -586,10 +686,15 @@ type MsgClient interface { MintToken(ctx context.Context, in *MsgMintToken, opts ...grpc.CallOption) (*MsgMintTokenResponse, error) // BurnToken defines a method for burning some tokens BurnToken(ctx context.Context, in *MsgBurnToken, opts ...grpc.CallOption) (*MsgBurnTokenResponse, error) - // TransferTokenOwner defines a method for minting some tokens + // TransferTokenOwner defines a method for transfering token owner TransferTokenOwner(ctx context.Context, in *MsgTransferTokenOwner, opts ...grpc.CallOption) (*MsgTransferTokenOwnerResponse, error) // SwapFeeToken defines a method for swap some fee token SwapFeeToken(ctx context.Context, in *MsgSwapFeeToken, opts ...grpc.CallOption) (*MsgSwapFeeTokenResponse, error) + // UpdateParams defines a governance operation for updating the token + // module parameters. The authority is defined in the keeper. + // + // Since: cosmos-sdk 0.47 + UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) } type msgClient struct { @@ -654,6 +759,15 @@ func (c *msgClient) SwapFeeToken(ctx context.Context, in *MsgSwapFeeToken, opts return out, nil } +func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) { + out := new(MsgUpdateParamsResponse) + err := c.cc.Invoke(ctx, "/irismod.token.v1.Msg/UpdateParams", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { // IssueToken defines a method for issuing a new token @@ -664,10 +778,15 @@ type MsgServer interface { MintToken(context.Context, *MsgMintToken) (*MsgMintTokenResponse, error) // BurnToken defines a method for burning some tokens BurnToken(context.Context, *MsgBurnToken) (*MsgBurnTokenResponse, error) - // TransferTokenOwner defines a method for minting some tokens + // TransferTokenOwner defines a method for transfering token owner TransferTokenOwner(context.Context, *MsgTransferTokenOwner) (*MsgTransferTokenOwnerResponse, error) // SwapFeeToken defines a method for swap some fee token SwapFeeToken(context.Context, *MsgSwapFeeToken) (*MsgSwapFeeTokenResponse, error) + // UpdateParams defines a governance operation for updating the token + // module parameters. The authority is defined in the keeper. + // + // Since: cosmos-sdk 0.47 + UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -692,6 +811,9 @@ func (*UnimplementedMsgServer) TransferTokenOwner(ctx context.Context, req *MsgT func (*UnimplementedMsgServer) SwapFeeToken(ctx context.Context, req *MsgSwapFeeToken) (*MsgSwapFeeTokenResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method SwapFeeToken not implemented") } +func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -805,6 +927,24 @@ func _Msg_SwapFeeToken_Handler(srv interface{}, ctx context.Context, dec func(in return interceptor(ctx, in, info, handler) } +func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateParams) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdateParams(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/irismod.token.v1.Msg/UpdateParams", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateParams(ctx, req.(*MsgUpdateParams)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "irismod.token.v1.Msg", HandlerType: (*MsgServer)(nil), @@ -833,6 +973,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "SwapFeeToken", Handler: _Msg_SwapFeeToken_Handler, }, + { + MethodName: "UpdateParams", + Handler: _Msg_UpdateParams_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "token/v1/tx.proto", @@ -1296,6 +1440,69 @@ func (m *MsgSwapFeeTokenResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) return len(dAtA) - i, nil } +func (m *MsgUpdateParams) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUpdateParams) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUpdateParamsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUpdateParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + func encodeVarintTx(dAtA []byte, offset int, v uint64) int { offset -= sovTx(v) base := offset @@ -1502,6 +1709,30 @@ func (m *MsgSwapFeeTokenResponse) Size() (n int) { return n } +func (m *MsgUpdateParams) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Params.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgUpdateParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + func sovTx(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -2848,6 +3079,171 @@ func (m *MsgSwapFeeTokenResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipTx(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/proto/token/v1/query.proto b/proto/token/v1/query.proto index dff3acbf..44e188e9 100644 --- a/proto/token/v1/query.proto +++ b/proto/token/v1/query.proto @@ -4,6 +4,7 @@ package irismod.token.v1; import "cosmos/base/v1beta1/coin.proto"; import "cosmos_proto/cosmos.proto"; import "cosmos/base/query/v1beta1/pagination.proto"; +import "cosmos/query/v1/query.proto"; import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; import "google/protobuf/any.proto"; @@ -15,22 +16,27 @@ option go_package = "github.com/irisnet/irismod/modules/token/types/v1"; service Query { // Token returns token with token name rpc Token(QueryTokenRequest) returns (QueryTokenResponse) { + option (cosmos.query.v1.module_query_safe) = true; option (google.api.http).get = "/irismod/token/v1/tokens/{denom}"; } // Tokens returns the token list rpc Tokens(QueryTokensRequest) returns (QueryTokensResponse) { + option (cosmos.query.v1.module_query_safe) = true; option (google.api.http).get = "/irismod/token/v1/tokens"; } // Fees returns the fees to issue or mint a token rpc Fees(QueryFeesRequest) returns (QueryFeesResponse) { + option (cosmos.query.v1.module_query_safe) = true; option (google.api.http).get = "/irismod/token/v1/tokens/{symbol}/fees"; } // Params queries the token parameters rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { + option (cosmos.query.v1.module_query_safe) = true; option (google.api.http).get = "/irismod/token/v1/params"; } // TotalBurn queries all the burnt coins rpc TotalBurn(QueryTotalBurnRequest) returns (QueryTotalBurnResponse) { + option (cosmos.query.v1.module_query_safe) = true; option (google.api.http).get = "/irismod/token/v1/total_burn"; } } @@ -40,8 +46,7 @@ message QueryTokenRequest { string denom = 1; } // QueryTokenResponse is response type for the Query/Token RPC method message QueryTokenResponse { - google.protobuf.Any Token = 1 - [ (cosmos_proto.accepts_interface) = "ContentI" ]; + google.protobuf.Any token = 1 [ (cosmos_proto.accepts_interface) = "ContentI" ]; } // QueryTokensRequest is request type for the Query/Tokens RPC method @@ -53,9 +58,7 @@ message QueryTokensRequest { // QueryTokensResponse is response type for the Query/Tokens RPC method message QueryTokensResponse { - repeated google.protobuf.Any Tokens = 1 - [ (cosmos_proto.accepts_interface) = "ContentI" ]; - + repeated google.protobuf.Any tokens = 1 [ (cosmos_proto.accepts_interface) = "ContentI" ]; cosmos.base.query.v1beta1.PageResponse pagination = 2; } diff --git a/proto/token/v1/tx.proto b/proto/token/v1/tx.proto index 8c3811b6..47424225 100644 --- a/proto/token/v1/tx.proto +++ b/proto/token/v1/tx.proto @@ -3,12 +3,17 @@ package irismod.token.v1; import "gogoproto/gogo.proto"; import "cosmos/base/v1beta1/coin.proto"; +import "cosmos/msg/v1/msg.proto"; +import "cosmos_proto/cosmos.proto"; +import "token/v1/token.proto"; option go_package = "github.com/irisnet/irismod/modules/token/types/v1"; option (gogoproto.goproto_getters_all) = false; // Msg defines the oracle Msg service service Msg { + option (cosmos.msg.v1.service) = true; + // IssueToken defines a method for issuing a new token rpc IssueToken(MsgIssueToken) returns (MsgIssueTokenResponse); @@ -21,16 +26,23 @@ service Msg { // BurnToken defines a method for burning some tokens rpc BurnToken(MsgBurnToken) returns (MsgBurnTokenResponse); - // TransferTokenOwner defines a method for minting some tokens - rpc TransferTokenOwner(MsgTransferTokenOwner) - returns (MsgTransferTokenOwnerResponse); + // TransferTokenOwner defines a method for transfering token owner + rpc TransferTokenOwner(MsgTransferTokenOwner) returns (MsgTransferTokenOwnerResponse); // SwapFeeToken defines a method for swap some fee token rpc SwapFeeToken(MsgSwapFeeToken) returns (MsgSwapFeeTokenResponse); + + // UpdateParams defines a governance operation for updating the token + // module parameters. The authority is defined in the keeper. + // + // Since: cosmos-sdk 0.47 + rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); } // MsgIssueToken defines an SDK message for issuing a new token message MsgIssueToken { + option (cosmos.msg.v1.signer) = "owner"; + string symbol = 1; string name = 2; uint32 scale = 3; @@ -38,7 +50,7 @@ message MsgIssueToken { uint64 initial_supply = 5; uint64 max_supply = 6 ; bool mintable = 7; - string owner = 8; + string owner = 8 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; } // MsgIssueTokenResponse defines the Msg/IssueToken response type @@ -46,9 +58,11 @@ message MsgIssueTokenResponse {} // MsgTransferTokenOwner defines an SDK message for transferring the token owner message MsgTransferTokenOwner { + option (cosmos.msg.v1.signer) = "src_owner"; + string src_owner = 1; string dst_owner = 2; - string symbol = 3; + string symbol = 3 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; } // MsgTransferTokenOwnerResponse defines the Msg/TransferTokenOwner response @@ -57,11 +71,13 @@ message MsgTransferTokenOwnerResponse {} // MsgEditToken defines an SDK message for editing a new token message MsgEditToken { + option (cosmos.msg.v1.signer) = "owner"; + string symbol = 1; string name = 2; uint64 max_supply = 3; string mintable = 4 [ (gogoproto.casttype) = "github.com/irisnet/irismod/modules/token/types.Bool" ]; - string owner = 5; + string owner = 5 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; } // MsgEditTokenResponse defines the Msg/EditToken response type @@ -69,9 +85,11 @@ message MsgEditTokenResponse {} // MsgMintToken defines an SDK message for minting a new token message MsgMintToken { + option (cosmos.msg.v1.signer) = "owner"; + cosmos.base.v1beta1.Coin coin = 1 [ (gogoproto.nullable) = false ]; string to = 2; - string owner = 3; + string owner = 3 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; } // MsgMintTokenResponse defines the Msg/MintToken response type @@ -79,8 +97,10 @@ message MsgMintTokenResponse {} // MsgBurnToken defines an SDK message for burning some tokens message MsgBurnToken { + option (cosmos.msg.v1.signer) = "sender"; + cosmos.base.v1beta1.Coin coin = 1 [ (gogoproto.nullable) = false ]; - string sender = 2; + string sender = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; } // MsgBurnTokenResponse defines the Msg/BurnToken response type @@ -88,12 +108,36 @@ message MsgBurnTokenResponse {} // MsgSwapFeeToken defines an SDK message for swap fee token message MsgSwapFeeToken { + option (cosmos.msg.v1.signer) = "sender"; + cosmos.base.v1beta1.Coin fee_paid = 1 [ (gogoproto.nullable) = false ]; string recipient = 2; - string sender = 3; + string sender = 3 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; } // MsgSwapFeeTokenResponse defines the Msg/SwapFeeToken response type message MsgSwapFeeTokenResponse { cosmos.base.v1beta1.Coin fee_got = 1 [ (gogoproto.nullable) = false ]; -} \ No newline at end of file +} + +// MsgUpdateParams is the Msg/UpdateParams request type. +// +// Since: cosmos-sdk 0.47 +message MsgUpdateParams { + option (cosmos.msg.v1.signer) = "authority"; + + // authority is the address that controls the module (defaults to token unless + // overwritten). + string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + + // params defines the token parameters to update. + // + // NOTE: All parameters must be supplied. + Params params = 2 [ (gogoproto.nullable) = false ]; +} + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +// +// Since: cosmos-sdk 0.47 +message MsgUpdateParamsResponse {} \ No newline at end of file diff --git a/simapp/app.go b/simapp/app.go index ec616d61..5c1775d8 100644 --- a/simapp/app.go +++ b/simapp/app.go @@ -436,6 +436,7 @@ func NewSimApp( app.BankKeeper, app.ModuleAccountAddrs(), authtypes.FeeCollectorName, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) app.RecordKeeper = recordkeeper.NewKeeper(appCodec, keys[recordtypes.StoreKey]) From 3059afb5bb0fc902b2603ddddb3e8273dd803ee4 Mon Sep 17 00:00:00 2001 From: Dreamer <745124335@qq.com> Date: Thu, 15 Jun 2023 14:05:12 +0800 Subject: [PATCH 2/4] implement migration function for token module --- modules/coinswap/module.go | 5 ++- modules/farm/module.go | 5 ++- modules/htlc/module.go | 5 ++- modules/service/module.go | 5 ++- modules/token/genesis.go | 6 ++-- modules/token/handler_test.go | 5 +-- modules/token/keeper/fees.go | 4 +-- modules/token/keeper/grpc_query.go | 2 +- modules/token/keeper/grpc_query_test.go | 2 +- modules/token/keeper/keeper.go | 9 ------ modules/token/keeper/keeper_test.go | 2 +- modules/token/keeper/migrations.go | 24 ++++++++++++++ modules/token/keeper/params.go | 33 ++++++++++++++----- modules/token/migrations/v2/migrate.go | 20 ++++++++++++ modules/token/migrations/v2/migrate_test.go | 35 +++++++++++++++++++++ modules/token/module.go | 19 ++++++++--- modules/token/types/keys.go | 1 + modules/token/types/v1/params.go | 31 ------------------ modules/token/types/v1/params_leagcy.go | 35 +++++++++++++++++++++ simapp/app.go | 12 +++++-- 20 files changed, 192 insertions(+), 68 deletions(-) create mode 100644 modules/token/keeper/migrations.go create mode 100644 modules/token/migrations/v2/migrate.go create mode 100644 modules/token/migrations/v2/migrate_test.go create mode 100644 modules/token/types/v1/params_leagcy.go diff --git a/modules/coinswap/module.go b/modules/coinswap/module.go index 9721489d..7b19e5d9 100644 --- a/modules/coinswap/module.go +++ b/modules/coinswap/module.go @@ -23,6 +23,9 @@ import ( "github.com/irisnet/irismod/types/exported" ) +// ConsensusVersion defines the current coinswap module consensus version. +const ConsensusVersion = 5 + var ( _ module.AppModule = AppModule{} _ module.AppModuleBasic = AppModuleBasic{} @@ -159,7 +162,7 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw } // ConsensusVersion implements AppModule/ConsensusVersion. -func (AppModule) ConsensusVersion() uint64 { return 5 } +func (AppModule) ConsensusVersion() uint64 { return ConsensusVersion } // ____________________________________________________________________________ diff --git a/modules/farm/module.go b/modules/farm/module.go index 7f71742a..85ae8a11 100644 --- a/modules/farm/module.go +++ b/modules/farm/module.go @@ -25,6 +25,9 @@ import ( "github.com/irisnet/irismod/types/exported" ) +// ConsensusVersion defines the current farm module consensus version. +const ConsensusVersion = 3 + var ( _ module.AppModule = AppModule{} _ module.AppModuleBasic = AppModuleBasic{} @@ -161,7 +164,7 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw } // ConsensusVersion implements AppModule/ConsensusVersion. -func (AppModule) ConsensusVersion() uint64 { return 3 } +func (AppModule) ConsensusVersion() uint64 { return ConsensusVersion } // BeginBlock performs a no-op. func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) {} diff --git a/modules/htlc/module.go b/modules/htlc/module.go index 5edcb499..27a75715 100644 --- a/modules/htlc/module.go +++ b/modules/htlc/module.go @@ -25,6 +25,9 @@ import ( "github.com/irisnet/irismod/types/exported" ) +// ConsensusVersion defines the current htlc module consensus version. +const ConsensusVersion = 2 + var ( _ module.AppModule = AppModule{} _ module.AppModuleBasic = AppModuleBasic{} @@ -155,7 +158,7 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw } // ConsensusVersion implements AppModule/ConsensusVersion. -func (AppModule) ConsensusVersion() uint64 { return 2 } +func (AppModule) ConsensusVersion() uint64 { return ConsensusVersion } // BeginBlock performs a no-op. func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) { diff --git a/modules/service/module.go b/modules/service/module.go index 5f3fca74..d48d71ce 100644 --- a/modules/service/module.go +++ b/modules/service/module.go @@ -24,6 +24,9 @@ import ( "github.com/irisnet/irismod/types/exported" ) +// ConsensusVersion defines the current service module consensus version. +const ConsensusVersion = 2 + var ( _ module.AppModule = AppModule{} _ module.AppModuleBasic = AppModuleBasic{} @@ -152,7 +155,7 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw } // ConsensusVersion implements AppModule/ConsensusVersion. -func (AppModule) ConsensusVersion() uint64 { return 2 } +func (AppModule) ConsensusVersion() uint64 { return ConsensusVersion } // BeginBlock performs a no-op. func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) { diff --git a/modules/token/genesis.go b/modules/token/genesis.go index 3058cf4a..f34ecad2 100644 --- a/modules/token/genesis.go +++ b/modules/token/genesis.go @@ -15,7 +15,9 @@ func InitGenesis(ctx sdk.Context, k keeper.Keeper, data v1.GenesisState) { panic(err.Error()) } - k.SetParam(ctx, data.Params) + if err := k.SetParams(ctx, data.Params); err != nil { + panic(err.Error()) + } // init tokens for _, token := range data.Tokens { @@ -43,7 +45,7 @@ func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *v1.GenesisState { tokens = append(tokens, *t) } return &v1.GenesisState{ - Params: k.GetParam(ctx), + Params: k.GetParams(ctx), Tokens: tokens, BurnedCoins: k.GetAllBurnCoin(ctx), } diff --git a/modules/token/handler_test.go b/modules/token/handler_test.go index 1e2a30c4..20c012e7 100644 --- a/modules/token/handler_test.go +++ b/modules/token/handler_test.go @@ -54,10 +54,11 @@ func (suite *HandlerSuite) SetupTest() { suite.bk = app.BankKeeper // set params - suite.keeper.SetParam(suite.ctx, v1.DefaultParams()) + err := suite.keeper.SetParams(suite.ctx, v1.DefaultParams()) + suite.NoError(err) // init tokens to addr - err := suite.bk.MintCoins(suite.ctx, types.ModuleName, initCoin) + err = suite.bk.MintCoins(suite.ctx, types.ModuleName, initCoin) suite.NoError(err) err = suite.bk.SendCoinsFromModuleToAccount(suite.ctx, types.ModuleName, owner, initCoin) suite.NoError(err) diff --git a/modules/token/keeper/fees.go b/modules/token/keeper/fees.go index 5bbd68f0..286737f7 100644 --- a/modules/token/keeper/fees.go +++ b/modules/token/keeper/fees.go @@ -63,7 +63,7 @@ func (k Keeper) GetTokenMintFee(ctx sdk.Context, symbol string) (sdk.Coin, error func (k Keeper) calcTokenIssueFee(ctx sdk.Context, symbol string) (sdk.Coin, v1.Params) { // get params - params := k.GetParam(ctx) + params := k.GetParams(ctx) issueTokenBaseFee := params.IssueTokenBaseFee // compute the fee @@ -76,7 +76,7 @@ func (k Keeper) calcTokenIssueFee(ctx sdk.Context, symbol string) (sdk.Coin, v1. // feeHandler handles the fee of token func feeHandler(ctx sdk.Context, k Keeper, feeAcc sdk.AccAddress, fee sdk.Coin) error { - params := k.GetParam(ctx) + params := k.GetParams(ctx) tokenTaxRate := params.TokenTaxRate // compute community tax and burned coin diff --git a/modules/token/keeper/grpc_query.go b/modules/token/keeper/grpc_query.go index a03c4454..f6800c9b 100644 --- a/modules/token/keeper/grpc_query.go +++ b/modules/token/keeper/grpc_query.go @@ -151,7 +151,7 @@ func (k Keeper) Params( req *v1.QueryParamsRequest, ) (*v1.QueryParamsResponse, error) { ctx := sdk.UnwrapSDKContext(c) - params := k.GetParam(ctx) + params := k.GetParams(ctx) return &v1.QueryParamsResponse{Params: params}, nil } diff --git a/modules/token/keeper/grpc_query_test.go b/modules/token/keeper/grpc_query_test.go index 1160a1a3..0488c87f 100644 --- a/modules/token/keeper/grpc_query_test.go +++ b/modules/token/keeper/grpc_query_test.go @@ -62,7 +62,7 @@ func (suite *KeeperTestSuite) TestGRPCQueryParams() { queryClient := v1.NewQueryClient(queryHelper) paramsResp, err := queryClient.Params(gocontext.Background(), &v1.QueryParamsRequest{}) - params := app.TokenKeeper.GetParam(ctx) + params := app.TokenKeeper.GetParams(ctx) suite.Require().NoError(err) suite.Equal(params, paramsResp.Params) } diff --git a/modules/token/keeper/keeper.go b/modules/token/keeper/keeper.go index 2d2ed460..160032d0 100644 --- a/modules/token/keeper/keeper.go +++ b/modules/token/keeper/keeper.go @@ -10,7 +10,6 @@ import ( storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" "github.com/irisnet/irismod/modules/token/types" v1 "github.com/irisnet/irismod/modules/token/types/v1" @@ -20,7 +19,6 @@ type Keeper struct { storeKey storetypes.StoreKey cdc codec.Codec bankKeeper types.BankKeeper - paramSpace paramstypes.Subspace blockedAddrs map[string]bool feeCollectorName string authority string @@ -30,21 +28,14 @@ type Keeper struct { func NewKeeper( cdc codec.Codec, key storetypes.StoreKey, - paramSpace paramstypes.Subspace, bankKeeper types.BankKeeper, blockedAddrs map[string]bool, feeCollectorName string, authority string, ) Keeper { - // set KeyTable if it has not already been set - if !paramSpace.HasKeyTable() { - paramSpace = paramSpace.WithKeyTable(v1.ParamKeyTable()) - } - return Keeper{ storeKey: key, cdc: cdc, - paramSpace: paramSpace, bankKeeper: bankKeeper, feeCollectorName: feeCollectorName, blockedAddrs: blockedAddrs, diff --git a/modules/token/keeper/keeper_test.go b/modules/token/keeper/keeper_test.go index 3a3a36da..fc5aab0c 100644 --- a/modules/token/keeper/keeper_test.go +++ b/modules/token/keeper/keeper_test.go @@ -51,7 +51,7 @@ func (suite *KeeperTestSuite) SetupTest() { suite.app = app // set params - suite.keeper.SetParam(suite.ctx, v1.DefaultParams()) + suite.keeper.SetParams(suite.ctx, v1.DefaultParams()) // init tokens to addr err := suite.bk.MintCoins(suite.ctx, types.ModuleName, initCoin) diff --git a/modules/token/keeper/migrations.go b/modules/token/keeper/migrations.go new file mode 100644 index 00000000..562e6df0 --- /dev/null +++ b/modules/token/keeper/migrations.go @@ -0,0 +1,24 @@ +package keeper + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + + v2 "github.com/irisnet/irismod/modules/token/migrations/v2" + "github.com/irisnet/irismod/types/exported" +) + +// Migrator is a struct for handling in-place store migrations. +type Migrator struct { + k Keeper + legacySubspace exported.Subspace +} + +// NewMigrator returns a new Migrator. +func NewMigrator(k Keeper, legacySubspace exported.Subspace) Migrator { + return Migrator{k: k, legacySubspace: legacySubspace} +} + +// Migrate1to2 migrates from version 1 to 2. +func (m Migrator) Migrate1to2(ctx sdk.Context) error { + return v2.Migrate(ctx, m.k, m.legacySubspace) +} diff --git a/modules/token/keeper/params.go b/modules/token/keeper/params.go index 6827d428..b0a68604 100644 --- a/modules/token/keeper/params.go +++ b/modules/token/keeper/params.go @@ -3,17 +3,34 @@ package keeper import ( sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/irisnet/irismod/modules/token/types" v1 "github.com/irisnet/irismod/modules/token/types/v1" ) -// GetParam returns token params from the global param store -func (k Keeper) GetParam(ctx sdk.Context) v1.Params { - var p v1.Params - k.paramSpace.GetParamSet(ctx, &p) - return p +// GetParams sets the token module parameters. +func (k Keeper) GetParams(ctx sdk.Context) (params v1.Params) { + store := ctx.KVStore(k.storeKey) + bz := store.Get([]byte(types.ParamsKey)) + if bz == nil { + return params + } + + k.cdc.MustUnmarshal(bz, ¶ms) + return params } -// SetParam sets token params to the global param store -func (k Keeper) SetParam(ctx sdk.Context, params v1.Params) { - k.paramSpace.SetParamSet(ctx, ¶ms) +// SetParams sets the token module parameters. +func (k Keeper) SetParams(ctx sdk.Context, params v1.Params) error { + if err := params.Validate(); err != nil { + return err + } + + store := ctx.KVStore(k.storeKey) + bz, err := k.cdc.Marshal(¶ms) + if err != nil { + return err + } + store.Set(types.ParamsKey, bz) + + return nil } diff --git a/modules/token/migrations/v2/migrate.go b/modules/token/migrations/v2/migrate.go new file mode 100644 index 00000000..823b5e9a --- /dev/null +++ b/modules/token/migrations/v2/migrate.go @@ -0,0 +1,20 @@ +package v2 + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + + v1 "github.com/irisnet/irismod/modules/token/types/v1" + "github.com/irisnet/irismod/types/exported" +) + +// TokenKeeper defines a interface for SetParams function +type TokenKeeper interface { + SetParams(ctx sdk.Context, params v1.Params) error +} + +// Migrate migrate the service params from legacy x/params module to htlc module +func Migrate(ctx sdk.Context, k TokenKeeper, legacySubspace exported.Subspace) error { + var params v1.Params + legacySubspace.GetParamSet(ctx, ¶ms) + return k.SetParams(ctx, params) +} diff --git a/modules/token/migrations/v2/migrate_test.go b/modules/token/migrations/v2/migrate_test.go new file mode 100644 index 00000000..b36a272c --- /dev/null +++ b/modules/token/migrations/v2/migrate_test.go @@ -0,0 +1,35 @@ +package v2_test + +import ( + "testing" + + "github.com/stretchr/testify/require" + + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + + v2 "github.com/irisnet/irismod/modules/token/migrations/v2" + tokentypes "github.com/irisnet/irismod/modules/token/types" + v1 "github.com/irisnet/irismod/modules/token/types/v1" + "github.com/irisnet/irismod/simapp" +) + +func TestMigrate(t *testing.T) { + app := simapp.Setup(t, false) + ctx := app.BaseApp.NewContext(false, tmproto.Header{}) + + legacySubspace := app.GetSubspace(tokentypes.ModuleName) + + params := v1.DefaultParams() + legacySubspace.SetParamSet(ctx, ¶ms) + + err := v2.Migrate( + ctx, + app.TokenKeeper, + legacySubspace, + ) + require.NoError(t, err) + + expParams := app.TokenKeeper.GetParams(ctx) + require.Equal(t, expParams, params, "v2.Migrate failed") + +} diff --git a/modules/token/module.go b/modules/token/module.go index 484a76a9..6e5f5917 100644 --- a/modules/token/module.go +++ b/modules/token/module.go @@ -24,8 +24,12 @@ import ( "github.com/irisnet/irismod/modules/token/types" v1 "github.com/irisnet/irismod/modules/token/types/v1" "github.com/irisnet/irismod/modules/token/types/v1beta1" + "github.com/irisnet/irismod/types/exported" ) +// ConsensusVersion defines the current token module consensus version. +const ConsensusVersion = 2 + var ( _ module.AppModule = AppModule{} _ module.AppModuleBasic = AppModuleBasic{} @@ -100,9 +104,10 @@ func (AppModuleBasic) RegisterInterfaces(registry codectypes.InterfaceRegistry) type AppModule struct { AppModuleBasic - keeper keeper.Keeper - accountKeeper types.AccountKeeper - bankKeeper types.BankKeeper + keeper keeper.Keeper + accountKeeper types.AccountKeeper + bankKeeper types.BankKeeper + legacySubspace exported.Subspace } // NewAppModule creates a new AppModule object @@ -111,12 +116,14 @@ func NewAppModule( keeper keeper.Keeper, ak types.AccountKeeper, bk types.BankKeeper, + legacySubspace exported.Subspace, ) AppModule { return AppModule{ AppModuleBasic: AppModuleBasic{cdc: cdc}, keeper: keeper, accountKeeper: ak, bankKeeper: bk, + legacySubspace: legacySubspace, } } @@ -138,6 +145,10 @@ func (am AppModule) RegisterServices(cfg module.Configurator) { keeper.NewLegacyQueryServer(am.keeper, am.keeper.Codec()), ) + m := keeper.NewMigrator(am.keeper, am.legacySubspace) + if err := cfg.RegisterMigration(types.ModuleName, 1, m.Migrate1to2); err != nil { + panic(err) + } } // RegisterInvariants registers the token module invariants. @@ -165,7 +176,7 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw } // ConsensusVersion implements AppModule/ConsensusVersion. -func (AppModule) ConsensusVersion() uint64 { return 1 } +func (AppModule) ConsensusVersion() uint64 { return ConsensusVersion } // BeginBlock performs a no-op. func (AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {} diff --git a/modules/token/types/keys.go b/modules/token/types/keys.go index ff9b9f71..9b7cf196 100644 --- a/modules/token/types/keys.go +++ b/modules/token/types/keys.go @@ -30,6 +30,7 @@ var ( PrefixTokens = []byte{0x03} // PeffixBurnTokenAmt defines a prefix for the amount of token burnt PeffixBurnTokenAmt = []byte{0x04} + ParamsKey = []byte{0x05} // prefix for the token params ) // KeySymbol returns the key of the token with the specified symbol diff --git a/modules/token/types/v1/params.go b/modules/token/types/v1/params.go index 1ea63c36..8d6a1002 100644 --- a/modules/token/types/v1/params.go +++ b/modules/token/types/v1/params.go @@ -4,34 +4,8 @@ import ( "fmt" sdk "github.com/cosmos/cosmos-sdk/types" - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" ) -var _ paramtypes.ParamSet = (*Params)(nil) - -// parameter keys -var ( - KeyTokenTaxRate = []byte("TokenTaxRate") - KeyIssueTokenBaseFee = []byte("IssueTokenBaseFee") - KeyMintTokenFeeRatio = []byte("MintTokenFeeRatio") -) - -func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { - return paramtypes.ParamSetPairs{ - paramtypes.NewParamSetPair(KeyTokenTaxRate, &p.TokenTaxRate, validateTaxRate), - paramtypes.NewParamSetPair( - KeyIssueTokenBaseFee, - &p.IssueTokenBaseFee, - validateIssueTokenBaseFee, - ), - paramtypes.NewParamSetPair( - KeyMintTokenFeeRatio, - &p.MintTokenFeeRatio, - validateMintTokenFeeRatio, - ), - } -} - // NewParams constructs a new Params instance func NewParams(tokenTaxRate sdk.Dec, issueTokenBaseFee sdk.Coin, mintTokenFeeRatio sdk.Dec, @@ -43,11 +17,6 @@ func NewParams(tokenTaxRate sdk.Dec, issueTokenBaseFee sdk.Coin, } } -// ParamKeyTable returns the TypeTable for the token module -func ParamKeyTable() paramtypes.KeyTable { - return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) -} - // DefaultParams return the default params func DefaultParams() Params { defaultToken := GetNativeToken() diff --git a/modules/token/types/v1/params_leagcy.go b/modules/token/types/v1/params_leagcy.go new file mode 100644 index 00000000..0d858fe8 --- /dev/null +++ b/modules/token/types/v1/params_leagcy.go @@ -0,0 +1,35 @@ +package v1 + +import ( + "github.com/irisnet/irismod/types/exported" +) + +var _ exported.ParamSet = (*Params)(nil) + +// parameter keys +var ( + KeyTokenTaxRate = []byte("TokenTaxRate") + KeyIssueTokenBaseFee = []byte("IssueTokenBaseFee") + KeyMintTokenFeeRatio = []byte("MintTokenFeeRatio") +) + +func (p *Params) ParamSetPairs() exported.ParamSetPairs { + return exported.ParamSetPairs{ + exported.NewParamSetPair(KeyTokenTaxRate, &p.TokenTaxRate, validateTaxRate), + exported.NewParamSetPair( + KeyIssueTokenBaseFee, + &p.IssueTokenBaseFee, + validateIssueTokenBaseFee, + ), + exported.NewParamSetPair( + KeyMintTokenFeeRatio, + &p.MintTokenFeeRatio, + validateMintTokenFeeRatio, + ), + } +} + +// ParamKeyTable returns the TypeTable for the token module +func ParamKeyTable() exported.KeyTable { + return exported.NewKeyTable().RegisterParamSet(&Params{}) +} diff --git a/simapp/app.go b/simapp/app.go index 5c1775d8..2fef0390 100644 --- a/simapp/app.go +++ b/simapp/app.go @@ -124,6 +124,7 @@ import ( "github.com/irisnet/irismod/modules/token" tokenkeeper "github.com/irisnet/irismod/modules/token/keeper" tokentypes "github.com/irisnet/irismod/modules/token/types" + tokenv1 "github.com/irisnet/irismod/modules/token/types/v1" // unnamed import of statik for swagger UI support _ "github.com/cosmos/cosmos-sdk/client/docs/statik" @@ -432,7 +433,6 @@ func NewSimApp( app.TokenKeeper = tokenkeeper.NewKeeper( appCodec, keys[tokentypes.StoreKey], - app.GetSubspace(tokentypes.ModuleName), app.BankKeeper, app.ModuleAccountAddrs(), authtypes.FeeCollectorName, @@ -617,7 +617,13 @@ func NewSimApp( upgrade.NewAppModule(app.UpgradeKeeper), evidence.NewAppModule(*app.EvidenceKeeper), params.NewAppModule(app.ParamsKeeper), - token.NewAppModule(appCodec, app.TokenKeeper, app.AccountKeeper, app.BankKeeper), + token.NewAppModule( + appCodec, + app.TokenKeeper, + app.AccountKeeper, + app.BankKeeper, + app.GetSubspace(stakingtypes.ModuleName), + ), record.NewAppModule(appCodec, app.RecordKeeper, app.AccountKeeper, app.BankKeeper), nft.NewAppModule(appCodec, app.NFTKeeper, app.AccountKeeper, app.BankKeeper), mt.NewAppModule(appCodec, app.MTKeeper, app.AccountKeeper, app.BankKeeper), @@ -1075,7 +1081,7 @@ func initParamsKeeper( paramsKeeper.Subspace(slashingtypes.ModuleName) paramsKeeper.Subspace(govtypes.ModuleName).WithKeyTable(govv1.ParamKeyTable()) paramsKeeper.Subspace(crisistypes.ModuleName) - paramsKeeper.Subspace(tokentypes.ModuleName) + paramsKeeper.Subspace(tokentypes.ModuleName).WithKeyTable(tokenv1.ParamKeyTable()) paramsKeeper.Subspace(recordtypes.ModuleName) paramsKeeper.Subspace(htlctypes.ModuleName).WithKeyTable(htlctypes.ParamKeyTable()) paramsKeeper.Subspace(coinswaptypes.ModuleName).WithKeyTable(coinswaptypes.ParamKeyTable()) From 0d7dee6d11152a9747e46ecdf5bebc2db440c964 Mon Sep 17 00:00:00 2001 From: Dreamer <745124335@qq.com> Date: Thu, 15 Jun 2023 14:11:59 +0800 Subject: [PATCH 3/4] fix --- modules/token/keeper/msg_server.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/token/keeper/msg_server.go b/modules/token/keeper/msg_server.go index a77d7369..f40549fc 100644 --- a/modules/token/keeper/msg_server.go +++ b/modules/token/keeper/msg_server.go @@ -291,9 +291,9 @@ func (m msgServer) UpdateParams( ) } - // ctx := sdk.UnwrapSDKContext(goCtx) - // if err := m.k.SetParamSet(ctx, msg.Params); err != nil { - // return nil, err - // } + ctx := sdk.UnwrapSDKContext(goCtx) + if err := m.k.SetParams(ctx, msg.Params); err != nil { + return nil, err + } return &v1.MsgUpdateParamsResponse{}, nil } From f6e202f76ca69cd3ba0041e7a0f15886b5d19771 Mon Sep 17 00:00:00 2001 From: Dreamer <745124335@qq.com> Date: Thu, 15 Jun 2023 14:25:04 +0800 Subject: [PATCH 4/4] fix bugs --- simapp/app.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/simapp/app.go b/simapp/app.go index 2fef0390..037b76da 100644 --- a/simapp/app.go +++ b/simapp/app.go @@ -622,7 +622,7 @@ func NewSimApp( app.TokenKeeper, app.AccountKeeper, app.BankKeeper, - app.GetSubspace(stakingtypes.ModuleName), + app.GetSubspace(tokentypes.ModuleName), ), record.NewAppModule(appCodec, app.RecordKeeper, app.AccountKeeper, app.BankKeeper), nft.NewAppModule(appCodec, app.NFTKeeper, app.AccountKeeper, app.BankKeeper), @@ -655,7 +655,7 @@ func NewSimApp( app.FarmKeeper, app.AccountKeeper, app.BankKeeper, - app.GetSubspace(coinswaptypes.ModuleName), + app.GetSubspace(farmtypes.ModuleName), ), consensus.NewAppModule(appCodec, app.ConsensusParamsKeeper), )