diff --git a/app/app.go b/app/app.go index 840f74b67f..95ab020cda 100644 --- a/app/app.go +++ b/app/app.go @@ -197,10 +197,11 @@ var maccPerms = map[string][]string{ govtypes.ModuleName: {authtypes.Burner}, nft.ModuleName: nil, // non sdk modules - ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner}, - ibcfeetypes.ModuleName: nil, - icatypes.ModuleName: nil, - wasmtypes.ModuleName: {authtypes.Burner}, + ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner}, + ibcfeetypes.ModuleName: nil, + icatypes.ModuleName: nil, + wasmtypes.ModuleName: {authtypes.Burner}, + tokenfactorytypes.ModuleName: {authtypes.Minter, authtypes.Burner}, } var ( @@ -356,7 +357,7 @@ func NewWasmApp( // non sdk store keys capabilitytypes.StoreKey, ibcexported.StoreKey, ibctransfertypes.StoreKey, ibcfeetypes.StoreKey, wasmtypes.StoreKey, icahosttypes.StoreKey, - icacontrollertypes.StoreKey, clocktypes.StoreKey, ibchookstypes.StoreKey, packetforwardtypes.StoreKey, + icacontrollertypes.StoreKey, clocktypes.StoreKey, ibchookstypes.StoreKey, packetforwardtypes.StoreKey, tokenfactorytypes.StoreKey, ) tkeys := storetypes.NewTransientStoreKeys(paramstypes.TStoreKey) @@ -822,6 +823,7 @@ func NewWasmApp( clock.NewAppModule(appCodec, app.ClockKeeper), ibchooks.NewAppModule(app.AccountKeeper, *app.IBCHooksKeeper), packetforward.NewAppModule(app.PacketForwardKeeper, app.GetSubspace(packetforwardtypes.ModuleName)), + tokenfactory.NewAppModule(app.TokenFactoryKeeper, app.AccountKeeper, app.BankKeeper), ) // BasicModuleManager defines the module BasicManager is in charge of setting up basic, @@ -872,6 +874,7 @@ func NewWasmApp( clocktypes.ModuleName, ibchookstypes.ModuleName, packetforwardtypes.ModuleName, + tokenfactorytypes.ModuleName, ) app.ModuleManager.SetOrderEndBlockers( @@ -891,6 +894,7 @@ func NewWasmApp( clocktypes.ModuleName, ibchookstypes.ModuleName, packetforwardtypes.ModuleName, + tokenfactorytypes.ModuleName, ) // NOTE: The genutils module must occur after staking so that pools are @@ -919,6 +923,7 @@ func NewWasmApp( clocktypes.ModuleName, ibchookstypes.ModuleName, packetforwardtypes.ModuleName, + tokenfactorytypes.ModuleName, } app.ModuleManager.SetOrderInitGenesis(genesisModuleOrder...) app.ModuleManager.SetOrderExportGenesis(genesisModuleOrder...) @@ -1299,5 +1304,6 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino paramsKeeper.Subspace(clocktypes.ModuleName) paramsKeeper.Subspace(ibchookstypes.ModuleName) paramsKeeper.Subspace(packetforwardtypes.ModuleName).WithKeyTable(packetforwardtypes.ParamKeyTable()) + paramsKeeper.Subspace(tokenfactorytypes.ModuleName) return paramsKeeper } diff --git a/go.mod b/go.mod index edaddefe57..70e83a39e3 100644 --- a/go.mod +++ b/go.mod @@ -15,7 +15,7 @@ require ( github.com/dvsekhvalnov/jose2go v1.6.0 // indirect github.com/golang/protobuf v1.5.4 github.com/google/gofuzz v1.2.0 - github.com/gorilla/mux v1.8.1 // indirect + github.com/gorilla/mux v1.8.1 github.com/grpc-ecosystem/grpc-gateway v1.16.0 github.com/osmosis-labs/osmosis/x/ibc-hooks v0.0.14-0.20240723150708-5b683bc62428 github.com/pkg/errors v0.9.1 diff --git a/x/tokenfactory/bindings/helpers_test.go b/x/tokenfactory/bindings/helpers_test.go index 7ee6ac923a..774ae12b79 100644 --- a/x/tokenfactory/bindings/helpers_test.go +++ b/x/tokenfactory/bindings/helpers_test.go @@ -4,14 +4,13 @@ import ( "os" "testing" + "github.com/cosmos/cosmos-sdk/x/bank/testutil" "github.com/stretchr/testify/require" "github.com/cometbft/cometbft/crypto" "github.com/cometbft/cometbft/crypto/ed25519" - "cosmossdk.io/math" - - "cosmossdk.io/x/bank/testutil" + // "cosmossdk.io/x/bank/testutil" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/CosmWasm/wasmd/app" @@ -24,13 +23,6 @@ func CreateTestInput(t *testing.T) (*app.WasmApp, sdk.Context) { return osmosis, ctx } -func FundAccount(t *testing.T, ctx sdk.Context, osmosis *app.WasmApp, acct sdk.AccAddress) { - err := testutil.FundAccount(ctx, osmosis.BankKeeper, acct, sdk.NewCoins( - sdk.NewCoin("uosmo", math.NewInt(10000000000)), - )) - require.NoError(t, err) -} - // we need to make this deterministic (same every test run), as content might affect gas costs func keyPubAddr() (crypto.PrivKey, crypto.PubKey, sdk.AccAddress) { key := ed25519.GenPrivKey() diff --git a/x/tokenfactory/keeper/admins_test.go b/x/tokenfactory/keeper/admins_test.go deleted file mode 100644 index 0210c0527c..0000000000 --- a/x/tokenfactory/keeper/admins_test.go +++ /dev/null @@ -1,522 +0,0 @@ -package keeper_test - -import ( - "fmt" - - sdk "github.com/cosmos/cosmos-sdk/types" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - - "github.com/CosmWasm/wasmd/x/tokenfactory/types" -) - -func (suite *KeeperTestSuite) TestAdminMsgs() { - addr0bal := int64(0) - addr1bal := int64(0) - - bankKeeper := suite.App.BankKeeper - - suite.CreateDefaultDenom() - // Make sure that the admin is set correctly - queryRes, err := suite.queryClient.DenomAuthorityMetadata(suite.Ctx.Context(), &types.QueryDenomAuthorityMetadataRequest{ - Denom: suite.defaultDenom, - }) - suite.Require().NoError(err) - suite.Require().Equal(suite.TestAccs[0].String(), queryRes.AuthorityMetadata.Admin) - - // Test minting to admins own account - _, err = suite.msgServer.Mint(sdk.WrapSDKContext(suite.Ctx), types.NewMsgMint(suite.TestAccs[0].String(), sdk.NewInt64Coin(suite.defaultDenom, 10))) - addr0bal += 10 - 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 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))) - suite.Require().NoError(err) - suite.Require().True(bankKeeper.GetBalance(suite.Ctx, suite.TestAccs[1], suite.defaultDenom).Amount.Int64() == addr1bal) - - // Test Change Admin - _, err = suite.msgServer.ChangeAdmin(sdk.WrapSDKContext(suite.Ctx), types.NewMsgChangeAdmin(suite.TestAccs[0].String(), suite.defaultDenom, suite.TestAccs[1].String())) - suite.Require().NoError(err) - queryRes, err = suite.queryClient.DenomAuthorityMetadata(suite.Ctx.Context(), &types.QueryDenomAuthorityMetadataRequest{ - Denom: suite.defaultDenom, - }) - suite.Require().NoError(err) - suite.Require().Equal(suite.TestAccs[1].String(), queryRes.AuthorityMetadata.Admin) - - // Make sure old admin can no longer do actions - _, err = suite.msgServer.Burn(sdk.WrapSDKContext(suite.Ctx), types.NewMsgBurn(suite.TestAccs[0].String(), sdk.NewInt64Coin(suite.defaultDenom, 5))) - suite.Require().Error(err) - - // Make sure the new admin works - _, err = suite.msgServer.Mint(sdk.WrapSDKContext(suite.Ctx), types.NewMsgMint(suite.TestAccs[1].String(), sdk.NewInt64Coin(suite.defaultDenom, 5))) - addr1bal += 5 - suite.Require().NoError(err) - suite.Require().True(bankKeeper.GetBalance(suite.Ctx, suite.TestAccs[1], suite.defaultDenom).Amount.Int64() == addr1bal) - - // Try setting admin to empty - _, err = suite.msgServer.ChangeAdmin(sdk.WrapSDKContext(suite.Ctx), types.NewMsgChangeAdmin(suite.TestAccs[1].String(), suite.defaultDenom, "")) - suite.Require().NoError(err) - queryRes, err = suite.queryClient.DenomAuthorityMetadata(suite.Ctx.Context(), &types.QueryDenomAuthorityMetadataRequest{ - Denom: suite.defaultDenom, - }) - suite.Require().NoError(err) - suite.Require().Equal("", queryRes.AuthorityMetadata.Admin) -} - -// TestMintDenom ensures the following properties of the MintMessage: -// * Noone can mint tokens for a denom that doesn't exist -// * 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() { - 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 - mintMsg types.MsgMint - expectPass bool - }{ - { - 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: "success case - mint to self", - mintMsg: *types.NewMsgMint( - suite.TestAccs[0].String(), - sdk.NewInt64Coin(suite.defaultDenom, 10), - ), - expectPass: 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() { - _, err := suite.msgServer.Mint(sdk.WrapSDKContext(suite.Ctx), &tc.mintMsg) - if tc.expectPass { - suite.Require().NoError(err) - 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() { - // 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 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 - forceTransferMsg types.MsgForceTransfer - expectPass bool - }{ - { - 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: "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: "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: "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() { - _, err := suite.msgServer.ForceTransfer(sdk.WrapSDKContext(suite.Ctx), &tc.forceTransferMsg) - if tc.expectPass { - suite.Require().NoError(err) - - balances[tc.forceTransferMsg.TransferFromAddress] -= tc.forceTransferMsg.Amount.Amount.Int64() - balances[tc.forceTransferMsg.TransferToAddress] += tc.forceTransferMsg.Amount.Amount.Int64() - } else { - suite.Require().Error(err) - } - - 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 - msgChangeAdmin func(denom string) *types.MsgChangeAdmin - expectedChangeAdminPass bool - expectedAdminIndex int - msgMint func(denom string) *types.MsgMint - expectedMintPass bool - }{ - { - desc: "creator admin can't mint after setting to '' ", - msgChangeAdmin: func(denom string) *types.MsgChangeAdmin { - return types.NewMsgChangeAdmin(suite.TestAccs[0].String(), denom, "") - }, - expectedChangeAdminPass: true, - expectedAdminIndex: -1, - msgMint: func(denom string) *types.MsgMint { - return types.NewMsgMint(suite.TestAccs[0].String(), sdk.NewInt64Coin(denom, 5)) - }, - expectedMintPass: false, - }, - { - desc: "non-admins can't change the existing admin", - msgChangeAdmin: func(denom string) *types.MsgChangeAdmin { - return types.NewMsgChangeAdmin(suite.TestAccs[1].String(), denom, suite.TestAccs[2].String()) - }, - expectedChangeAdminPass: false, - expectedAdminIndex: 0, - }, - { - desc: "success change admin", - msgChangeAdmin: func(denom string) *types.MsgChangeAdmin { - return types.NewMsgChangeAdmin(suite.TestAccs[0].String(), denom, suite.TestAccs[1].String()) - }, - expectedAdminIndex: 1, - expectedChangeAdminPass: true, - msgMint: func(denom string) *types.MsgMint { - return types.NewMsgMint(suite.TestAccs[1].String(), sdk.NewInt64Coin(denom, 5)) - }, - expectedMintPass: true, - }, - } { - suite.Run(fmt.Sprintf("Case %s", tc.desc), func() { - // setup test - suite.SetupTest() - - // Create a denom and mint - res, err := suite.msgServer.CreateDenom(sdk.WrapSDKContext(suite.Ctx), types.NewMsgCreateDenom(suite.TestAccs[0].String(), "bitcoin")) - suite.Require().NoError(err) - - testDenom := res.GetNewTokenDenom() - - _, err = suite.msgServer.Mint(sdk.WrapSDKContext(suite.Ctx), types.NewMsgMint(suite.TestAccs[0].String(), sdk.NewInt64Coin(testDenom, 10))) - suite.Require().NoError(err) - - _, err = suite.msgServer.ChangeAdmin(sdk.WrapSDKContext(suite.Ctx), tc.msgChangeAdmin(testDenom)) - if tc.expectedChangeAdminPass { - suite.Require().NoError(err) - } else { - suite.Require().Error(err) - } - - queryRes, err := suite.queryClient.DenomAuthorityMetadata(suite.Ctx.Context(), &types.QueryDenomAuthorityMetadataRequest{ - Denom: testDenom, - }) - suite.Require().NoError(err) - - // expectedAdminIndex with negative value is assumed as admin with value of "" - const emptyStringAdminIndexFlag = -1 - if tc.expectedAdminIndex == emptyStringAdminIndexFlag { - suite.Require().Equal("", queryRes.AuthorityMetadata.Admin) - } else { - suite.Require().Equal(suite.TestAccs[tc.expectedAdminIndex].String(), queryRes.AuthorityMetadata.Admin) - } - - // we test mint to test if admin authority is performed properly after admin change. - if tc.msgMint != nil { - _, err := suite.msgServer.Mint(sdk.WrapSDKContext(suite.Ctx), tc.msgMint(testDenom)) - if tc.expectedMintPass { - suite.Require().NoError(err) - } else { - suite.Require().Error(err) - } - } - }) - } -} - -func (suite *KeeperTestSuite) TestSetDenomMetaData() { - // setup test - suite.SetupTest() - suite.CreateDefaultDenom() - - for _, tc := range []struct { - desc string - msgSetDenomMetadata types.MsgSetDenomMetadata - expectedPass bool - }{ - { - desc: "successful set denom metadata", - msgSetDenomMetadata: *types.NewMsgSetDenomMetadata(suite.TestAccs[0].String(), banktypes.Metadata{ - Description: "yeehaw", - DenomUnits: []*banktypes.DenomUnit{ - { - Denom: suite.defaultDenom, - Exponent: 0, - }, - { - Denom: "uosmo", - Exponent: 6, - }, - }, - Base: suite.defaultDenom, - Display: "uosmo", - Name: "OSMO", - Symbol: "OSMO", - }), - expectedPass: true, - }, - { - desc: "non existent factory denom name", - msgSetDenomMetadata: *types.NewMsgSetDenomMetadata(suite.TestAccs[0].String(), banktypes.Metadata{ - Description: "yeehaw", - DenomUnits: []*banktypes.DenomUnit{ - { - Denom: fmt.Sprintf("factory/%s/litecoin", suite.TestAccs[0].String()), - Exponent: 0, - }, - { - Denom: "uosmo", - Exponent: 6, - }, - }, - Base: fmt.Sprintf("factory/%s/litecoin", suite.TestAccs[0].String()), - Display: "uosmo", - Name: "OSMO", - Symbol: "OSMO", - }), - expectedPass: false, - }, - { - desc: "non-factory denom", - msgSetDenomMetadata: *types.NewMsgSetDenomMetadata(suite.TestAccs[0].String(), banktypes.Metadata{ - Description: "yeehaw", - DenomUnits: []*banktypes.DenomUnit{ - { - Denom: "uosmo", - Exponent: 0, - }, - { - Denom: "uosmoo", - Exponent: 6, - }, - }, - Base: "uosmo", - Display: "uosmoo", - Name: "OSMO", - Symbol: "OSMO", - }), - expectedPass: false, - }, - { - desc: "wrong admin", - msgSetDenomMetadata: *types.NewMsgSetDenomMetadata(suite.TestAccs[1].String(), banktypes.Metadata{ - Description: "yeehaw", - DenomUnits: []*banktypes.DenomUnit{ - { - Denom: suite.defaultDenom, - Exponent: 0, - }, - { - Denom: "uosmo", - Exponent: 6, - }, - }, - Base: suite.defaultDenom, - Display: "uosmo", - Name: "OSMO", - Symbol: "OSMO", - }), - expectedPass: false, - }, - { - desc: "invalid metadata (missing display denom unit)", - msgSetDenomMetadata: *types.NewMsgSetDenomMetadata(suite.TestAccs[0].String(), banktypes.Metadata{ - Description: "yeehaw", - DenomUnits: []*banktypes.DenomUnit{ - { - Denom: suite.defaultDenom, - Exponent: 0, - }, - }, - Base: suite.defaultDenom, - Display: "uosmo", - Name: "OSMO", - Symbol: "OSMO", - }), - expectedPass: false, - }, - } { - suite.Run(fmt.Sprintf("Case %s", tc.desc), func() { - bankKeeper := suite.App.BankKeeper - res, err := suite.msgServer.SetDenomMetadata(sdk.WrapSDKContext(suite.Ctx), &tc.msgSetDenomMetadata) - if tc.expectedPass { - suite.Require().NoError(err) - suite.Require().NotNil(res) - - md, found := bankKeeper.GetDenomMetaData(suite.Ctx, suite.defaultDenom) - suite.Require().True(found) - suite.Require().Equal(tc.msgSetDenomMetadata.Metadata.Name, md.Name) - } else { - suite.Require().Error(err) - } - }) - } -} diff --git a/x/tokenfactory/keeper/createdenom_test.go b/x/tokenfactory/keeper/createdenom_test.go deleted file mode 100644 index 046d26d147..0000000000 --- a/x/tokenfactory/keeper/createdenom_test.go +++ /dev/null @@ -1,164 +0,0 @@ -package keeper_test - -import ( - "fmt" - - "cosmossdk.io/math" - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/CosmWasm/wasmd/x/tokenfactory/testhelpers" - "github.com/CosmWasm/wasmd/x/tokenfactory/types" -) - -func (suite *KeeperTestSuite) TestMsgCreateDenom() { - var ( - tokenFactoryKeeper = suite.App.TokenFactoryKeeper - bankKeeper = suite.App.BankKeeper - denomCreationFee = tokenFactoryKeeper.GetParams(suite.Ctx).DenomCreationFee - ) - - // Get balance of acc 0 before creating a denom - preCreateBalance := bankKeeper.GetBalance(suite.Ctx, suite.TestAccs[0], denomCreationFee[0].Denom) - - // Creating a denom should work - res, err := suite.msgServer.CreateDenom(sdk.WrapSDKContext(suite.Ctx), types.NewMsgCreateDenom(suite.TestAccs[0].String(), "bitcoin")) - suite.Require().NoError(err) - suite.Require().NotEmpty(res.GetNewTokenDenom()) - - // Make sure that the admin is set correctly - queryRes, err := suite.queryClient.DenomAuthorityMetadata(suite.Ctx.Context(), &types.QueryDenomAuthorityMetadataRequest{ - Denom: res.GetNewTokenDenom(), - }) - suite.Require().NoError(err) - suite.Require().Equal(suite.TestAccs[0].String(), queryRes.AuthorityMetadata.Admin) - - // Make sure that creation fee was deducted - postCreateBalance := bankKeeper.GetBalance(suite.Ctx, suite.TestAccs[0], tokenFactoryKeeper.GetParams(suite.Ctx).DenomCreationFee[0].Denom) - suite.Require().True(preCreateBalance.Sub(postCreateBalance).IsEqual(denomCreationFee[0])) - - // Make sure that a second version of the same denom can't be recreated - _, err = suite.msgServer.CreateDenom(sdk.WrapSDKContext(suite.Ctx), types.NewMsgCreateDenom(suite.TestAccs[0].String(), "bitcoin")) - suite.Require().Error(err) - - // Creating a second denom should work - res, err = suite.msgServer.CreateDenom(sdk.WrapSDKContext(suite.Ctx), types.NewMsgCreateDenom(suite.TestAccs[0].String(), "litecoin")) - suite.Require().NoError(err) - suite.Require().NotEmpty(res.GetNewTokenDenom()) - - // Try querying all the denoms created by suite.TestAccs[0] - queryRes2, err := suite.queryClient.DenomsFromCreator(suite.Ctx.Context(), &types.QueryDenomsFromCreatorRequest{ - Creator: suite.TestAccs[0].String(), - }) - suite.Require().NoError(err) - suite.Require().Len(queryRes2.Denoms, 2) - - // Make sure that a second account can create a denom with the same subdenom - res, err = suite.msgServer.CreateDenom(sdk.WrapSDKContext(suite.Ctx), types.NewMsgCreateDenom(suite.TestAccs[1].String(), "bitcoin")) - suite.Require().NoError(err) - suite.Require().NotEmpty(res.GetNewTokenDenom()) - - // Make sure that an address with a "/" in it can't create denoms - _, err = suite.msgServer.CreateDenom(sdk.WrapSDKContext(suite.Ctx), types.NewMsgCreateDenom("osmosis.eth/creator", "bitcoin")) - suite.Require().Error(err) -} - -func (suite *KeeperTestSuite) TestCreateDenom() { - var ( - primaryDenom = types.DefaultParams().DenomCreationFee[0].Denom - secondaryDenom = testhelpers.SecondaryDenom - defaultDenomCreationFee = types.Params{DenomCreationFee: sdk.NewCoins(sdk.NewCoin(primaryDenom, math.NewInt(50000000)))} - twoDenomCreationFee = types.Params{DenomCreationFee: sdk.NewCoins(sdk.NewCoin(primaryDenom, math.NewInt(50000000)), sdk.NewCoin(secondaryDenom, math.NewInt(50000000)))} - nilCreationFee = types.Params{DenomCreationFee: nil} - largeCreationFee = types.Params{DenomCreationFee: sdk.NewCoins(sdk.NewCoin(primaryDenom, math.NewInt(5000000000)))} - ) - - for _, tc := range []struct { - desc string - denomCreationFee types.Params - setup func() - subdenom string - valid bool - }{ - { - desc: "subdenom too long", - denomCreationFee: defaultDenomCreationFee, - subdenom: "assadsadsadasdasdsadsadsadsadsadsadsklkadaskkkdasdasedskhanhassyeunganassfnlksdflksafjlkasd", - valid: false, - }, - { - desc: "subdenom and creator pair already exists", - denomCreationFee: defaultDenomCreationFee, - setup: func() { - _, err := suite.msgServer.CreateDenom(sdk.WrapSDKContext(suite.Ctx), types.NewMsgCreateDenom(suite.TestAccs[0].String(), "bitcoin")) - suite.Require().NoError(err) - }, - subdenom: "bitcoin", - valid: false, - }, - { - desc: "success case: defaultDenomCreationFee", - denomCreationFee: defaultDenomCreationFee, - subdenom: "evmos", - valid: true, - }, - { - desc: "success case: twoDenomCreationFee", - denomCreationFee: twoDenomCreationFee, - subdenom: "catcoin", - valid: true, - }, - { - desc: "success case: nilCreationFee", - denomCreationFee: nilCreationFee, - subdenom: "czcoin", - valid: true, - }, - { - desc: "account doesn't have enough to pay for denom creation fee", - denomCreationFee: largeCreationFee, - subdenom: "tooexpensive", - valid: false, - }, - { - desc: "subdenom having invalid characters", - denomCreationFee: defaultDenomCreationFee, - subdenom: "bit/***///&&&/coin", - valid: false, - }, - } { - suite.SetupTest() - suite.Run(fmt.Sprintf("Case %s", tc.desc), func() { - if tc.setup != nil { - tc.setup() - } - tokenFactoryKeeper := suite.App.TokenFactoryKeeper - bankKeeper := suite.App.BankKeeper - // Set denom creation fee in params - tokenFactoryKeeper.SetParams(suite.Ctx, tc.denomCreationFee) - denomCreationFee := tokenFactoryKeeper.GetParams(suite.Ctx).DenomCreationFee - suite.Require().Equal(tc.denomCreationFee.DenomCreationFee, denomCreationFee) - - // note balance, create a tokenfactory denom, then note balance again - preCreateBalance := bankKeeper.GetAllBalances(suite.Ctx, suite.TestAccs[0]) - res, err := suite.msgServer.CreateDenom(sdk.WrapSDKContext(suite.Ctx), types.NewMsgCreateDenom(suite.TestAccs[0].String(), tc.subdenom)) - postCreateBalance := bankKeeper.GetAllBalances(suite.Ctx, suite.TestAccs[0]) - if tc.valid { - suite.Require().NoError(err) - suite.Require().True(preCreateBalance.Sub(postCreateBalance).IsEqual(denomCreationFee)) - - // Make sure that the admin is set correctly - queryRes, err := suite.queryClient.DenomAuthorityMetadata(suite.Ctx.Context(), &types.QueryDenomAuthorityMetadataRequest{ - Denom: res.GetNewTokenDenom(), - }) - - suite.Require().NoError(err) - suite.Require().Equal(suite.TestAccs[0].String(), queryRes.AuthorityMetadata.Admin) - - } else { - suite.Require().Error(err) - // Ensure we don't charge if we expect an error - suite.Require().True(preCreateBalance.IsEqual(postCreateBalance)) - } - }) - } -} diff --git a/x/tokenfactory/keeper/genesis_test.go b/x/tokenfactory/keeper/genesis_test.go deleted file mode 100644 index d729de7216..0000000000 --- a/x/tokenfactory/keeper/genesis_test.go +++ /dev/null @@ -1,59 +0,0 @@ -package keeper_test - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - - "github.com/CosmWasm/wasmd/x/tokenfactory/types" -) - -func (suite *KeeperTestSuite) TestGenesis() { - genesisState := types.GenesisState{ - FactoryDenoms: []types.GenesisDenom{ - { - Denom: "factory/cosmos1t7egva48prqmzl59x5ngv4zx0dtrwewcdqdjr8/bitcoin", - AuthorityMetadata: types.DenomAuthorityMetadata{ - Admin: "cosmos1t7egva48prqmzl59x5ngv4zx0dtrwewcdqdjr8", - }, - }, - { - Denom: "factory/cosmos1t7egva48prqmzl59x5ngv4zx0dtrwewcdqdjr8/diff-admin", - AuthorityMetadata: types.DenomAuthorityMetadata{ - Admin: "cosmos15czt5nhlnvayqq37xun9s9yus0d6y26dx74r5p", - }, - }, - { - Denom: "factory/cosmos1t7egva48prqmzl59x5ngv4zx0dtrwewcdqdjr8/litecoin", - AuthorityMetadata: types.DenomAuthorityMetadata{ - Admin: "cosmos1t7egva48prqmzl59x5ngv4zx0dtrwewcdqdjr8", - }, - }, - }, - } - - suite.SetupTestForInitGenesis() - app := suite.App - - // Test both with bank denom metadata set, and not set. - for i, denom := range genesisState.FactoryDenoms { - // hacky, sets bank metadata to exist if i != 0, to cover both cases. - if i != 0 { - app.BankKeeper.SetDenomMetaData(suite.Ctx, banktypes.Metadata{Base: denom.GetDenom()}) - } - } - - // check before initGenesis that the module account is nil - tokenfactoryModuleAccount := app.AccountKeeper.GetAccount(suite.Ctx, app.AccountKeeper.GetModuleAddress(types.ModuleName)) - suite.Require().Nil(tokenfactoryModuleAccount) - - app.TokenFactoryKeeper.SetParams(suite.Ctx, types.Params{DenomCreationFee: sdk.Coins{sdk.NewInt64Coin("uosmo", 100)}}) - app.TokenFactoryKeeper.InitGenesis(suite.Ctx, genesisState) - - // check that the module account is now initialized - tokenfactoryModuleAccount = app.AccountKeeper.GetAccount(suite.Ctx, app.AccountKeeper.GetModuleAddress(types.ModuleName)) - suite.Require().NotNil(tokenfactoryModuleAccount) - - exportedGenesis := app.TokenFactoryKeeper.ExportGenesis(suite.Ctx) - suite.Require().NotNil(exportedGenesis) - suite.Require().Equal(genesisState, *exportedGenesis) -} diff --git a/x/tokenfactory/keeper/keeper_test.go b/x/tokenfactory/keeper/keeper_test.go deleted file mode 100644 index 4f9de8f71c..0000000000 --- a/x/tokenfactory/keeper/keeper_test.go +++ /dev/null @@ -1,64 +0,0 @@ -package keeper_test - -import ( - "testing" - - tmproto "github.com/cometbft/cometbft/proto/tendermint/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/suite" - - "github.com/CosmWasm/wasmd/app/apptesting" - "github.com/CosmWasm/wasmd/x/tokenfactory/keeper" - "github.com/CosmWasm/wasmd/x/tokenfactory/testhelpers" - "github.com/CosmWasm/wasmd/x/tokenfactory/types" -) - -type KeeperTestSuite struct { - apptesting.KeeperTestHelper - - queryClient types.QueryClient - msgServer types.MsgServer - // defaultDenom is on the suite, as it depends on the creator test address. - defaultDenom string -} - -func TestKeeperTestSuite(t *testing.T) { - suite.Run(t, new(KeeperTestSuite)) -} - -func (suite *KeeperTestSuite) SetupTest() { - suite.Setup() - // Fund every TestAcc with two denoms, one of which is the denom creation fee - fundAccsAmount := sdk.NewCoins(sdk.NewCoin(types.DefaultParams().DenomCreationFee[0].Denom, types.DefaultParams().DenomCreationFee[0].Amount.MulRaw(100)), sdk.NewCoin(testhelpers.SecondaryDenom, testhelpers.SecondaryAmount)) - for _, acc := range suite.TestAccs { - suite.FundAcc(acc, fundAccsAmount) - } - - suite.queryClient = types.NewQueryClient(suite.QueryHelper) - suite.msgServer = keeper.NewMsgServerImpl(suite.App.TokenFactoryKeeper) -} - -func (suite *KeeperTestSuite) CreateDefaultDenom() { - res, _ := suite.msgServer.CreateDenom(sdk.WrapSDKContext(suite.Ctx), types.NewMsgCreateDenom(suite.TestAccs[0].String(), "bitcoin")) - suite.defaultDenom = res.GetNewTokenDenom() -} - -func (suite *KeeperTestSuite) TestCreateModuleAccount() { - app := suite.App - - // remove module account - tokenfactoryModuleAccount := app.AccountKeeper.GetAccount(suite.Ctx, app.AccountKeeper.GetModuleAddress(types.ModuleName)) - app.AccountKeeper.RemoveAccount(suite.Ctx, tokenfactoryModuleAccount) - - // ensure module account was removed - suite.Ctx = app.BaseApp.NewContext(false, tmproto.Header{}) - tokenfactoryModuleAccount = app.AccountKeeper.GetAccount(suite.Ctx, app.AccountKeeper.GetModuleAddress(types.ModuleName)) - suite.Require().Nil(tokenfactoryModuleAccount) - - // create module account - app.TokenFactoryKeeper.CreateModuleAccount(suite.Ctx) - - // check that the module account is now initialized - tokenfactoryModuleAccount = app.AccountKeeper.GetAccount(suite.Ctx, app.AccountKeeper.GetModuleAddress(types.ModuleName)) - suite.Require().NotNil(tokenfactoryModuleAccount) -} diff --git a/x/tokenfactory/keeper/msg_server_test.go b/x/tokenfactory/keeper/msg_server_test.go deleted file mode 100644 index 2aa93ec3c0..0000000000 --- a/x/tokenfactory/keeper/msg_server_test.go +++ /dev/null @@ -1,248 +0,0 @@ -package keeper_test - -import ( - "fmt" - - "cosmossdk.io/math" - "github.com/CosmWasm/wasmd/x/tokenfactory/types" - - sdk "github.com/cosmos/cosmos-sdk/types" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" -) - -// TestMintDenomMsg tests TypeMsgMint message is emitted on a successful mint -func (suite *KeeperTestSuite) TestMintDenomMsg() { - // Create a denom - suite.CreateDefaultDenom() - - for _, tc := range []struct { - desc string - amount int64 - mintDenom string - admin string - valid bool - expectedMessageEvents int - }{ - { - desc: "denom does not exist", - amount: 10, - mintDenom: "factory/osmo1t7egva48prqmzl59x5ngv4zx0dtrwewc9m7z44/evmos", - admin: suite.TestAccs[0].String(), - valid: false, - }, - { - desc: "success case", - amount: 10, - mintDenom: suite.defaultDenom, - admin: suite.TestAccs[0].String(), - valid: true, - expectedMessageEvents: 1, - }, - } { - suite.Run(fmt.Sprintf("Case %s", tc.desc), func() { - ctx := suite.Ctx.WithEventManager(sdk.NewEventManager()) - suite.Require().Equal(0, len(ctx.EventManager().Events())) - // Test mint message - suite.msgServer.Mint(sdk.WrapSDKContext(ctx), types.NewMsgMint(tc.admin, sdk.NewInt64Coin(tc.mintDenom, 10))) //nolint:errcheck - // Ensure current number and type of event is emitted - suite.AssertEventEmitted(ctx, types.TypeMsgMint, tc.expectedMessageEvents) - }) - } -} - -// TestBurnDenomMsg tests TypeMsgBurn message is emitted on a successful burn -func (suite *KeeperTestSuite) TestBurnDenomMsg() { - // 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 - - for _, tc := range []struct { - desc string - amount int64 - burnDenom string - admin string - valid bool - expectedMessageEvents int - }{ - { - desc: "denom does not exist", - burnDenom: "factory/osmo1t7egva48prqmzl59x5ngv4zx0dtrwewc9m7z44/evmos", - admin: suite.TestAccs[0].String(), - valid: false, - }, - { - desc: "success case", - burnDenom: suite.defaultDenom, - admin: suite.TestAccs[0].String(), - valid: true, - expectedMessageEvents: 1, - }, - } { - suite.Run(fmt.Sprintf("Case %s", tc.desc), func() { - ctx := suite.Ctx.WithEventManager(sdk.NewEventManager()) - suite.Require().Equal(0, len(ctx.EventManager().Events())) - // Test burn message - suite.msgServer.Burn(sdk.WrapSDKContext(ctx), types.NewMsgBurn(tc.admin, sdk.NewInt64Coin(tc.burnDenom, 10))) //nolint:errcheck - // Ensure current number and type of event is emitted - suite.AssertEventEmitted(ctx, types.TypeMsgBurn, tc.expectedMessageEvents) - }) - } -} - -// TestCreateDenomMsg tests TypeMsgCreateDenom message is emitted on a successful denom creation -func (suite *KeeperTestSuite) TestCreateDenomMsg() { - defaultDenomCreationFee := types.Params{DenomCreationFee: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, math.NewInt(50000000)))} - for _, tc := range []struct { - desc string - denomCreationFee types.Params - subdenom string - valid bool - expectedMessageEvents int - }{ - { - desc: "subdenom too long", - denomCreationFee: defaultDenomCreationFee, - subdenom: "assadsadsadasdasdsadsadsadsadsadsadsklkadaskkkdasdasedskhanhassyeunganassfnlksdflksafjlkasd", - valid: false, - }, - { - desc: "success case: defaultDenomCreationFee", - denomCreationFee: defaultDenomCreationFee, - subdenom: "evmos", - valid: true, - expectedMessageEvents: 1, - }, - } { - suite.SetupTest() - suite.Run(fmt.Sprintf("Case %s", tc.desc), func() { - tokenFactoryKeeper := suite.App.TokenFactoryKeeper - ctx := suite.Ctx.WithEventManager(sdk.NewEventManager()) - suite.Require().Equal(0, len(ctx.EventManager().Events())) - // Set denom creation fee in params - tokenFactoryKeeper.SetParams(suite.Ctx, tc.denomCreationFee) - // Test create denom message - suite.msgServer.CreateDenom(sdk.WrapSDKContext(ctx), types.NewMsgCreateDenom(suite.TestAccs[0].String(), tc.subdenom)) //nolint:errcheck - // Ensure current number and type of event is emitted - suite.AssertEventEmitted(ctx, types.TypeMsgCreateDenom, tc.expectedMessageEvents) - }) - } -} - -// TestChangeAdminDenomMsg tests TypeMsgChangeAdmin message is emitted on a successful admin change -func (suite *KeeperTestSuite) TestChangeAdminDenomMsg() { - for _, tc := range []struct { - desc string - msgChangeAdmin func(denom string) *types.MsgChangeAdmin - expectedChangeAdminPass bool - expectedAdminIndex int - msgMint func(denom string) *types.MsgMint - expectedMintPass bool - expectedMessageEvents int - }{ - { - desc: "non-admins can't change the existing admin", - msgChangeAdmin: func(denom string) *types.MsgChangeAdmin { - return types.NewMsgChangeAdmin(suite.TestAccs[1].String(), denom, suite.TestAccs[2].String()) - }, - expectedChangeAdminPass: false, - expectedAdminIndex: 0, - }, - { - desc: "success change admin", - msgChangeAdmin: func(denom string) *types.MsgChangeAdmin { - return types.NewMsgChangeAdmin(suite.TestAccs[0].String(), denom, suite.TestAccs[1].String()) - }, - expectedAdminIndex: 1, - expectedChangeAdminPass: true, - expectedMessageEvents: 1, - msgMint: func(denom string) *types.MsgMint { - return types.NewMsgMint(suite.TestAccs[1].String(), sdk.NewInt64Coin(denom, 5)) - }, - expectedMintPass: true, - }, - } { - suite.Run(fmt.Sprintf("Case %s", tc.desc), func() { - // setup test - suite.SetupTest() - ctx := suite.Ctx.WithEventManager(sdk.NewEventManager()) - suite.Require().Equal(0, len(ctx.EventManager().Events())) - // Create a denom and mint - res, err := suite.msgServer.CreateDenom(sdk.WrapSDKContext(ctx), types.NewMsgCreateDenom(suite.TestAccs[0].String(), "bitcoin")) - suite.Require().NoError(err) - testDenom := res.GetNewTokenDenom() - suite.msgServer.Mint(sdk.WrapSDKContext(ctx), types.NewMsgMint(suite.TestAccs[0].String(), sdk.NewInt64Coin(testDenom, 10))) //nolint:errcheck - // Test change admin message - suite.msgServer.ChangeAdmin(sdk.WrapSDKContext(ctx), tc.msgChangeAdmin(testDenom)) //nolint:errcheck - // Ensure current number and type of event is emitted - suite.AssertEventEmitted(ctx, types.TypeMsgChangeAdmin, tc.expectedMessageEvents) - }) - } -} - -// TestSetDenomMetaDataMsg tests TypeMsgSetDenomMetadata message is emitted on a successful denom metadata change -func (suite *KeeperTestSuite) TestSetDenomMetaDataMsg() { - // setup test - suite.SetupTest() - suite.CreateDefaultDenom() - - for _, tc := range []struct { - desc string - msgSetDenomMetadata types.MsgSetDenomMetadata - expectedPass bool - expectedMessageEvents int - }{ - { - desc: "successful set denom metadata", - msgSetDenomMetadata: *types.NewMsgSetDenomMetadata(suite.TestAccs[0].String(), banktypes.Metadata{ - Description: "yeehaw", - DenomUnits: []*banktypes.DenomUnit{ - { - Denom: suite.defaultDenom, - Exponent: 0, - }, - { - Denom: "uosmo", - Exponent: 6, - }, - }, - Base: suite.defaultDenom, - Display: "uosmo", - Name: "OSMO", - Symbol: "OSMO", - }), - expectedPass: true, - expectedMessageEvents: 1, - }, - { - desc: "non existent factory denom name", - msgSetDenomMetadata: *types.NewMsgSetDenomMetadata(suite.TestAccs[0].String(), banktypes.Metadata{ - Description: "yeehaw", - DenomUnits: []*banktypes.DenomUnit{ - { - Denom: fmt.Sprintf("factory/%s/litecoin", suite.TestAccs[0].String()), - Exponent: 0, - }, - { - Denom: "uosmo", - Exponent: 6, - }, - }, - Base: fmt.Sprintf("factory/%s/litecoin", suite.TestAccs[0].String()), - Display: "uosmo", - Name: "OSMO", - Symbol: "OSMO", - }), - expectedPass: false, - }, - } { - suite.Run(fmt.Sprintf("Case %s", tc.desc), func() { - ctx := suite.Ctx.WithEventManager(sdk.NewEventManager()) - suite.Require().Equal(0, len(ctx.EventManager().Events())) - // Test set denom metadata message - suite.msgServer.SetDenomMetadata(sdk.WrapSDKContext(ctx), &tc.msgSetDenomMetadata) //nolint:errcheck - // Ensure current number and type of event is emitted - suite.AssertEventEmitted(ctx, types.TypeMsgSetDenomMetadata, tc.expectedMessageEvents) - }) - } -} diff --git a/x/tokenfactory/types/authorityMetadata.pb.go b/x/tokenfactory/types/authorityMetadata.pb.go index e4741b285f..a0f23b9e41 100644 --- a/x/tokenfactory/types/authorityMetadata.pb.go +++ b/x/tokenfactory/types/authorityMetadata.pb.go @@ -7,7 +7,7 @@ import ( fmt "fmt" _ "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/gogo/protobuf/proto" + proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" diff --git a/x/tokenfactory/types/genesis.pb.go b/x/tokenfactory/types/genesis.pb.go index 23beeaebc1..5f83a23571 100644 --- a/x/tokenfactory/types/genesis.pb.go +++ b/x/tokenfactory/types/genesis.pb.go @@ -6,7 +6,7 @@ package types import ( fmt "fmt" _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/gogo/protobuf/proto" + proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" diff --git a/x/tokenfactory/types/params.pb.go b/x/tokenfactory/types/params.pb.go index 31e3cea8b2..bce6e0d41f 100644 --- a/x/tokenfactory/types/params.pb.go +++ b/x/tokenfactory/types/params.pb.go @@ -9,7 +9,7 @@ import ( github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/gogo/protobuf/proto" + proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" diff --git a/x/tokenfactory/types/query.pb.go b/x/tokenfactory/types/query.pb.go index a0d598a1d0..5590926375 100644 --- a/x/tokenfactory/types/query.pb.go +++ b/x/tokenfactory/types/query.pb.go @@ -9,7 +9,7 @@ import ( _ "github.com/cosmos/cosmos-sdk/types/query" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/gogo/protobuf/grpc" - proto "github.com/gogo/protobuf/proto" + proto "github.com/cosmos/gogoproto/proto" _ "google.golang.org/genproto/googleapis/api/annotations" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" diff --git a/x/tokenfactory/types/tx.pb.go b/x/tokenfactory/types/tx.pb.go index a729922b64..e80c3c7991 100644 --- a/x/tokenfactory/types/tx.pb.go +++ b/x/tokenfactory/types/tx.pb.go @@ -10,7 +10,7 @@ import ( types1 "github.com/cosmos/cosmos-sdk/x/bank/types" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/gogo/protobuf/grpc" - proto "github.com/gogo/protobuf/proto" + proto "github.com/cosmos/gogoproto/proto" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" diff --git a/x/wasm/types/authz.pb.go b/x/wasm/types/authz.pb.go index 4830d1a456..454a2397be 100644 --- a/x/wasm/types/authz.pb.go +++ b/x/wasm/types/authz.pb.go @@ -11,7 +11,7 @@ import ( types1 "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/cosmos-sdk/types/tx/amino" _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/gogo/protobuf/proto" + proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" diff --git a/x/wasm/types/genesis.pb.go b/x/wasm/types/genesis.pb.go index d842c0e949..dcf072a152 100644 --- a/x/wasm/types/genesis.pb.go +++ b/x/wasm/types/genesis.pb.go @@ -8,7 +8,7 @@ import ( _ "github.com/cosmos/cosmos-proto" _ "github.com/cosmos/cosmos-sdk/types/tx/amino" _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/gogo/protobuf/proto" + proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" diff --git a/x/wasm/types/ibc.pb.go b/x/wasm/types/ibc.pb.go index eca49535a2..153a2276b4 100644 --- a/x/wasm/types/ibc.pb.go +++ b/x/wasm/types/ibc.pb.go @@ -6,7 +6,7 @@ package types import ( fmt "fmt" _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/gogo/protobuf/proto" + proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" diff --git a/x/wasm/types/proposal_legacy.pb.go b/x/wasm/types/proposal_legacy.pb.go index 4984f49ebf..fc4a656419 100644 --- a/x/wasm/types/proposal_legacy.pb.go +++ b/x/wasm/types/proposal_legacy.pb.go @@ -11,7 +11,7 @@ import ( types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/cosmos-sdk/types/tx/amino" _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/gogo/protobuf/proto" + proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" diff --git a/x/wasm/types/query.pb.go b/x/wasm/types/query.pb.go index b4c092cf4a..e638edb12b 100644 --- a/x/wasm/types/query.pb.go +++ b/x/wasm/types/query.pb.go @@ -13,7 +13,7 @@ import ( _ "github.com/cosmos/cosmos-sdk/types/tx/amino" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/gogo/protobuf/grpc" - proto "github.com/gogo/protobuf/proto" + proto "github.com/cosmos/gogoproto/proto" _ "google.golang.org/genproto/googleapis/api/annotations" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" diff --git a/x/wasm/types/tx.pb.go b/x/wasm/types/tx.pb.go index 333e562af7..299a5c999a 100644 --- a/x/wasm/types/tx.pb.go +++ b/x/wasm/types/tx.pb.go @@ -13,7 +13,7 @@ import ( _ "github.com/cosmos/cosmos-sdk/types/tx/amino" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/gogo/protobuf/grpc" - proto "github.com/gogo/protobuf/proto" + proto "github.com/cosmos/gogoproto/proto" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" diff --git a/x/wasm/types/types.pb.go b/x/wasm/types/types.pb.go index b7646805be..82a818c9ac 100644 --- a/x/wasm/types/types.pb.go +++ b/x/wasm/types/types.pb.go @@ -11,7 +11,7 @@ import ( types "github.com/cosmos/cosmos-sdk/codec/types" _ "github.com/cosmos/cosmos-sdk/types/tx/amino" _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/gogo/protobuf/proto" + proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits"