From b210bf445a0ded7ef28025c49b34a87c9d3bef59 Mon Sep 17 00:00:00 2001 From: Kevin Yang <5478483+k-yang@users.noreply.github.com> Date: Tue, 2 Apr 2024 15:17:17 +0900 Subject: [PATCH] feat(tokenfactory): burn native method (#1832) * refactor: move Burn rpc method to x/tokenfactory * Update tx_msgs.go * feat: add burn native method to tokenfactory msg server * feat: add cli cmd * fix: validate msg * feat: add v1.2.0 upgrade handler * Update CHANGELOG.md * fix: register codec for MsgBurnNative * fix: test --------- Co-authored-by: Unique-Divine --- CHANGELOG.md | 2 +- app/upgrades.go | 2 + app/upgrades/v1_2_0/constants.go | 22 + proto/nibiru/inflation/v1/tx.proto | 4 - proto/nibiru/tokenfactory/v1/tx.proto | 12 + x/inflation/keeper/msg_server.go | 14 - x/inflation/keeper/msg_server_test.go | 42 -- x/inflation/types/tx.pb.go | 123 ++---- x/inflation/types/tx.pb.gw.go | 83 ---- x/tokenfactory/cli/tx.go | 48 ++- x/tokenfactory/keeper/keeper_test.go | 2 + x/tokenfactory/keeper/msg_server.go | 26 ++ x/tokenfactory/keeper/msg_server_test.go | 87 ++++ x/tokenfactory/types/codec.go | 2 + x/tokenfactory/types/tx.pb.go | 485 ++++++++++++++++++++--- x/tokenfactory/types/tx_msgs.go | 109 ++++- 16 files changed, 769 insertions(+), 294 deletions(-) create mode 100644 app/upgrades/v1_2_0/constants.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 24aca4848..453563d1a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -49,7 +49,7 @@ Nibiru v1.2.0 adds a burn method to the x/inflation module that allows senders t ### Features -* [#1823](https://github.com/NibiruChain/nibiru/pull/1823) - feat(inflation): add burn method +* [#1832](https://github.com/NibiruChain/nibiru/pull/1832) - feat(tokenfactory): add burn method for native tokens ## [v1.1.0](https://github.com/NibiruChain/nibiru/releases/tag/v1.1.0) - 2024-03-19 diff --git a/app/upgrades.go b/app/upgrades.go index 6f7bca04a..68afbc057 100644 --- a/app/upgrades.go +++ b/app/upgrades.go @@ -11,6 +11,7 @@ import ( "github.com/NibiruChain/nibiru/app/upgrades/v1_0_1" "github.com/NibiruChain/nibiru/app/upgrades/v1_0_2" "github.com/NibiruChain/nibiru/app/upgrades/v1_1_0" + "github.com/NibiruChain/nibiru/app/upgrades/v1_2_0" ) var Upgrades = []upgrades.Upgrade{ @@ -18,6 +19,7 @@ var Upgrades = []upgrades.Upgrade{ v1_0_2.Upgrade, v1_0_3.Upgrade, v1_1_0.Upgrade, + v1_2_0.Upgrade, } func (app *NibiruApp) setupUpgrades() { diff --git a/app/upgrades/v1_2_0/constants.go b/app/upgrades/v1_2_0/constants.go new file mode 100644 index 000000000..fea9289a7 --- /dev/null +++ b/app/upgrades/v1_2_0/constants.go @@ -0,0 +1,22 @@ +package v1_2_0 + +import ( + "github.com/cosmos/cosmos-sdk/store/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" + + "github.com/NibiruChain/nibiru/app/upgrades" +) + +const UpgradeName = "v1.2.0" + +var Upgrade = upgrades.Upgrade{ + UpgradeName: UpgradeName, + CreateUpgradeHandler: func(mm *module.Manager, cfg module.Configurator) upgradetypes.UpgradeHandler { + return func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { + return mm.RunMigrations(ctx, cfg, fromVM) + } + }, + StoreUpgrades: types.StoreUpgrades{}, +} diff --git a/proto/nibiru/inflation/v1/tx.proto b/proto/nibiru/inflation/v1/tx.proto index da0a31b05..36626a3f9 100644 --- a/proto/nibiru/inflation/v1/tx.proto +++ b/proto/nibiru/inflation/v1/tx.proto @@ -19,10 +19,6 @@ service Msg { returns (MsgEditInflationParamsResponse) { option (google.api.http).post = "/nibiru/inflation/edit-inflation-params"; }; - - rpc Burn(MsgBurn) returns (MsgBurnResponse) { - option (google.api.http).post = "/nibiru/inflation/v1/burn"; - }; } // MsgToggleInflation defines a message to enable or disable inflation. diff --git a/proto/nibiru/tokenfactory/v1/tx.proto b/proto/nibiru/tokenfactory/v1/tx.proto index d62246753..8f984d17b 100644 --- a/proto/nibiru/tokenfactory/v1/tx.proto +++ b/proto/nibiru/tokenfactory/v1/tx.proto @@ -24,6 +24,9 @@ service Msg { rpc Burn(MsgBurn) returns (MsgBurnResponse); rpc SetDenomMetadata(MsgSetDenomMetadata) returns (MsgSetDenomMetadataResponse); + + // burns a native token such as unibi + rpc BurnNative(MsgBurnNative) returns (MsgBurnNativeResponse) {}; } // MsgCreateDenom: sdk.Msg that registers an a token factory denom. @@ -114,3 +117,12 @@ message MsgSetDenomMetadata { } message MsgSetDenomMetadataResponse {} + +// Burn a native token such as unibi +message MsgBurnNative { + string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ]; + cosmos.base.v1beta1.Coin coin = 2 + [ (gogoproto.moretags) = "yaml:\"coin\"", (gogoproto.nullable) = false ]; +} + +message MsgBurnNativeResponse {} \ No newline at end of file diff --git a/x/inflation/keeper/msg_server.go b/x/inflation/keeper/msg_server.go index c72725bd6..b1cc8048a 100644 --- a/x/inflation/keeper/msg_server.go +++ b/x/inflation/keeper/msg_server.go @@ -46,17 +46,3 @@ func (ms msgServer) ToggleInflation( resp = &types.MsgToggleInflationResponse{} return resp, err } - -func (ms msgServer) Burn( - goCtx context.Context, msg *types.MsgBurn, -) (resp *types.MsgBurnResponse, err error) { - ctx := sdk.UnwrapSDKContext(goCtx) - - sender, err := sdk.AccAddressFromBech32(msg.Sender) - if err != nil { - return nil, err - } - - err = ms.Keeper.Burn(ctx, sdk.NewCoins(msg.Coin), sender) - return &types.MsgBurnResponse{}, err -} diff --git a/x/inflation/keeper/msg_server_test.go b/x/inflation/keeper/msg_server_test.go index cc37a97a3..2f1e1483f 100644 --- a/x/inflation/keeper/msg_server_test.go +++ b/x/inflation/keeper/msg_server_test.go @@ -70,45 +70,3 @@ func TestMsgEditInflationParams(t *testing.T) { params = app.InflationKeeper.GetParams(ctx) require.EqualValues(t, params.EpochsPerPeriod, 42) } - -func TestMsgBurn(t *testing.T) { - app, ctx := testapp.NewNibiruTestAppAndContext() - sender := testutil.AccAddress() - err := app.BankKeeper.MintCoins(ctx, types.ModuleName, sdk.NewCoins(sdk.NewCoin("unibi", sdk.NewInt(100)))) - require.NoError(t, err) - err = app.BankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, sender, sdk.NewCoins(sdk.NewCoin("unibi", sdk.NewInt(100)))) - require.NoError(t, err) - - msgServer := keeper.NewMsgServerImpl(app.InflationKeeper) - - msg := types.MsgBurn{ - Sender: sender.String(), - Coin: sdk.NewCoin("unibi", sdk.NewInt(100)), - } - - _, err = msgServer.Burn(ctx, &msg) - require.NoError(t, err) - supply := app.BankKeeper.GetSupply(ctx, "unibi") - require.Equal(t, sdk.ZeroInt(), supply.Amount) -} - -func TestMsgBurn_NotEnoughCoins(t *testing.T) { - app, ctx := testapp.NewNibiruTestAppAndContext() - sender := testutil.AccAddress() - err := app.BankKeeper.MintCoins(ctx, types.ModuleName, sdk.NewCoins(sdk.NewCoin("unibi", sdk.NewInt(100)))) - require.NoError(t, err) - err = app.BankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, sender, sdk.NewCoins(sdk.NewCoin("unibi", sdk.NewInt(100)))) - require.NoError(t, err) - - msgServer := keeper.NewMsgServerImpl(app.InflationKeeper) - - msg := types.MsgBurn{ - Sender: sender.String(), - Coin: sdk.NewCoin("unibi", sdk.NewInt(101)), - } - - _, err = msgServer.Burn(ctx, &msg) - require.EqualError(t, err, "spendable balance 100unibi is smaller than 101unibi: insufficient funds") - supply := app.BankKeeper.GetSupply(ctx, "unibi") - require.Equal(t, sdk.NewInt(100), supply.Amount) -} diff --git a/x/inflation/types/tx.pb.go b/x/inflation/types/tx.pb.go index 8d8a555fd..ab332dea7 100644 --- a/x/inflation/types/tx.pb.go +++ b/x/inflation/types/tx.pb.go @@ -286,50 +286,49 @@ func init() { func init() { proto.RegisterFile("nibiru/inflation/v1/tx.proto", fileDescriptor_9f6843f876608d76) } var fileDescriptor_9f6843f876608d76 = []byte{ - // 686 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0x31, 0x4f, 0xdb, 0x4e, - 0x1c, 0x8d, 0x49, 0xfe, 0x01, 0x0e, 0xfd, 0x0b, 0x31, 0x2d, 0x0a, 0x21, 0xb5, 0x53, 0x53, 0x95, - 0x50, 0x84, 0x4f, 0x81, 0x8d, 0xd1, 0x40, 0x25, 0x86, 0x54, 0x91, 0xd5, 0xa1, 0x45, 0xaa, 0xd0, - 0x39, 0x3e, 0xcc, 0xa9, 0xf6, 0x9d, 0x75, 0xe7, 0xa0, 0x64, 0xed, 0xd4, 0x11, 0xa9, 0x5f, 0x80, - 0xb1, 0x73, 0xd5, 0x0f, 0xc1, 0x88, 0xd4, 0xa5, 0xea, 0x10, 0x55, 0xd0, 0xa1, 0x33, 0x9f, 0xa0, - 0xb2, 0xcf, 0x31, 0x51, 0x31, 0x55, 0x61, 0x88, 0xe2, 0xbb, 0xf7, 0xfb, 0xbd, 0xf7, 0xee, 0xfc, - 0x7e, 0x06, 0x75, 0x4a, 0x1c, 0xc2, 0x7b, 0x90, 0xd0, 0x43, 0x1f, 0x45, 0x84, 0x51, 0x78, 0xdc, - 0x82, 0x51, 0xdf, 0x0c, 0x39, 0x8b, 0x98, 0x3a, 0x2f, 0x51, 0x33, 0x43, 0xcd, 0xe3, 0x56, 0xed, - 0xa1, 0xc7, 0x3c, 0x96, 0xe0, 0x30, 0x7e, 0x92, 0xa5, 0xb5, 0xba, 0xc7, 0x98, 0xe7, 0x63, 0x88, - 0x42, 0x02, 0x11, 0xa5, 0x2c, 0x4a, 0xea, 0x45, 0x8a, 0x2e, 0xe7, 0xc9, 0x5c, 0xb3, 0xca, 0x22, - 0xad, 0xcb, 0x44, 0xc0, 0x04, 0x74, 0x90, 0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 0x3c, 0xf5, 0x44, 0x01, 0xb3, 0x7f, 0x0e, 0xdb, 0x4a, 0x6e, 0x80, 0x6e, 0x9e, - 0xbd, 0x06, 0xff, 0xb1, 0x30, 0xbb, 0x82, 0xe5, 0xf7, 0x5f, 0x7f, 0x7e, 0x9c, 0x78, 0x6c, 0x2c, - 0xc1, 0xdc, 0x2f, 0x52, 0xd2, 0xa5, 0x7e, 0x52, 0xc0, 0x7c, 0xde, 0x6c, 0xae, 0xdd, 0xa6, 0x96, - 0x53, 0x5c, 0xdb, 0xbc, 0x43, 0x71, 0x66, 0x0f, 0x26, 0xf6, 0x56, 0x8d, 0x95, 0x9b, 0xf6, 0xb0, - 0x4b, 0xa2, 0xf5, 0x6c, 0xb9, 0x1e, 0x4a, 0x4b, 0x01, 0x28, 0x25, 0xef, 0xb3, 0x7e, 0x9b, 0x5a, - 0x8c, 0xd6, 0x9e, 0xfe, 0x0d, 0xcd, 0xc4, 0x9f, 0x24, 0xe2, 0x4b, 0xc6, 0x62, 0xee, 0xdd, 0x38, - 0x3d, 0x4e, 0xad, 0xbd, 0xb3, 0x0b, 0x4d, 0x39, 0xbf, 0xd0, 0x94, 0x1f, 0x17, 0x9a, 0x72, 0x72, - 0xa9, 0x15, 0xce, 0x2f, 0xb5, 0xc2, 0xb7, 0x4b, 0xad, 0xb0, 0x0f, 0xc7, 0x82, 0xfd, 0x32, 0x69, - 0xdf, 0x3e, 0x42, 0x84, 0x8e, 0xa8, 0xfa, 0x63, 0x64, 0x49, 0xca, 0x9d, 0x72, 0xf2, 0xb5, 0xdd, - 0xfc, 0x1d, 0x00, 0x00, 0xff, 0xff, 0xc1, 0xc6, 0x47, 0x4d, 0x1b, 0x06, 0x00, 0x00, + // 660 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0x31, 0x4f, 0xdb, 0x40, + 0x14, 0x8e, 0x21, 0x0d, 0x70, 0xa8, 0x85, 0x98, 0x16, 0xa5, 0x29, 0xb5, 0x23, 0x23, 0x95, 0x50, + 0x84, 0x4f, 0x81, 0x8d, 0xd1, 0x40, 0x25, 0x86, 0x54, 0x91, 0xd5, 0xa1, 0x45, 0xaa, 0xd0, 0x39, + 0x3e, 0xcc, 0xa9, 0xf6, 0x9d, 0x75, 0x77, 0x41, 0xc9, 0xda, 0xa9, 0x23, 0x52, 0xff, 0x00, 0x63, + 0x7f, 0x40, 0xff, 0x41, 0x17, 0x46, 0xa4, 0x2e, 0x55, 0x87, 0xa8, 0x82, 0x0e, 0x9d, 0xf9, 0x05, + 0x95, 0x7d, 0x8e, 0x89, 0x8a, 0x91, 0x0a, 0x83, 0x65, 0xdf, 0xbd, 0xef, 0x7d, 0xef, 0x7b, 0xe7, + 0xef, 0x1d, 0x58, 0xa2, 0xc4, 0x23, 0xbc, 0x07, 0x09, 0x3d, 0x0c, 0x91, 0x24, 0x8c, 0xc2, 0xe3, + 0x16, 0x94, 0x7d, 0x3b, 0xe6, 0x4c, 0x32, 0x7d, 0x41, 0x45, 0xed, 0x3c, 0x6a, 0x1f, 0xb7, 0xea, + 0x8f, 0x03, 0x16, 0xb0, 0x34, 0x0e, 0x93, 0x2f, 0x05, 0xad, 0x2f, 0x05, 0x8c, 0x05, 0x21, 0x86, + 0x28, 0x26, 0x10, 0x51, 0xca, 0x64, 0x8a, 0x17, 0x59, 0x74, 0xb9, 0xa8, 0xcc, 0x35, 0xab, 0x02, + 0x19, 0x5d, 0x26, 0x22, 0x26, 0xa0, 0x87, 0x04, 0x86, 0xc7, 0x2d, 0x0f, 0x4b, 0xd4, 0x82, 0x5d, + 0x46, 0xb2, 0xb8, 0x85, 0x80, 0xde, 0x16, 0xc1, 0x1b, 0x16, 0x04, 0x21, 0xde, 0x1b, 0xe5, 0xea, + 0x8b, 0xa0, 0x22, 0x30, 0xf5, 0x31, 0xaf, 0x69, 0x0d, 0xad, 0x39, 0xe3, 0x66, 0x2b, 0x7d, 0x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, 0x6b, 0xb7, 0x55, 0x2b, + 0x00, 0xd7, 0x37, 0xef, 0x00, 0xce, 0xe5, 0xc1, 0x54, 0xde, 0xaa, 0xb5, 0x72, 0x53, 0x1e, 0xf6, + 0x89, 0x5c, 0xcf, 0x97, 0xeb, 0x71, 0x9a, 0xe8, 0xec, 0x9d, 0x5d, 0x18, 0xda, 0xf9, 0x85, 0xa1, + 0xfd, 0xba, 0x30, 0xb4, 0x93, 0x4b, 0xa3, 0x74, 0x7e, 0x69, 0x94, 0x7e, 0x5c, 0x1a, 0xa5, 0x7d, + 0x38, 0xe6, 0xb4, 0xd7, 0x29, 0xd9, 0xf6, 0x11, 0x22, 0x74, 0x44, 0xdc, 0x1f, 0xa3, 0x4e, 0x6d, + 0xe7, 0x55, 0xd2, 0xeb, 0x6f, 0xf3, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x4c, 0x43, 0x97, 0xb5, + 0xac, 0x05, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -348,7 +347,6 @@ type MsgClient interface { ToggleInflation(ctx context.Context, in *MsgToggleInflation, opts ...grpc.CallOption) (*MsgToggleInflationResponse, error) // EditInflationParams defines a method to edit the inflation params. EditInflationParams(ctx context.Context, in *MsgEditInflationParams, opts ...grpc.CallOption) (*MsgEditInflationParamsResponse, error) - Burn(ctx context.Context, in *MsgBurn, opts ...grpc.CallOption) (*MsgBurnResponse, error) } type msgClient struct { @@ -377,22 +375,12 @@ func (c *msgClient) EditInflationParams(ctx context.Context, in *MsgEditInflatio return out, nil } -func (c *msgClient) Burn(ctx context.Context, in *MsgBurn, opts ...grpc.CallOption) (*MsgBurnResponse, error) { - out := new(MsgBurnResponse) - err := c.cc.Invoke(ctx, "/nibiru.inflation.v1.Msg/Burn", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - // MsgServer is the server API for Msg service. type MsgServer interface { // ToggleInflation defines a method to enable or disable inflation. ToggleInflation(context.Context, *MsgToggleInflation) (*MsgToggleInflationResponse, error) // EditInflationParams defines a method to edit the inflation params. EditInflationParams(context.Context, *MsgEditInflationParams) (*MsgEditInflationParamsResponse, error) - Burn(context.Context, *MsgBurn) (*MsgBurnResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -405,9 +393,6 @@ func (*UnimplementedMsgServer) ToggleInflation(ctx context.Context, req *MsgTogg func (*UnimplementedMsgServer) EditInflationParams(ctx context.Context, req *MsgEditInflationParams) (*MsgEditInflationParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method EditInflationParams not implemented") } -func (*UnimplementedMsgServer) Burn(ctx context.Context, req *MsgBurn) (*MsgBurnResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Burn not implemented") -} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -449,24 +434,6 @@ func _Msg_EditInflationParams_Handler(srv interface{}, ctx context.Context, dec return interceptor(ctx, in, info, handler) } -func _Msg_Burn_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgBurn) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).Burn(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/nibiru.inflation.v1.Msg/Burn", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).Burn(ctx, req.(*MsgBurn)) - } - return interceptor(ctx, in, info, handler) -} - var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "nibiru.inflation.v1.Msg", HandlerType: (*MsgServer)(nil), @@ -479,10 +446,6 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "EditInflationParams", Handler: _Msg_EditInflationParams_Handler, }, - { - MethodName: "Burn", - Handler: _Msg_Burn_Handler, - }, }, Streams: []grpc.StreamDesc{}, Metadata: "nibiru/inflation/v1/tx.proto", diff --git a/x/inflation/types/tx.pb.gw.go b/x/inflation/types/tx.pb.gw.go index 0a75000c6..0d122966c 100644 --- a/x/inflation/types/tx.pb.gw.go +++ b/x/inflation/types/tx.pb.gw.go @@ -105,42 +105,6 @@ func local_request_Msg_EditInflationParams_0(ctx context.Context, marshaler runt } -var ( - filter_Msg_Burn_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} -) - -func request_Msg_Burn_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq MsgBurn - var metadata runtime.ServerMetadata - - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_Burn_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := client.Burn(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Msg_Burn_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq MsgBurn - var metadata runtime.ServerMetadata - - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_Burn_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := server.Burn(ctx, &protoReq) - return msg, metadata, err - -} - // RegisterMsgHandlerServer registers the http handlers for service Msg to "mux". // UnaryRPC :call MsgServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. @@ -193,29 +157,6 @@ func RegisterMsgHandlerServer(ctx context.Context, mux *runtime.ServeMux, server }) - mux.Handle("POST", pattern_Msg_Burn_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Msg_Burn_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Msg_Burn_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - return nil } @@ -297,26 +238,6 @@ func RegisterMsgHandlerClient(ctx context.Context, mux *runtime.ServeMux, client }) - mux.Handle("POST", pattern_Msg_Burn_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Msg_Burn_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Msg_Burn_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - return nil } @@ -324,14 +245,10 @@ var ( pattern_Msg_ToggleInflation_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"nibiru", "inflation", "v1", "toggle"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Msg_EditInflationParams_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"nibiru", "inflation", "edit-inflation-params"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Msg_Burn_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"nibiru", "inflation", "v1", "burn"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( forward_Msg_ToggleInflation_0 = runtime.ForwardResponseMessage forward_Msg_EditInflationParams_0 = runtime.ForwardResponseMessage - - forward_Msg_Burn_0 = runtime.ForwardResponseMessage ) diff --git a/x/tokenfactory/cli/tx.go b/x/tokenfactory/cli/tx.go index 5f64f1723..7c472b2cc 100644 --- a/x/tokenfactory/cli/tx.go +++ b/x/tokenfactory/cli/tx.go @@ -2,18 +2,16 @@ package cli import ( "fmt" + "strings" - "github.com/spf13/cobra" - + "github.com/MakeNowJust/heredoc/v2" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/client/tx" - sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/spf13/cobra" "github.com/NibiruChain/nibiru/x/tokenfactory/types" - - "github.com/MakeNowJust/heredoc/v2" ) // NewTxCmd returns the transaction commands for this module @@ -32,6 +30,7 @@ func NewTxCmd() *cobra.Command { CmdChangeAdmin(), CmdMint(), CmdBurn(), + CmdBurnNative(), // CmdModifyDenomMetadata(), // CosmWasm only ) @@ -213,3 +212,42 @@ func CmdBurn() *cobra.Command { flags.AddTxFlagsToCmd(cmd) return cmd } + +func CmdBurnNative() *cobra.Command { + cmd := &cobra.Command{ + Use: "burn-native [amount]", + Args: cobra.ExactArgs(1), + Short: "Burn native tokens.", + Long: strings.TrimSpace(` +Burn native tokens. + +$ nibid tx tokenfactory burn-native 100unibi +`), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + burnCoin, err := sdk.ParseCoinNormalized(args[0]) + if err != nil { + return err + } + + msg := &types.MsgBurnNative{ + Sender: clientCtx.GetFromAddress().String(), + Coin: burnCoin, + } + + if err := msg.ValidateBasic(); err != nil { + return err + } + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + + return cmd +} diff --git a/x/tokenfactory/keeper/keeper_test.go b/x/tokenfactory/keeper/keeper_test.go index 51a20cc5e..fc7a44431 100644 --- a/x/tokenfactory/keeper/keeper_test.go +++ b/x/tokenfactory/keeper/keeper_test.go @@ -61,6 +61,8 @@ func (s *TestSuite) HandleMsg(txMsg sdk.Msg) (err error) { _, err = s.app.TokenFactoryKeeper.ChangeAdmin(goCtx, txMsg) case *tftypes.MsgSetDenomMetadata: _, err = s.app.TokenFactoryKeeper.SetDenomMetadata(goCtx, txMsg) + case *tftypes.MsgBurnNative: + _, err = s.app.TokenFactoryKeeper.BurnNative(goCtx, txMsg) default: err = fmt.Errorf("unknown message type: %t", txMsg) } diff --git a/x/tokenfactory/keeper/msg_server.go b/x/tokenfactory/keeper/msg_server.go index e8991585f..8bf814768 100644 --- a/x/tokenfactory/keeper/msg_server.go +++ b/x/tokenfactory/keeper/msg_server.go @@ -274,3 +274,29 @@ func (k Keeper) SetDenomMetadata( Caller: txMsg.Sender, }) } + +func (k Keeper) BurnNative( + goCtx context.Context, msg *types.MsgBurnNative, +) (resp *types.MsgBurnNativeResponse, err error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + sender, err := sdk.AccAddressFromBech32(msg.Sender) + if err != nil { + return nil, err + } + + coins := sdk.NewCoins(msg.Coin) + + if err := k.bankKeeper.SendCoinsFromAccountToModule( + ctx, sender, types.ModuleName, coins, + ); err != nil { + return nil, err + } + + err = k.bankKeeper.BurnCoins(ctx, types.ModuleName, coins) + if err != nil { + return nil, err + } + + return &types.MsgBurnNativeResponse{}, err +} diff --git a/x/tokenfactory/keeper/msg_server_test.go b/x/tokenfactory/keeper/msg_server_test.go index abda9991b..70801cdc4 100644 --- a/x/tokenfactory/keeper/msg_server_test.go +++ b/x/tokenfactory/keeper/msg_server_test.go @@ -636,3 +636,90 @@ func (s *TestSuite) TestSetDenomMetadata() { }) } } + +func (s *TestSuite) TestBurnNative() { + _, addrs := testutil.PrivKeyAddressPairs(4) + tfModuleAddr := authtypes.NewModuleAddress(types.ModuleName) + + testCases := []TestCaseTx{ + { + Name: "happy: burn", + SetupMsgs: []sdk.Msg{}, + PreHook: func(ctx sdk.Context, bapp *app.NibiruApp) { + coins := sdk.NewCoins(sdk.NewCoin("unibi", sdk.NewInt(123))) + s.NoError(bapp.BankKeeper.MintCoins(ctx, types.ModuleName, coins)) + s.NoError(bapp.BankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, addrs[0], coins)) + }, + TestMsgs: []TestMsgElem{ + { + TestMsg: &types.MsgBurnNative{ + Sender: addrs[0].String(), + Coin: sdk.NewCoin("unibi", sdk.NewInt(123)), + }, + WantErr: "", + }, + }, + PostHook: func(ctx sdk.Context, bapp *app.NibiruApp) { + s.Equal( + sdk.NewInt(0), s.app.BankKeeper.GetSupply(s.ctx, "unibi").Amount, + ) + + s.Equal( + sdk.NewInt(0), + s.app.BankKeeper.GetBalance(s.ctx, tfModuleAddr, "unibi").Amount, + ) + + s.Equal( + sdk.NewInt(0), + s.app.BankKeeper.GetBalance(s.ctx, addrs[0], "unibi").Amount, + ) + }, + }, + + { + Name: "sad: not enough funds", + SetupMsgs: []sdk.Msg{}, + PreHook: func(ctx sdk.Context, bapp *app.NibiruApp) { + coins := sdk.NewCoins(sdk.NewCoin("unibi", sdk.NewInt(123))) + s.NoError(bapp.BankKeeper.MintCoins(ctx, types.ModuleName, coins)) + s.NoError(bapp.BankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, addrs[0], coins)) + }, + TestMsgs: []TestMsgElem{ + { + TestMsg: &types.MsgBurnNative{ + Sender: addrs[0].String(), + Coin: sdk.NewCoin("unibi", sdk.NewInt(124)), + }, + WantErr: "spendable balance 123unibi is smaller than 124unibi: insufficient funds", + }, + }, + PostHook: func(ctx sdk.Context, bapp *app.NibiruApp) { + s.Equal( + sdk.NewInt(123), s.app.BankKeeper.GetSupply(s.ctx, "unibi").Amount, + ) + + s.Equal( + sdk.NewInt(123), + s.app.BankKeeper.GetBalance(s.ctx, addrs[0], "unibi").Amount, + ) + }, + }, + + { + Name: "sad: nil msg", + TestMsgs: []TestMsgElem{ + { + TestMsg: (*types.MsgSetDenomMetadata)(nil), + WantErr: "nil msg", + }, + }, + }, + } + + for _, tc := range testCases { + s.Run(tc.Name, func() { + s.SetupTest() + tc.RunTest(s) + }) + } +} diff --git a/x/tokenfactory/types/codec.go b/x/tokenfactory/types/codec.go index 84be87b73..e0e639c0d 100644 --- a/x/tokenfactory/types/codec.go +++ b/x/tokenfactory/types/codec.go @@ -34,6 +34,7 @@ func RegisterInterfaces(registry codectypes.InterfaceRegistry) { &MsgUpdateModuleParams{}, &MsgMint{}, &MsgBurn{}, + &MsgBurnNative{}, &MsgSetDenomMetadata{}, ) @@ -47,6 +48,7 @@ func TX_MSG_TYPE_URLS() []string { "/nibiru.tokenfactory.v1.MsgUpdateModuleParams", "/nibiru.tokenfactory.v1.MsgMint", "/nibiru.tokenfactory.v1.MsgBurn", + "/nibiru.tokenfactory.v1.MsgBurnNative", "/nibiru.tokenfactory.v1.MsgSetDenomMetadata", } } diff --git a/x/tokenfactory/types/tx.pb.go b/x/tokenfactory/types/tx.pb.go index dbfc272ef..25a92dacf 100644 --- a/x/tokenfactory/types/tx.pb.go +++ b/x/tokenfactory/types/tx.pb.go @@ -631,6 +631,95 @@ func (m *MsgSetDenomMetadataResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgSetDenomMetadataResponse proto.InternalMessageInfo +// Burn a native token such as unibi +type MsgBurnNative struct { + Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty" yaml:"sender"` + Coin types.Coin `protobuf:"bytes,2,opt,name=coin,proto3" json:"coin" yaml:"coin"` +} + +func (m *MsgBurnNative) Reset() { *m = MsgBurnNative{} } +func (m *MsgBurnNative) String() string { return proto.CompactTextString(m) } +func (*MsgBurnNative) ProtoMessage() {} +func (*MsgBurnNative) Descriptor() ([]byte, []int) { + return fileDescriptor_4c78bacd179e004d, []int{12} +} +func (m *MsgBurnNative) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgBurnNative) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgBurnNative.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 *MsgBurnNative) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgBurnNative.Merge(m, src) +} +func (m *MsgBurnNative) XXX_Size() int { + return m.Size() +} +func (m *MsgBurnNative) XXX_DiscardUnknown() { + xxx_messageInfo_MsgBurnNative.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgBurnNative proto.InternalMessageInfo + +func (m *MsgBurnNative) GetSender() string { + if m != nil { + return m.Sender + } + return "" +} + +func (m *MsgBurnNative) GetCoin() types.Coin { + if m != nil { + return m.Coin + } + return types.Coin{} +} + +type MsgBurnNativeResponse struct { +} + +func (m *MsgBurnNativeResponse) Reset() { *m = MsgBurnNativeResponse{} } +func (m *MsgBurnNativeResponse) String() string { return proto.CompactTextString(m) } +func (*MsgBurnNativeResponse) ProtoMessage() {} +func (*MsgBurnNativeResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_4c78bacd179e004d, []int{13} +} +func (m *MsgBurnNativeResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgBurnNativeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgBurnNativeResponse.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 *MsgBurnNativeResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgBurnNativeResponse.Merge(m, src) +} +func (m *MsgBurnNativeResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgBurnNativeResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgBurnNativeResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgBurnNativeResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*MsgCreateDenom)(nil), "nibiru.tokenfactory.v1.MsgCreateDenom") proto.RegisterType((*MsgCreateDenomResponse)(nil), "nibiru.tokenfactory.v1.MsgCreateDenomResponse") @@ -644,62 +733,66 @@ func init() { proto.RegisterType((*MsgBurnResponse)(nil), "nibiru.tokenfactory.v1.MsgBurnResponse") proto.RegisterType((*MsgSetDenomMetadata)(nil), "nibiru.tokenfactory.v1.MsgSetDenomMetadata") proto.RegisterType((*MsgSetDenomMetadataResponse)(nil), "nibiru.tokenfactory.v1.MsgSetDenomMetadataResponse") + proto.RegisterType((*MsgBurnNative)(nil), "nibiru.tokenfactory.v1.MsgBurnNative") + proto.RegisterType((*MsgBurnNativeResponse)(nil), "nibiru.tokenfactory.v1.MsgBurnNativeResponse") } func init() { proto.RegisterFile("nibiru/tokenfactory/v1/tx.proto", fileDescriptor_4c78bacd179e004d) } var fileDescriptor_4c78bacd179e004d = []byte{ - // 787 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x55, 0x4d, 0x4f, 0xe3, 0x46, - 0x18, 0x8e, 0x4b, 0x1a, 0x92, 0xa1, 0x7c, 0x19, 0x1a, 0x42, 0x2a, 0xe2, 0x6a, 0x54, 0xd1, 0x96, - 0x0a, 0x5b, 0x01, 0xb5, 0x07, 0x2e, 0x15, 0xa6, 0xea, 0xa9, 0xae, 0x90, 0xa1, 0x97, 0xaa, 0x52, - 0x34, 0x89, 0x07, 0xc7, 0x02, 0xcf, 0x44, 0x9e,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x00, 0x00, + // 826 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x56, 0x4f, 0x6f, 0xe3, 0x44, + 0x14, 0x8f, 0xd9, 0x6e, 0x36, 0x99, 0xd2, 0x3f, 0xeb, 0x96, 0x34, 0x6b, 0xd4, 0x18, 0x8d, 0x60, + 0x81, 0x45, 0xb5, 0x95, 0xae, 0xe0, 0xb0, 0x17, 0xb4, 0x2e, 0xe2, 0x84, 0x57, 0x2b, 0x6f, 0xb9, + 0x20, 0xa4, 0x68, 0x12, 0x4f, 0x1d, 0xab, 0xf5, 0x4c, 0xe4, 0x99, 0xa4, 0x0d, 0x07, 0x24, 0xf8, + 0x04, 0x9c, 0xf8, 0x02, 0x9c, 0x10, 0x17, 0x0e, 0x7c, 0x88, 0xde, 0xa8, 0x38, 0x71, 0xb2, 0x50, + 0x7b, 0xe0, 0x9e, 0x4f, 0xb0, 0x9a, 0x3f, 0xb5, 0xdd, 0x26, 0x4d, 0x9b, 0x4b, 0x6f, 0x63, 0xbf, + 0xdf, 0xfb, 0xbd, 0xdf, 0xcf, 0x7e, 0xef, 0x69, 0x80, 0x4d, 0xe2, 0x6e, 0x9c, 0x0e, 0x5d, 0x4e, + 0x0f, 0x31, 0x39, 0x40, 0x3d, 0x4e, 0xd3, 0xb1, 0x3b, 0x6a, 0xbb, 0xfc, 0xc4, 0x19, 0xa4, 0x94, + 0x53, 0xb3, 0xa1, 0x00, 0x4e, 0x19, 0xe0, 0x8c, 0xda, 0xd6, 0x66, 0x44, 0x23, 0x2a, 0x21, 0xae, + 0x38, 0x29, 0xb4, 0xd5, 0xea, 0x51, 0x96, 0x50, 0xe6, 0x76, 0x11, 0xc3, 0xee, 0xa8, 0xdd, 0xc5, + 0x1c, 0xb5, 0xdd, 0x1e, 0x8d, 0x89, 0x8e, 0x6f, 0xe9, 0x78, 0xc2, 0x22, 0x51, 0x25, 0x61, 0x91, + 0x0e, 0x3c, 0x51, 0x81, 0x8e, 0x62, 0x54, 0x0f, 0x53, 0x9c, 0xe4, 0x30, 0xe7, 0x14, 0x0f, 0x3a, + 0x0e, 0x6f, 0xb0, 0xc0, 0x38, 0xe2, 0x58, 0x61, 0xe0, 0x11, 0x58, 0xf5, 0x59, 0xb4, 0x97, 0x62, + 0xc4, 0xf1, 0x57, 0x98, 0xd0, 0xc4, 0xfc, 0x14, 0x54, 0x19, 0x26, 0x21, 0x4e, 0x9b, 0xc6, 0x07, + 0xc6, 0x27, 0x75, 0xef, 0xf1, 0x24, 0xb3, 0x57, 0xc6, 0x28, 0x39, 0x7a, 0x01, 0xd5, 0x7b, 0x18, + 0x68, 0x80, 0xe9, 0x82, 0x1a, 0x1b, 0x76, 0x43, 0x91, 0xd6, 0x7c, 0x47, 0x82, 0x37, 0x26, 0x99, + 0xbd, 0xa6, 0xc1, 0x3a, 0x02, 0x83, 0x1c, 0x04, 0xbf, 0x07, 0x8d, 0xab, 0xd5, 0x02, 0xcc, 0x06, + 0x94, 0x30, 0x6c, 0x7a, 0x60, 0x8d, 0xe0, 0xe3, 0x8e, 0x94, 0xda, 0x51, 0x8c, 0xaa, 0xbc, 0x35, + 0xc9, 0xec, 0x86, 0x62, 0xbc, 0x06, 0x80, 0xc1, 0x0a, 0xc1, 0xc7, 0xfb, 0xe2, 0x85, 0xe4, 0x82, + 0xbf, 0x1a, 0xca, 0x4c, 0x1f, 0x91, 0x08, 0xbf, 0x0c, 0x93, 0x98, 0x2c, 0x62, 0xe6, 0x29, 0x78, + 0x58, 0x76, 0xb2, 0x3e, 0xc9, 0xec, 0x77, 0x15, 0x52, 0x57, 0x53, 0x61, 0xb3, 0x0d, 0xea, 0x42, + 0x08, 0x12, 0xfc, 0xcd, 0x07, 0x12, 0xbb, 0x39, 0xc9, 0xec, 0xf5, 0x42, 0xa3, 0x0c, 0xc1, 0xa0, + 0x46, 0xf0, 0xb1, 0x54, 0x01, 0x9b, 0xca, 0x76, 0xa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f, 0xcd, 0x49, 0xbe, 0x0e, 0xb6, 0x9e, 0x2f, 0x00, 0xce, + 0xab, 0x86, 0x00, 0x94, 0x26, 0xe0, 0xa3, 0x5b, 0xc4, 0x2a, 0x98, 0xb5, 0x73, 0x27, 0x58, 0x3e, + 0x68, 0x15, 0xef, 0x9b, 0xd3, 0xf3, 0x96, 0x71, 0x76, 0xde, 0x32, 0xfe, 0x3b, 0x6f, 0x19, 0xbf, + 0x5c, 0xb4, 0x2a, 0x67, 0x17, 0xad, 0xca, 0xbf, 0x17, 0xad, 0xca, 0x77, 0xbb, 0x51, 0xcc, 0xfb, + 0xc3, 0xae, 0xd3, 0xa3, 0x89, 0xfb, 0x4a, 0x92, 0xee, 0xf5, 0x51, 0x4c, 0x5c, 0x7d, 0x83, 0x38, + 0xb9, 0x7a, 0x87, 0xe0, 0xe3, 0x01, 0x66, 0xdd, 0xaa, 0xbc, 0x41, 0x3c, 0x7f, 0x1b, 0x00, 0x00, + 0xff, 0xff, 0xb6, 0x28, 0x76, 0x66, 0x2a, 0x09, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -723,6 +816,8 @@ type MsgClient interface { Mint(ctx context.Context, in *MsgMint, opts ...grpc.CallOption) (*MsgMintResponse, error) Burn(ctx context.Context, in *MsgBurn, opts ...grpc.CallOption) (*MsgBurnResponse, error) SetDenomMetadata(ctx context.Context, in *MsgSetDenomMetadata, opts ...grpc.CallOption) (*MsgSetDenomMetadataResponse, error) + // burns a native token such as unibi + BurnNative(ctx context.Context, in *MsgBurnNative, opts ...grpc.CallOption) (*MsgBurnNativeResponse, error) } type msgClient struct { @@ -787,6 +882,15 @@ func (c *msgClient) SetDenomMetadata(ctx context.Context, in *MsgSetDenomMetadat return out, nil } +func (c *msgClient) BurnNative(ctx context.Context, in *MsgBurnNative, opts ...grpc.CallOption) (*MsgBurnNativeResponse, error) { + out := new(MsgBurnNativeResponse) + err := c.cc.Invoke(ctx, "/nibiru.tokenfactory.v1.Msg/BurnNative", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { // CreateDenom: registers a token factory denom. @@ -798,6 +902,8 @@ type MsgServer interface { Mint(context.Context, *MsgMint) (*MsgMintResponse, error) Burn(context.Context, *MsgBurn) (*MsgBurnResponse, error) SetDenomMetadata(context.Context, *MsgSetDenomMetadata) (*MsgSetDenomMetadataResponse, error) + // burns a native token such as unibi + BurnNative(context.Context, *MsgBurnNative) (*MsgBurnNativeResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -822,6 +928,9 @@ func (*UnimplementedMsgServer) Burn(ctx context.Context, req *MsgBurn) (*MsgBurn func (*UnimplementedMsgServer) SetDenomMetadata(ctx context.Context, req *MsgSetDenomMetadata) (*MsgSetDenomMetadataResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method SetDenomMetadata not implemented") } +func (*UnimplementedMsgServer) BurnNative(ctx context.Context, req *MsgBurnNative) (*MsgBurnNativeResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method BurnNative not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -935,6 +1044,24 @@ func _Msg_SetDenomMetadata_Handler(srv interface{}, ctx context.Context, dec fun return interceptor(ctx, in, info, handler) } +func _Msg_BurnNative_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgBurnNative) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).BurnNative(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/nibiru.tokenfactory.v1.Msg/BurnNative", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).BurnNative(ctx, req.(*MsgBurnNative)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "nibiru.tokenfactory.v1.Msg", HandlerType: (*MsgServer)(nil), @@ -963,6 +1090,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "SetDenomMetadata", Handler: _Msg_SetDenomMetadata_Handler, }, + { + MethodName: "BurnNative", + Handler: _Msg_BurnNative_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "nibiru/tokenfactory/v1/tx.proto", @@ -1375,6 +1506,69 @@ func (m *MsgSetDenomMetadataResponse) MarshalToSizedBuffer(dAtA []byte) (int, er return len(dAtA) - i, nil } +func (m *MsgBurnNative) 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 *MsgBurnNative) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgBurnNative) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Coin.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgBurnNativeResponse) 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 *MsgBurnNativeResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgBurnNativeResponse) 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 @@ -1554,6 +1748,30 @@ func (m *MsgSetDenomMetadataResponse) Size() (n int) { return n } +func (m *MsgBurnNative) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Coin.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgBurnNativeResponse) 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 } @@ -2708,6 +2926,171 @@ func (m *MsgSetDenomMetadataResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgBurnNative) 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: MsgBurnNative: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgBurnNative: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", 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.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Coin", 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.Coin.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 *MsgBurnNativeResponse) 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: MsgBurnNativeResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgBurnNativeResponse: 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/x/tokenfactory/types/tx_msgs.go b/x/tokenfactory/types/tx_msgs.go index fb87e9fa8..2cfa4099c 100644 --- a/x/tokenfactory/types/tx_msgs.go +++ b/x/tokenfactory/types/tx_msgs.go @@ -10,8 +10,13 @@ import ( // MsgCreateDenom var ( - _ sdk.Msg = &MsgCreateDenom{} _ legacytx.LegacyMsg = &MsgCreateDenom{} + _ legacytx.LegacyMsg = &MsgChangeAdmin{} + _ legacytx.LegacyMsg = &MsgUpdateModuleParams{} + _ legacytx.LegacyMsg = &MsgMint{} + _ legacytx.LegacyMsg = &MsgBurn{} + _ legacytx.LegacyMsg = &MsgSetDenomMetadata{} + _ legacytx.LegacyMsg = &MsgBurnNative{} ) // ValidateBasic performs stateless validation checks. Impl sdk.Msg. @@ -55,11 +60,6 @@ func (m MsgCreateDenom) GetSignBytes() []byte { // ---------------------------------------------------------------- // MsgChangeAdmin -var ( - _ sdk.Msg = &MsgChangeAdmin{} - _ legacytx.LegacyMsg = &MsgChangeAdmin{} -) - // ValidateBasic performs stateless validation checks. Impl sdk.Msg. func (m MsgChangeAdmin) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(m.Sender) @@ -99,8 +99,6 @@ func (m MsgChangeAdmin) GetSignBytes() []byte { // ---------------------------------------------------------------- // MsgMint -var _ sdk.Msg = &MsgMint{} - // ValidateBasic performs stateless validation checks. Impl sdk.Msg. func (m MsgMint) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(m.Sender) @@ -139,11 +137,22 @@ func validateCoin(coin sdk.Coin) error { return nil } +// Route: Impl legacytx.LegacyMsg. The mesage route must be alphanumeric or empty. +func (m MsgMint) Route() string { return RouterKey } + +// Type: Impl legacytx.LegacyMsg. Returns a human-readable string for the message, +// intended for utilization within tags +func (m MsgMint) Type() string { return "mint" } + +// GetSignBytes: Get the canonical byte representation of the Msg. Impl +// legacytx.LegacyMsg. +func (m MsgMint) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m)) +} + // ---------------------------------------------------------------- // MsgBurn -var _ sdk.Msg = &MsgBurn{} - // ValidateBasic performs stateless validation checks. Impl sdk.Msg. func (m MsgBurn) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(m.Sender) @@ -175,11 +184,22 @@ func (m MsgBurn) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{sender} } +// Route: Impl legacytx.LegacyMsg. The mesage route must be alphanumeric or empty. +func (m MsgBurn) Route() string { return RouterKey } + +// Type: Impl legacytx.LegacyMsg. Returns a human-readable string for the message, +// intended for utilization within tags +func (m MsgBurn) Type() string { return "burn" } + +// GetSignBytes: Get the canonical byte representation of the Msg. Impl +// legacytx.LegacyMsg. +func (m MsgBurn) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m)) +} + // ---------------------------------------------------------------- // MsgUpdateModuleParams -var _ sdk.Msg = &MsgUpdateModuleParams{} - // ValidateBasic performs stateless validation checks. Impl sdk.Msg. func (m MsgUpdateModuleParams) ValidateBasic() error { if _, err := sdk.AccAddressFromBech32(m.Authority); err != nil { @@ -195,11 +215,22 @@ func (m MsgUpdateModuleParams) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{sender} } +// Route: Impl legacytx.LegacyMsg. The mesage route must be alphanumeric or empty. +func (m MsgUpdateModuleParams) Route() string { return RouterKey } + +// Type: Impl legacytx.LegacyMsg. Returns a human-readable string for the message, +// intended for utilization within tags +func (m MsgUpdateModuleParams) Type() string { return "update_module_params" } + +// GetSignBytes: Get the canonical byte representation of the Msg. Impl +// legacytx.LegacyMsg. +func (m MsgUpdateModuleParams) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m)) +} + // ---------------------------------------------------------------- // MsgSetDenomMetadata -var _ sdk.Msg = &MsgSetDenomMetadata{} - // ValidateBasic performs stateless validation checks. Impl sdk.Msg. func (m MsgSetDenomMetadata) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(m.Sender) @@ -215,3 +246,53 @@ func (m MsgSetDenomMetadata) GetSigners() []sdk.AccAddress { sender, _ := sdk.AccAddressFromBech32(m.Sender) return []sdk.AccAddress{sender} } + +// Route: Impl legacytx.LegacyMsg. The mesage route must be alphanumeric or empty. +func (m MsgSetDenomMetadata) Route() string { return RouterKey } + +// Type: Impl legacytx.LegacyMsg. Returns a human-readable string for the message, +// intended for utilization within tags +func (m MsgSetDenomMetadata) Type() string { return "set_denom_metadata" } + +// GetSignBytes: Get the canonical byte representation of the Msg. Impl +// legacytx.LegacyMsg. +func (m MsgSetDenomMetadata) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m)) +} + +// ---------------------------------------------------------------- +// MsgBurnNative + +// ValidateBasic performs stateless validation checks. Impl sdk.Msg. +func (m MsgBurnNative) ValidateBasic() error { + _, err := sdk.AccAddressFromBech32(m.Sender) + if err != nil { + return sdkerrors.ErrInvalidAddress.Wrapf( + "invalid sender (%s): %s", m.Sender, err) + } + + if err := validateCoin(m.Coin); err != nil { + return err + } + + return nil +} + +// GetSigners: Impl sdk.Msg. +func (m MsgBurnNative) GetSigners() []sdk.AccAddress { + sender, _ := sdk.AccAddressFromBech32(m.Sender) + return []sdk.AccAddress{sender} +} + +// Route: Impl legacytx.LegacyMsg. The mesage route must be alphanumeric or empty. +func (m MsgBurnNative) Route() string { return RouterKey } + +// Type: Impl legacytx.LegacyMsg. Returns a human-readable string for the message, +// intended for utilization within tags +func (m MsgBurnNative) Type() string { return "burn_native" } + +// GetSignBytes: Get the canonical byte representation of the Msg. Impl +// legacytx.LegacyMsg. +func (m MsgBurnNative) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m)) +}