From ea05a63b5b70c48a9a4aec69dab602bb77ce13da Mon Sep 17 00:00:00 2001 From: Reece Williams Date: Mon, 20 Mar 2023 00:27:27 -0500 Subject: [PATCH 01/11] Initial --- proto/buf.lock | 4 +- proto/osmosis/tokenfactory/v1beta1/tx.proto | 44 ++++++++++++--------- 2 files changed, 27 insertions(+), 21 deletions(-) diff --git a/proto/buf.lock b/proto/buf.lock index fa395a9..5e30ec3 100644 --- a/proto/buf.lock +++ b/proto/buf.lock @@ -8,7 +8,7 @@ deps: - remote: buf.build owner: cosmos repository: cosmos-sdk - commit: fdef37ae59634f77bf9f6466e54c571b + commit: 4e1072d2e34943e79c5699c02aad7066 - remote: buf.build owner: cosmos repository: gogo-proto @@ -16,4 +16,4 @@ deps: - remote: buf.build owner: googleapis repository: googleapis - commit: 75b4300737fb4efca0831636be94e517 + commit: 463926e7ee924d46ad0a726e1cf4eacd diff --git a/proto/osmosis/tokenfactory/v1beta1/tx.proto b/proto/osmosis/tokenfactory/v1beta1/tx.proto index 3b7408f..627e3ef 100644 --- a/proto/osmosis/tokenfactory/v1beta1/tx.proto +++ b/proto/osmosis/tokenfactory/v1beta1/tx.proto @@ -15,10 +15,8 @@ service Msg { rpc ChangeAdmin(MsgChangeAdmin) returns (MsgChangeAdminResponse); rpc SetDenomMetadata(MsgSetDenomMetadata) returns (MsgSetDenomMetadataResponse); - - // ForceTransfer is deactivated for now because we need to think through edge - // cases rpc ForceTransfer(MsgForceTransfer) returns - // (MsgForceTransferResponse); + rpc ForceTransfer(MsgForceTransfer) + returns (MsgForceTransferResponse); } // MsgCreateDenom defines the message structure for the CreateDenom gRPC service @@ -51,6 +49,8 @@ message MsgMint { (gogoproto.moretags) = "yaml:\"amount\"", (gogoproto.nullable) = false ]; + string mintToAddress = 3 + [ (gogoproto.moretags) = "yaml:\"mint_to_address\"" ]; } message MsgMintResponse {} @@ -63,6 +63,8 @@ message MsgBurn { (gogoproto.moretags) = "yaml:\"amount\"", (gogoproto.nullable) = false ]; + string burnFromAddress = 3 + [ (gogoproto.moretags) = "yaml:\"burn_from_address\"" ]; } message MsgBurnResponse {} @@ -79,20 +81,6 @@ message MsgChangeAdmin { // MsgChangeAdmin message. message MsgChangeAdminResponse {} -// message MsgForceTransfer { -// string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ]; -// cosmos.base.v1beta1.Coin amount = 2 [ -// (gogoproto.moretags) = "yaml:\"amount\"", -// (gogoproto.nullable) = false -// ]; -// string transferFromAddress = 3 -// [ (gogoproto.moretags) = "yaml:\"transfer_from_address\"" ]; -// string transferToAddress = 4 -// [ (gogoproto.moretags) = "yaml:\"transfer_to_address\"" ]; -// } - -// message MsgForceTransferResponse {} - // MsgSetDenomMetadata is the sdk.Msg type for allowing an admin account to set // the denom's bank metadata message MsgSetDenomMetadata { @@ -105,4 +93,22 @@ message MsgSetDenomMetadata { // MsgSetDenomMetadataResponse defines the response structure for an executed // MsgSetDenomMetadata message. -message MsgSetDenomMetadataResponse {} \ No newline at end of file +message MsgSetDenomMetadataResponse {} + +// MsgForceTransfer is the sdk.Msg type for allowing an admin account to force +// transfer tokens from one account to another. +message MsgForceTransfer { + string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ]; + cosmos.base.v1beta1.Coin amount = 2 [ + (gogoproto.moretags) = "yaml:\"amount\"", + (gogoproto.nullable) = false + ]; + string transferFromAddress = 3 + [ (gogoproto.moretags) = "yaml:\"transfer_from_address\"" ]; + string transferToAddress = 4 + [ (gogoproto.moretags) = "yaml:\"transfer_to_address\"" ]; +} + +// MsgForceTransferResponse defines the response structure for an executed +// MsgForceTransfer message. +message MsgForceTransferResponse {} \ No newline at end of file From 9bb701f5d19179cca645e90176eaa3e22646e07f Mon Sep 17 00:00:00 2001 From: Reece Williams Date: Mon, 20 Mar 2023 00:41:53 -0500 Subject: [PATCH 02/11] base layer, just need to gen proto --- proto/osmosis/tokenfactory/v1beta1/tx.proto | 7 +- x/tokenfactory/keeper/admins_test.go | 257 ++++++++++++++------ x/tokenfactory/keeper/bankactions.go | 1 - x/tokenfactory/keeper/msg_server.go | 68 +++--- x/tokenfactory/types/codec.go | 2 +- x/tokenfactory/types/msgs.go | 105 ++++---- 6 files changed, 292 insertions(+), 148 deletions(-) diff --git a/proto/osmosis/tokenfactory/v1beta1/tx.proto b/proto/osmosis/tokenfactory/v1beta1/tx.proto index 627e3ef..169b5ef 100644 --- a/proto/osmosis/tokenfactory/v1beta1/tx.proto +++ b/proto/osmosis/tokenfactory/v1beta1/tx.proto @@ -15,8 +15,7 @@ service Msg { rpc ChangeAdmin(MsgChangeAdmin) returns (MsgChangeAdminResponse); rpc SetDenomMetadata(MsgSetDenomMetadata) returns (MsgSetDenomMetadataResponse); - rpc ForceTransfer(MsgForceTransfer) - returns (MsgForceTransferResponse); + rpc ForceTransfer(MsgForceTransfer) returns (MsgForceTransferResponse); } // MsgCreateDenom defines the message structure for the CreateDenom gRPC service @@ -64,7 +63,7 @@ message MsgBurn { (gogoproto.nullable) = false ]; string burnFromAddress = 3 - [ (gogoproto.moretags) = "yaml:\"burn_from_address\"" ]; + [ (gogoproto.moretags) = "yaml:\"burn_from_address\"" ]; } message MsgBurnResponse {} @@ -100,7 +99,7 @@ message MsgSetDenomMetadataResponse {} message MsgForceTransfer { string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ]; cosmos.base.v1beta1.Coin amount = 2 [ - (gogoproto.moretags) = "yaml:\"amount\"", + (gogoproto.moretags) = "yaml:\"amount\"", (gogoproto.nullable) = false ]; string transferFromAddress = 3 diff --git a/x/tokenfactory/keeper/admins_test.go b/x/tokenfactory/keeper/admins_test.go index 9cd15c7..16384eb 100644 --- a/x/tokenfactory/keeper/admins_test.go +++ b/x/tokenfactory/keeper/admins_test.go @@ -29,11 +29,19 @@ func (suite *KeeperTestSuite) TestAdminMsgs() { suite.Require().NoError(err) suite.Require().True(bankKeeper.GetBalance(suite.Ctx, suite.TestAccs[0], suite.defaultDenom).Amount.Int64() == addr0bal, bankKeeper.GetBalance(suite.Ctx, suite.TestAccs[0], suite.defaultDenom)) - // // Test force transferring - // _, err = suite.msgServer.ForceTransfer(sdk.WrapSDKContext(suite.Ctx), types.NewMsgForceTransfer(suite.TestAccs[0].String(), sdk.NewInt64Coin(denom, 5), suite.TestAccs[1].String(), suite.TestAccs[0].String())) - // suite.Require().NoError(err) - // suite.Require().True(bankKeeper.GetBalance(suite.Ctx, suite.TestAccs[0], denom).IsEqual(sdk.NewInt64Coin(denom, 15))) - // suite.Require().True(bankKeeper.GetBalance(suite.Ctx, suite.TestAccs[1], denom).IsEqual(sdk.NewInt64Coin(denom, 5))) + // Test minting to a different account + _, err = suite.msgServer.Mint(sdk.WrapSDKContext(suite.Ctx), types.NewMsgMintTo(suite.TestAccs[0].String(), sdk.NewInt64Coin(suite.defaultDenom, 10), suite.TestAccs[1].String())) + addr1bal += 10 + suite.Require().NoError(err) + suite.Require().True(suite.App.BankKeeper.GetBalance(suite.Ctx, suite.TestAccs[1], suite.defaultDenom).Amount.Int64() == addr1bal, suite.App.BankKeeper.GetBalance(suite.Ctx, suite.TestAccs[1], suite.defaultDenom)) + + // Test force transferring + _, err = suite.msgServer.ForceTransfer(sdk.WrapSDKContext(suite.Ctx), types.NewMsgForceTransfer(suite.TestAccs[0].String(), sdk.NewInt64Coin(suite.defaultDenom, 5), suite.TestAccs[1].String(), suite.TestAccs[0].String())) + addr1bal -= 5 + addr0bal += 5 + suite.Require().NoError(err) + suite.Require().True(suite.App.BankKeeper.GetBalance(suite.Ctx, suite.TestAccs[0], suite.defaultDenom).Amount.Int64() == addr0bal, suite.App.BankKeeper.GetBalance(suite.Ctx, suite.TestAccs[0], suite.defaultDenom)) + suite.Require().True(suite.App.BankKeeper.GetBalance(suite.Ctx, suite.TestAccs[1], suite.defaultDenom).Amount.Int64() == addr1bal, suite.App.BankKeeper.GetBalance(suite.Ctx, suite.TestAccs[1], suite.defaultDenom)) // Test burning from own account _, err = suite.msgServer.Burn(sdk.WrapSDKContext(suite.Ctx), types.NewMsgBurn(suite.TestAccs[0].String(), sdk.NewInt64Coin(suite.defaultDenom, 5))) @@ -74,117 +82,230 @@ func (suite *KeeperTestSuite) TestAdminMsgs() { // * Only the admin of a denom can mint tokens for it // * The admin of a denom can mint tokens for it func (suite *KeeperTestSuite) TestMintDenom() { - var addr0bal int64 + balances := make(map[string]int64) + for _, acc := range suite.TestAccs { + balances[acc.String()] = 0 + } // Create a denom suite.CreateDefaultDenom() for _, tc := range []struct { - desc string - amount int64 - mintDenom string - admin string - valid bool + desc string + mintMsg types.MsgMint + expectPass bool }{ { - desc: "denom does not exist", - amount: 10, - mintDenom: "factory/osmo1t7egva48prqmzl59x5ngv4zx0dtrwewc9m7z44/evmos", - admin: suite.TestAccs[0].String(), - valid: false, + desc: "denom does not exist", + mintMsg: *types.NewMsgMint( + suite.TestAccs[0].String(), + sdk.NewInt64Coin("factory/osmo1t7egva48prqmzl59x5ngv4zx0dtrwewc9m7z44/evmos", 10), + ), + expectPass: false, + }, + { + desc: "mint is not by the admin", + mintMsg: *types.NewMsgMintTo( + suite.TestAccs[1].String(), + sdk.NewInt64Coin(suite.defaultDenom, 10), + suite.TestAccs[0].String(), + ), + expectPass: false, }, { - desc: "mint is not by the admin", - amount: 10, - mintDenom: suite.defaultDenom, - admin: suite.TestAccs[1].String(), - valid: false, + desc: "success case - mint to self", + mintMsg: *types.NewMsgMint( + suite.TestAccs[0].String(), + sdk.NewInt64Coin(suite.defaultDenom, 10), + ), + expectPass: true, }, { - desc: "success case", - amount: 10, - mintDenom: suite.defaultDenom, - admin: suite.TestAccs[0].String(), - valid: true, + desc: "success case - mint to another address", + mintMsg: *types.NewMsgMintTo( + suite.TestAccs[0].String(), + sdk.NewInt64Coin(suite.defaultDenom, 10), + suite.TestAccs[1].String(), + ), + expectPass: true, }, } { suite.Run(fmt.Sprintf("Case %s", tc.desc), func() { - // Test minting to admins own account - bankKeeper := suite.App.BankKeeper - _, err := suite.msgServer.Mint(sdk.WrapSDKContext(suite.Ctx), types.NewMsgMint(tc.admin, sdk.NewInt64Coin(tc.mintDenom, 10))) - if tc.valid { - addr0bal += 10 + _, err := suite.msgServer.Mint(sdk.WrapSDKContext(suite.Ctx), &tc.mintMsg) + if tc.expectPass { suite.Require().NoError(err) - suite.Require().Equal(bankKeeper.GetBalance(suite.Ctx, suite.TestAccs[0], suite.defaultDenom).Amount.Int64(), addr0bal, bankKeeper.GetBalance(suite.Ctx, suite.TestAccs[0], suite.defaultDenom)) + balances[tc.mintMsg.MintToAddress] += tc.mintMsg.Amount.Amount.Int64() } else { suite.Require().Error(err) } + + mintToAddr, _ := sdk.AccAddressFromBech32(tc.mintMsg.MintToAddress) + bal := suite.App.BankKeeper.GetBalance(suite.Ctx, mintToAddr, suite.defaultDenom).Amount + suite.Require().Equal(bal.Int64(), balances[tc.mintMsg.MintToAddress]) }) } } + func (suite *KeeperTestSuite) TestBurnDenom() { - var addr0bal int64 + // Create a denom. + suite.CreateDefaultDenom() + // mint 1000 default token for all testAccs + balances := make(map[string]int64) + for _, acc := range suite.TestAccs { + _, err := suite.msgServer.Mint(sdk.WrapSDKContext(suite.Ctx), types.NewMsgMintTo(suite.TestAccs[0].String(), sdk.NewInt64Coin(suite.defaultDenom, 1000), acc.String())) + suite.Require().NoError(err) + balances[acc.String()] = 1000 + } + + for _, tc := range []struct { + desc string + burnMsg types.MsgBurn + expectPass bool + }{ + { + desc: "denom does not exist", + burnMsg: *types.NewMsgBurn( + suite.TestAccs[0].String(), + sdk.NewInt64Coin("factory/osmo1t7egva48prqmzl59x5ngv4zx0dtrwewc9m7z44/evmos", 10), + ), + expectPass: false, + }, + { + desc: "burn is not by the admin", + burnMsg: *types.NewMsgBurnFrom( + suite.TestAccs[1].String(), + sdk.NewInt64Coin(suite.defaultDenom, 10), + suite.TestAccs[0].String(), + ), + expectPass: false, + }, + { + desc: "burn more than balance", + burnMsg: *types.NewMsgBurn( + suite.TestAccs[0].String(), + sdk.NewInt64Coin(suite.defaultDenom, 10000), + ), + expectPass: false, + }, + { + desc: "success case - burn from self", + burnMsg: *types.NewMsgBurn( + suite.TestAccs[0].String(), + sdk.NewInt64Coin(suite.defaultDenom, 10), + ), + expectPass: true, + }, + { + desc: "success case - burn from another address", + burnMsg: *types.NewMsgBurnFrom( + suite.TestAccs[0].String(), + sdk.NewInt64Coin(suite.defaultDenom, 10), + suite.TestAccs[1].String(), + ), + expectPass: true, + }, + } { + suite.Run(fmt.Sprintf("Case %s", tc.desc), func() { + _, err := suite.msgServer.Burn(sdk.WrapSDKContext(suite.Ctx), &tc.burnMsg) + if tc.expectPass { + suite.Require().NoError(err) + balances[tc.burnMsg.BurnFromAddress] -= tc.burnMsg.Amount.Amount.Int64() + } else { + suite.Require().Error(err) + } + + burnFromAddr, _ := sdk.AccAddressFromBech32(tc.burnMsg.BurnFromAddress) + bal := suite.App.BankKeeper.GetBalance(suite.Ctx, burnFromAddr, suite.defaultDenom).Amount + suite.Require().Equal(bal.Int64(), balances[tc.burnMsg.BurnFromAddress]) + }) + } +} + +func (suite *KeeperTestSuite) TestForceTransferDenom() { // Create a denom. suite.CreateDefaultDenom() - // mint 10 default token for testAcc[0] - suite.msgServer.Mint(sdk.WrapSDKContext(suite.Ctx), types.NewMsgMint(suite.TestAccs[0].String(), sdk.NewInt64Coin(suite.defaultDenom, 10))) //nolint:errcheck - addr0bal += 10 + // mint 1000 default token for all testAccs + balances := make(map[string]int64) + for _, acc := range suite.TestAccs { + _, err := suite.msgServer.Mint(sdk.WrapSDKContext(suite.Ctx), types.NewMsgMintTo(suite.TestAccs[0].String(), sdk.NewInt64Coin(suite.defaultDenom, 1000), acc.String())) + suite.Require().NoError(err) + balances[acc.String()] = 1000 + } for _, tc := range []struct { - desc string - amount int64 - burnDenom string - admin string - valid bool + desc string + forceTransferMsg types.MsgForceTransfer + expectPass bool }{ { - desc: "denom does not exist", - amount: 10, - burnDenom: "factory/osmo1t7egva48prqmzl59x5ngv4zx0dtrwewc9m7z44/evmos", - admin: suite.TestAccs[0].String(), - valid: false, + desc: "valid force transfer", + forceTransferMsg: *types.NewMsgForceTransfer( + suite.TestAccs[0].String(), + sdk.NewInt64Coin(suite.defaultDenom, 10), + suite.TestAccs[1].String(), + suite.TestAccs[2].String(), + ), + expectPass: true, }, { - desc: "burn is not by the admin", - amount: 10, - burnDenom: suite.defaultDenom, - admin: suite.TestAccs[1].String(), - valid: false, + desc: "denom does not exist", + forceTransferMsg: *types.NewMsgForceTransfer( + suite.TestAccs[0].String(), + sdk.NewInt64Coin("factory/osmo1t7egva48prqmzl59x5ngv4zx0dtrwewc9m7z44/evmos", 10), + suite.TestAccs[1].String(), + suite.TestAccs[2].String(), + ), + expectPass: false, }, { - desc: "burn amount is bigger than minted amount", - amount: 1000, - burnDenom: suite.defaultDenom, - admin: suite.TestAccs[1].String(), - valid: false, + desc: "forceTransfer is not by the admin", + forceTransferMsg: *types.NewMsgForceTransfer( + suite.TestAccs[1].String(), + sdk.NewInt64Coin(suite.defaultDenom, 10), + suite.TestAccs[1].String(), + suite.TestAccs[2].String(), + ), + expectPass: false, }, { - desc: "success case", - amount: 10, - burnDenom: suite.defaultDenom, - admin: suite.TestAccs[0].String(), - valid: true, + desc: "forceTransfer is greater than the balance of", + forceTransferMsg: *types.NewMsgForceTransfer( + suite.TestAccs[0].String(), + sdk.NewInt64Coin(suite.defaultDenom, 10000), + suite.TestAccs[1].String(), + suite.TestAccs[2].String(), + ), + expectPass: false, }, } { suite.Run(fmt.Sprintf("Case %s", tc.desc), func() { - // Test minting to admins own account - bankKeeper := suite.App.BankKeeper - _, err := suite.msgServer.Burn(sdk.WrapSDKContext(suite.Ctx), types.NewMsgBurn(tc.admin, sdk.NewInt64Coin(tc.burnDenom, 10))) - if tc.valid { - addr0bal -= 10 + _, err := suite.msgServer.ForceTransfer(sdk.WrapSDKContext(suite.Ctx), &tc.forceTransferMsg) + if tc.expectPass { suite.Require().NoError(err) - suite.Require().True(bankKeeper.GetBalance(suite.Ctx, suite.TestAccs[0], suite.defaultDenom).Amount.Int64() == addr0bal, bankKeeper.GetBalance(suite.Ctx, suite.TestAccs[0], suite.defaultDenom)) + + balances[tc.forceTransferMsg.TransferFromAddress] -= tc.forceTransferMsg.Amount.Amount.Int64() + balances[tc.forceTransferMsg.TransferToAddress] += tc.forceTransferMsg.Amount.Amount.Int64() } else { suite.Require().Error(err) - suite.Require().True(bankKeeper.GetBalance(suite.Ctx, suite.TestAccs[0], suite.defaultDenom).Amount.Int64() == addr0bal, bankKeeper.GetBalance(suite.Ctx, suite.TestAccs[0], suite.defaultDenom)) } + + fromAddr, err := sdk.AccAddressFromBech32(tc.forceTransferMsg.TransferFromAddress) + suite.Require().NoError(err) + fromBal := suite.App.BankKeeper.GetBalance(suite.Ctx, fromAddr, suite.defaultDenom).Amount + suite.Require().True(fromBal.Int64() == balances[tc.forceTransferMsg.TransferFromAddress]) + + toAddr, err := sdk.AccAddressFromBech32(tc.forceTransferMsg.TransferToAddress) + suite.Require().NoError(err) + toBal := suite.App.BankKeeper.GetBalance(suite.Ctx, toAddr, suite.defaultDenom).Amount + suite.Require().True(toBal.Int64() == balances[tc.forceTransferMsg.TransferToAddress]) }) } } + func (suite *KeeperTestSuite) TestChangeAdminDenom() { for _, tc := range []struct { desc string diff --git a/x/tokenfactory/keeper/bankactions.go b/x/tokenfactory/keeper/bankactions.go index f860dc7..b7a0882 100644 --- a/x/tokenfactory/keeper/bankactions.go +++ b/x/tokenfactory/keeper/bankactions.go @@ -51,7 +51,6 @@ func (k Keeper) burnFrom(ctx sdk.Context, amount sdk.Coin, burnFrom string) erro return k.bankKeeper.BurnCoins(ctx, types.ModuleName, sdk.NewCoins(amount)) } -// nolint: unused func (k Keeper) forceTransfer(ctx sdk.Context, amount sdk.Coin, fromAddr string, toAddr string) error { // verify that denom is an x/tokenfactory denom _, _, err := types.DeconstructDenom(amount.Denom) diff --git a/x/tokenfactory/keeper/msg_server.go b/x/tokenfactory/keeper/msg_server.go index 7bc4d21..fba9914 100644 --- a/x/tokenfactory/keeper/msg_server.go +++ b/x/tokenfactory/keeper/msg_server.go @@ -59,7 +59,11 @@ func (server msgServer) Mint(goCtx context.Context, msg *types.MsgMint) (*types. return nil, types.ErrUnauthorized } - err = server.Keeper.mintTo(ctx, msg.Amount, msg.Sender) + if msg.MintToAddress == "" { + msg.MintToAddress = msg.Sender + } + + err = server.Keeper.mintTo(ctx, msg.Amount, msg.MintToAddress) if err != nil { return nil, err } @@ -87,7 +91,11 @@ func (server msgServer) Burn(goCtx context.Context, msg *types.MsgBurn) (*types. return nil, types.ErrUnauthorized } - err = server.Keeper.burnFrom(ctx, msg.Amount, msg.Sender) + if msg.BurnFromAddress == "" { + msg.BurnFromAddress = msg.Sender + } + + err = server.Keeper.burnFrom(ctx, msg.Amount, msg.BurnFromAddress) if err != nil { return nil, err } @@ -103,34 +111,34 @@ func (server msgServer) Burn(goCtx context.Context, msg *types.MsgBurn) (*types. return &types.MsgBurnResponse{}, nil } -// func (server msgServer) ForceTransfer(goCtx context.Context, msg *types.MsgForceTransfer) (*types.MsgForceTransferResponse, error) { -// ctx := sdk.UnwrapSDKContext(goCtx) - -// authorityMetadata, err := server.Keeper.GetAuthorityMetadata(ctx, msg.Amount.GetDenom()) -// if err != nil { -// return nil, err -// } - -// if msg.Sender != authorityMetadata.GetAdmin() { -// return nil, types.ErrUnauthorized -// } - -// err = server.Keeper.forceTransfer(ctx, msg.Amount, msg.TransferFromAddress, msg.TransferToAddress) -// if err != nil { -// return nil, err -// } - -// ctx.EventManager().EmitEvents(sdk.Events{ -// sdk.NewEvent( -// types.TypeMsgForceTransfer, -// sdk.NewAttribute(types.AttributeTransferFromAddress, msg.TransferFromAddress), -// sdk.NewAttribute(types.AttributeTransferToAddress, msg.TransferToAddress), -// sdk.NewAttribute(types.AttributeAmount, msg.Amount.String()), -// ), -// }) - -// return &types.MsgForceTransferResponse{}, nil -// } +func (server msgServer) ForceTransfer(goCtx context.Context, msg *types.MsgForceTransfer) (*types.MsgForceTransferResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + authorityMetadata, err := server.Keeper.GetAuthorityMetadata(ctx, msg.Amount.GetDenom()) + if err != nil { + return nil, err + } + + if msg.Sender != authorityMetadata.GetAdmin() { + return nil, types.ErrUnauthorized + } + + err = server.Keeper.forceTransfer(ctx, msg.Amount, msg.TransferFromAddress, msg.TransferToAddress) + if err != nil { + return nil, err + } + + ctx.EventManager().EmitEvents(sdk.Events{ + sdk.NewEvent( + types.TypeMsgForceTransfer, + sdk.NewAttribute(types.AttributeTransferFromAddress, msg.TransferFromAddress), + sdk.NewAttribute(types.AttributeTransferToAddress, msg.TransferToAddress), + sdk.NewAttribute(types.AttributeAmount, msg.Amount.String()), + ), + }) + + return &types.MsgForceTransferResponse{}, nil +} func (server msgServer) ChangeAdmin(goCtx context.Context, msg *types.MsgChangeAdmin) (*types.MsgChangeAdminResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) diff --git a/x/tokenfactory/types/codec.go b/x/tokenfactory/types/codec.go index cb76899..8984dd8 100644 --- a/x/tokenfactory/types/codec.go +++ b/x/tokenfactory/types/codec.go @@ -14,7 +14,7 @@ func RegisterCodec(cdc *codec.LegacyAmino) { cdc.RegisterConcrete(&MsgCreateDenom{}, "osmosis/tokenfactory/create-denom", nil) cdc.RegisterConcrete(&MsgMint{}, "osmosis/tokenfactory/mint", nil) cdc.RegisterConcrete(&MsgBurn{}, "osmosis/tokenfactory/burn", nil) - // cdc.RegisterConcrete(&MsgForceTransfer{}, "osmosis/tokenfactory/force-transfer", nil) + cdc.RegisterConcrete(&MsgForceTransfer{}, "osmosis/tokenfactory/force-transfer", nil) cdc.RegisterConcrete(&MsgChangeAdmin{}, "osmosis/tokenfactory/change-admin", nil) } diff --git a/x/tokenfactory/types/msgs.go b/x/tokenfactory/types/msgs.go index 9c78328..ca62a4e 100644 --- a/x/tokenfactory/types/msgs.go +++ b/x/tokenfactory/types/msgs.go @@ -61,6 +61,14 @@ func NewMsgMint(sender string, amount sdk.Coin) *MsgMint { } } +func NewMsgMintTo(sender string, amount sdk.Coin, mintToAddress string) *MsgMint { + return &MsgMint{ + Sender: sender, + Amount: amount, + MintToAddress: mintToAddress, + } +} + func (m MsgMint) Route() string { return RouterKey } func (m MsgMint) Type() string { return TypeMsgMint } func (m MsgMint) ValidateBasic() error { @@ -95,6 +103,15 @@ func NewMsgBurn(sender string, amount sdk.Coin) *MsgBurn { } } +// NewMsgBurn creates a message to burn tokens +func NewMsgBurnFrom(sender string, amount sdk.Coin, burnFromAddress string) *MsgBurn { + return &MsgBurn{ + Sender: sender, + Amount: amount, + BurnFromAddress: burnFromAddress, + } +} + func (m MsgBurn) Route() string { return RouterKey } func (m MsgBurn) Type() string { return TypeMsgBurn } func (m MsgBurn) ValidateBasic() error { @@ -119,50 +136,50 @@ func (m MsgBurn) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{sender} } -// var _ sdk.Msg = &MsgForceTransfer{} - -// // NewMsgForceTransfer creates a transfer funds from one account to another -// func NewMsgForceTransfer(sender string, amount sdk.Coin, fromAddr, toAddr string) *MsgForceTransfer { -// return &MsgForceTransfer{ -// Sender: sender, -// Amount: amount, -// TransferFromAddress: fromAddr, -// TransferToAddress: toAddr, -// } -// } - -// func (m MsgForceTransfer) Route() string { return RouterKey } -// func (m MsgForceTransfer) Type() string { return TypeMsgForceTransfer } -// func (m MsgForceTransfer) ValidateBasic() error { -// _, err := sdk.AccAddressFromBech32(m.Sender) -// if err != nil { -// return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid sender address (%s)", err) -// } - -// _, err = sdk.AccAddressFromBech32(m.TransferFromAddress) -// if err != nil { -// return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid address (%s)", err) -// } -// _, err = sdk.AccAddressFromBech32(m.TransferToAddress) -// if err != nil { -// return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid address (%s)", err) -// } - -// if !m.Amount.IsValid() { -// return sdkerrors.Wrap(sdkerrors.ErrInvalidCoins, m.Amount.String()) -// } - -// return nil -// } - -// func (m MsgForceTransfer) GetSignBytes() []byte { -// return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m)) -// } - -// func (m MsgForceTransfer) GetSigners() []sdk.AccAddress { -// sender, _ := sdk.AccAddressFromBech32(m.Sender) -// return []sdk.AccAddress{sender} -// } +var _ sdk.Msg = &MsgForceTransfer{} + +// NewMsgForceTransfer creates a transfer funds from one account to another +func NewMsgForceTransfer(sender string, amount sdk.Coin, fromAddr, toAddr string) *MsgForceTransfer { + return &MsgForceTransfer{ + Sender: sender, + Amount: amount, + TransferFromAddress: fromAddr, + TransferToAddress: toAddr, + } +} + +func (m MsgForceTransfer) Route() string { return RouterKey } +func (m MsgForceTransfer) Type() string { return TypeMsgForceTransfer } +func (m MsgForceTransfer) ValidateBasic() error { + _, err := sdk.AccAddressFromBech32(m.Sender) + if err != nil { + return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid sender address (%s)", err) + } + + _, err = sdk.AccAddressFromBech32(m.TransferFromAddress) + if err != nil { + return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid address (%s)", err) + } + _, err = sdk.AccAddressFromBech32(m.TransferToAddress) + if err != nil { + return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid address (%s)", err) + } + + if !m.Amount.IsValid() { + return sdkerrors.Wrap(sdkerrors.ErrInvalidCoins, m.Amount.String()) + } + + return nil +} + +func (m MsgForceTransfer) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m)) +} + +func (m MsgForceTransfer) GetSigners() []sdk.AccAddress { + sender, _ := sdk.AccAddressFromBech32(m.Sender) + return []sdk.AccAddress{sender} +} var _ sdk.Msg = &MsgChangeAdmin{} From ff11f1b55f3d0a5e046c40bf9639d87a420157ce Mon Sep 17 00:00:00 2001 From: Reece Williams Date: Mon, 20 Mar 2023 01:16:30 -0500 Subject: [PATCH 03/11] how to proto gen here --- scripts/protocgen.sh | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/scripts/protocgen.sh b/scripts/protocgen.sh index 79d7a23..2270aed 100644 --- a/scripts/protocgen.sh +++ b/scripts/protocgen.sh @@ -17,6 +17,24 @@ # go get github.com/regen-network/cosmos-proto@latest # doesn't work in install mode # go get github.com/regen-network/cosmos-proto/protoc-gen-gocosmos@v0.3.1 +# To run this, i had to modify the following: +# git clone https://github.com/regen-network/cosmos-proto.git +# +# Modify interfacetype/interfacetype.go and comment out the following lines: +# +# if len(message.OneofDecl) != 1 { +# panic("interfacetype only supports messages with exactly one oneof declaration") +# } +# for _, field := range message.Field { +# if idx := field.OneofIndex; idx == nil || *idx != 0 { +# panic("all fields in interfacetype message must belong to the oneof") +# } +# } +# +# then: +# cd cosmos-proto/protoc-gen-gocosmos +# go install . + set -eo pipefail echo "Generating gogo proto code" @@ -26,7 +44,7 @@ cd .. buf generate # move proto files to the right places -cp -r ./github.com/CosmosContracts/token-factory/x/* x/ +cp -r ./github.com/CosmWasm/token-factory/x/* x/ rm -rf ./github.com go mod tidy From e2b86a70258824782236d5dedd486262db0d718a Mon Sep 17 00:00:00 2001 From: Reece Williams Date: Mon, 20 Mar 2023 01:20:39 -0500 Subject: [PATCH 04/11] Adds: `force transfer, mintTo, burnFrom`, --- Makefile | 32 +- go.mod | 2 +- proto/Dockerfile | 0 proto/buf.gen.gogo.yaml | 8 + proto/buf.lock | 0 proto/buf.yaml | 0 .../v1beta1/authorityMetadata.proto | 2 +- .../tokenfactory/v1beta1/genesis.proto | 2 +- .../osmosis/tokenfactory/v1beta1/params.proto | 2 +- .../osmosis/tokenfactory/v1beta1/query.proto | 0 proto/osmosis/tokenfactory/v1beta1/tx.proto | 4 - x/tokenfactory/types/authorityMetadata.pb.go | 14 +- x/tokenfactory/types/genesis.pb.go | 12 +- x/tokenfactory/types/params.pb.go | 42 +- x/tokenfactory/types/query.pb.go | 76 +- x/tokenfactory/types/tx.pb.go | 679 ++++++++++++++++-- 16 files changed, 737 insertions(+), 138 deletions(-) mode change 100644 => 100755 proto/Dockerfile create mode 100644 proto/buf.gen.gogo.yaml mode change 100644 => 100755 proto/buf.lock mode change 100644 => 100755 proto/buf.yaml mode change 100644 => 100755 proto/osmosis/tokenfactory/v1beta1/authorityMetadata.proto mode change 100644 => 100755 proto/osmosis/tokenfactory/v1beta1/genesis.proto mode change 100644 => 100755 proto/osmosis/tokenfactory/v1beta1/params.proto mode change 100644 => 100755 proto/osmosis/tokenfactory/v1beta1/query.proto mode change 100644 => 100755 proto/osmosis/tokenfactory/v1beta1/tx.proto diff --git a/Makefile b/Makefile index 9be2f8b..7c36883 100644 --- a/Makefile +++ b/Makefile @@ -168,26 +168,30 @@ format: format-tools PROTO_BUILDER_IMAGE=tendermintdev/sdk-proto-gen:v0.7 PROTO_FORMATTER_IMAGE=tendermintdev/docker-build-proto@sha256:aabcfe2fc19c31c0f198d4cd26393f5e5ca9502d7ea3feafbfe972448fee7cae -proto-all: proto-format proto-lint proto-gen format +protoVer=v0.8 +protoImageName=osmolabs/osmo-proto-gen:$(protoVer) +containerProtoGen=cosmos-sdk-proto-gen-$(protoVer) +containerProtoFmt=cosmos-sdk-proto-fmt-$(protoVer) + +# proto-gen: +# @echo "Generating Protobuf files" +# $(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace $(PROTO_BUILDER_IMAGE) sh ./scripts/protocgen.sh proto-gen: @echo "Generating Protobuf files" - $(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace $(PROTO_BUILDER_IMAGE) sh ./scripts/protocgen.sh + @if docker ps -a --format '{{.Names}}' | grep -Eq "^${containerProtoGen}$$"; then docker start -a $(containerProtoGen); else docker run --name $(containerProtoGen) -v $(CURDIR):/workspace --workdir /workspace $(protoImageName) \ + sh ./scripts/protocgen.sh; fi proto-format: @echo "Formatting Protobuf files" - $(DOCKER) run --rm -v $(CURDIR):/workspace \ - --workdir /workspace $(PROTO_FORMATTER_IMAGE) \ - find ./ -name *.proto -exec clang-format -i {} \; - -proto-swagger-gen: - @./scripts/protoc-swagger-gen.sh - -proto-lint: - @$(DOCKER_BUF) lint --error-format=json - -proto-check-breaking: - @$(DOCKER_BUF) breaking --against $(HTTPS_GIT)#branch=main + @if docker ps -a --format '{{.Names}}' | grep -Eq "^${containerProtoFmt}$$"; then docker start -a $(containerProtoFmt); else docker run --name $(containerProtoFmt) -v $(CURDIR):/workspace --workdir /workspace tendermintdev/docker-build-proto \ + find ./ -not -path "./third_party/*" -name "*.proto" -exec clang-format -i {} \; ; fi + +# protoImageName=cosmwasm/tf-proto:1.0.0 +proto-image-build: +# docker run -v $(pwd):/workspace --workdir /workspace cosmwasm/tf-proto:1.0.0 sh ./scripts/protocgen.sh +# @DOCKER_BUILDKIT=1 docker build -t cosmwasm/tf-proto:1.0.0 -f ./proto/Dockerfile ./proto + @DOCKER_BUILDKIT=1 docker build -t $(protoImageName) -f ./proto/Dockerfile ./proto .PHONY: all install install-debug \ go-mod-cache draw-deps clean build format \ diff --git a/go.mod b/go.mod index 0cde56d..a308fa4 100644 --- a/go.mod +++ b/go.mod @@ -6,6 +6,7 @@ require ( github.com/CosmWasm/wasmd v0.30.0 github.com/cosmos/cosmos-proto v1.0.0-beta.1 github.com/cosmos/cosmos-sdk v0.45.12 + github.com/cosmos/gogoproto v1.4.3 github.com/cosmos/ibc-go/v4 v4.3.0 github.com/cosmos/interchain-accounts v0.2.5 github.com/gogo/protobuf v1.3.3 @@ -25,7 +26,6 @@ require ( require ( github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect - github.com/cosmos/gogoproto v1.4.3 // indirect github.com/cosmos/iavl v0.19.4 // indirect github.com/creachadair/taskgroup v0.3.2 // indirect github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect diff --git a/proto/Dockerfile b/proto/Dockerfile old mode 100644 new mode 100755 diff --git a/proto/buf.gen.gogo.yaml b/proto/buf.gen.gogo.yaml new file mode 100644 index 0000000..1d19108 --- /dev/null +++ b/proto/buf.gen.gogo.yaml @@ -0,0 +1,8 @@ +version: v1 +plugins: + - name: gocosmos + out: .. + opt: plugins=grpc,Mgoogle/protobuf/duration.proto=github.com/gogo/protobuf/types,Mgoogle/protobuf/struct.proto=github.com/gogo/protobuf/types,Mgoogle/protobuf/timestamp.proto=github.com/gogo/protobuf/types,Mgoogle/protobuf/wrappers.proto=github.com/gogo/protobuf/types,Mgoogle/protobuf/any.proto=github.com/cosmos/cosmos-sdk/codec/types,Mcosmos/orm/v1alpha1/orm.proto=github.com/cosmos/cosmos-sdk/api/cosmos/orm/v1alpha1 + - name: grpc-gateway + out: .. + opt: logtostderr=true,allow_colon_final_segments=true \ No newline at end of file diff --git a/proto/buf.lock b/proto/buf.lock old mode 100644 new mode 100755 diff --git a/proto/buf.yaml b/proto/buf.yaml old mode 100644 new mode 100755 diff --git a/proto/osmosis/tokenfactory/v1beta1/authorityMetadata.proto b/proto/osmosis/tokenfactory/v1beta1/authorityMetadata.proto old mode 100644 new mode 100755 index fc869da..1169f00 --- a/proto/osmosis/tokenfactory/v1beta1/authorityMetadata.proto +++ b/proto/osmosis/tokenfactory/v1beta1/authorityMetadata.proto @@ -14,4 +14,4 @@ message DenomAuthorityMetadata { // Can be empty for no admin, or a valid osmosis address string admin = 1 [ (gogoproto.moretags) = "yaml:\"admin\"" ]; -} +} \ No newline at end of file diff --git a/proto/osmosis/tokenfactory/v1beta1/genesis.proto b/proto/osmosis/tokenfactory/v1beta1/genesis.proto old mode 100644 new mode 100755 index 3e260c0..d9ae411 --- a/proto/osmosis/tokenfactory/v1beta1/genesis.proto +++ b/proto/osmosis/tokenfactory/v1beta1/genesis.proto @@ -29,4 +29,4 @@ message GenesisDenom { (gogoproto.moretags) = "yaml:\"authority_metadata\"", (gogoproto.nullable) = false ]; -} +} \ No newline at end of file diff --git a/proto/osmosis/tokenfactory/v1beta1/params.proto b/proto/osmosis/tokenfactory/v1beta1/params.proto old mode 100644 new mode 100755 index 4e4e049..0a9f5ff --- a/proto/osmosis/tokenfactory/v1beta1/params.proto +++ b/proto/osmosis/tokenfactory/v1beta1/params.proto @@ -15,4 +15,4 @@ message Params { (gogoproto.moretags) = "yaml:\"denom_creation_fee\"", (gogoproto.nullable) = false ]; -} +} \ No newline at end of file diff --git a/proto/osmosis/tokenfactory/v1beta1/query.proto b/proto/osmosis/tokenfactory/v1beta1/query.proto old mode 100644 new mode 100755 diff --git a/proto/osmosis/tokenfactory/v1beta1/tx.proto b/proto/osmosis/tokenfactory/v1beta1/tx.proto old mode 100644 new mode 100755 index 169b5ef..98cbaf2 --- a/proto/osmosis/tokenfactory/v1beta1/tx.proto +++ b/proto/osmosis/tokenfactory/v1beta1/tx.proto @@ -94,8 +94,6 @@ message MsgSetDenomMetadata { // MsgSetDenomMetadata message. message MsgSetDenomMetadataResponse {} -// MsgForceTransfer is the sdk.Msg type for allowing an admin account to force -// transfer tokens from one account to another. message MsgForceTransfer { string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ]; cosmos.base.v1beta1.Coin amount = 2 [ @@ -108,6 +106,4 @@ message MsgForceTransfer { [ (gogoproto.moretags) = "yaml:\"transfer_to_address\"" ]; } -// MsgForceTransferResponse defines the response structure for an executed -// MsgForceTransfer message. message MsgForceTransferResponse {} \ No newline at end of file diff --git a/x/tokenfactory/types/authorityMetadata.pb.go b/x/tokenfactory/types/authorityMetadata.pb.go index 9241dde..50febce 100644 --- a/x/tokenfactory/types/authorityMetadata.pb.go +++ b/x/tokenfactory/types/authorityMetadata.pb.go @@ -6,7 +6,7 @@ package types import ( fmt "fmt" _ "github.com/cosmos/cosmos-sdk/types" - _ "github.com/gogo/protobuf/gogoproto" + _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/gogo/protobuf/proto" io "io" math "math" @@ -81,7 +81,7 @@ func init() { } var fileDescriptor_99435de88ae175f7 = []byte{ - // 239 bytes of a gzipped FileDescriptorProto + // 238 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x32, 0xc9, 0x2f, 0xce, 0xcd, 0x2f, 0xce, 0x2c, 0xd6, 0x2f, 0xc9, 0xcf, 0x4e, 0xcd, 0x4b, 0x4b, 0x4c, 0x2e, 0xc9, 0x2f, 0xaa, 0xd4, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, 0x49, 0x34, 0xd4, 0x4f, 0x2c, 0x2d, 0xc9, 0xc8, 0x2f, 0xca, @@ -91,12 +91,12 @@ var fileDescriptor_99435de88ae175f7 = []byte{ 0xa7, 0xc2, 0x2d, 0x48, 0xce, 0xcf, 0xcc, 0x83, 0xc8, 0x2b, 0xb9, 0x71, 0x89, 0xb9, 0xa4, 0xe6, 0xe5, 0xe7, 0x3a, 0xa2, 0xdb, 0x29, 0xa4, 0xc6, 0xc5, 0x9a, 0x98, 0x92, 0x9b, 0x99, 0x27, 0xc1, 0xa8, 0xc0, 0xa8, 0xc1, 0xe9, 0x24, 0xf0, 0xe9, 0x9e, 0x3c, 0x4f, 0x65, 0x62, 0x6e, 0x8e, 0x95, - 0x12, 0x58, 0x58, 0x29, 0x08, 0x22, 0x6d, 0xc5, 0xf2, 0x62, 0x81, 0x3c, 0xa3, 0x53, 0xd0, 0x89, + 0x12, 0x58, 0x58, 0x29, 0x08, 0x22, 0x6d, 0xc5, 0xf2, 0x62, 0x81, 0x3c, 0xa3, 0x53, 0xc0, 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0x3e, 0x78, 0x24, 0xc7, 0x38, 0xe1, 0xb1, 0x1c, 0xc3, - 0x85, 0xc7, 0x72, 0x0c, 0x37, 0x1e, 0xcb, 0x31, 0x44, 0x59, 0xa4, 0x67, 0x96, 0x64, 0x94, 0x26, - 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0x43, 0x3d, 0xa0, 0x9b, 0x93, 0x98, 0x54, 0x0c, 0xe3, 0xe8, 0x97, - 0x19, 0x1a, 0xe9, 0x57, 0xa0, 0x86, 0x44, 0x49, 0x65, 0x41, 0x6a, 0x71, 0x12, 0x1b, 0xd8, 0x89, - 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0x05, 0xcf, 0xa3, 0x03, 0x2e, 0x01, 0x00, 0x00, + 0x85, 0xc7, 0x72, 0x0c, 0x37, 0x1e, 0xcb, 0x31, 0x44, 0x99, 0xa5, 0x67, 0x96, 0x64, 0x94, 0x26, + 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0x3b, 0xe7, 0x17, 0xe7, 0x86, 0x27, 0x16, 0xe7, 0x42, 0xfc, 0xad, + 0x0b, 0xf3, 0x78, 0x05, 0x6a, 0x38, 0x94, 0x54, 0x16, 0xa4, 0x16, 0x27, 0xb1, 0x81, 0x1d, 0x68, + 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0x58, 0x13, 0xa0, 0xd7, 0x2c, 0x01, 0x00, 0x00, } func (this *DenomAuthorityMetadata) Equal(that interface{}) bool { diff --git a/x/tokenfactory/types/genesis.pb.go b/x/tokenfactory/types/genesis.pb.go index c067319..e37943c 100644 --- a/x/tokenfactory/types/genesis.pb.go +++ b/x/tokenfactory/types/genesis.pb.go @@ -5,7 +5,7 @@ package types import ( fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" + _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/gogo/protobuf/proto" io "io" math "math" @@ -160,12 +160,12 @@ var fileDescriptor_5749c3f71850298b = []byte{ 0xe0, 0xd3, 0x3d, 0x79, 0x1e, 0x88, 0x49, 0x60, 0x61, 0xa5, 0x20, 0x88, 0xb4, 0x50, 0x1b, 0x23, 0x97, 0x10, 0x3c, 0x18, 0xe3, 0x73, 0xa1, 0xe1, 0x28, 0xc1, 0x04, 0xf6, 0xbb, 0x09, 0x7e, 0xf7, 0x82, 0x6d, 0x72, 0x44, 0x8f, 0x03, 0x27, 0x45, 0xa8, 0xcb, 0x25, 0x21, 0xf6, 0x61, 0x9a, 0xae, - 0x14, 0x24, 0x88, 0x11, 0x73, 0x56, 0x2c, 0x2f, 0x16, 0xc8, 0x33, 0x3a, 0x05, 0x9d, 0x78, 0x24, + 0x14, 0x24, 0x88, 0x11, 0x73, 0x56, 0x2c, 0x2f, 0x16, 0xc8, 0x33, 0x3a, 0x05, 0x9c, 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x13, 0x1e, 0xcb, 0x31, 0x5c, 0x78, - 0x2c, 0xc7, 0x70, 0xe3, 0xb1, 0x1c, 0x43, 0x94, 0x45, 0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, - 0x72, 0x7e, 0xae, 0x3e, 0xd4, 0x55, 0xba, 0x39, 0x89, 0x49, 0xc5, 0x30, 0x8e, 0x7e, 0x99, 0xa1, - 0x91, 0x7e, 0x05, 0x6a, 0x8c, 0x97, 0x54, 0x16, 0xa4, 0x16, 0x27, 0xb1, 0x81, 0x63, 0xda, 0x18, - 0x10, 0x00, 0x00, 0xff, 0xff, 0x16, 0xe9, 0x52, 0x6a, 0xac, 0x02, 0x00, 0x00, + 0x2c, 0xc7, 0x70, 0xe3, 0xb1, 0x1c, 0x43, 0x94, 0x59, 0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, + 0x72, 0x7e, 0xae, 0xbe, 0x73, 0x7e, 0x71, 0x6e, 0x78, 0x62, 0x71, 0x2e, 0x24, 0x7e, 0x75, 0x61, + 0x11, 0x5c, 0x81, 0x1a, 0xdf, 0x25, 0x95, 0x05, 0xa9, 0xc5, 0x49, 0x6c, 0xe0, 0x78, 0x36, 0x06, + 0x04, 0x00, 0x00, 0xff, 0xff, 0xcc, 0xdd, 0x1a, 0x51, 0xaa, 0x02, 0x00, 0x00, } func (this *GenesisDenom) Equal(that interface{}) bool { diff --git a/x/tokenfactory/types/params.pb.go b/x/tokenfactory/types/params.pb.go index 4ad1f92..6ec0236 100644 --- a/x/tokenfactory/types/params.pb.go +++ b/x/tokenfactory/types/params.pb.go @@ -8,7 +8,7 @@ import ( _ "github.com/cosmos/cosmos-proto" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" types "github.com/cosmos/cosmos-sdk/types" - _ "github.com/gogo/protobuf/gogoproto" + _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/gogo/protobuf/proto" io "io" math "math" @@ -81,26 +81,26 @@ func init() { var fileDescriptor_cc8299d306f3ff47 = []byte{ // 309 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x90, 0xbf, 0x4e, 0xf3, 0x30, - 0x14, 0xc5, 0x63, 0x7d, 0x52, 0x87, 0x7e, 0x0b, 0xaa, 0x18, 0x68, 0x85, 0x1c, 0x94, 0xa9, 0x0c, - 0xb5, 0x95, 0xc2, 0x80, 0x18, 0x5b, 0x89, 0xad, 0x12, 0xea, 0xc8, 0x12, 0xdd, 0x24, 0x6e, 0x6a, - 0xb5, 0xc9, 0x8d, 0x62, 0xb7, 0x22, 0x6f, 0xc1, 0xc4, 0xce, 0xca, 0x93, 0x74, 0xec, 0xc8, 0x54, - 0x50, 0xf2, 0x06, 0x3c, 0x01, 0xaa, 0xe3, 0xa2, 0x22, 0x24, 0x26, 0xfb, 0xe8, 0x9e, 0xf3, 0xbb, - 0x7f, 0xda, 0x97, 0xa8, 0x52, 0x54, 0x52, 0x71, 0x8d, 0x0b, 0x91, 0xcd, 0x20, 0xd2, 0x58, 0x94, - 0x7c, 0xed, 0x87, 0x42, 0x83, 0xcf, 0x73, 0x28, 0x20, 0x55, 0x2c, 0x2f, 0x50, 0x63, 0xe7, 0xdc, - 0x5a, 0xd9, 0xb1, 0x95, 0x59, 0x6b, 0xef, 0x34, 0xc1, 0x04, 0x8d, 0x91, 0xef, 0x7f, 0x4d, 0xa6, - 0x77, 0xfd, 0x27, 0x1e, 0x56, 0x7a, 0x8e, 0x85, 0xd4, 0xe5, 0x44, 0x68, 0x88, 0x41, 0x83, 0x4d, - 0x75, 0x23, 0x13, 0x0b, 0x1a, 0x5c, 0x23, 0x6c, 0x89, 0x36, 0x8a, 0x87, 0xa0, 0xc4, 0x37, 0x27, - 0x42, 0x99, 0x35, 0x75, 0xef, 0x85, 0xb4, 0x5b, 0xf7, 0x66, 0xea, 0xce, 0x33, 0x69, 0x77, 0x62, - 0x91, 0x61, 0x1a, 0x44, 0x85, 0x00, 0x2d, 0x31, 0x0b, 0x66, 0x42, 0x9c, 0x91, 0x8b, 0x7f, 0xfd, - 0xff, 0xc3, 0x2e, 0xb3, 0xd8, 0x3d, 0xe8, 0xb0, 0x04, 0x1b, 0xa3, 0xcc, 0x46, 0x93, 0xcd, 0xce, - 0x75, 0x3e, 0x77, 0x6e, 0xb7, 0x84, 0x74, 0x79, 0xeb, 0xfd, 0x46, 0x78, 0xaf, 0xef, 0x6e, 0x3f, - 0x91, 0x7a, 0xbe, 0x0a, 0x59, 0x84, 0xa9, 0x1d, 0xd0, 0x3e, 0x03, 0x15, 0x2f, 0xb8, 0x2e, 0x73, - 0xa1, 0x0c, 0x4d, 0x4d, 0x4f, 0x0c, 0x60, 0x6c, 0xf3, 0x77, 0x42, 0x8c, 0xa6, 0x9b, 0x8a, 0x92, - 0x6d, 0x45, 0xc9, 0x47, 0x45, 0xc9, 0x53, 0x4d, 0x9d, 0x6d, 0x4d, 0x9d, 0xb7, 0x9a, 0x3a, 0x0f, - 0x37, 0x47, 0x54, 0x7b, 0xb9, 0xc1, 0x12, 0x42, 0x75, 0x10, 0x7c, 0xed, 0x0f, 0xf9, 0xe3, 0xcf, - 0x63, 0x9a, 0x5e, 0x61, 0xcb, 0xac, 0x7f, 0xf5, 0x15, 0x00, 0x00, 0xff, 0xff, 0xa0, 0x89, 0xb8, - 0xda, 0xd0, 0x01, 0x00, 0x00, + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00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x31, 0x37, + 0xc7, 0x4a, 0x09, 0xd3, 0x08, 0xa5, 0x55, 0xf7, 0xe5, 0x35, 0xd2, 0x33, 0x4b, 0x32, 0x4a, 0x93, + 0xf4, 0x92, 0xf3, 0x73, 0xa1, 0x0e, 0x84, 0x52, 0xba, 0xc5, 0x29, 0xd9, 0xfa, 0x25, 0x95, 0x05, + 0xa9, 0xc5, 0x60, 0xd3, 0x8a, 0x83, 0x04, 0xc0, 0x06, 0x38, 0x43, 0xf5, 0xbb, 0xa5, 0xa6, 0x3a, + 0x05, 0x9c, 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x13, 0x1e, + 0xcb, 0x31, 0x5c, 0x78, 0x2c, 0xc7, 0x70, 0xe3, 0xb1, 0x1c, 0x43, 0x94, 0x19, 0x92, 0xa9, 0xce, + 0xf9, 0xc5, 0xb9, 0xe1, 0x89, 0xc5, 0xb9, 0x90, 0xa0, 0xd3, 0x85, 0x85, 0x5d, 0x05, 0x6a, 0x50, + 0x82, 0x6d, 0x4a, 0x62, 0x03, 0x7b, 0xde, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0xad, 0x69, 0xdf, + 0x1c, 0xce, 0x01, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { diff --git a/x/tokenfactory/types/query.pb.go b/x/tokenfactory/types/query.pb.go index aec8c19..ce00a69 100644 --- a/x/tokenfactory/types/query.pb.go +++ b/x/tokenfactory/types/query.pb.go @@ -7,7 +7,7 @@ import ( context "context" fmt "fmt" _ "github.com/cosmos/cosmos-sdk/types/query" - _ "github.com/gogo/protobuf/gogoproto" + _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/gogo/protobuf/grpc" proto "github.com/gogo/protobuf/proto" _ "google.golang.org/genproto/googleapis/api/annotations" @@ -311,43 +311,43 @@ func init() { } var fileDescriptor_6f22013ad0f72e3f = []byte{ - // 574 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x54, 0xcb, 0x6e, 0xd3, 0x4c, - 0x14, 0xce, 0xfc, 0x7f, 0x1b, 0xd4, 0xe1, 0x22, 0x32, 0x54, 0x08, 0xa2, 0xe2, 0xc0, 0x50, 0x55, - 0x29, 0x2a, 0x1e, 0x12, 0xba, 0x40, 0x14, 0x04, 0x71, 0x11, 0x2c, 0xa0, 0x12, 0x78, 0x07, 0x9b, - 0x68, 0x92, 0x4e, 0x5d, 0x8b, 0xd8, 0xe3, 0x7a, 0x26, 0x15, 0x51, 0xd5, 0x0d, 0x0b, 0xd6, 0x48, - 0x2c, 0x79, 0x07, 0x9e, 0xa3, 0xcb, 0x4a, 0xdd, 0xb0, 0xb2, 0x50, 0x52, 0xf1, 0x00, 0x79, 0x02, - 0xe4, 0x99, 0x49, 0x68, 0x71, 0xb0, 0x02, 0xac, 0x62, 0xcd, 0xf9, 0xce, 0x77, 0x39, 0xe7, 0x28, - 0xb0, 0xca, 0x45, 0xc0, 0x85, 0x2f, 0x88, 0xe4, 0x6f, 0x59, 0xb8, 0x45, 0xdb, 0x92, 0xc7, 0x3d, - 0xb2, 0x5b, 0x6b, 0x31, 0x49, 0x6b, 0x64, 0xa7, 0xcb, 0xe2, 0x9e, 0x1d, 0xc5, 0x5c, 0x72, 0xb4, - 0x60, 0x90, 0xf6, 0x49, 0xa4, 0x6d, 0x90, 0xe5, 0x79, 0x8f, 0x7b, 0x5c, 0x01, 0x49, 0xfa, 0xa5, - 0x7b, 0xca, 0x0b, 0x1e, 0xe7, 0x5e, 0x87, 0x11, 0x1a, 0xf9, 0x84, 0x86, 0x21, 0x97, 0x54, 0xfa, - 0x3c, 0x14, 0xa6, 0x7a, 0xab, 0xad, 0x28, 0x49, 0x8b, 0x0a, 0xa6, 0xa5, 0xc6, 0xc2, 0x11, 0xf5, - 0xfc, 0x50, 0x81, 0x0d, 0x76, 0x35, 0xd7,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, 0xf2, 0xee, 0xb4, 0xa6, 0xec, 0x45, 0x4c, 0xb4, 0x8a, 0xea, 0xdf, 0xec, 0xee, - 0x8f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x0b, 0x3a, 0x54, 0xaf, 0xd8, 0x05, 0x00, 0x00, + // 573 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x54, 0x4f, 0x6b, 0x13, 0x41, + 0x14, 0xcf, 0x6a, 0x1b, 0xe9, 0xf8, 0x07, 0x3b, 0x16, 0xd1, 0x50, 0x37, 0x3a, 0x96, 0x92, 0x4a, + 0xdd, 0x31, 0xb5, 0x78, 0xb0, 0x8a, 0x66, 0x23, 0x7a, 0xd0, 0x42, 0xdd, 0x8b, 0xe8, 0x25, 0x4c, + 0xd2, 0xe9, 0x76, 0xb1, 0xb3, 0x6f, 0xbb, 0x33, 0x11, 0x43, 0xe9, 0xc5, 0x83, 0x67, 0xc1, 0xa3, + 0xdf, 0xc1, 0xcf, 0xd1, 0x63, 0xa1, 0x17, 0x4f, 0x41, 0x92, 0xe2, 0x07, 0xc8, 0x27, 0x90, 0xcc, + 0x4c, 0x6a, 0x6b, 0xe2, 0x12, 0xf5, 0x94, 0x65, 0xde, 0xef, 0xfd, 0xfe, 0xbc, 0xf7, 0x08, 0x2a, + 0x81, 0x14, 0x20, 0x23, 0x49, 0x15, 0xbc, 0xe5, 0xf1, 0x06, 0x6b, 0x28, 0x48, 0x5b, 0xf4, 0x5d, + 0xb9, 0xce, 0x15, 0x2b, 0xd3, 0xed, 0x26, 0x4f, 0x5b, 0x5e, 0x92, 0x82, 0x02, 0x3c, 0x6b, 0x91, + 0xde, 0x71, 0xa4, 0x67, 0x91, 0x85, 0x99, 0x10, 0x42, 0xd0, 0x40, 0xda, 0xff, 0x32, 0x3d, 0x85, + 0xd9, 0x10, 0x20, 0xdc, 0xe2, 0x94, 0x25, 0x11, 0x65, 0x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, 0xba, 0x6e, 0x6e, 0xbf, 0xeb, 0xe6, 0xbe, 0x75, 0xdd, 0xdc, 0x9b, 0x7b, + 0x61, 0xa4, 0x36, 0x9b, 0x75, 0xaf, 0x01, 0x82, 0x56, 0x41, 0x8a, 0x57, 0x4c, 0x0a, 0xa3, 0x70, + 0x7b, 0x20, 0xf1, 0xfe, 0xa4, 0xa2, 0x6a, 0x25, 0x5c, 0xd6, 0xf3, 0xfa, 0xbf, 0xec, 0xee, 0xcf, + 0x00, 0x00, 0x00, 0xff, 0xff, 0x7d, 0x7f, 0x3a, 0xdf, 0xd6, 0x05, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/x/tokenfactory/types/tx.pb.go b/x/tokenfactory/types/tx.pb.go index b61b87b..bedf6bb 100644 --- a/x/tokenfactory/types/tx.pb.go +++ b/x/tokenfactory/types/tx.pb.go @@ -8,7 +8,7 @@ import ( fmt "fmt" types "github.com/cosmos/cosmos-sdk/types" types1 "github.com/cosmos/cosmos-sdk/x/bank/types" - _ "github.com/gogo/protobuf/gogoproto" + _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/gogo/protobuf/grpc" proto "github.com/gogo/protobuf/proto" grpc "google.golang.org/grpc" @@ -141,8 +141,9 @@ func (m *MsgCreateDenomResponse) GetNewTokenDenom() string { // MsgMint is the sdk.Msg type for allowing an admin account to mint // more of a token. For now, we only support minting to the sender account type MsgMint struct { - Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty" yaml:"sender"` - Amount types.Coin `protobuf:"bytes,2,opt,name=amount,proto3" json:"amount" yaml:"amount"` + Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty" yaml:"sender"` + Amount types.Coin `protobuf:"bytes,2,opt,name=amount,proto3" json:"amount" yaml:"amount"` + MintToAddress string `protobuf:"bytes,3,opt,name=mintToAddress,proto3" json:"mintToAddress,omitempty" yaml:"mint_to_address"` } func (m *MsgMint) Reset() { *m = MsgMint{} } @@ -192,6 +193,13 @@ func (m *MsgMint) GetAmount() types.Coin { return types.Coin{} } +func (m *MsgMint) GetMintToAddress() string { + if m != nil { + return m.MintToAddress + } + return "" +} + type MsgMintResponse struct { } @@ -231,8 +239,9 @@ var xxx_messageInfo_MsgMintResponse proto.InternalMessageInfo // MsgBurn is the sdk.Msg type for allowing an admin account to burn // a token. For now, we only support burning from the sender account. type MsgBurn struct { - Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty" yaml:"sender"` - Amount types.Coin `protobuf:"bytes,2,opt,name=amount,proto3" json:"amount" yaml:"amount"` + Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty" yaml:"sender"` + Amount types.Coin `protobuf:"bytes,2,opt,name=amount,proto3" json:"amount" yaml:"amount"` + BurnFromAddress string `protobuf:"bytes,3,opt,name=burnFromAddress,proto3" json:"burnFromAddress,omitempty" yaml:"burn_from_address"` } func (m *MsgBurn) Reset() { *m = MsgBurn{} } @@ -282,6 +291,13 @@ func (m *MsgBurn) GetAmount() types.Coin { return types.Coin{} } +func (m *MsgBurn) GetBurnFromAddress() string { + if m != nil { + return m.BurnFromAddress + } + return "" +} + type MsgBurnResponse struct { } @@ -510,6 +526,110 @@ func (m *MsgSetDenomMetadataResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgSetDenomMetadataResponse proto.InternalMessageInfo +type MsgForceTransfer struct { + Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty" yaml:"sender"` + Amount types.Coin `protobuf:"bytes,2,opt,name=amount,proto3" json:"amount" yaml:"amount"` + TransferFromAddress string `protobuf:"bytes,3,opt,name=transferFromAddress,proto3" json:"transferFromAddress,omitempty" yaml:"transfer_from_address"` + TransferToAddress string `protobuf:"bytes,4,opt,name=transferToAddress,proto3" json:"transferToAddress,omitempty" yaml:"transfer_to_address"` +} + +func (m *MsgForceTransfer) Reset() { *m = MsgForceTransfer{} } +func (m *MsgForceTransfer) String() string { return proto.CompactTextString(m) } +func (*MsgForceTransfer) ProtoMessage() {} +func (*MsgForceTransfer) Descriptor() ([]byte, []int) { + return fileDescriptor_283b6c9a90a846b4, []int{10} +} +func (m *MsgForceTransfer) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgForceTransfer) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgForceTransfer.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 *MsgForceTransfer) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgForceTransfer.Merge(m, src) +} +func (m *MsgForceTransfer) XXX_Size() int { + return m.Size() +} +func (m *MsgForceTransfer) XXX_DiscardUnknown() { + xxx_messageInfo_MsgForceTransfer.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgForceTransfer proto.InternalMessageInfo + +func (m *MsgForceTransfer) GetSender() string { + if m != nil { + return m.Sender + } + return "" +} + +func (m *MsgForceTransfer) GetAmount() types.Coin { + if m != nil { + return m.Amount + } + return types.Coin{} +} + +func (m *MsgForceTransfer) GetTransferFromAddress() string { + if m != nil { + return m.TransferFromAddress + } + return "" +} + +func (m *MsgForceTransfer) GetTransferToAddress() string { + if m != nil { + return m.TransferToAddress + } + return "" +} + +type MsgForceTransferResponse struct { +} + +func (m *MsgForceTransferResponse) Reset() { *m = MsgForceTransferResponse{} } +func (m *MsgForceTransferResponse) String() string { return proto.CompactTextString(m) } +func (*MsgForceTransferResponse) ProtoMessage() {} +func (*MsgForceTransferResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_283b6c9a90a846b4, []int{11} +} +func (m *MsgForceTransferResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgForceTransferResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgForceTransferResponse.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 *MsgForceTransferResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgForceTransferResponse.Merge(m, src) +} +func (m *MsgForceTransferResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgForceTransferResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgForceTransferResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgForceTransferResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*MsgCreateDenom)(nil), "osmosis.tokenfactory.v1beta1.MsgCreateDenom") proto.RegisterType((*MsgCreateDenomResponse)(nil), "osmosis.tokenfactory.v1beta1.MsgCreateDenomResponse") @@ -521,6 +641,8 @@ func init() { proto.RegisterType((*MsgChangeAdminResponse)(nil), "osmosis.tokenfactory.v1beta1.MsgChangeAdminResponse") proto.RegisterType((*MsgSetDenomMetadata)(nil), "osmosis.tokenfactory.v1beta1.MsgSetDenomMetadata") proto.RegisterType((*MsgSetDenomMetadataResponse)(nil), "osmosis.tokenfactory.v1beta1.MsgSetDenomMetadataResponse") + proto.RegisterType((*MsgForceTransfer)(nil), "osmosis.tokenfactory.v1beta1.MsgForceTransfer") + proto.RegisterType((*MsgForceTransferResponse)(nil), "osmosis.tokenfactory.v1beta1.MsgForceTransferResponse") } func init() { @@ -528,45 +650,54 @@ func init() { } var fileDescriptor_283b6c9a90a846b4 = []byte{ - // 593 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x55, 0x41, 0x6e, 0xd3, 0x40, - 0x14, 0x8d, 0x69, 0x29, 0xe9, 0x94, 0x92, 0xd4, 0x2d, 0x25, 0x18, 0x6a, 0xa3, 0x91, 0x8a, 0x40, - 0xa2, 0xb6, 0x12, 0x58, 0x00, 0x3b, 0x5c, 0x16, 0x6c, 0xbc, 0x31, 0xac, 0x50, 0xa5, 0x6a, 0x9c, - 0x0c, 0xae, 0x95, 0x78, 0x26, 0x64, 0x26, 0x4d, 0xb3, 0x41, 0x1c, 0x81, 0x05, 0xe2, 0x10, 0x9c, - 0xa4, 0xcb, 0x2e, 0x59, 0x59, 0x28, 0xb9, 0x41, 0x4e, 0x80, 0x3c, 0x33, 0x76, 0x9c, 0x06, 0x91, - 0x64, 0xc5, 0x2e, 0xf6, 0x7f, 0xef, 0xcd, 0x9b, 0xf7, 0xff, 0x8f, 0xc1, 0x21, 0x65, 0x31, 0x65, - 0x11, 0x73, 0x38, 0x6d, 0x63, 0xf2, 0x09, 0x35, 0x39, 0xed, 0x0d, 0x9d, 0xf3, 0x7a, 0x80, 0x39, - 0xaa, 0x3b, 0xfc, 0xc2, 0xee, 0xf6, 0x28, 0xa7, 0xfa, 0x43, 0x05, 0xb3, 0x8b, 0x30, 0x5b, 0xc1, - 0x8c, 0xbd, 0x90, 0x86, 0x54, 0x00, 0x9d, 0xf4, 0x97, 0xe4, 0x18, 0x66, 0x53, 0x90, 0x9c, 0x00, - 0x31, 0x9c, 0x2b, 0x36, 0x69, 0x44, 0xe6, 0xea, 0xa4, 0x9d, 0xd7, 0xd3, 0x07, 0x59, 0x87, 0x1d, - 0x70, 0xc7, 0x63, 0xe1, 0x71, 0x0f, 0x23, 0x8e, 0xdf, 0x62, 0x42, 0x63, 0xfd, 0x29, 0xd8, 0x60, - 0x98, 0xb4, 0x70, 0xaf, 0xa6, 0x3d, 0xd2, 0x9e, 0x6c, 0xba, 0x3b, 0x93, 0xc4, 0xda, 0x1e, 0xa2, - 0xb8, 0xf3, 0x1a, 0xca, 0xf7, 0xd0, 0x57, 0x00, 0xdd, 0x01, 0x65, 0xd6, 0x0f, 0x5a, 0x29, 0xad, - 0x76, 0x43, 0x80, 0x77, 0x27, 0x89, 0x55, 0x51, 0x60, 0x55, 0x81, 0x7e, 0x0e, 0x82, 0x27, 0x60, - 0x7f, 0xf6, 0x34, 0x1f, 0xb3, 0x2e, 0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+ // 746 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x56, 0xcd, 0x4e, 0xdb, 0x4a, + 0x14, 0x8e, 0xf9, 0xbb, 0x30, 0xdc, 0xdc, 0x04, 0xc3, 0xe5, 0xe6, 0xba, 0x60, 0xa3, 0x91, 0xa8, + 0x5a, 0xa9, 0x38, 0x0a, 0xad, 0x90, 0xda, 0x55, 0x09, 0x15, 0xea, 0xa2, 0x91, 0x2a, 0x17, 0xa9, + 0x52, 0x85, 0x14, 0x4d, 0x92, 0xc1, 0x44, 0xe0, 0x19, 0xea, 0x99, 0x34, 0xb0, 0xeb, 0x23, 0x74, + 0x51, 0xf5, 0x05, 0xba, 0xea, 0x5b, 0x74, 0x55, 0xb1, 0x64, 0xd9, 0x95, 0x55, 0xc1, 0x1b, 0xf8, + 0x09, 0x2a, 0xcf, 0x8c, 0x1d, 0xdb, 0x41, 0x4d, 0xb2, 0x62, 0x97, 0xf8, 0x7c, 0xdf, 0x37, 0xe7, + 0x3b, 0x73, 0xce, 0xd1, 0x80, 0x4d, 0xca, 0x3c, 0xca, 0xba, 0xac, 0xca, 0xe9, 0x09, 0x26, 0x47, + 0xa8, 0xcd, 0xa9, 0x7f, 0x51, 0xfd, 0x50, 0x6b, 0x61, 0x8e, 0x6a, 0x55, 0x7e, 0x6e, 0x9f, 0xf9, + 0x94, 0x53, 0x7d, 0x4d, 0xc1, 0xec, 0x34, 0xcc, 0x56, 0x30, 0x63, 0xc5, 0xa5, 0x2e, 0x15, 0xc0, + 0x6a, 0xf4, 0x4b, 0x72, 0x0c, 0xb3, 0x2d, 0x48, 0xd5, 0x16, 0x62, 0x38, 0x51, 0x6c, 0xd3, 0x2e, + 0x19, 0x8a, 0x93, 0x93, 0x24, 0x1e, 0xfd, 0x91, 0x71, 0x78, 0x0a, 0xfe, 0x69, 0x30, 0x77, 0xcf, + 0xc7, 0x88, 0xe3, 0x17,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b, 0xe1, 0xf1, 0xef, 0x00, 0x00, 0x00, + 0xff, 0xff, 0xfa, 0x79, 0x80, 0xdc, 0xca, 0x08, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -586,6 +717,7 @@ type MsgClient interface { Burn(ctx context.Context, in *MsgBurn, opts ...grpc.CallOption) (*MsgBurnResponse, error) ChangeAdmin(ctx context.Context, in *MsgChangeAdmin, opts ...grpc.CallOption) (*MsgChangeAdminResponse, error) SetDenomMetadata(ctx context.Context, in *MsgSetDenomMetadata, opts ...grpc.CallOption) (*MsgSetDenomMetadataResponse, error) + ForceTransfer(ctx context.Context, in *MsgForceTransfer, opts ...grpc.CallOption) (*MsgForceTransferResponse, error) } type msgClient struct { @@ -641,6 +773,15 @@ func (c *msgClient) SetDenomMetadata(ctx context.Context, in *MsgSetDenomMetadat return out, nil } +func (c *msgClient) ForceTransfer(ctx context.Context, in *MsgForceTransfer, opts ...grpc.CallOption) (*MsgForceTransferResponse, error) { + out := new(MsgForceTransferResponse) + err := c.cc.Invoke(ctx, "/osmosis.tokenfactory.v1beta1.Msg/ForceTransfer", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { CreateDenom(context.Context, *MsgCreateDenom) (*MsgCreateDenomResponse, error) @@ -648,6 +789,7 @@ type MsgServer interface { Burn(context.Context, *MsgBurn) (*MsgBurnResponse, error) ChangeAdmin(context.Context, *MsgChangeAdmin) (*MsgChangeAdminResponse, error) SetDenomMetadata(context.Context, *MsgSetDenomMetadata) (*MsgSetDenomMetadataResponse, error) + ForceTransfer(context.Context, *MsgForceTransfer) (*MsgForceTransferResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -669,6 +811,9 @@ func (*UnimplementedMsgServer) ChangeAdmin(ctx context.Context, req *MsgChangeAd func (*UnimplementedMsgServer) SetDenomMetadata(ctx context.Context, req *MsgSetDenomMetadata) (*MsgSetDenomMetadataResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method SetDenomMetadata not implemented") } +func (*UnimplementedMsgServer) ForceTransfer(ctx context.Context, req *MsgForceTransfer) (*MsgForceTransferResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ForceTransfer not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -764,6 +909,24 @@ func _Msg_SetDenomMetadata_Handler(srv interface{}, ctx context.Context, dec fun return interceptor(ctx, in, info, handler) } +func _Msg_ForceTransfer_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgForceTransfer) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).ForceTransfer(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/osmosis.tokenfactory.v1beta1.Msg/ForceTransfer", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).ForceTransfer(ctx, req.(*MsgForceTransfer)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "osmosis.tokenfactory.v1beta1.Msg", HandlerType: (*MsgServer)(nil), @@ -788,6 +951,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "SetDenomMetadata", Handler: _Msg_SetDenomMetadata_Handler, }, + { + MethodName: "ForceTransfer", + Handler: _Msg_ForceTransfer_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "osmosis/tokenfactory/v1beta1/tx.proto", @@ -880,6 +1047,13 @@ func (m *MsgMint) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.MintToAddress) > 0 { + i -= len(m.MintToAddress) + copy(dAtA[i:], m.MintToAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.MintToAddress))) + i-- + dAtA[i] = 0x1a + } { size, err := m.Amount.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -943,6 +1117,13 @@ func (m *MsgBurn) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.BurnFromAddress) > 0 { + i -= len(m.BurnFromAddress) + copy(dAtA[i:], m.BurnFromAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.BurnFromAddress))) + i-- + dAtA[i] = 0x1a + } { size, err := m.Amount.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -1116,6 +1297,83 @@ func (m *MsgSetDenomMetadataResponse) MarshalToSizedBuffer(dAtA []byte) (int, er return len(dAtA) - i, nil } +func (m *MsgForceTransfer) 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 *MsgForceTransfer) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgForceTransfer) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.TransferToAddress) > 0 { + i -= len(m.TransferToAddress) + copy(dAtA[i:], m.TransferToAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.TransferToAddress))) + i-- + dAtA[i] = 0x22 + } + if len(m.TransferFromAddress) > 0 { + i -= len(m.TransferFromAddress) + copy(dAtA[i:], m.TransferFromAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.TransferFromAddress))) + i-- + dAtA[i] = 0x1a + } + { + size, err := m.Amount.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 *MsgForceTransferResponse) 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 *MsgForceTransferResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgForceTransferResponse) 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 @@ -1169,6 +1427,10 @@ func (m *MsgMint) Size() (n int) { } l = m.Amount.Size() n += 1 + l + sovTx(uint64(l)) + l = len(m.MintToAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } return n } @@ -1193,6 +1455,10 @@ func (m *MsgBurn) Size() (n int) { } l = m.Amount.Size() n += 1 + l + sovTx(uint64(l)) + l = len(m.BurnFromAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } return n } @@ -1259,6 +1525,38 @@ func (m *MsgSetDenomMetadataResponse) Size() (n int) { return n } +func (m *MsgForceTransfer) 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.Amount.Size() + n += 1 + l + sovTx(uint64(l)) + l = len(m.TransferFromAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.TransferToAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgForceTransferResponse) 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 } @@ -1555,6 +1853,38 @@ func (m *MsgMint) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MintToAddress", 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.MintToAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) @@ -1720,6 +2050,38 @@ func (m *MsgBurn) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BurnFromAddress", 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.BurnFromAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) @@ -2152,6 +2514,235 @@ func (m *MsgSetDenomMetadataResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgForceTransfer) 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: MsgForceTransfer: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgForceTransfer: 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 Amount", 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.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TransferFromAddress", 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.TransferFromAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TransferToAddress", 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.TransferToAddress = string(dAtA[iNdEx:postIndex]) + 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 *MsgForceTransferResponse) 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: MsgForceTransferResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgForceTransferResponse: 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 From d80aa49ed82d9cee5a748225bc55d85b1a006aa9 Mon Sep 17 00:00:00 2001 From: Reece Williams Date: Mon, 20 Mar 2023 01:28:20 -0500 Subject: [PATCH 05/11] Adds Tx commands (mint-to, burn-from, force-transfer) --- x/tokenfactory/client/cli/tx.go | 148 ++++++++++++++++++++++++-------- 1 file changed, 113 insertions(+), 35 deletions(-) diff --git a/x/tokenfactory/client/cli/tx.go b/x/tokenfactory/client/cli/tx.go index c01d4db..ecba126 100644 --- a/x/tokenfactory/client/cli/tx.go +++ b/x/tokenfactory/client/cli/tx.go @@ -31,8 +31,10 @@ func GetTxCmd() *cobra.Command { cmd.AddCommand( NewCreateDenomCmd(), NewMintCmd(), + NewMintToCmd(), NewBurnCmd(), - // NewForceTransferCmd(), + NewBurnFromCmd(), + NewForceTransferCmd(), NewChangeAdminCmd(), NewModifyDenomMetadataCmd(), ) @@ -71,7 +73,7 @@ func NewCreateDenomCmd() *cobra.Command { func NewMintCmd() *cobra.Command { cmd := &cobra.Command{ Use: "mint [amount] [flags]", - Short: "Mint a denom to an address. Must have admin authority to do so.", + Short: "Mint a denom to your address. Must have admin authority to do so.", Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) error { clientCtx, err := client.GetClientTxContext(cmd) @@ -99,6 +101,44 @@ func NewMintCmd() *cobra.Command { return cmd } +// NewMintToCmd broadcast MsgMintTo +func NewMintToCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "mint-to [address] [amount] [flags]", + Short: "Mint a denom to an address. Must have admin authority to do so.", + Args: cobra.ExactArgs(2), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + txf := tx.NewFactoryCLI(clientCtx, cmd.Flags()).WithTxConfig(clientCtx.TxConfig).WithAccountRetriever(clientCtx.AccountRetriever) + + toAddr, err := sdk.AccAddressFromBech32(args[0]) + if err != nil { + return err + } + + amount, err := sdk.ParseCoinNormalized(args[1]) + if err != nil { + return err + } + + msg := types.NewMsgMintTo( + clientCtx.GetFromAddress().String(), + amount, + toAddr.String(), + ) + + return tx.GenerateOrBroadcastTxWithFactory(clientCtx, txf, msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + return cmd +} + // NewBurnCmd broadcast MsgBurn func NewBurnCmd() *cobra.Command { cmd := &cobra.Command{ @@ -131,39 +171,77 @@ func NewBurnCmd() *cobra.Command { return cmd } -// // NewForceTransferCmd broadcast MsgForceTransfer -// func NewForceTransferCmd() *cobra.Command { -// cmd := &cobra.Command{ -// Use: "force-transfer [amount] [transfer-from-address] [transfer-to-address] [flags]", -// Short: "Force transfer tokens from one address to another address. Must have admin authority to do so.", -// Args: cobra.ExactArgs(3), -// RunE: func(cmd *cobra.Command, args []string) error { -// clientCtx, err := client.GetClientTxContext(cmd) -// if err != nil { -// return err -// } - -// txf := tx.NewFactoryCLI(clientCtx, cmd.Flags()).WithTxConfig(clientCtx.TxConfig).WithAccountRetriever(clientCtx.AccountRetriever) - -// amount, err := sdk.ParseCoinNormalized(args[0]) -// if err != nil { -// return err -// } - -// msg := types.NewMsgForceTransfer( -// clientCtx.GetFromAddress().String(), -// amount, -// args[1], -// args[2], -// ) - -// return tx.GenerateOrBroadcastTxWithFactory(clientCtx, txf, msg) -// }, -// } - -// flags.AddTxFlagsToCmd(cmd) -// return cmd -// } +// NewBurnFromCmd broadcast MsgBurnFrom +func NewBurnFromCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "burn-from [address] [amount] [flags]", + Short: "Burn tokens from an address. Must have admin authority to do so.", + Args: cobra.ExactArgs(2), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + txf := tx.NewFactoryCLI(clientCtx, cmd.Flags()).WithTxConfig(clientCtx.TxConfig).WithAccountRetriever(clientCtx.AccountRetriever) + + fromAddr, err := sdk.AccAddressFromBech32() + if err != nil { + return err + } + + amount, err := sdk.ParseCoinNormalized(args[1]) + if err != nil { + return err + } + + msg := types.NewMsgBurnFrom( + clientCtx.GetFromAddress().String(), + amount, + fromAddr.String(), + ) + + return tx.GenerateOrBroadcastTxWithFactory(clientCtx, txf, msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + return cmd +} + +// NewForceTransferCmd broadcast MsgForceTransfer +func NewForceTransferCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "force-transfer [amount] [transfer-from-address] [transfer-to-address] [flags]", + Short: "Force transfer tokens from one address to another address. Must have admin authority to do so.", + Args: cobra.ExactArgs(3), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + txf := tx.NewFactoryCLI(clientCtx, cmd.Flags()).WithTxConfig(clientCtx.TxConfig).WithAccountRetriever(clientCtx.AccountRetriever) + + amount, err := sdk.ParseCoinNormalized(args[0]) + if err != nil { + return err + } + + msg := types.NewMsgForceTransfer( + clientCtx.GetFromAddress().String(), + amount, + args[1], + args[2], + ) + + return tx.GenerateOrBroadcastTxWithFactory(clientCtx, txf, msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + return cmd +} // NewChangeAdminCmd broadcast MsgChangeAdmin func NewChangeAdminCmd() *cobra.Command { From f17d6cebe39caab6046dfb8cc972917c6e180360 Mon Sep 17 00:00:00 2001 From: Reece Williams Date: Mon, 20 Mar 2023 01:32:21 -0500 Subject: [PATCH 06/11] format --- x/tokenfactory/bindings/types/msg.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/x/tokenfactory/bindings/types/msg.go b/x/tokenfactory/bindings/types/msg.go index b1dabe0..76781ea 100644 --- a/x/tokenfactory/bindings/types/msg.go +++ b/x/tokenfactory/bindings/types/msg.go @@ -48,10 +48,9 @@ type MintTokens struct { } type BurnTokens struct { - Denom string `json:"denom"` - Amount sdk.Int `json:"amount"` - // BurnFromAddress must be set to "" for now. - BurnFromAddress string `json:"burn_from_address"` + Denom string `json:"denom"` + Amount sdk.Int `json:"amount"` + BurnFromAddress string `json:"burn_from_address"` } type SetMetadata struct { From a1813e6347a4046e70025cb029232aa14ee99f22 Mon Sep 17 00:00:00 2001 From: Reece Williams Date: Mon, 20 Mar 2023 01:35:40 -0500 Subject: [PATCH 07/11] Fix arg --- x/tokenfactory/client/cli/tx.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/tokenfactory/client/cli/tx.go b/x/tokenfactory/client/cli/tx.go index ecba126..ebb46c3 100644 --- a/x/tokenfactory/client/cli/tx.go +++ b/x/tokenfactory/client/cli/tx.go @@ -185,7 +185,7 @@ func NewBurnFromCmd() *cobra.Command { txf := tx.NewFactoryCLI(clientCtx, cmd.Flags()).WithTxConfig(clientCtx.TxConfig).WithAccountRetriever(clientCtx.AccountRetriever) - fromAddr, err := sdk.AccAddressFromBech32() + fromAddr, err := sdk.AccAddressFromBech32(args[0]) if err != nil { return err } From 4ed0a7f229e68678fdc666f9a3f0cfcc4f7ecf03 Mon Sep 17 00:00:00 2001 From: Reece Williams Date: Mon, 20 Mar 2023 01:36:13 -0500 Subject: [PATCH 08/11] Clean makefile --- Makefile | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/Makefile b/Makefile index 7c36883..398dabc 100644 --- a/Makefile +++ b/Makefile @@ -168,31 +168,15 @@ format: format-tools PROTO_BUILDER_IMAGE=tendermintdev/sdk-proto-gen:v0.7 PROTO_FORMATTER_IMAGE=tendermintdev/docker-build-proto@sha256:aabcfe2fc19c31c0f198d4cd26393f5e5ca9502d7ea3feafbfe972448fee7cae -protoVer=v0.8 -protoImageName=osmolabs/osmo-proto-gen:$(protoVer) -containerProtoGen=cosmos-sdk-proto-gen-$(protoVer) -containerProtoFmt=cosmos-sdk-proto-fmt-$(protoVer) - -# proto-gen: -# @echo "Generating Protobuf files" -# $(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace $(PROTO_BUILDER_IMAGE) sh ./scripts/protocgen.sh - proto-gen: @echo "Generating Protobuf files" - @if docker ps -a --format '{{.Names}}' | grep -Eq "^${containerProtoGen}$$"; then docker start -a $(containerProtoGen); else docker run --name $(containerProtoGen) -v $(CURDIR):/workspace --workdir /workspace $(protoImageName) \ - sh ./scripts/protocgen.sh; fi + $(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace $(PROTO_BUILDER_IMAGE) sh ./scripts/protocgen.sh proto-format: @echo "Formatting Protobuf files" @if docker ps -a --format '{{.Names}}' | grep -Eq "^${containerProtoFmt}$$"; then docker start -a $(containerProtoFmt); else docker run --name $(containerProtoFmt) -v $(CURDIR):/workspace --workdir /workspace tendermintdev/docker-build-proto \ find ./ -not -path "./third_party/*" -name "*.proto" -exec clang-format -i {} \; ; fi -# protoImageName=cosmwasm/tf-proto:1.0.0 -proto-image-build: -# docker run -v $(pwd):/workspace --workdir /workspace cosmwasm/tf-proto:1.0.0 sh ./scripts/protocgen.sh -# @DOCKER_BUILDKIT=1 docker build -t cosmwasm/tf-proto:1.0.0 -f ./proto/Dockerfile ./proto - @DOCKER_BUILDKIT=1 docker build -t $(protoImageName) -f ./proto/Dockerfile ./proto - .PHONY: all install install-debug \ go-mod-cache draw-deps clean build format \ test test-all test-build test-cover test-unit test-race \ From c57f47a0b23228fc0ea8f4837ace776155036362 Mon Sep 17 00:00:00 2001 From: Reece Williams Date: Mon, 20 Mar 2023 01:39:36 -0500 Subject: [PATCH 09/11] 1.52.0 lint --- app/test_helpers.go | 4 ++-- x/tokenfactory/keeper/admins_test.go | 2 -- x/tokenfactory/keeper/createdenom.go | 2 +- x/tokenfactory/keeper/grpc_query.go | 2 +- x/tokenfactory/module.go | 10 +++++----- x/tokenfactory/simulation/params.go | 2 +- x/tokenfactory/types/params.go | 6 ++---- 7 files changed, 12 insertions(+), 16 deletions(-) diff --git a/app/test_helpers.go b/app/test_helpers.go index 4a66c83..e5d9ba2 100644 --- a/app/test_helpers.go +++ b/app/test_helpers.go @@ -363,7 +363,7 @@ func SignCheckDeliver( // ibc testing package causes checkState and deliverState to diverge in block time. func SignAndDeliver( t *testing.T, txCfg client.TxConfig, app *bam.BaseApp, header tmproto.Header, msgs []sdk.Msg, - chainID string, accNums, accSeqs []uint64, expSimPass, expPass bool, priv ...cryptotypes.PrivKey, + chainID string, accNums, accSeqs []uint64, _, expPass bool, priv ...cryptotypes.PrivKey, ) (sdk.GasInfo, *sdk.Result, error) { tx, err := helpers.GenTx( txCfg, @@ -460,7 +460,7 @@ func NewPubKeyFromHex(pk string) (res cryptotypes.PubKey) { type EmptyBaseAppOptions struct{} // Get implements AppOptions -func (ao EmptyBaseAppOptions) Get(o string) interface{} { +func (ao EmptyBaseAppOptions) Get(_ string) interface{} { return nil } diff --git a/x/tokenfactory/keeper/admins_test.go b/x/tokenfactory/keeper/admins_test.go index 16384eb..021a112 100644 --- a/x/tokenfactory/keeper/admins_test.go +++ b/x/tokenfactory/keeper/admins_test.go @@ -146,7 +146,6 @@ func (suite *KeeperTestSuite) TestMintDenom() { } } - func (suite *KeeperTestSuite) TestBurnDenom() { // Create a denom. suite.CreateDefaultDenom() @@ -305,7 +304,6 @@ func (suite *KeeperTestSuite) TestForceTransferDenom() { } } - func (suite *KeeperTestSuite) TestChangeAdminDenom() { for _, tc := range []struct { desc string diff --git a/x/tokenfactory/keeper/createdenom.go b/x/tokenfactory/keeper/createdenom.go index 5da92b0..6ea5ec5 100644 --- a/x/tokenfactory/keeper/createdenom.go +++ b/x/tokenfactory/keeper/createdenom.go @@ -70,7 +70,7 @@ func (k Keeper) validateCreateDenom(ctx sdk.Context, creatorAddr string, subdeno return denom, nil } -func (k Keeper) chargeForCreateDenom(ctx sdk.Context, creatorAddr string, subdenom string) (err error) { +func (k Keeper) chargeForCreateDenom(ctx sdk.Context, creatorAddr string, _ string) (err error) { // Send creation fee to community pool creationFee := k.GetParams(ctx).DenomCreationFee accAddr, err := sdk.AccAddressFromBech32(creatorAddr) diff --git a/x/tokenfactory/keeper/grpc_query.go b/x/tokenfactory/keeper/grpc_query.go index 622fdfa..e9094ea 100644 --- a/x/tokenfactory/keeper/grpc_query.go +++ b/x/tokenfactory/keeper/grpc_query.go @@ -10,7 +10,7 @@ import ( var _ types.QueryServer = Keeper{} -func (k Keeper) Params(ctx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { +func (k Keeper) Params(ctx context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { sdkCtx := sdk.UnwrapSDKContext(ctx) params := k.GetParams(sdkCtx) diff --git a/x/tokenfactory/module.go b/x/tokenfactory/module.go index 35f12ad..5884b8e 100644 --- a/x/tokenfactory/module.go +++ b/x/tokenfactory/module.go @@ -69,7 +69,7 @@ func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { } // ValidateGenesis performs genesis state validation for the x/tokenfactory module. -func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { +func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, _ client.TxEncodingConfig, bz json.RawMessage) error { var genState types.GenesisState if err := cdc.UnmarshalJSON(bz, &genState); err != nil { return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) @@ -79,7 +79,7 @@ func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncod } // RegisterRESTRoutes registers the capability module's REST service handlers. -func (AppModuleBasic) RegisterRESTRoutes(clientCtx client.Context, rtr *mux.Router) { +func (AppModuleBasic) RegisterRESTRoutes(_ client.Context, _ *mux.Router) { } // RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module. @@ -137,7 +137,7 @@ func (am AppModule) Route() sdk.Route { func (AppModule) QuerierRoute() string { return types.QuerierRoute } // LegacyQuerierHandler returns the x/tokenfactory module's Querier. -func (am AppModule) LegacyQuerierHandler(legacyQuerierCdc *codec.LegacyAmino) sdk.Querier { +func (am AppModule) LegacyQuerierHandler(_ *codec.LegacyAmino) sdk.Querier { return nil } @@ -211,7 +211,7 @@ func (AppModule) GenerateGenesisState(simState *module.SimulationState) { } // GenerateGenesisState creates a randomized GenState of the bank module. -func (am AppModule) ProposalContents(simState module.SimulationState) []simtypes.WeightedProposalContent { +func (am AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalContent { return nil } @@ -221,7 +221,7 @@ func (am AppModule) RandomizedParams(r *rand.Rand) []simtypes.ParamChange { } // RegisterStoreDecoder registers a decoder for supply module's types -func (am AppModule) RegisterStoreDecoder(sdr sdk.StoreDecoderRegistry) { +func (am AppModule) RegisterStoreDecoder(_ sdk.StoreDecoderRegistry) { } // WeightedOperations returns the all the gov module operations with their respective weights. diff --git a/x/tokenfactory/simulation/params.go b/x/tokenfactory/simulation/params.go index ff9d6b8..fc46ee2 100644 --- a/x/tokenfactory/simulation/params.go +++ b/x/tokenfactory/simulation/params.go @@ -9,7 +9,7 @@ import ( "github.com/cosmos/cosmos-sdk/x/simulation" ) -func ParamChanges(r *rand.Rand) []simtypes.ParamChange { +func ParamChanges(_ *rand.Rand) []simtypes.ParamChange { return []simtypes.ParamChange{ simulation.NewSimParamChange( types.ModuleName, diff --git a/x/tokenfactory/types/params.go b/x/tokenfactory/types/params.go index a483078..9519c71 100644 --- a/x/tokenfactory/types/params.go +++ b/x/tokenfactory/types/params.go @@ -34,11 +34,9 @@ func DefaultParams() Params { // validate params. func (p Params) Validate() error { - if err := validateDenomCreationFee(p.DenomCreationFee); err != nil { - return err - } + err := validateDenomCreationFee(p.DenomCreationFee) - return nil + return err } // Implements params.ParamSet. From 14f43778766c2b3b729693e2544a7c30add68f3f Mon Sep 17 00:00:00 2001 From: Reece Williams Date: Mon, 20 Mar 2023 01:47:33 -0500 Subject: [PATCH 10/11] remove old Tx CLI things --- x/tokenfactory/client/cli/tx.go | 35 +-------------------------------- 1 file changed, 1 insertion(+), 34 deletions(-) diff --git a/x/tokenfactory/client/cli/tx.go b/x/tokenfactory/client/cli/tx.go index ebb46c3..d014a0b 100644 --- a/x/tokenfactory/client/cli/tx.go +++ b/x/tokenfactory/client/cli/tx.go @@ -16,8 +16,6 @@ import ( banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" ) -var DeniedDenoms = [1]string{"juno"} - // GetTxCmd returns the transaction commands for this module func GetTxCmd() *cobra.Command { cmd := &cobra.Command{ @@ -283,9 +281,6 @@ func NewModifyDenomMetadataCmd() *cobra.Command { return err } - maxTickerLength := 6 - maxExponent := 18 - txf := tx.NewFactoryCLI(clientCtx, cmd.Flags()).WithTxConfig(clientCtx.TxConfig).WithAccountRetriever(clientCtx.AccountRetriever) fullDenom, ticker, desc := args[0], strings.ToUpper(args[1]), args[2] @@ -294,44 +289,16 @@ func NewModifyDenomMetadataCmd() *cobra.Command { return fmt.Errorf("denom must start with factory/") } - // Ticker Checks - for _, prefix := range DeniedDenoms { - if strings.Contains(strings.ToLower(ticker), prefix) { - return fmt.Errorf("ticker contains a denied word: %s and is not allowed", prefix) - } - - if strings.Contains(ticker, "/") { - return fmt.Errorf("ticker cannot contain a / (slash)") - } - } - - // check if the length of ticker is greater than 6 - if len(ticker) > maxTickerLength { - return fmt.Errorf("ticker cannot be greater than 6 characters") - } else if len(ticker) == 0 { + if len(ticker) == 0 { return fmt.Errorf("ticker cannot be empty") } - // Description Length Checks - if len(desc) > 255 { - return fmt.Errorf("description cannot be greater than 255 characters: %d", len(desc)) - } - - deniedCharList := "@#$^*<>;()" - if strings.ContainsAny(desc, deniedCharList) { - return fmt.Errorf("desc cannot contain special characters: %s", deniedCharList) - } - // Exponent Checks exponent, err := strconv.ParseUint(args[3], 10, 32) if err != nil { return err } - if exponent > uint64(maxExponent) { - return fmt.Errorf("exponent cannot be greater than %d", maxExponent) - } - bankMetadata := banktypes.Metadata{ Description: desc, Display: fullDenom, From 5de9dc555ffa143cfacc4a443d1f2133f6c7194b Mon Sep 17 00:00:00 2001 From: Reece Williams Date: Mon, 20 Mar 2023 01:52:15 -0500 Subject: [PATCH 11/11] Fix makefile - done now :D --- Makefile | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Makefile b/Makefile index 398dabc..4576d06 100644 --- a/Makefile +++ b/Makefile @@ -168,10 +168,27 @@ format: format-tools PROTO_BUILDER_IMAGE=tendermintdev/sdk-proto-gen:v0.7 PROTO_FORMATTER_IMAGE=tendermintdev/docker-build-proto@sha256:aabcfe2fc19c31c0f198d4cd26393f5e5ca9502d7ea3feafbfe972448fee7cae +proto-all: proto-format proto-lint proto-gen format + proto-gen: @echo "Generating Protobuf files" $(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace $(PROTO_BUILDER_IMAGE) sh ./scripts/protocgen.sh +proto-format: + @echo "Formatting Protobuf files" + $(DOCKER) run --rm -v $(CURDIR):/workspace \ + --workdir /workspace $(PROTO_FORMATTER_IMAGE) \ + find ./ -name *.proto -exec clang-format -i {} \; + +proto-swagger-gen: + @./scripts/protoc-swagger-gen.sh + +proto-lint: + @$(DOCKER_BUF) lint --error-format=json + +proto-check-breaking: + @$(DOCKER_BUF) breaking --against $(HTTPS_GIT)#branch=main + proto-format: @echo "Formatting Protobuf files" @if docker ps -a --format '{{.Names}}' | grep -Eq "^${containerProtoFmt}$$"; then docker start -a $(containerProtoFmt); else docker run --name $(containerProtoFmt) -v $(CURDIR):/workspace --workdir /workspace tendermintdev/docker-build-proto \