From 70a5bbb740043ba35936372746cc6559e94c37a2 Mon Sep 17 00:00:00 2001 From: expertdicer Date: Tue, 11 Feb 2025 15:43:27 +0700 Subject: [PATCH 1/5] refactor(devgas): For #1866 --- app/ante.go | 2 +- app/ante/handler_opts.go | 4 +- app/keepers.go | 16 +-- app/keepers/all_keepers.go | 2 +- app/simapp/sim_test.go | 4 +- app/wasmext/stargate_query.go | 2 +- app/wasmext/stargate_query_test.go | 2 +- gosdk/querier.go | 2 +- proto/nibiru/devgas/v1/devgas.proto | 2 +- proto/nibiru/devgas/v1/event.proto | 2 +- proto/nibiru/devgas/v1/genesis.proto | 2 +- proto/nibiru/devgas/v1/query.proto | 2 +- proto/nibiru/devgas/v1/tx.proto | 2 +- x/devgas/{v1 => }/README.md | 0 x/devgas/{v1 => }/ante/ante.go | 12 +- x/devgas/{v1 => }/ante/ante_test.go | 18 +-- x/devgas/{v1 => }/ante/expected_keepers.go | 6 +- x/devgas/{v1 => }/client/cli/cli_test.go | 4 +- x/devgas/{v1 => }/client/cli/query.go | 24 ++-- x/devgas/{v1 => }/client/cli/tx.go | 10 +- x/devgas/{v1/types => }/codec.go | 2 +- x/devgas/{v1/types => }/codec_test.go | 2 +- x/devgas/{v1/types => }/devgas.go | 2 +- x/devgas/{v1/types => }/devgas.pb.go | 13 +-- x/devgas/{v1/types => }/devgas_test.go | 2 +- x/devgas/{v1 => devgasmodule}/genesis.go | 10 +- x/devgas/{v1 => devgasmodule}/genesis_test.go | 38 +++---- x/devgas/{v1 => devgasmodule}/module.go | 34 +++--- x/devgas/{v1 => devgasmodule}/module_test.go | 8 +- x/devgas/{v1/types => }/errors.go | 2 +- x/devgas/{v1/types => }/event.pb.go | 13 +-- x/devgas/{v1/types => }/expected_keepers.go | 2 +- x/devgas/{v1/types => }/export.go | 2 +- x/devgas/{v1 => }/exported/exported.go | 0 x/devgas/{v1/types => }/genesis.go | 2 +- x/devgas/{v1/types => }/genesis.pb.go | 50 ++++----- x/devgas/{v1/types => }/genesis_test.go | 2 +- x/devgas/{v1 => }/keeper/feeshare.go | 6 +- x/devgas/{v1 => }/keeper/grpc_query.go | 28 ++--- x/devgas/{v1 => }/keeper/grpc_query_test.go | 24 ++-- x/devgas/{v1 => }/keeper/keeper.go | 20 ++-- x/devgas/{v1 => }/keeper/keeper_test.go | 12 +- x/devgas/{v1 => }/keeper/msg_server.go | 52 ++++----- x/devgas/{v1 => }/keeper/msg_server_test.go | 106 +++++++++--------- x/devgas/{v1 => }/keeper/params.go | 4 +- x/devgas/{v1 => }/keeper/store.go | 30 ++--- .../{v1 => }/keeper/testdata/reflect.wasm | Bin x/devgas/{v1/types => }/keys.go | 2 +- x/devgas/{v1/types => }/msg.go | 2 +- x/devgas/{v1/types => }/msg_test.go | 2 +- x/devgas/{v1/types => }/params.go | 2 +- x/devgas/{v1/types => }/params_legacy.go | 2 +- x/devgas/{v1/types => }/params_legacy_test.go | 2 +- x/devgas/{v1/types => }/params_test.go | 2 +- x/devgas/{v1/types => }/query.go | 2 +- x/devgas/{v1/types => }/query.pb.go | 74 ++++++------ x/devgas/{v1/types => }/query.pb.gw.go | 4 +- x/devgas/{v1 => }/simulation/genesis.go | 10 +- x/devgas/{v1/types => }/tx.pb.go | 72 ++++++------ x/devgas/{v1/types => }/tx.pb.gw.go | 4 +- 60 files changed, 381 insertions(+), 383 deletions(-) rename x/devgas/{v1 => }/README.md (100%) rename x/devgas/{v1 => }/ante/ante.go (89%) rename x/devgas/{v1 => }/ante/ante_test.go (95%) rename x/devgas/{v1 => }/ante/expected_keepers.go (68%) rename x/devgas/{v1 => }/client/cli/cli_test.go (98%) rename x/devgas/{v1 => }/client/cli/query.go (88%) rename x/devgas/{v1 => }/client/cli/tx.go (94%) rename x/devgas/{v1/types => }/codec.go (99%) rename x/devgas/{v1/types => }/codec_test.go (98%) rename x/devgas/{v1/types => }/devgas.go (99%) rename x/devgas/{v1/types => }/devgas.pb.go (96%) rename x/devgas/{v1/types => }/devgas_test.go (99%) rename x/devgas/{v1 => devgasmodule}/genesis.go (71%) rename x/devgas/{v1 => devgasmodule}/genesis_test.go (72%) rename x/devgas/{v1 => devgasmodule}/module.go (87%) rename x/devgas/{v1 => devgasmodule}/module_test.go (83%) rename x/devgas/{v1/types => }/errors.go (97%) rename x/devgas/{v1/types => }/event.pb.go (98%) rename x/devgas/{v1/types => }/expected_keepers.go (98%) rename x/devgas/{v1/types => }/export.go (95%) rename x/devgas/{v1 => }/exported/exported.go (100%) rename x/devgas/{v1/types => }/genesis.go (98%) rename x/devgas/{v1/types => }/genesis.pb.go (87%) rename x/devgas/{v1/types => }/genesis_test.go (99%) rename x/devgas/{v1 => }/keeper/feeshare.go (84%) rename x/devgas/{v1 => }/keeper/grpc_query.go (76%) rename x/devgas/{v1 => }/keeper/grpc_query_test.go (88%) rename x/devgas/{v1 => }/keeper/keeper.go (79%) rename x/devgas/{v1 => }/keeper/keeper_test.go (85%) rename x/devgas/{v1 => }/keeper/msg_server.go (86%) rename x/devgas/{v1 => }/keeper/msg_server_test.go (81%) rename x/devgas/{v1 => }/keeper/params.go (60%) rename x/devgas/{v1 => }/keeper/store.go (51%) rename x/devgas/{v1 => }/keeper/testdata/reflect.wasm (100%) rename x/devgas/{v1/types => }/keys.go (96%) rename x/devgas/{v1/types => }/msg.go (99%) rename x/devgas/{v1/types => }/msg_test.go (99%) rename x/devgas/{v1/types => }/params.go (99%) rename x/devgas/{v1/types => }/params_legacy.go (98%) rename x/devgas/{v1/types => }/params_legacy_test.go (99%) rename x/devgas/{v1/types => }/params_test.go (99%) rename x/devgas/{v1/types => }/query.go (98%) rename x/devgas/{v1/types => }/query.pb.go (93%) rename x/devgas/{v1/types => }/query.pb.gw.go (99%) rename x/devgas/{v1 => }/simulation/genesis.go (79%) rename x/devgas/{v1/types => }/tx.pb.go (93%) rename x/devgas/{v1/types => }/tx.pb.gw.go (99%) diff --git a/app/ante.go b/app/ante.go index 79c2d5adfe..24ee678ddb 100644 --- a/app/ante.go +++ b/app/ante.go @@ -11,7 +11,7 @@ import ( "github.com/NibiruChain/nibiru/v2/app/ante" "github.com/NibiruChain/nibiru/v2/app/evmante" - devgasante "github.com/NibiruChain/nibiru/v2/x/devgas/v1/ante" + devgasante "github.com/NibiruChain/nibiru/v2/x/devgas/ante" ) // NewAnteHandler returns and AnteHandler that checks and increments sequence diff --git a/app/ante/handler_opts.go b/app/ante/handler_opts.go index 9c1d883013..f94386a193 100644 --- a/app/ante/handler_opts.go +++ b/app/ante/handler_opts.go @@ -10,8 +10,8 @@ import ( authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper" - devgasante "github.com/NibiruChain/nibiru/v2/x/devgas/v1/ante" - devgaskeeper "github.com/NibiruChain/nibiru/v2/x/devgas/v1/keeper" + devgasante "github.com/NibiruChain/nibiru/v2/x/devgas/ante" + devgaskeeper "github.com/NibiruChain/nibiru/v2/x/devgas/keeper" evmkeeper "github.com/NibiruChain/nibiru/v2/x/evm/keeper" ) diff --git a/app/keepers.go b/app/keepers.go index 1138bc5408..fa814ba9e2 100644 --- a/app/keepers.go +++ b/app/keepers.go @@ -111,9 +111,9 @@ import ( "github.com/NibiruChain/nibiru/v2/app/wasmext" "github.com/NibiruChain/nibiru/v2/eth" "github.com/NibiruChain/nibiru/v2/x/common" - "github.com/NibiruChain/nibiru/v2/x/devgas/v1" - devgaskeeper "github.com/NibiruChain/nibiru/v2/x/devgas/v1/keeper" - devgastypes "github.com/NibiruChain/nibiru/v2/x/devgas/v1/types" + "github.com/NibiruChain/nibiru/v2/x/devgas/devgasmodule" + devgaskeeper "github.com/NibiruChain/nibiru/v2/x/devgas/keeper" + devgas "github.com/NibiruChain/nibiru/v2/x/devgas" "github.com/NibiruChain/nibiru/v2/x/epochs" epochskeeper "github.com/NibiruChain/nibiru/v2/x/epochs/keeper" epochstypes "github.com/NibiruChain/nibiru/v2/x/epochs/types" @@ -205,7 +205,7 @@ func initStoreKeys() ( inflationtypes.StoreKey, sudotypes.StoreKey, wasmtypes.StoreKey, - devgastypes.StoreKey, + devgas.StoreKey, tokenfactorytypes.StoreKey, evm.StoreKey, @@ -508,7 +508,7 @@ func (app *NibiruApp) InitKeepers( // DevGas uses WasmKeeper app.DevGasKeeper = devgaskeeper.NewKeeper( - keys[devgastypes.StoreKey], + keys[devgas.StoreKey], appCodec, app.BankKeeper, app.WasmKeeper, @@ -677,7 +677,7 @@ func (app *NibiruApp) initAppModules( app.GetSubspace(wasmtypes.ModuleName)), devgas.NewAppModule( app.DevGasKeeper, app.AccountKeeper, - app.GetSubspace(devgastypes.ModuleName)), + app.GetSubspace(devgas.ModuleName)), tokenfactory.NewAppModule( app.TokenFactoryKeeper, app.AccountKeeper, ), @@ -745,7 +745,7 @@ func orderedModuleNames() []string { // -------------------------------------------------------------------- // CosmWasm wasmtypes.ModuleName, - devgastypes.ModuleName, + devgas.ModuleName, tokenfactorytypes.ModuleName, // Everything else should be before genmsg @@ -904,7 +904,7 @@ func initParamsKeeper( paramsKeeper.Subspace(icahosttypes.SubModuleName) // wasm params keepers paramsKeeper.Subspace(wasmtypes.ModuleName) - paramsKeeper.Subspace(devgastypes.ModuleName) + paramsKeeper.Subspace(devgas.ModuleName) return paramsKeeper } diff --git a/app/keepers/all_keepers.go b/app/keepers/all_keepers.go index 06d08655c4..fc2c2562cb 100644 --- a/app/keepers/all_keepers.go +++ b/app/keepers/all_keepers.go @@ -23,7 +23,7 @@ import ( // Nibiru Custom Modules "github.com/NibiruChain/nibiru/v2/app/wasmext" - devgaskeeper "github.com/NibiruChain/nibiru/v2/x/devgas/v1/keeper" + devgaskeeper "github.com/NibiruChain/nibiru/v2/x/devgas/keeper" epochskeeper "github.com/NibiruChain/nibiru/v2/x/epochs/keeper" evmkeeper "github.com/NibiruChain/nibiru/v2/x/evm/keeper" inflationkeeper "github.com/NibiruChain/nibiru/v2/x/inflation/keeper" diff --git a/app/simapp/sim_test.go b/app/simapp/sim_test.go index ba58da5b8c..3573f1fb39 100644 --- a/app/simapp/sim_test.go +++ b/app/simapp/sim_test.go @@ -38,7 +38,7 @@ import ( "github.com/NibiruChain/nibiru/v2/app" "github.com/NibiruChain/nibiru/v2/app/codec" - devgastypes "github.com/NibiruChain/nibiru/v2/x/devgas/v1/types" + devgas "github.com/NibiruChain/nibiru/v2/x/devgas" epochstypes "github.com/NibiruChain/nibiru/v2/x/epochs/types" inflationtypes "github.com/NibiruChain/nibiru/v2/x/inflation/types" oracletypes "github.com/NibiruChain/nibiru/v2/x/oracle/types" @@ -289,7 +289,7 @@ func TestAppImportExport(t *testing.T) { {oldApp.GetKey(evidencetypes.StoreKey), newApp.GetKey(evidencetypes.StoreKey), [][]byte{}}, {oldApp.GetKey(capabilitytypes.StoreKey), newApp.GetKey(capabilitytypes.StoreKey), [][]byte{}}, {oldApp.GetKey(authzkeeper.StoreKey), newApp.GetKey(authzkeeper.StoreKey), [][]byte{authzkeeper.GrantKey, authzkeeper.GrantQueuePrefix}}, - {oldApp.GetKey(devgastypes.StoreKey), newApp.GetKey(devgastypes.StoreKey), [][]byte{}}, + {oldApp.GetKey(devgas.StoreKey), newApp.GetKey(devgas.StoreKey), [][]byte{}}, {oldApp.GetKey(epochstypes.StoreKey), newApp.GetKey(epochstypes.StoreKey), [][]byte{}}, {oldApp.GetKey(inflationtypes.StoreKey), newApp.GetKey(inflationtypes.StoreKey), [][]byte{}}, {oldApp.GetKey(oracletypes.StoreKey), newApp.GetKey(oracletypes.StoreKey), [][]byte{}}, diff --git a/app/wasmext/stargate_query.go b/app/wasmext/stargate_query.go index 2d90b6d580..ccc8095938 100644 --- a/app/wasmext/stargate_query.go +++ b/app/wasmext/stargate_query.go @@ -3,7 +3,7 @@ package wasmext import ( wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" - devgas "github.com/NibiruChain/nibiru/v2/x/devgas/v1/types" + devgas "github.com/NibiruChain/nibiru/v2/x/devgas" epochs "github.com/NibiruChain/nibiru/v2/x/epochs/types" inflation "github.com/NibiruChain/nibiru/v2/x/inflation/types" oracle "github.com/NibiruChain/nibiru/v2/x/oracle/types" diff --git a/app/wasmext/stargate_query_test.go b/app/wasmext/stargate_query_test.go index 1b8f981f13..dbbb3b86c9 100644 --- a/app/wasmext/stargate_query_test.go +++ b/app/wasmext/stargate_query_test.go @@ -12,7 +12,7 @@ import ( "github.com/NibiruChain/nibiru/v2/x/common/set" - devgas "github.com/NibiruChain/nibiru/v2/x/devgas/v1/types" + devgas "github.com/NibiruChain/nibiru/v2/x/devgas" epochs "github.com/NibiruChain/nibiru/v2/x/epochs/types" inflation "github.com/NibiruChain/nibiru/v2/x/inflation/types" oracle "github.com/NibiruChain/nibiru/v2/x/oracle/types" diff --git a/gosdk/querier.go b/gosdk/querier.go index 1ce1522b3a..8bc2ded72f 100644 --- a/gosdk/querier.go +++ b/gosdk/querier.go @@ -6,7 +6,7 @@ import ( wasm "github.com/CosmWasm/wasmd/x/wasm/types" "google.golang.org/grpc" - devgas "github.com/NibiruChain/nibiru/v2/x/devgas/v1/types" + devgas "github.com/NibiruChain/nibiru/v2/x/devgas" epochs "github.com/NibiruChain/nibiru/v2/x/epochs/types" "github.com/NibiruChain/nibiru/v2/x/evm" inflation "github.com/NibiruChain/nibiru/v2/x/inflation/types" diff --git a/proto/nibiru/devgas/v1/devgas.proto b/proto/nibiru/devgas/v1/devgas.proto index 38711a7ee4..b643ab0680 100644 --- a/proto/nibiru/devgas/v1/devgas.proto +++ b/proto/nibiru/devgas/v1/devgas.proto @@ -1,7 +1,7 @@ syntax = "proto3"; package nibiru.devgas.v1; -option go_package = "github.com/NibiruChain/nibiru/v2/x/devgas/v1/types"; +option go_package = "github.com/NibiruChain/nibiru/v2/x/devgas"; // FeeShare defines an instance that organizes fee distribution conditions for // the owner of a given smart contract diff --git a/proto/nibiru/devgas/v1/event.proto b/proto/nibiru/devgas/v1/event.proto index 10a67045b1..34ad6f730a 100644 --- a/proto/nibiru/devgas/v1/event.proto +++ b/proto/nibiru/devgas/v1/event.proto @@ -1,7 +1,7 @@ syntax = "proto3"; package nibiru.devgas.v1; -option go_package = "github.com/NibiruChain/nibiru/v2/x/devgas/v1/types"; +option go_package = "github.com/NibiruChain/nibiru/v2/x/devgas"; // ABCI event emitted when a deployer registers a contract to receive fee // sharing payouts, specifying the deployer, contract, and withdrawer addresses. diff --git a/proto/nibiru/devgas/v1/genesis.proto b/proto/nibiru/devgas/v1/genesis.proto index bd72093f57..d08044bf07 100644 --- a/proto/nibiru/devgas/v1/genesis.proto +++ b/proto/nibiru/devgas/v1/genesis.proto @@ -3,7 +3,7 @@ package nibiru.devgas.v1; import "nibiru/devgas/v1/devgas.proto"; import "gogoproto/gogo.proto"; -option go_package = "github.com/NibiruChain/nibiru/v2/x/devgas/v1/types"; +option go_package = "github.com/NibiruChain/nibiru/v2/x/devgas"; // GenesisState defines the module's genesis state. message GenesisState { diff --git a/proto/nibiru/devgas/v1/query.proto b/proto/nibiru/devgas/v1/query.proto index c9a26c9914..b890403e9f 100644 --- a/proto/nibiru/devgas/v1/query.proto +++ b/proto/nibiru/devgas/v1/query.proto @@ -7,7 +7,7 @@ import "nibiru/devgas/v1/devgas.proto"; import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; -option go_package = "github.com/NibiruChain/nibiru/v2/x/devgas/v1/types"; +option go_package = "github.com/NibiruChain/nibiru/v2/x/devgas"; // Query defines the gRPC querier service. service Query { diff --git a/proto/nibiru/devgas/v1/tx.proto b/proto/nibiru/devgas/v1/tx.proto index 33f798a7ca..6503c40b75 100644 --- a/proto/nibiru/devgas/v1/tx.proto +++ b/proto/nibiru/devgas/v1/tx.proto @@ -8,7 +8,7 @@ import "cosmos/msg/v1/msg.proto"; import "cosmos_proto/cosmos.proto"; import "nibiru/devgas/v1/genesis.proto"; -option go_package = "github.com/NibiruChain/nibiru/v2/x/devgas/v1/types"; +option go_package = "github.com/NibiruChain/nibiru/v2/x/devgas"; // Msg defines the fees Msg service. service Msg { diff --git a/x/devgas/v1/README.md b/x/devgas/README.md similarity index 100% rename from x/devgas/v1/README.md rename to x/devgas/README.md diff --git a/x/devgas/v1/ante/ante.go b/x/devgas/ante/ante.go similarity index 89% rename from x/devgas/v1/ante/ante.go rename to x/devgas/ante/ante.go index 697a46698f..2b67004a77 100644 --- a/x/devgas/v1/ante/ante.go +++ b/x/devgas/ante/ante.go @@ -9,7 +9,7 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - devgastypes "github.com/NibiruChain/nibiru/v2/x/devgas/v1/types" + "github.com/NibiruChain/nibiru/v2/x/devgas" ) var _ sdk.AnteDecorator = (*DevGasPayoutDecorator)(nil) @@ -77,11 +77,11 @@ func (a DevGasPayoutDecorator) devGasPayout( bz, err := json.Marshal(feesPaidOutput) if err != nil { - return devgastypes.ErrFeeSharePayment.Wrapf("failed to marshal feesPaidOutput: %s", err.Error()) + return devgas.ErrFeeSharePayment.Wrapf("failed to marshal feesPaidOutput: %s", err.Error()) } return ctx.EventManager().EmitTypedEvent( - &devgastypes.EventPayoutDevGas{Payouts: string(bz)}, + &devgas.EventPayoutDevGas{Payouts: string(bz)}, ) } @@ -92,7 +92,7 @@ type FeeSharePayoutEventOutput struct { // settleFeePayments sends the funds to the contract developers func (a DevGasPayoutDecorator) settleFeePayments( - ctx sdk.Context, toPay []sdk.AccAddress, params devgastypes.ModuleParams, totalFees sdk.Coins, + ctx sdk.Context, toPay []sdk.AccAddress, params devgas.ModuleParams, totalFees sdk.Coins, ) ([]FeeSharePayoutEventOutput, error) { allowedFees := getAllowedFees(params, totalFees) @@ -111,7 +111,7 @@ func (a DevGasPayoutDecorator) settleFeePayments( } if err != nil { - return nil, devgastypes.ErrFeeSharePayment.Wrapf("failed to pay allowedFees to contract developer: %s", err.Error()) + return nil, devgas.ErrFeeSharePayment.Wrapf("failed to pay allowedFees to contract developer: %s", err.Error()) } } } @@ -121,7 +121,7 @@ func (a DevGasPayoutDecorator) settleFeePayments( // getAllowedFees gets the allowed fees to be paid based on the module // parameters of x/devgas -func getAllowedFees(params devgastypes.ModuleParams, totalFees sdk.Coins) sdk.Coins { +func getAllowedFees(params devgas.ModuleParams, totalFees sdk.Coins) sdk.Coins { // Get only allowed governance fees to be paid (helps for taxes) var allowedFees sdk.Coins if len(params.AllowedDenoms) == 0 { diff --git a/x/devgas/v1/ante/ante_test.go b/x/devgas/ante/ante_test.go similarity index 95% rename from x/devgas/v1/ante/ante_test.go rename to x/devgas/ante/ante_test.go index 75a974e041..e1a1672409 100644 --- a/x/devgas/v1/ante/ante_test.go +++ b/x/devgas/ante/ante_test.go @@ -17,8 +17,8 @@ import ( "github.com/NibiruChain/nibiru/v2/app" "github.com/NibiruChain/nibiru/v2/x/common/testutil" "github.com/NibiruChain/nibiru/v2/x/common/testutil/testapp" - devgasante "github.com/NibiruChain/nibiru/v2/x/devgas/v1/ante" - devgastypes "github.com/NibiruChain/nibiru/v2/x/devgas/v1/types" + devgas "github.com/NibiruChain/nibiru/v2/x/devgas" + devgasante "github.com/NibiruChain/nibiru/v2/x/devgas/ante" ) type AnteTestSuite struct { @@ -145,8 +145,8 @@ func (suite *AnteTestSuite) TestDevGasPayout() { } devGasForWithdrawer := func( contractIdx int, withdrawerIdx int, - ) devgastypes.FeeShare { - return devgastypes.FeeShare{ + ) devgas.FeeShare { + return devgas.FeeShare{ ContractAddress: contracts[contractIdx].String(), DeployerAddress: deployerAddr.String(), WithdrawerAddress: withdrawAddrs[withdrawerIdx].String(), @@ -155,14 +155,14 @@ func (suite *AnteTestSuite) TestDevGasPayout() { testCases := []struct { name string - devGasState []devgastypes.FeeShare + devGasState []devgas.FeeShare wantWithdrawerRoyalties sdk.Coins wantErr bool setup func() (*app.NibiruApp, sdk.Context) }{ { name: "1 contract, 1 exec, 1 withdrawer", - devGasState: []devgastypes.FeeShare{ + devGasState: []devgas.FeeShare{ devGasForWithdrawer(0, 0), }, // The expected royalty is gas / num_withdrawers / 2. Thus, We @@ -180,7 +180,7 @@ func (suite *AnteTestSuite) TestDevGasPayout() { }, { name: "1 contract, 4 exec, 2 withdrawer", - devGasState: []devgastypes.FeeShare{ + devGasState: []devgas.FeeShare{ devGasForWithdrawer(0, 0), devGasForWithdrawer(1, 0), devGasForWithdrawer(2, 1), @@ -201,7 +201,7 @@ func (suite *AnteTestSuite) TestDevGasPayout() { }, { name: "err: empty fee collector module account", - devGasState: []devgastypes.FeeShare{ + devGasState: []devgas.FeeShare{ devGasForWithdrawer(0, 0), }, // The expected royalty is gas / num_withdrawers / 2. Thus, We @@ -216,7 +216,7 @@ func (suite *AnteTestSuite) TestDevGasPayout() { }, { name: "happy: no registered dev gas contracts", - devGasState: []devgastypes.FeeShare{}, + devGasState: []devgas.FeeShare{}, // The expected royalty is gas / num_withdrawers / 2. Thus, We // divide gas by (num_withdrawers * 2). The 2 comes from 50% split. // wantWithdrawerRoyalties: num_withdrawers * 2 = 2 diff --git a/x/devgas/v1/ante/expected_keepers.go b/x/devgas/ante/expected_keepers.go similarity index 68% rename from x/devgas/v1/ante/expected_keepers.go rename to x/devgas/ante/expected_keepers.go index f961e9705f..b68fae41c7 100644 --- a/x/devgas/v1/ante/expected_keepers.go +++ b/x/devgas/ante/expected_keepers.go @@ -5,7 +5,7 @@ package ante import ( sdk "github.com/cosmos/cosmos-sdk/types" - devgastypes "github.com/NibiruChain/nibiru/v2/x/devgas/v1/types" + "github.com/NibiruChain/nibiru/v2/x/devgas" ) type BankKeeper interface { @@ -20,6 +20,6 @@ type BankKeeper interface { } type IDevGasKeeper interface { - GetParams(ctx sdk.Context) devgastypes.ModuleParams - GetFeeShare(ctx sdk.Context, contract sdk.Address) (devgastypes.FeeShare, bool) + GetParams(ctx sdk.Context) devgas.ModuleParams + GetFeeShare(ctx sdk.Context, contract sdk.Address) (devgas.FeeShare, bool) } diff --git a/x/devgas/v1/client/cli/cli_test.go b/x/devgas/client/cli/cli_test.go similarity index 98% rename from x/devgas/v1/client/cli/cli_test.go rename to x/devgas/client/cli/cli_test.go index 544948f95b..842297787c 100644 --- a/x/devgas/v1/client/cli/cli_test.go +++ b/x/devgas/client/cli/cli_test.go @@ -21,8 +21,8 @@ import ( svrcmd "github.com/cosmos/cosmos-sdk/server/cmd" "github.com/NibiruChain/nibiru/v2/x/common/testutil" - devgas "github.com/NibiruChain/nibiru/v2/x/devgas/v1" - "github.com/NibiruChain/nibiru/v2/x/devgas/v1/client/cli" + devgas "github.com/NibiruChain/nibiru/v2/x/devgas" + "github.com/NibiruChain/nibiru/v2/x/devgas/client/cli" ) // CLITestSuite: Tests all tx commands for the module. diff --git a/x/devgas/v1/client/cli/query.go b/x/devgas/client/cli/query.go similarity index 88% rename from x/devgas/v1/client/cli/query.go rename to x/devgas/client/cli/query.go index 740441331f..543f7a0fa5 100644 --- a/x/devgas/v1/client/cli/query.go +++ b/x/devgas/client/cli/query.go @@ -10,14 +10,14 @@ import ( "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/version" - "github.com/NibiruChain/nibiru/v2/x/devgas/v1/types" + "github.com/NibiruChain/nibiru/v2/x/devgas" ) // GetQueryCmd returns the cli query commands for this module func GetQueryCmd() *cobra.Command { feesQueryCmd := &cobra.Command{ - Use: types.ModuleName, - Short: fmt.Sprintf("Querying commands for the %s module", types.ModuleName), + Use: devgas.ModuleName, + Short: fmt.Sprintf("Querying commands for the %s module", devgas.ModuleName), DisableFlagParsing: true, SuggestionsMinimumDistance: 2, RunE: client.ValidateCmd, @@ -42,7 +42,7 @@ func GetCmdQueryFeeShares() *cobra.Command { Long: "Query dev gas contracts registered with a deployer", Args: cobra.ExactArgs(1), Example: fmt.Sprintf("%s query %s deployer-contracts ", - version.AppName, types.ModuleName, + version.AppName, devgas.ModuleName, ), RunE: func(cmd *cobra.Command, args []string) error { @@ -50,10 +50,10 @@ func GetCmdQueryFeeShares() *cobra.Command { if err != nil { return err } - queryClient := types.NewQueryClient(clientCtx) + queryClient := devgas.NewQueryClient(clientCtx) deployer := args[0] - req := &types.QueryFeeSharesRequest{ + req := &devgas.QueryFeeSharesRequest{ Deployer: deployer, } if err := req.ValidateBasic(); err != nil { @@ -89,9 +89,9 @@ func GetCmdQueryFeeShare() *cobra.Command { return err } - queryClient := types.NewQueryClient(clientCtx) + queryClient := devgas.NewQueryClient(clientCtx) - req := &types.QueryFeeShareRequest{ContractAddress: args[0]} + req := &devgas.QueryFeeShareRequest{ContractAddress: args[0]} if err := req.ValidateBasic(); err != nil { return err } @@ -121,9 +121,9 @@ func GetCmdQueryParams() *cobra.Command { if err != nil { return err } - queryClient := types.NewQueryClient(clientCtx) + queryClient := devgas.NewQueryClient(clientCtx) - params := &types.QueryParamsRequest{} + params := &devgas.QueryParamsRequest{} res, err := queryClient.Params(context.Background(), params) if err != nil { @@ -155,9 +155,9 @@ func GetCmdQueryFeeSharesByWithdrawer() *cobra.Command { return err } - queryClient := types.NewQueryClient(clientCtx) + queryClient := devgas.NewQueryClient(clientCtx) - withdrawReq := &types.QueryFeeSharesByWithdrawerRequest{ + withdrawReq := &devgas.QueryFeeSharesByWithdrawerRequest{ WithdrawerAddress: args[0], } diff --git a/x/devgas/v1/client/cli/tx.go b/x/devgas/client/cli/tx.go similarity index 94% rename from x/devgas/v1/client/cli/tx.go rename to x/devgas/client/cli/tx.go index f5fb650653..c6d1d18344 100644 --- a/x/devgas/v1/client/cli/tx.go +++ b/x/devgas/client/cli/tx.go @@ -10,14 +10,14 @@ import ( "github.com/cosmos/cosmos-sdk/client/tx" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/NibiruChain/nibiru/v2/x/devgas/v1/types" + "github.com/NibiruChain/nibiru/v2/x/devgas" ) // NewTxCmd returns a root CLI command handler for certain modules/FeeShare // transaction commands. func NewTxCmd() *cobra.Command { txCmd := &cobra.Command{ - Use: types.ModuleName, + Use: devgas.ModuleName, Short: "FeeShare subcommands", DisableFlagParsing: true, SuggestionsMinimumDistance: 2, @@ -51,7 +51,7 @@ func CmdRegisterFeeShare() *cobra.Command { contract := args[0] withdrawer := args[1] - msg := &types.MsgRegisterFeeShare{ + msg := &devgas.MsgRegisterFeeShare{ ContractAddress: contract, DeployerAddress: deployer.String(), WithdrawerAddress: withdrawer, @@ -87,7 +87,7 @@ func CmdCancelFeeShare() *cobra.Command { contract := args[0] - msg := &types.MsgCancelFeeShare{ + msg := &devgas.MsgCancelFeeShare{ ContractAddress: contract, DeployerAddress: deployer.String(), } @@ -127,7 +127,7 @@ func CmdUpdateFeeShare() *cobra.Command { withdrawer := args[1] - msg := &types.MsgUpdateFeeShare{ + msg := &devgas.MsgUpdateFeeShare{ ContractAddress: contract, DeployerAddress: deployer.String(), WithdrawerAddress: withdrawer, diff --git a/x/devgas/v1/types/codec.go b/x/devgas/codec.go similarity index 99% rename from x/devgas/v1/types/codec.go rename to x/devgas/codec.go index ecedea2e11..9743f22c75 100644 --- a/x/devgas/v1/types/codec.go +++ b/x/devgas/codec.go @@ -1,4 +1,4 @@ -package types +package devgas import ( "github.com/cosmos/cosmos-sdk/codec" diff --git a/x/devgas/v1/types/codec_test.go b/x/devgas/codec_test.go similarity index 98% rename from x/devgas/v1/types/codec_test.go rename to x/devgas/codec_test.go index 3759d4fd88..f1908063da 100644 --- a/x/devgas/v1/types/codec_test.go +++ b/x/devgas/codec_test.go @@ -1,4 +1,4 @@ -package types +package devgas import ( "testing" diff --git a/x/devgas/v1/types/devgas.go b/x/devgas/devgas.go similarity index 99% rename from x/devgas/v1/types/devgas.go rename to x/devgas/devgas.go index 97e6a1ed59..cb8e481035 100644 --- a/x/devgas/v1/types/devgas.go +++ b/x/devgas/devgas.go @@ -1,4 +1,4 @@ -package types +package devgas import ( errorsmod "cosmossdk.io/errors" diff --git a/x/devgas/v1/types/devgas.pb.go b/x/devgas/devgas.pb.go similarity index 96% rename from x/devgas/v1/types/devgas.pb.go rename to x/devgas/devgas.pb.go index bbcf512e8a..88c2f0b590 100644 --- a/x/devgas/v1/types/devgas.pb.go +++ b/x/devgas/devgas.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. // source: nibiru/devgas/v1/devgas.proto -package types +package devgas import ( fmt "fmt" @@ -97,7 +97,7 @@ func init() { func init() { proto.RegisterFile("nibiru/devgas/v1/devgas.proto", fileDescriptor_f71dc4524d1e4ffb) } var fileDescriptor_f71dc4524d1e4ffb = []byte{ - // 213 bytes of a gzipped FileDescriptorProto + // 208 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xcd, 0xcb, 0x4c, 0xca, 0x2c, 0x2a, 0xd5, 0x4f, 0x49, 0x2d, 0x4b, 0x4f, 0x2c, 0xd6, 0x2f, 0x33, 0x84, 0xb2, 0xf4, 0x0a, 0x8a, 0xf2, 0x4b, 0xf2, 0x85, 0x04, 0x20, 0xd2, 0x7a, 0x50, 0xc1, 0x32, 0x43, 0xa5, 0x7e, 0x46, @@ -106,12 +106,11 @@ var fileDescriptor_f71dc4524d1e4ffb = []byte{ 0x05, 0x46, 0x0d, 0xce, 0x20, 0x7e, 0x98, 0xb8, 0x23, 0x44, 0x18, 0xa4, 0x34, 0x25, 0xb5, 0x20, 0x27, 0xbf, 0x32, 0xb5, 0x08, 0xae, 0x94, 0x09, 0xa2, 0x14, 0x26, 0x0e, 0x53, 0xaa, 0xcb, 0x25, 0x54, 0x9e, 0x59, 0x92, 0x91, 0x52, 0x94, 0x58, 0x8e, 0xa4, 0x98, 0x19, 0xac, 0x58, 0x10, 0x21, - 0x03, 0x55, 0xee, 0xe4, 0x73, 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x0f, 0x1e, 0xc9, - 0x31, 0x4e, 0x78, 0x2c, 0xc7, 0x70, 0xe1, 0xb1, 0x1c, 0xc3, 0x8d, 0xc7, 0x72, 0x0c, 0x51, 0x46, + 0x03, 0x55, 0xee, 0xe4, 0x7c, 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x0f, 0x1e, 0xc9, + 0x31, 0x4e, 0x78, 0x2c, 0xc7, 0x70, 0xe1, 0xb1, 0x1c, 0xc3, 0x8d, 0xc7, 0x72, 0x0c, 0x51, 0x9a, 0xe9, 0x99, 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0xfa, 0x7e, 0x60, 0x8f, 0x38, 0x67, - 0x24, 0x66, 0xe6, 0xe9, 0x43, 0xfd, 0x5c, 0x66, 0xa4, 0x5f, 0x81, 0xe4, 0xf1, 0x92, 0xca, 0x82, - 0xd4, 0xe2, 0x24, 0x36, 0xb0, 0xc7, 0x8d, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xbf, 0x1b, 0x82, - 0x7a, 0x19, 0x01, 0x00, 0x00, + 0x24, 0x66, 0xe6, 0xe9, 0x43, 0xfd, 0x5c, 0x66, 0xa4, 0x5f, 0x01, 0xf5, 0x6e, 0x12, 0x1b, 0xd8, + 0xbf, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x7f, 0x19, 0xe8, 0x10, 0x01, 0x00, 0x00, } func (m *FeeShare) Marshal() (dAtA []byte, err error) { diff --git a/x/devgas/v1/types/devgas_test.go b/x/devgas/devgas_test.go similarity index 99% rename from x/devgas/v1/types/devgas_test.go rename to x/devgas/devgas_test.go index 72add1d0e7..3e77538cd1 100644 --- a/x/devgas/v1/types/devgas_test.go +++ b/x/devgas/devgas_test.go @@ -1,4 +1,4 @@ -package types +package devgas import ( "testing" diff --git a/x/devgas/v1/genesis.go b/x/devgas/devgasmodule/genesis.go similarity index 71% rename from x/devgas/v1/genesis.go rename to x/devgas/devgasmodule/genesis.go index 7b95912ed0..e566b07059 100644 --- a/x/devgas/v1/genesis.go +++ b/x/devgas/devgasmodule/genesis.go @@ -5,15 +5,15 @@ import ( "github.com/NibiruChain/collections" - "github.com/NibiruChain/nibiru/v2/x/devgas/v1/keeper" - "github.com/NibiruChain/nibiru/v2/x/devgas/v1/types" + "github.com/NibiruChain/nibiru/v2/x/devgas/keeper" + "github.com/NibiruChain/nibiru/v2/x/devgas" ) // InitGenesis import module genesis func InitGenesis( ctx sdk.Context, k keeper.Keeper, - data types.GenesisState, + data devgas.GenesisState, ) { if err := data.Validate(); err != nil { panic(err) @@ -28,8 +28,8 @@ func InitGenesis( } // ExportGenesis export module state -func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { - return &types.GenesisState{ +func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *devgas.GenesisState { + return &devgas.GenesisState{ Params: k.GetParams(ctx), FeeShare: k.DevGasStore.Iterate(ctx, collections.Range[string]{}).Values(), } diff --git a/x/devgas/v1/genesis_test.go b/x/devgas/devgasmodule/genesis_test.go similarity index 72% rename from x/devgas/v1/genesis_test.go rename to x/devgas/devgasmodule/genesis_test.go index 7c450f6083..d151877062 100644 --- a/x/devgas/v1/genesis_test.go +++ b/x/devgas/devgasmodule/genesis_test.go @@ -12,8 +12,8 @@ import ( "github.com/NibiruChain/nibiru/v2/app" "github.com/NibiruChain/nibiru/v2/x/common/testutil" "github.com/NibiruChain/nibiru/v2/x/common/testutil/testapp" - devgas "github.com/NibiruChain/nibiru/v2/x/devgas/v1" - devgastypes "github.com/NibiruChain/nibiru/v2/x/devgas/v1/types" + "github.com/NibiruChain/nibiru/v2/x/devgas/devgasmodule" + devgas "github.com/NibiruChain/nibiru/v2/x/devgas" ) type GenesisTestSuite struct { @@ -22,7 +22,7 @@ type GenesisTestSuite struct { app *app.NibiruApp ctx sdk.Context - genesis devgastypes.GenesisState + genesis devgas.GenesisState } func TestGenesisTestSuite(t *testing.T) { @@ -35,14 +35,14 @@ func (s *GenesisTestSuite) SetupTest() { s.app = app s.ctx = ctx - s.genesis = *devgastypes.DefaultGenesisState() + s.genesis = *devgas.DefaultGenesisState() } func (s *GenesisTestSuite) TestGenesis() { randomAddr := testutil.AccAddress().String() testCases := []struct { name string - genesis devgastypes.GenesisState + genesis devgas.GenesisState expPanic bool }{ { @@ -52,10 +52,10 @@ func (s *GenesisTestSuite) TestGenesis() { }, { name: "custom genesis - feeshare disabled", - genesis: devgastypes.GenesisState{ - Params: devgastypes.ModuleParams{ + genesis: devgas.GenesisState{ + Params: devgas.ModuleParams{ EnableFeeShare: false, - DeveloperShares: devgastypes.DefaultDeveloperShares, + DeveloperShares: devgas.DefaultDeveloperShares, AllowedDenoms: []string{"unibi"}, }, }, @@ -63,8 +63,8 @@ func (s *GenesisTestSuite) TestGenesis() { }, { name: "custom genesis - feeshare enabled, 0% developer shares", - genesis: devgastypes.GenesisState{ - Params: devgastypes.ModuleParams{ + genesis: devgas.GenesisState{ + Params: devgas.ModuleParams{ EnableFeeShare: true, DeveloperShares: math.LegacyNewDecWithPrec(0, 2), AllowedDenoms: []string{"unibi"}, @@ -74,8 +74,8 @@ func (s *GenesisTestSuite) TestGenesis() { }, { name: "custom genesis - feeshare enabled, 100% developer shares", - genesis: devgastypes.GenesisState{ - Params: devgastypes.ModuleParams{ + genesis: devgas.GenesisState{ + Params: devgas.ModuleParams{ EnableFeeShare: true, DeveloperShares: math.LegacyNewDecWithPrec(100, 2), AllowedDenoms: []string{"unibi"}, @@ -85,13 +85,13 @@ func (s *GenesisTestSuite) TestGenesis() { }, { name: "custom genesis - feeshare enabled, all denoms allowed", - genesis: devgastypes.GenesisState{ - Params: devgastypes.ModuleParams{ + genesis: devgas.GenesisState{ + Params: devgas.ModuleParams{ EnableFeeShare: true, DeveloperShares: math.LegacyNewDecWithPrec(10, 2), AllowedDenoms: []string{}, }, - FeeShare: []devgastypes.FeeShare{ + FeeShare: []devgas.FeeShare{ { ContractAddress: randomAddr, DeployerAddress: randomAddr, @@ -103,7 +103,7 @@ func (s *GenesisTestSuite) TestGenesis() { }, { name: "empty genesis", - genesis: devgastypes.GenesisState{}, + genesis: devgas.GenesisState{}, expPanic: true, }, } @@ -114,17 +114,17 @@ func (s *GenesisTestSuite) TestGenesis() { if tc.expPanic { s.Require().Panics(func() { - devgas.InitGenesis(s.ctx, s.app.DevGasKeeper, tc.genesis) + devgasmodule.InitGenesis(s.ctx, s.app.DevGasKeeper, tc.genesis) }) } else { s.Require().NotPanics(func() { - devgas.InitGenesis(s.ctx, s.app.DevGasKeeper, tc.genesis) + devgasmodule.InitGenesis(s.ctx, s.app.DevGasKeeper, tc.genesis) }) params := s.app.DevGasKeeper.GetParams(s.ctx) s.Require().EqualValues(tc.genesis.Params, params) - gen := devgas.ExportGenesis(s.ctx, s.app.DevGasKeeper) + gen := devgasmodule.ExportGenesis(s.ctx, s.app.DevGasKeeper) s.NoError(gen.Validate()) } }) diff --git a/x/devgas/v1/module.go b/x/devgas/devgasmodule/module.go similarity index 87% rename from x/devgas/v1/module.go rename to x/devgas/devgasmodule/module.go index 6f3ca969ec..77c7e0869b 100644 --- a/x/devgas/v1/module.go +++ b/x/devgas/devgasmodule/module.go @@ -16,11 +16,11 @@ import ( "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/spf13/cobra" - "github.com/NibiruChain/nibiru/v2/x/devgas/v1/client/cli" - "github.com/NibiruChain/nibiru/v2/x/devgas/v1/exported" - "github.com/NibiruChain/nibiru/v2/x/devgas/v1/keeper" - "github.com/NibiruChain/nibiru/v2/x/devgas/v1/simulation" - "github.com/NibiruChain/nibiru/v2/x/devgas/v1/types" + "github.com/NibiruChain/nibiru/v2/x/devgas/client/cli" + "github.com/NibiruChain/nibiru/v2/x/devgas/exported" + "github.com/NibiruChain/nibiru/v2/x/devgas/keeper" + "github.com/NibiruChain/nibiru/v2/x/devgas/simulation" + "github.com/NibiruChain/nibiru/v2/x/devgas" ) // type check to ensure the interface is properly implemented @@ -38,13 +38,13 @@ type AppModuleBasic struct{} // Name returns the fees module's name. func (AppModuleBasic) Name() string { - return types.ModuleName + return devgas.ModuleName } // RegisterLegacyAminoCodec performs a no-op as the fees do not support Amino // encoding. func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *sdkcodec.LegacyAmino) { - types.RegisterLegacyAminoCodec(cdc) + devgas.RegisterLegacyAminoCodec(cdc) } // ConsensusVersion returns the consensus state-breaking version for the module. @@ -57,22 +57,22 @@ func (AppModuleBasic) ConsensusVersion() uint64 { func (AppModuleBasic) RegisterInterfaces( interfaceRegistry sdkcodectypes.InterfaceRegistry, ) { - types.RegisterInterfaces(interfaceRegistry) + devgas.RegisterInterfaces(interfaceRegistry) } // DefaultGenesis returns default genesis state as raw bytes for the fees // module. func (AppModuleBasic) DefaultGenesis(cdc sdkcodec.JSONCodec) json.RawMessage { - return cdc.MustMarshalJSON(types.DefaultGenesisState()) + return cdc.MustMarshalJSON(devgas.DefaultGenesisState()) } // ValidateGenesis performs genesis state validation for the fees module. func (b AppModuleBasic) ValidateGenesis( cdc sdkcodec.JSONCodec, _ sdkclient.TxEncodingConfig, bz json.RawMessage, ) error { - var genesisState types.GenesisState + var genesisState devgas.GenesisState if err := cdc.UnmarshalJSON(bz, &genesisState); err != nil { - return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) + return fmt.Errorf("failed to unmarshal %s genesis state: %w", devgas.ModuleName, err) } return genesisState.Validate() @@ -83,7 +83,7 @@ func (b AppModuleBasic) ValidateGenesis( func (b AppModuleBasic) RegisterGRPCGatewayRoutes( c sdkclient.Context, serveMux *runtime.ServeMux, ) { - if err := types.RegisterQueryHandlerClient(context.Background(), serveMux, types.NewQueryClient(c)); err != nil { + if err := devgas.RegisterQueryHandlerClient(context.Background(), serveMux, devgas.NewQueryClient(c)); err != nil { panic(err) } } @@ -126,7 +126,7 @@ func NewAppModule( // Name returns the fees module's name. func (AppModule) Name() string { - return types.ModuleName + return devgas.ModuleName } // RegisterInvariants registers the fees module's invariants. @@ -134,14 +134,14 @@ func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {} // QuerierRoute returns the module's query routing key. func (am AppModule) QuerierRoute() string { - return types.RouterKey + return devgas.RouterKey } // RegisterServices registers a GRPC query service to respond to the // module-specific GRPC queries. func (am AppModule) RegisterServices(cfg module.Configurator) { - types.RegisterMsgServer(cfg.MsgServer(), am.keeper) - types.RegisterQueryServer( + devgas.RegisterMsgServer(cfg.MsgServer(), am.keeper) + devgas.RegisterQueryServer( cfg.QueryServer(), keeper.NewQuerier(am.keeper), ) } @@ -159,7 +159,7 @@ func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.Valid // InitGenesis performs the fees module's genesis initialization. It returns // no validator updates. func (am AppModule) InitGenesis(ctx sdk.Context, cdc sdkcodec.JSONCodec, data json.RawMessage) []abci.ValidatorUpdate { - var genesisState types.GenesisState + var genesisState devgas.GenesisState cdc.MustUnmarshalJSON(data, &genesisState) InitGenesis(ctx, am.keeper, genesisState) diff --git a/x/devgas/v1/module_test.go b/x/devgas/devgasmodule/module_test.go similarity index 83% rename from x/devgas/v1/module_test.go rename to x/devgas/devgasmodule/module_test.go index 7723c59c0d..b3ea02e2f2 100644 --- a/x/devgas/v1/module_test.go +++ b/x/devgas/devgasmodule/module_test.go @@ -4,13 +4,13 @@ import ( abci "github.com/cometbft/cometbft/abci/types" "github.com/NibiruChain/nibiru/v2/app/codec" - devgas "github.com/NibiruChain/nibiru/v2/x/devgas/v1" - devgastypes "github.com/NibiruChain/nibiru/v2/x/devgas/v1/types" + devgasmodule "github.com/NibiruChain/nibiru/v2/x/devgas/devgasmodule" + "github.com/NibiruChain/nibiru/v2/x/devgas" ) func (s *GenesisTestSuite) TestAppModule() { s.SetupTest() - appModule := devgas.NewAppModule( + appModule := devgasmodule.NewAppModule( s.app.DevGasKeeper, s.app.AccountKeeper, s.app.GetSubspace(devgastypes.ModuleName), @@ -25,7 +25,7 @@ func (s *GenesisTestSuite) TestAppModule() { cdc := s.app.AppCodec() jsonBz := appModule.ExportGenesis(s.ctx, cdc) - genState := new(devgastypes.GenesisState) + genState := new(devgas.GenesisState) err := cdc.UnmarshalJSON(jsonBz, genState) s.NoError(err) s.EqualValues(s.genesis, *genState) diff --git a/x/devgas/v1/types/errors.go b/x/devgas/errors.go similarity index 97% rename from x/devgas/v1/types/errors.go rename to x/devgas/errors.go index 231c8557e1..6e4bbabced 100644 --- a/x/devgas/v1/types/errors.go +++ b/x/devgas/errors.go @@ -1,4 +1,4 @@ -package types +package devgas import ( errorsmod "cosmossdk.io/errors" diff --git a/x/devgas/v1/types/event.pb.go b/x/devgas/event.pb.go similarity index 98% rename from x/devgas/v1/types/event.pb.go rename to x/devgas/event.pb.go index dcb56d85c5..245844c901 100644 --- a/x/devgas/v1/types/event.pb.go +++ b/x/devgas/event.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. // source: nibiru/devgas/v1/event.proto -package types +package devgas import ( fmt "fmt" @@ -274,7 +274,7 @@ func init() { func init() { proto.RegisterFile("nibiru/devgas/v1/event.proto", fileDescriptor_dd3ce94d3a226edf) } var fileDescriptor_dd3ce94d3a226edf = []byte{ - // 259 bytes of a gzipped FileDescriptorProto + // 254 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xc9, 0xcb, 0x4c, 0xca, 0x2c, 0x2a, 0xd5, 0x4f, 0x49, 0x2d, 0x4b, 0x4f, 0x2c, 0xd6, 0x2f, 0x33, 0xd4, 0x4f, 0x2d, 0x4b, 0xcd, 0x2b, 0xd1, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x80, 0xc8, 0xea, 0x41, 0x64, 0xf5, @@ -286,12 +286,11 @@ var fileDescriptor_dd3ce94d3a226edf = []byte{ 0x79, 0x73, 0x09, 0x82, 0xad, 0x73, 0x4e, 0xcc, 0x4b, 0x4e, 0xcd, 0xa1, 0xcc, 0x32, 0xa5, 0x6c, 0xa8, 0x61, 0xa1, 0x05, 0x29, 0x89, 0x25, 0xa9, 0x34, 0x76, 0xb9, 0x2e, 0xd4, 0xb2, 0x80, 0xc4, 0xca, 0xfc, 0xd2, 0x12, 0xa8, 0x65, 0x12, 0x5c, 0xec, 0x05, 0x60, 0x7e, 0x31, 0xd4, 0x2e, 0x18, - 0xd7, 0xc9, 0xe7, 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, 0xe4, 0x18, 0x1f, 0x3c, 0x92, 0x63, 0x9c, - 0xf0, 0x58, 0x8e, 0xe1, 0xc2, 0x63, 0x39, 0x86, 0x1b, 0x8f, 0xe5, 0x18, 0xa2, 0x8c, 0xd2, 0x33, + 0xd7, 0xc9, 0xf9, 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, 0xe4, 0x18, 0x1f, 0x3c, 0x92, 0x63, 0x9c, + 0xf0, 0x58, 0x8e, 0xe1, 0xc2, 0x63, 0x39, 0x86, 0x1b, 0x8f, 0xe5, 0x18, 0xa2, 0x34, 0xd3, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0xfd, 0xc0, 0xd1, 0xe1, 0x9c, 0x91, 0x98, - 0x99, 0xa7, 0x0f, 0x8d, 0xb8, 0x32, 0x23, 0xfd, 0x0a, 0xa4, 0xd8, 0x2b, 0xa9, 0x2c, 0x48, 0x2d, - 0x4e, 0x62, 0x03, 0x47, 0x9f, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0xf0, 0x57, 0x64, 0x78, 0xde, - 0x01, 0x00, 0x00, + 0x99, 0xa7, 0x0f, 0x8d, 0xb8, 0x32, 0x23, 0xfd, 0x0a, 0x68, 0xec, 0x25, 0xb1, 0x81, 0x63, 0xcd, + 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0x06, 0x97, 0x60, 0x8d, 0xd5, 0x01, 0x00, 0x00, } func (m *EventRegisterDevGas) Marshal() (dAtA []byte, err error) { diff --git a/x/devgas/v1/types/expected_keepers.go b/x/devgas/expected_keepers.go similarity index 98% rename from x/devgas/v1/types/expected_keepers.go rename to x/devgas/expected_keepers.go index 1592cf2bf6..01c8a58f73 100644 --- a/x/devgas/v1/types/expected_keepers.go +++ b/x/devgas/expected_keepers.go @@ -1,4 +1,4 @@ -package types +package devgas import ( wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" diff --git a/x/devgas/v1/types/export.go b/x/devgas/export.go similarity index 95% rename from x/devgas/v1/types/export.go rename to x/devgas/export.go index fb4b6e3b6f..caafc10c70 100644 --- a/x/devgas/v1/types/export.go +++ b/x/devgas/export.go @@ -1,4 +1,4 @@ -package types +package devgas import ( grpc "google.golang.org/grpc" diff --git a/x/devgas/v1/exported/exported.go b/x/devgas/exported/exported.go similarity index 100% rename from x/devgas/v1/exported/exported.go rename to x/devgas/exported/exported.go diff --git a/x/devgas/v1/types/genesis.go b/x/devgas/genesis.go similarity index 98% rename from x/devgas/v1/types/genesis.go rename to x/devgas/genesis.go index 1b0600dc9b..440d0c8e68 100644 --- a/x/devgas/v1/types/genesis.go +++ b/x/devgas/genesis.go @@ -1,4 +1,4 @@ -package types +package devgas import "fmt" diff --git a/x/devgas/v1/types/genesis.pb.go b/x/devgas/genesis.pb.go similarity index 87% rename from x/devgas/v1/types/genesis.pb.go rename to x/devgas/genesis.pb.go index 7f00566949..19c1116d16 100644 --- a/x/devgas/v1/types/genesis.pb.go +++ b/x/devgas/genesis.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. // source: nibiru/devgas/v1/genesis.proto -package types +package devgas import ( fmt "fmt" @@ -148,30 +148,30 @@ func init() { func init() { proto.RegisterFile("nibiru/devgas/v1/genesis.proto", fileDescriptor_86a5066ce5bd7311) } var fileDescriptor_86a5066ce5bd7311 = []byte{ - // 361 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x91, 0xc1, 0x6e, 0xda, 0x40, - 0x10, 0x86, 0xbd, 0x50, 0x21, 0x58, 0x28, 0x45, 0x56, 0x0f, 0x16, 0x52, 0x17, 0x0b, 0xa9, 0x95, - 0x2f, 0xdd, 0x15, 0xee, 0xb5,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xa7, 0x5b, 0xea, 0xaf, 0x28, 0xfd, - 0x02, 0xf7, 0x3c, 0xc8, 0x21, 0x14, 0x09, 0xa4, 0xe5, 0xa0, 0x34, 0x6a, 0x26, 0xb2, 0x5a, 0x63, - 0x5a, 0x2c, 0x79, 0xda, 0x0e, 0x7e, 0xf8, 0x41, 0xb6, 0x5c, 0xb9, 0x74, 0x2e, 0x22, 0x36, 0x17, - 0x32, 0x12, 0xb2, 0xfa, 0xfc, 0x94, 0xde, 0x15, 0xcb, 0x6e, 0x13, 0x90, 0x74, 0x02, 0x73, 0xe7, - 0xcb, 0x1b, 0x47, 0x91, 0xa5, 0xfe, 0x1d, 0x77, 0x79, 0x18, 0x8a, 0x6b, 0xf0, 0x66, 0x1e, 0xc4, - 0x22, 0x92, 0x46, 0xdd, 0xac, 0x5b, 0x2d, 0xe7, 0x73, 0xa5, 0x4e, 0x94, 0x38, 0x3e, 0x59, 0xef, - 0x08, 0xda, 0xec, 0x08, 0x7a, 0xde, 0x11, 0x74, 0xbf, 0x27, 0xda, 0x66, 0x4f, 0xb4, 0xc7, 0x3d, - 0xd1, 0x2e, 0xed, 0x83, 0xcd, 0x67, 0xea, 0x31, 0xfe, 0x2e, 0x79, 0x10, 0xb3, 0x2a, 0xb0, 0xdc, - 0x66, 0x37, 0x07, 0xa9, 0xa9, 0x4b, 0xdc, 0x86, 0xca, 0xe7, 0xd7, 0x4b, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x90, 0xf4, 0xd8, 0xe7, 0x08, 0x02, 0x00, 0x00, + // 358 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x91, 0xc1, 0x6e, 0xe2, 0x30, + 0x10, 0x86, 0x63, 0x58, 0x21, 0x30, 0x2c, 0x8b, 0xa2, 0x3d, 0x44, 0x48, 0x6b, 0x22, 0xa4, 0x5d, + 0x65, 0x0f, 0x6b, 0x0b, 0xf6, 0xba,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, 0xfa, 0x1b, 0x4a, 0xbf, + 0xc4, 0x1d, 0x17, 0x32, 0x08, 0x44, 0x0c, 0x49, 0x39, 0x28, 0x8d, 0x8a, 0x89, 0xac, 0xc6, 0x88, + 0xe6, 0x4b, 0x9e, 0xb7, 0xbd, 0x5f, 0x9e, 0x9f, 0x2e, 0x57, 0x0e, 0x9d, 0x8b, 0x90, 0xcd, 0x85, + 0x0c, 0x85, 0x54, 0xc7, 0x1f, 0xe9, 0x5e, 0xb3, 0xf4, 0x2e, 0x06, 0x49, 0x27, 0x30, 0xb7, 0xbf, + 0xbd, 0x73, 0x0a, 0xb2, 0xd4, 0x7f, 0xe2, 0x36, 0x0f, 0x02, 0x71, 0x03, 0xee, 0xcc, 0x85, 0x48, + 0x84, 0xd2, 0xa8, 0x9a, 0x55, 0xab, 0x61, 0x7f, 0x55, 0xea, 0xa4, 0x10, 0x47, 0xe3, 0xf5, 0x8e, + 0xa0, 0xcd, 0x8e, 0xa0, 0x97, 0x1d, 0x41, 0x0f, 0x7b, 0xa2, 0x6d, 0xf6, 0x44, 0x7b, 0xda, 0x13, + 0xed, 0xea, 0xf7, 0xc1, 0xe6, 0xf3, 0xe2, 0x33, 0xc6, 0x4b, 0xee, 0x47, 0x4c, 0x05, 0x96, 0x0d, + 0xd9, 0xad, 0xca, 0xca, 0xa9, 0x15, 0xb1, 0xfc, 0x7d, 0x0d, 0x00, 0x00, 0xff, 0xff, 0x88, 0xa9, + 0x27, 0x33, 0xff, 0x01, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { diff --git a/x/devgas/v1/types/genesis_test.go b/x/devgas/genesis_test.go similarity index 99% rename from x/devgas/v1/types/genesis_test.go rename to x/devgas/genesis_test.go index a6297b1b17..5fde8baad0 100644 --- a/x/devgas/v1/types/genesis_test.go +++ b/x/devgas/genesis_test.go @@ -1,4 +1,4 @@ -package types +package devgas import ( "testing" diff --git a/x/devgas/v1/keeper/feeshare.go b/x/devgas/keeper/feeshare.go similarity index 84% rename from x/devgas/v1/keeper/feeshare.go rename to x/devgas/keeper/feeshare.go index 477a481f8e..ef255ca899 100644 --- a/x/devgas/v1/keeper/feeshare.go +++ b/x/devgas/keeper/feeshare.go @@ -3,14 +3,14 @@ package keeper import ( sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/NibiruChain/nibiru/v2/x/devgas/v1/types" + "github.com/NibiruChain/nibiru/v2/x/devgas" ) // GetFeeShare returns the FeeShare for a registered contract func (k Keeper) GetFeeShare( ctx sdk.Context, contract sdk.Address, -) (devGas types.FeeShare, isFound bool) { +) (devGas devgas.FeeShare, isFound bool) { isFound = true devGas, err := k.DevGasStore.Get(ctx, contract.String()) if err != nil { @@ -22,7 +22,7 @@ func (k Keeper) GetFeeShare( // SetFeeShare stores the FeeShare for a registered contract, then iterates // over every registered Indexer and instructs them to create the relationship // between the primary key PK and the object v. -func (k Keeper) SetFeeShare(ctx sdk.Context, feeshare types.FeeShare) { +func (k Keeper) SetFeeShare(ctx sdk.Context, feeshare devgas.FeeShare) { k.DevGasStore.Insert(ctx, feeshare.ContractAddress, feeshare) } diff --git a/x/devgas/v1/keeper/grpc_query.go b/x/devgas/keeper/grpc_query.go similarity index 76% rename from x/devgas/v1/keeper/grpc_query.go rename to x/devgas/keeper/grpc_query.go index 5a668cc942..fe3eb86853 100644 --- a/x/devgas/v1/keeper/grpc_query.go +++ b/x/devgas/keeper/grpc_query.go @@ -8,10 +8,10 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/NibiruChain/nibiru/v2/x/devgas/v1/types" + "github.com/NibiruChain/nibiru/v2/x/devgas" ) -var _ types.QueryServer = Querier{} +var _ devgas.QueryServer = Querier{} // Querier defines a wrapper around the x/FeeShare keeper providing gRPC method // handlers. @@ -29,14 +29,14 @@ func NewQuerier(k Keeper) Querier { // distribution func (q Querier) FeeShares( goCtx context.Context, - req *types.QueryFeeSharesRequest, -) (*types.QueryFeeSharesResponse, error) { + req *devgas.QueryFeeSharesRequest, +) (*devgas.QueryFeeSharesResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "empty request") } ctx := sdk.UnwrapSDKContext(goCtx) iter := q.DevGasStore.Indexes.Deployer.ExactMatch(ctx, req.Deployer) - return &types.QueryFeeSharesResponse{ + return &devgas.QueryFeeSharesResponse{ Feeshare: q.DevGasStore.Collect(ctx, iter), }, nil } @@ -45,8 +45,8 @@ func (q Querier) FeeShares( // contract func (q Querier) FeeShare( goCtx context.Context, - req *types.QueryFeeShareRequest, -) (*types.QueryFeeShareResponse, error) { + req *devgas.QueryFeeShareRequest, +) (*devgas.QueryFeeShareResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "empty request") } @@ -71,30 +71,30 @@ func (q Querier) FeeShare( ) } - return &types.QueryFeeShareResponse{Feeshare: feeshare}, nil + return &devgas.QueryFeeShareResponse{Feeshare: feeshare}, nil } // Params returns the fees module params func (q Querier) Params( c context.Context, - _ *types.QueryParamsRequest, -) (*types.QueryParamsResponse, error) { + _ *devgas.QueryParamsRequest, +) (*devgas.QueryParamsResponse, error) { ctx := sdk.UnwrapSDKContext(c) params := q.GetParams(ctx) - return &types.QueryParamsResponse{Params: params}, nil + return &devgas.QueryParamsResponse{Params: params}, nil } // FeeSharesByWithdrawer returns all fees for a given withdraw address func (q Querier) FeeSharesByWithdrawer( // nolint: dupl goCtx context.Context, - req *types.QueryFeeSharesByWithdrawerRequest, -) (*types.QueryFeeSharesByWithdrawerResponse, error) { + req *devgas.QueryFeeSharesByWithdrawerRequest, +) (*devgas.QueryFeeSharesByWithdrawerResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "empty request") } ctx := sdk.UnwrapSDKContext(goCtx) iter := q.DevGasStore.Indexes.Withdrawer.ExactMatch(ctx, req.WithdrawerAddress) - return &types.QueryFeeSharesByWithdrawerResponse{ + return &devgas.QueryFeeSharesByWithdrawerResponse{ Feeshare: q.DevGasStore.Collect(ctx, iter), }, nil } diff --git a/x/devgas/v1/keeper/grpc_query_test.go b/x/devgas/keeper/grpc_query_test.go similarity index 88% rename from x/devgas/v1/keeper/grpc_query_test.go rename to x/devgas/keeper/grpc_query_test.go index a48ec9b743..b1b541c1ab 100644 --- a/x/devgas/v1/keeper/grpc_query_test.go +++ b/x/devgas/keeper/grpc_query_test.go @@ -7,8 +7,8 @@ import ( "cosmossdk.io/math" "github.com/NibiruChain/nibiru/v2/x/common/testutil" - devgaskeeper "github.com/NibiruChain/nibiru/v2/x/devgas/v1/keeper" - devgastypes "github.com/NibiruChain/nibiru/v2/x/devgas/v1/types" + devgaskeeper "github.com/NibiruChain/nibiru/v2/x/devgas/keeper" + devgas "github.com/NibiruChain/nibiru/v2/x/devgas" ) func (s *KeeperTestSuite) TestQueryFeeShares() { @@ -29,16 +29,16 @@ func (s *KeeperTestSuite) TestQueryFeeShares() { } // Register FeeShares - var feeShares []devgastypes.FeeShare + var feeShares []devgas.FeeShare for _, contractAddress := range contractAddressList { goCtx := sdk.WrapSDKContext(s.ctx) - msg := &devgastypes.MsgRegisterFeeShare{ + msg := &devgas.MsgRegisterFeeShare{ ContractAddress: contractAddress, DeployerAddress: sender.String(), WithdrawerAddress: withdrawer.String(), } - feeShare := devgastypes.FeeShare{ + feeShare := devgas.FeeShare{ ContractAddress: contractAddress, DeployerAddress: sender.String(), WithdrawerAddress: withdrawer.String(), @@ -52,7 +52,7 @@ func (s *KeeperTestSuite) TestQueryFeeShares() { s.Run("from deployer", func() { deployer := sender.String() - req := &devgastypes.QueryFeeSharesRequest{ + req := &devgas.QueryFeeSharesRequest{ Deployer: deployer, } goCtx := sdk.WrapSDKContext(s.ctx) @@ -62,7 +62,7 @@ func (s *KeeperTestSuite) TestQueryFeeShares() { }) s.Run("from random", func() { deployer := testutil.AccAddress().String() - req := &devgastypes.QueryFeeSharesRequest{ + req := &devgas.QueryFeeSharesRequest{ Deployer: deployer, } goCtx := sdk.WrapSDKContext(s.ctx) @@ -81,13 +81,13 @@ func (s *KeeperTestSuite) TestFeeShare() { contractAddress := s.InstantiateContract(sender.String(), "") goCtx := sdk.WrapSDKContext(s.ctx) - msg := &devgastypes.MsgRegisterFeeShare{ + msg := &devgas.MsgRegisterFeeShare{ ContractAddress: contractAddress, DeployerAddress: sender.String(), WithdrawerAddress: withdrawer.String(), } - feeShare := devgastypes.FeeShare{ + feeShare := devgas.FeeShare{ ContractAddress: contractAddress, DeployerAddress: sender.String(), WithdrawerAddress: withdrawer.String(), @@ -95,7 +95,7 @@ func (s *KeeperTestSuite) TestFeeShare() { _, err := s.devgasMsgServer.RegisterFeeShare(goCtx, msg) s.Require().NoError(err) - req := &devgastypes.QueryFeeShareRequest{ + req := &devgas.QueryFeeShareRequest{ ContractAddress: contractAddress, } goCtx = sdk.WrapSDKContext(s.ctx) @@ -122,7 +122,7 @@ func (s *KeeperTestSuite) TestFeeSharesByWithdrawer() { // RegsisFeeShare for _, contractAddress := range contractAddressList { goCtx := sdk.WrapSDKContext(s.ctx) - msg := &devgastypes.MsgRegisterFeeShare{ + msg := &devgas.MsgRegisterFeeShare{ ContractAddress: contractAddress, DeployerAddress: sender.String(), WithdrawerAddress: withdrawer.String(), @@ -135,7 +135,7 @@ func (s *KeeperTestSuite) TestFeeSharesByWithdrawer() { s.Run("Total", func() { goCtx := sdk.WrapSDKContext(s.ctx) resp, err := s.queryClient.FeeSharesByWithdrawer(goCtx, - &devgastypes.QueryFeeSharesByWithdrawerRequest{ + &devgas.QueryFeeSharesByWithdrawerRequest{ WithdrawerAddress: withdrawer.String(), }) s.Require().NoError(err) diff --git a/x/devgas/v1/keeper/keeper.go b/x/devgas/keeper/keeper.go similarity index 79% rename from x/devgas/v1/keeper/keeper.go rename to x/devgas/keeper/keeper.go index 83ce8e770b..39180cc988 100644 --- a/x/devgas/v1/keeper/keeper.go +++ b/x/devgas/keeper/keeper.go @@ -13,7 +13,7 @@ import ( "github.com/NibiruChain/collections" - devgastypes "github.com/NibiruChain/nibiru/v2/x/devgas/v1/types" + devgas "github.com/NibiruChain/nibiru/v2/x/devgas" ) // Keeper of this module maintains collections of feeshares for contracts @@ -22,9 +22,9 @@ type Keeper struct { storeKey storetypes.StoreKey cdc codec.BinaryCodec - bankKeeper devgastypes.BankKeeper + bankKeeper devgas.BankKeeper wasmKeeper wasmkeeper.Keeper - accountKeeper devgastypes.AccountKeeper + accountKeeper devgas.AccountKeeper // feeCollectorName is the name of x/auth module's fee collector module // account, "fee_collector", which collects transaction fees for distribution @@ -39,9 +39,9 @@ type Keeper struct { // because there's exactly one deployer and withdrawer. // - value (V): FeeShare value saved into state. // - indexers (I): Indexed by deployer and withdrawer - DevGasStore collections.IndexedMap[string, devgastypes.FeeShare, DevGasIndexes] + DevGasStore collections.IndexedMap[string, devgas.FeeShare, DevGasIndexes] - ModuleParams collections.Item[devgastypes.ModuleParams] + ModuleParams collections.Item[devgas.ModuleParams] // the address capable of executing a MsgUpdateParams message. Typically, // this should be the x/gov module account. @@ -52,9 +52,9 @@ type Keeper struct { func NewKeeper( storeKey storetypes.StoreKey, cdc codec.BinaryCodec, - bk devgastypes.BankKeeper, + bk devgas.BankKeeper, wk wasmkeeper.Keeper, - ak devgastypes.AccountKeeper, + ak devgas.AccountKeeper, feeCollector string, authority string, ) Keeper { @@ -68,8 +68,8 @@ func NewKeeper( authority: authority, DevGasStore: NewDevGasStore(storeKey, cdc), ModuleParams: collections.NewItem( - storeKey, devgastypes.KeyPrefixParams, - collections.ProtoValueEncoder[devgastypes.ModuleParams](cdc), + storeKey, devgas.KeyPrefixParams, + collections.ProtoValueEncoder[devgas.ModuleParams](cdc), ), } } @@ -81,5 +81,5 @@ func (k Keeper) GetAuthority() string { // Logger returns a module-specific logger. func (k Keeper) Logger(ctx sdk.Context) log.Logger { - return ctx.Logger().With("module", fmt.Sprintf("x/%s", devgastypes.ModuleName)) + return ctx.Logger().With("module", fmt.Sprintf("x/%s", devgas.ModuleName)) } diff --git a/x/devgas/v1/keeper/keeper_test.go b/x/devgas/keeper/keeper_test.go similarity index 85% rename from x/devgas/v1/keeper/keeper_test.go rename to x/devgas/keeper/keeper_test.go index 9dd4382ab5..0a40248855 100644 --- a/x/devgas/v1/keeper/keeper_test.go +++ b/x/devgas/keeper/keeper_test.go @@ -12,8 +12,8 @@ import ( "github.com/NibiruChain/nibiru/v2/app" "github.com/NibiruChain/nibiru/v2/x/common/testutil/testapp" - devgaskeeper "github.com/NibiruChain/nibiru/v2/x/devgas/v1/keeper" - devgastypes "github.com/NibiruChain/nibiru/v2/x/devgas/v1/types" + devgaskeeper "github.com/NibiruChain/nibiru/v2/x/devgas/keeper" + devgas "github.com/NibiruChain/nibiru/v2/x/devgas" ) // BankKeeper defines the expected interface needed to retrieve account balances. @@ -30,8 +30,8 @@ type KeeperTestSuite struct { ctx sdk.Context app *app.NibiruApp - queryClient devgastypes.QueryClient - devgasMsgServer devgastypes.MsgServer + queryClient devgas.QueryClient + devgasMsgServer devgas.MsgServer wasmMsgServer wasmtypes.MsgServer } @@ -43,11 +43,11 @@ func (s *KeeperTestSuite) SetupTest() { queryHelper := baseapp.NewQueryServerTestHelper( s.ctx, s.app.InterfaceRegistry(), ) - devgastypes.RegisterQueryServer( + devgas.RegisterQueryServer( queryHelper, devgaskeeper.NewQuerier(s.app.DevGasKeeper), ) - s.queryClient = devgastypes.NewQueryClient(queryHelper) + s.queryClient = devgas.NewQueryClient(queryHelper) s.devgasMsgServer = s.app.DevGasKeeper s.wasmMsgServer = wasmkeeper.NewMsgServerImpl(&s.app.WasmKeeper) } diff --git a/x/devgas/v1/keeper/msg_server.go b/x/devgas/keeper/msg_server.go similarity index 86% rename from x/devgas/v1/keeper/msg_server.go rename to x/devgas/keeper/msg_server.go index 50cd7e9849..012319a54a 100644 --- a/x/devgas/v1/keeper/msg_server.go +++ b/x/devgas/keeper/msg_server.go @@ -9,10 +9,10 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" - "github.com/NibiruChain/nibiru/v2/x/devgas/v1/types" + "github.com/NibiruChain/nibiru/v2/x/devgas" ) -var _ types.MsgServer = &Keeper{} +var _ devgas.MsgServer = &Keeper{} // isContractCreatedFromFactory: Checks the smart contract info to see if it // was created by the "factory". This condition is true if: @@ -108,13 +108,13 @@ func (k Keeper) GetContractAdminOrCreatorAddress( // RegisterFeeShare registers a contract to receive transaction fees func (k Keeper) RegisterFeeShare( goCtx context.Context, - msg *types.MsgRegisterFeeShare, -) (*types.MsgRegisterFeeShareResponse, error) { + msg *devgas.MsgRegisterFeeShare, +) (*devgas.MsgRegisterFeeShareResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) params := k.GetParams(ctx) if !params.EnableFeeShare { - return nil, types.ErrFeeShareDisabled + return nil, devgas.ErrFeeShareDisabled } // Get Contract @@ -125,7 +125,7 @@ func (k Keeper) RegisterFeeShare( // Check if contract is already registered if k.IsFeeShareRegistered(ctx, contract) { - return nil, types.ErrFeeShareAlreadyRegistered.Wrapf("contract is already registered %s", contract) + return nil, devgas.ErrFeeShareAlreadyRegistered.Wrapf("contract is already registered %s", contract) } // Get the withdraw address of the contract @@ -147,7 +147,7 @@ func (k Keeper) RegisterFeeShare( // contract to be the contract itself, so long as the contract was // created from the "factory" (gov module or if contract admin or creator is another contract) if msg.WithdrawerAddress != msg.ContractAddress { - return nil, types.ErrFeeShareInvalidWithdrawer.Wrapf( + return nil, devgas.ErrFeeShareInvalidWithdrawer.Wrapf( "withdrawer address must be the same as the contract address if it is from a "+ "factory contract withdrawer: %s contract: %s", msg.WithdrawerAddress, msg.ContractAddress, @@ -170,7 +170,7 @@ func (k Keeper) RegisterFeeShare( } // prevent storing the same address for deployer and withdrawer - feeshare := types.NewFeeShare(contract, deployer, withdrawer) + feeshare := devgas.NewFeeShare(contract, deployer, withdrawer) k.SetFeeShare(ctx, feeshare) k.Logger(ctx).Debug( @@ -180,8 +180,8 @@ func (k Keeper) RegisterFeeShare( "withdraw", msg.WithdrawerAddress, ) - return &types.MsgRegisterFeeShareResponse{}, ctx.EventManager().EmitTypedEvent( - &types.EventRegisterDevGas{ + return &devgas.MsgRegisterFeeShareResponse{}, ctx.EventManager().EmitTypedEvent( + &devgas.EventRegisterDevGas{ Deployer: msg.DeployerAddress, Contract: msg.ContractAddress, Withdrawer: msg.WithdrawerAddress, @@ -194,12 +194,12 @@ func (k Keeper) RegisterFeeShare( // address is removed. func (k Keeper) UpdateFeeShare( goCtx context.Context, - msg *types.MsgUpdateFeeShare, -) (*types.MsgUpdateFeeShareResponse, error) { + msg *devgas.MsgUpdateFeeShare, +) (*devgas.MsgUpdateFeeShareResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) params := k.GetParams(ctx) if !params.EnableFeeShare { - return nil, types.ErrFeeShareDisabled + return nil, devgas.ErrFeeShareDisabled } contract, err := sdk.AccAddressFromBech32(msg.ContractAddress) @@ -213,14 +213,14 @@ func (k Keeper) UpdateFeeShare( feeshare, found := k.GetFeeShare(ctx, contract) if !found { return nil, - types.ErrFeeShareContractNotRegistered.Wrapf( + devgas.ErrFeeShareContractNotRegistered.Wrapf( "contract %s is not registered", msg.ContractAddress, ) } // feeshare with the given withdraw address is already registered if msg.WithdrawerAddress == feeshare.WithdrawerAddress { - return nil, types.ErrFeeShareAlreadyRegistered.Wrapf( + return nil, devgas.ErrFeeShareAlreadyRegistered.Wrapf( "feeshare with withdraw address %s is already registered", msg.WithdrawerAddress, ) } @@ -242,8 +242,8 @@ func (k Keeper) UpdateFeeShare( feeshare.WithdrawerAddress = newWithdrawAddr.String() k.SetFeeShare(ctx, feeshare) - return &types.MsgUpdateFeeShareResponse{}, ctx.EventManager().EmitTypedEvent( - &types.EventUpdateDevGas{ + return &devgas.MsgUpdateFeeShareResponse{}, ctx.EventManager().EmitTypedEvent( + &devgas.EventUpdateDevGas{ Deployer: msg.DeployerAddress, Contract: msg.ContractAddress, Withdrawer: msg.WithdrawerAddress, @@ -254,13 +254,13 @@ func (k Keeper) UpdateFeeShare( // CancelFeeShare deletes the FeeShare for a given contract func (k Keeper) CancelFeeShare( goCtx context.Context, - msg *types.MsgCancelFeeShare, -) (*types.MsgCancelFeeShareResponse, error) { + msg *devgas.MsgCancelFeeShare, +) (*devgas.MsgCancelFeeShareResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) params := k.GetParams(ctx) if !params.EnableFeeShare { - return nil, types.ErrFeeShareDisabled + return nil, devgas.ErrFeeShareDisabled } contract, err := sdk.AccAddressFromBech32(msg.ContractAddress) @@ -270,7 +270,7 @@ func (k Keeper) CancelFeeShare( fee, found := k.GetFeeShare(ctx, contract) if !found { - return nil, types.ErrFeeShareContractNotRegistered.Wrapf( + return nil, devgas.ErrFeeShareContractNotRegistered.Wrapf( "contract %s is not registered", msg.ContractAddress, ) } @@ -286,8 +286,8 @@ func (k Keeper) CancelFeeShare( return nil, err } - return &types.MsgCancelFeeShareResponse{}, ctx.EventManager().EmitTypedEvent( - &types.EventCancelDevGas{ + return &devgas.MsgCancelFeeShareResponse{}, ctx.EventManager().EmitTypedEvent( + &devgas.EventCancelDevGas{ Deployer: msg.DeployerAddress, Contract: msg.ContractAddress, }, @@ -295,8 +295,8 @@ func (k Keeper) CancelFeeShare( } func (k Keeper) UpdateParams( - goCtx context.Context, req *types.MsgUpdateParams, -) (resp *types.MsgUpdateParamsResponse, err error) { + goCtx context.Context, req *devgas.MsgUpdateParams, +) (resp *devgas.MsgUpdateParamsResponse, err error) { if k.authority != req.Authority { return nil, govtypes.ErrInvalidSigner.Wrapf("invalid authority; expected %s, got %s", k.authority, req.Authority) } @@ -307,5 +307,5 @@ func (k Keeper) UpdateParams( } k.ModuleParams.Set(ctx, req.Params) - return &types.MsgUpdateParamsResponse{}, err + return &devgas.MsgUpdateParamsResponse{}, err } diff --git a/x/devgas/v1/keeper/msg_server_test.go b/x/devgas/keeper/msg_server_test.go similarity index 81% rename from x/devgas/v1/keeper/msg_server_test.go rename to x/devgas/keeper/msg_server_test.go index d79f1e5cff..2f586fbf44 100644 --- a/x/devgas/v1/keeper/msg_server_test.go +++ b/x/devgas/keeper/msg_server_test.go @@ -15,7 +15,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" - "github.com/NibiruChain/nibiru/v2/x/devgas/v1/types" + "github.com/NibiruChain/nibiru/v2/x/devgas" ) //go:embed testdata/reflect.wasm @@ -23,13 +23,13 @@ var wasmContract []byte func (s *KeeperTestSuite) StoreCode() { _, _, sender := testdata.KeyTestPubAddr() - msg := wasmtypes.MsgStoreCodeFixture(func(m *wasmtypes.MsgStoreCode) { + msg := wasmdevgas.MsgStoreCodeFixture(func(m *wasmdevgas.MsgStoreCode) { m.WASMByteCode = wasmContract m.Sender = sender.String() }) rsp, err := s.app.MsgServiceRouter().Handler(msg)(s.ctx, msg) s.Require().NoError(err) - var result wasmtypes.MsgStoreCodeResponse + var result wasmdevgas.MsgStoreCodeResponse s.Require().NoError(s.app.AppCodec().Unmarshal(rsp.Data, &result)) s.Require().Equal(uint64(1), result.CodeID) expHash := sha256.Sum256(wasmContract) @@ -39,25 +39,25 @@ func (s *KeeperTestSuite) StoreCode() { s.Require().NotNil(info) s.Require().Equal(expHash[:], info.CodeHash) s.Require().Equal(sender.String(), info.Creator) - s.Require().Equal(wasmtypes.DefaultParams().InstantiateDefaultPermission.With(sender), info.InstantiateConfig) + s.Require().Equal(wasmdevgas.DefaultParams().InstantiateDefaultPermission.With(sender), info.InstantiateConfig) } func (s *KeeperTestSuite) InstantiateContract(sender string, admin string) string { - msgStoreCode := wasmtypes.MsgStoreCodeFixture(func(m *wasmtypes.MsgStoreCode) { + msgStoreCode := wasmdevgas.MsgStoreCodeFixture(func(m *wasmdevgas.MsgStoreCode) { m.WASMByteCode = wasmContract m.Sender = sender }) _, err := s.app.MsgServiceRouter().Handler(msgStoreCode)(s.ctx, msgStoreCode) s.Require().NoError(err) - msgInstantiate := wasmtypes.MsgInstantiateContractFixture(func(m *wasmtypes.MsgInstantiateContract) { + msgInstantiate := wasmdevgas.MsgInstantiateContractFixture(func(m *wasmdevgas.MsgInstantiateContract) { m.Sender = sender m.Admin = admin m.Msg = []byte(`{}`) }) resp, err := s.app.MsgServiceRouter().Handler(msgInstantiate)(s.ctx, msgInstantiate) s.Require().NoError(err) - var result wasmtypes.MsgInstantiateContractResponse + var result wasmdevgas.MsgInstantiateContractResponse s.Require().NoError(s.app.AppCodec().Unmarshal(resp.Data, &result)) contractInfo := s.app.WasmKeeper.GetContractInfo(s.ctx, sdk.MustAccAddressFromBech32(result.Address)) s.Require().Equal(contractInfo.CodeID, uint64(1)) @@ -122,7 +122,7 @@ func (s *KeeperTestSuite) TestRegisterFeeShare() { _, _, sender := testdata.KeyTestPubAddr() _ = s.FundAccount(s.ctx, sender, sdk.NewCoins(sdk.NewCoin("stake", math.NewInt(1_000_000)))) - gov := s.app.AccountKeeper.GetModuleAddress(govtypes.ModuleName).String() + gov := s.app.AccountKeeper.GetModuleAddress(govdevgas.ModuleName).String() govContract := s.InstantiateContract(sender.String(), gov) contractAddress := s.InstantiateContract(sender.String(), "") @@ -135,98 +135,98 @@ func (s *KeeperTestSuite) TestRegisterFeeShare() { for _, tc := range []struct { desc string - msg *types.MsgRegisterFeeShare - resp *types.MsgRegisterFeeShareResponse + msg *devgas.MsgRegisterFeeShare + resp *devgas.MsgRegisterFeeShareResponse shouldErr bool }{ { desc: "Invalid contract address", - msg: &types.MsgRegisterFeeShare{ + msg: &devgas.MsgRegisterFeeShare{ ContractAddress: "Invalid", DeployerAddress: sender.String(), WithdrawerAddress: withdrawer.String(), }, - resp: &types.MsgRegisterFeeShareResponse{}, + resp: &devgas.MsgRegisterFeeShareResponse{}, shouldErr: true, }, { desc: "Invalid deployer address", - msg: &types.MsgRegisterFeeShare{ + msg: &devgas.MsgRegisterFeeShare{ ContractAddress: contractAddress, DeployerAddress: "Invalid", WithdrawerAddress: withdrawer.String(), }, - resp: &types.MsgRegisterFeeShareResponse{}, + resp: &devgas.MsgRegisterFeeShareResponse{}, shouldErr: true, }, { desc: "Invalid withdrawer address", - msg: &types.MsgRegisterFeeShare{ + msg: &devgas.MsgRegisterFeeShare{ ContractAddress: contractAddress, DeployerAddress: sender.String(), WithdrawerAddress: "Invalid", }, - resp: &types.MsgRegisterFeeShareResponse{}, + resp: &devgas.MsgRegisterFeeShareResponse{}, shouldErr: true, }, { desc: "Success", - msg: &types.MsgRegisterFeeShare{ + msg: &devgas.MsgRegisterFeeShare{ ContractAddress: contractAddress, DeployerAddress: sender.String(), WithdrawerAddress: withdrawer.String(), }, - resp: &types.MsgRegisterFeeShareResponse{}, + resp: &devgas.MsgRegisterFeeShareResponse{}, shouldErr: false, }, { desc: "Invalid withdraw address for factory contract", - msg: &types.MsgRegisterFeeShare{ + msg: &devgas.MsgRegisterFeeShare{ ContractAddress: contractAddress2, DeployerAddress: sender.String(), WithdrawerAddress: sender.String(), }, - resp: &types.MsgRegisterFeeShareResponse{}, + resp: &devgas.MsgRegisterFeeShareResponse{}, shouldErr: true, }, { desc: "Success register factory contract to itself", - msg: &types.MsgRegisterFeeShare{ + msg: &devgas.MsgRegisterFeeShare{ ContractAddress: contractAddress2, DeployerAddress: sender.String(), WithdrawerAddress: contractAddress2, }, - resp: &types.MsgRegisterFeeShareResponse{}, + resp: &devgas.MsgRegisterFeeShareResponse{}, shouldErr: false, }, { desc: "Invalid register gov contract withdraw address", - msg: &types.MsgRegisterFeeShare{ + msg: &devgas.MsgRegisterFeeShare{ ContractAddress: govContract, DeployerAddress: sender.String(), WithdrawerAddress: sender.String(), }, - resp: &types.MsgRegisterFeeShareResponse{}, + resp: &devgas.MsgRegisterFeeShareResponse{}, shouldErr: true, }, { desc: "Success register gov contract withdraw address to self", - msg: &types.MsgRegisterFeeShare{ + msg: &devgas.MsgRegisterFeeShare{ ContractAddress: govContract, DeployerAddress: sender.String(), WithdrawerAddress: govContract, }, - resp: &types.MsgRegisterFeeShareResponse{}, + resp: &devgas.MsgRegisterFeeShareResponse{}, shouldErr: false, }, { desc: "Success register contract from contract as admin", - msg: &types.MsgRegisterFeeShare{ + msg: &devgas.MsgRegisterFeeShare{ ContractAddress: subContract, DeployerAddress: deployer, WithdrawerAddress: deployer, }, - resp: &types.MsgRegisterFeeShareResponse{}, + resp: &devgas.MsgRegisterFeeShareResponse{}, shouldErr: false, }, } { @@ -261,7 +261,7 @@ func (s *KeeperTestSuite) TestUpdateFeeShare() { // RegsisFeeShare goCtx := sdk.WrapSDKContext(s.ctx) - msg := &types.MsgRegisterFeeShare{ + msg := &devgas.MsgRegisterFeeShare{ ContractAddress: contractAddress, DeployerAddress: sender.String(), WithdrawerAddress: withdrawer.String(), @@ -273,13 +273,13 @@ func (s *KeeperTestSuite) TestUpdateFeeShare() { for _, tc := range []struct { desc string - msg *types.MsgUpdateFeeShare - resp *types.MsgCancelFeeShareResponse + msg *devgas.MsgUpdateFeeShare + resp *devgas.MsgCancelFeeShareResponse shouldErr bool }{ { desc: "Invalid - contract not regis", - msg: &types.MsgUpdateFeeShare{ + msg: &devgas.MsgUpdateFeeShare{ ContractAddress: contractAddressNoRegisFeeShare, DeployerAddress: sender.String(), WithdrawerAddress: newWithdrawer.String(), @@ -289,7 +289,7 @@ func (s *KeeperTestSuite) TestUpdateFeeShare() { }, { desc: "Invalid - Invalid DeployerAddress", - msg: &types.MsgUpdateFeeShare{ + msg: &devgas.MsgUpdateFeeShare{ ContractAddress: contractAddress, DeployerAddress: "Invalid", WithdrawerAddress: newWithdrawer.String(), @@ -299,7 +299,7 @@ func (s *KeeperTestSuite) TestUpdateFeeShare() { }, { desc: "Invalid - Invalid WithdrawerAddress", - msg: &types.MsgUpdateFeeShare{ + msg: &devgas.MsgUpdateFeeShare{ ContractAddress: contractAddress, DeployerAddress: sender.String(), WithdrawerAddress: "Invalid", @@ -309,7 +309,7 @@ func (s *KeeperTestSuite) TestUpdateFeeShare() { }, { desc: "Invalid - Invalid WithdrawerAddress not change", - msg: &types.MsgUpdateFeeShare{ + msg: &devgas.MsgUpdateFeeShare{ ContractAddress: contractAddress, DeployerAddress: sender.String(), WithdrawerAddress: withdrawer.String(), @@ -319,12 +319,12 @@ func (s *KeeperTestSuite) TestUpdateFeeShare() { }, { desc: "Success", - msg: &types.MsgUpdateFeeShare{ + msg: &devgas.MsgUpdateFeeShare{ ContractAddress: contractAddress, DeployerAddress: sender.String(), WithdrawerAddress: newWithdrawer.String(), }, - resp: &types.MsgCancelFeeShareResponse{}, + resp: &devgas.MsgCancelFeeShareResponse{}, shouldErr: false, }, } { @@ -352,7 +352,7 @@ func (s *KeeperTestSuite) TestCancelFeeShare() { // RegsisFeeShare goCtx := sdk.WrapSDKContext(s.ctx) - msg := &types.MsgRegisterFeeShare{ + msg := &devgas.MsgRegisterFeeShare{ ContractAddress: contractAddress, DeployerAddress: sender.String(), WithdrawerAddress: withdrawer.String(), @@ -362,13 +362,13 @@ func (s *KeeperTestSuite) TestCancelFeeShare() { for _, tc := range []struct { desc string - msg *types.MsgCancelFeeShare - resp *types.MsgCancelFeeShareResponse + msg *devgas.MsgCancelFeeShare + resp *devgas.MsgCancelFeeShareResponse shouldErr bool }{ { desc: "Invalid - contract Address", - msg: &types.MsgCancelFeeShare{ + msg: &devgas.MsgCancelFeeShare{ ContractAddress: "Invalid", DeployerAddress: sender.String(), }, @@ -377,7 +377,7 @@ func (s *KeeperTestSuite) TestCancelFeeShare() { }, { desc: "Invalid - deployer Address", - msg: &types.MsgCancelFeeShare{ + msg: &devgas.MsgCancelFeeShare{ ContractAddress: contractAddress, DeployerAddress: "Invalid", }, @@ -386,11 +386,11 @@ func (s *KeeperTestSuite) TestCancelFeeShare() { }, { desc: "Success", - msg: &types.MsgCancelFeeShare{ + msg: &devgas.MsgCancelFeeShare{ ContractAddress: contractAddress, DeployerAddress: sender.String(), }, - resp: &types.MsgCancelFeeShareResponse{}, + resp: &devgas.MsgCancelFeeShareResponse{}, shouldErr: false, }, } { @@ -411,42 +411,42 @@ func (s *KeeperTestSuite) TestCancelFeeShare() { } func (s *KeeperTestSuite) TestUpdateParams() { - govModuleAddr := authtypes.NewModuleAddress(govtypes.ModuleName).String() + govModuleAddr := authdevgas.NewModuleAddress(govdevgas.ModuleName).String() goCtx := sdk.WrapSDKContext(s.ctx) for _, tc := range []struct { desc string - msg *types.MsgUpdateParams + msg *devgas.MsgUpdateParams shouldErr bool }{ { desc: "happy", - msg: &types.MsgUpdateParams{ + msg: &devgas.MsgUpdateParams{ Authority: govModuleAddr, - Params: types.DefaultParams().Sanitize(), + Params: devgas.DefaultParams().Sanitize(), }, shouldErr: false, }, { desc: "err - empty params", - msg: &types.MsgUpdateParams{ + msg: &devgas.MsgUpdateParams{ Authority: govModuleAddr, - Params: types.ModuleParams{}, + Params: devgas.ModuleParams{}, }, shouldErr: true, }, { desc: "err - nil params", - msg: &types.MsgUpdateParams{ + msg: &devgas.MsgUpdateParams{ Authority: govModuleAddr, }, shouldErr: true, }, { desc: "err - nil params", - msg: &types.MsgUpdateParams{ + msg: &devgas.MsgUpdateParams{ Authority: "not-an-authority", - Params: types.DefaultParams(), + Params: devgas.DefaultParams(), }, shouldErr: true, }, diff --git a/x/devgas/v1/keeper/params.go b/x/devgas/keeper/params.go similarity index 60% rename from x/devgas/v1/keeper/params.go rename to x/devgas/keeper/params.go index 658558ae00..40db554a13 100644 --- a/x/devgas/v1/keeper/params.go +++ b/x/devgas/keeper/params.go @@ -3,11 +3,11 @@ package keeper import ( sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/NibiruChain/nibiru/v2/x/devgas/v1/types" + "github.com/NibiruChain/nibiru/v2/x/devgas" ) // GetParams returns the total set of fees parameters. -func (k Keeper) GetParams(ctx sdk.Context) (params types.ModuleParams) { +func (k Keeper) GetParams(ctx sdk.Context) (params devgas.ModuleParams) { params, _ = k.ModuleParams.Get(ctx) return params.Sanitize() } diff --git a/x/devgas/v1/keeper/store.go b/x/devgas/keeper/store.go similarity index 51% rename from x/devgas/v1/keeper/store.go rename to x/devgas/keeper/store.go index 9327504bf4..a8b3858b5f 100644 --- a/x/devgas/v1/keeper/store.go +++ b/x/devgas/keeper/store.go @@ -5,7 +5,7 @@ import ( sdkcodec "github.com/cosmos/cosmos-sdk/codec" storetypes "github.com/cosmos/cosmos-sdk/store/types" - devgastypes "github.com/NibiruChain/nibiru/v2/x/devgas/v1/types" + "github.com/NibiruChain/nibiru/v2/x/devgas" ) type DevGasIndexes struct { @@ -13,45 +13,45 @@ type DevGasIndexes struct { // - indexing key (IK): deployer address // - primary key (PK): contract address // - value (V): Dev gas struct - Deployer collections.MultiIndex[string, string, devgastypes.FeeShare] + Deployer collections.MultiIndex[string, string, devgas.FeeShare] // Withdrawer MultiIndex: // - indexing key (IK): withdrawer address // - primary key (PK): contract address // - value (V): Dev gas struct - Withdrawer collections.MultiIndex[string, string, devgastypes.FeeShare] + Withdrawer collections.MultiIndex[string, string, devgas.FeeShare] } -func (idxs DevGasIndexes) IndexerList() []collections.Indexer[string, devgastypes.FeeShare] { - return []collections.Indexer[string, devgastypes.FeeShare]{ +func (idxs DevGasIndexes) IndexerList() []collections.Indexer[string, devgas.FeeShare] { + return []collections.Indexer[string, devgas.FeeShare]{ idxs.Deployer, idxs.Withdrawer, } } func NewDevGasStore( storeKey storetypes.StoreKey, cdc sdkcodec.BinaryCodec, -) collections.IndexedMap[string, devgastypes.FeeShare, DevGasIndexes] { +) collections.IndexedMap[string, devgas.FeeShare, DevGasIndexes] { primaryKeyEncoder := collections.StringKeyEncoder - valueEncoder := collections.ProtoValueEncoder[devgastypes.FeeShare](cdc) + valueEncoder := collections.ProtoValueEncoder[devgas.FeeShare](cdc) - var namespace collections.Namespace = devgastypes.KeyPrefixFeeShare - var namespaceDeployerIdx collections.Namespace = devgastypes.KeyPrefixDeployer - var namespaceWithdrawerIdx collections.Namespace = devgastypes.KeyPrefixWithdrawer + var namespace collections.Namespace = devgas.KeyPrefixFeeShare + var namespaceDeployerIdx collections.Namespace = devgas.KeyPrefixDeployer + var namespaceWithdrawerIdx collections.Namespace = devgas.KeyPrefixWithdrawer - return collections.NewIndexedMap[string, devgastypes.FeeShare]( + return collections.NewIndexedMap[string, devgas.FeeShare]( storeKey, namespace, primaryKeyEncoder, valueEncoder, DevGasIndexes{ - Deployer: collections.NewMultiIndex[string, string, devgastypes.FeeShare]( + Deployer: collections.NewMultiIndex[string, string, devgas.FeeShare]( storeKey, namespaceDeployerIdx, collections.StringKeyEncoder, // index key (IK) collections.StringKeyEncoder, // primary key (PK) - func(v devgastypes.FeeShare) string { return v.DeployerAddress }, + func(v devgas.FeeShare) string { return v.DeployerAddress }, ), - Withdrawer: collections.NewMultiIndex[string, string, devgastypes.FeeShare]( + Withdrawer: collections.NewMultiIndex[string, string, devgas.FeeShare]( storeKey, namespaceWithdrawerIdx, collections.StringKeyEncoder, // index key (IK) collections.StringKeyEncoder, // primary key (PK) - func(v devgastypes.FeeShare) string { return v.WithdrawerAddress }, + func(v devgas.FeeShare) string { return v.WithdrawerAddress }, ), }, ) diff --git a/x/devgas/v1/keeper/testdata/reflect.wasm b/x/devgas/keeper/testdata/reflect.wasm similarity index 100% rename from x/devgas/v1/keeper/testdata/reflect.wasm rename to x/devgas/keeper/testdata/reflect.wasm diff --git a/x/devgas/v1/types/keys.go b/x/devgas/keys.go similarity index 96% rename from x/devgas/v1/types/keys.go rename to x/devgas/keys.go index 43ee7ee70d..0774331f1a 100644 --- a/x/devgas/v1/types/keys.go +++ b/x/devgas/keys.go @@ -1,4 +1,4 @@ -package types +package devgas import ( "github.com/NibiruChain/collections" diff --git a/x/devgas/v1/types/msg.go b/x/devgas/msg.go similarity index 99% rename from x/devgas/v1/types/msg.go rename to x/devgas/msg.go index 608bc8f363..b87f2b9ca9 100644 --- a/x/devgas/v1/types/msg.go +++ b/x/devgas/msg.go @@ -1,4 +1,4 @@ -package types +package devgas import ( errorsmod "cosmossdk.io/errors" diff --git a/x/devgas/v1/types/msg_test.go b/x/devgas/msg_test.go similarity index 99% rename from x/devgas/v1/types/msg_test.go rename to x/devgas/msg_test.go index 38ef569cff..bdf2caec53 100644 --- a/x/devgas/v1/types/msg_test.go +++ b/x/devgas/msg_test.go @@ -1,4 +1,4 @@ -package types +package devgas import ( "testing" diff --git a/x/devgas/v1/types/params.go b/x/devgas/params.go similarity index 99% rename from x/devgas/v1/types/params.go rename to x/devgas/params.go index 532436c73e..8ff9f0143b 100644 --- a/x/devgas/v1/types/params.go +++ b/x/devgas/params.go @@ -1,4 +1,4 @@ -package types +package devgas import ( "fmt" diff --git a/x/devgas/v1/types/params_legacy.go b/x/devgas/params_legacy.go similarity index 98% rename from x/devgas/v1/types/params_legacy.go rename to x/devgas/params_legacy.go index 259708e8a7..95d08d9c8c 100644 --- a/x/devgas/v1/types/params_legacy.go +++ b/x/devgas/params_legacy.go @@ -1,4 +1,4 @@ -package types +package devgas // TODO: Remove this and params_legacy_test.go after v0.47.x (v16) upgrade diff --git a/x/devgas/v1/types/params_legacy_test.go b/x/devgas/params_legacy_test.go similarity index 99% rename from x/devgas/v1/types/params_legacy_test.go rename to x/devgas/params_legacy_test.go index 6a86405cf9..16cd608e89 100644 --- a/x/devgas/v1/types/params_legacy_test.go +++ b/x/devgas/params_legacy_test.go @@ -1,4 +1,4 @@ -package types +package devgas import ( "testing" diff --git a/x/devgas/v1/types/params_test.go b/x/devgas/params_test.go similarity index 99% rename from x/devgas/v1/types/params_test.go rename to x/devgas/params_test.go index 422eeac98b..11fb7c2579 100644 --- a/x/devgas/v1/types/params_test.go +++ b/x/devgas/params_test.go @@ -1,4 +1,4 @@ -package types +package devgas import ( "testing" diff --git a/x/devgas/v1/types/query.go b/x/devgas/query.go similarity index 98% rename from x/devgas/v1/types/query.go rename to x/devgas/query.go index 928059c530..df99d9fefc 100644 --- a/x/devgas/v1/types/query.go +++ b/x/devgas/query.go @@ -1,4 +1,4 @@ -package types +package devgas import ( errorsmod "cosmossdk.io/errors" diff --git a/x/devgas/v1/types/query.pb.go b/x/devgas/query.pb.go similarity index 93% rename from x/devgas/v1/types/query.pb.go rename to x/devgas/query.pb.go index ec6ccc97c2..d07bb09d6a 100644 --- a/x/devgas/v1/types/query.pb.go +++ b/x/devgas/query.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. // source: nibiru/devgas/v1/query.proto -package types +package devgas import ( context "context" @@ -406,43 +406,43 @@ func init() { func init() { proto.RegisterFile("nibiru/devgas/v1/query.proto", fileDescriptor_b68d3a02185e7c52) } var fileDescriptor_b68d3a02185e7c52 = []byte{ - // 568 bytes of a gzipped FileDescriptorProto + // 563 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x94, 0xcf, 0x8e, 0xd2, 0x50, - 0x14, 0xc6, 0xa9, 0x8e, 0x84, 0xb9, 0x2e, 0x1c, 0xaf, 0x8c, 0x21, 0xcd, 0x58, 0xb1, 0x51, 0x61, - 0x4c, 0xec, 0x4d, 0xc1, 0xc4, 0x98, 0xb8, 0x19, 0x4c, 0x5c, 0xa9, 0x51, 0x26, 0x6a, 0xe2, 0x66, - 0x72, 0x4b, 0xcf, 0x94, 0x26, 0xd0, 0xdb, 0xe9, 0x2d, 0x20, 0x31, 0x6c, 0x7c, 0x01, 0x4d, 0xf4, - 0x75, 0xdc, 0xcf, 0x72, 0x12, 0x37, 0xae, 0x8c, 0x01, 0x37, 0xbe, 0x85, 0xe1, 0xfe, 0x41, 0xa1, - 0x0c, 0x64, 0x92, 0xd9, 0x95, 0x73, 0xce, 0x77, 0xbe, 0x1f, 0xa7, 0x1f, 0xa0, 0x9d, 0x28, 0xf4, - 0xc2, 0xa4, 0x47, 0x7c, 0xe8, 0x07, 0x94, 0x93, 0xbe, 0x4b, 0x8e, 0x7a, 0x90, 0x0c, 0x9d, 0x38, - 0x61, 0x29, 0xc3, 0x5b, 0xb2, 0xeb, 0xc8, 0xae, 0xd3, 0x77, 0xcd, 0x7b, 0x2d, 0xc6, 0xbb, 0x8c, - 0x13, 0x8f, 0x72, 0x90, 0xa3, 0xa4, 0xef, 0x7a, 0x90, 0x52, 0x97, 0xc4, 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 0x67, 0x13, 0xcb, 0xf8, 0x35, 0xb1, 0x8c, 0xcf, 0x53, 0x2b, + 0x77, 0x36, 0xb5, 0x72, 0x3f, 0xa6, 0x56, 0xee, 0x5d, 0x2d, 0x08, 0xd3, 0x4e, 0xdf, 0x73, 0xda, + 0xac, 0x47, 0x5e, 0x88, 0xb5, 0x07, 0x1d, 0x1a, 0x46, 0xda, 0x62, 0x50, 0x27, 0xef, 0x95, 0x8f, + 0x97, 0x17, 0xff, 0x80, 0x8d, 0xbf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x9e, 0x28, 0xae, 0x8e, 0xd2, + 0x05, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/x/devgas/v1/types/query.pb.gw.go b/x/devgas/query.pb.gw.go similarity index 99% rename from x/devgas/v1/types/query.pb.gw.go rename to x/devgas/query.pb.gw.go index 0f2930e049..a394cc9c78 100644 --- a/x/devgas/v1/types/query.pb.gw.go +++ b/x/devgas/query.pb.gw.go @@ -2,11 +2,11 @@ // source: nibiru/devgas/v1/query.proto /* -Package types is a reverse proxy. +Package devgas is a reverse proxy. It translates gRPC into RESTful JSON APIs. */ -package types +package devgas import ( "context" diff --git a/x/devgas/v1/simulation/genesis.go b/x/devgas/simulation/genesis.go similarity index 79% rename from x/devgas/v1/simulation/genesis.go rename to x/devgas/simulation/genesis.go index a32fa8cbd0..eea9e03e14 100644 --- a/x/devgas/v1/simulation/genesis.go +++ b/x/devgas/simulation/genesis.go @@ -11,7 +11,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" - "github.com/NibiruChain/nibiru/v2/x/devgas/v1/types" + "github.com/NibiruChain/nibiru/v2/x/devgas" ) const ( @@ -29,13 +29,13 @@ func RandomizedGenState(simState *module.SimulationState) { func(r *rand.Rand) { developerFeeShare = GenDeveloperFeeShare(r) }, ) - devgasGenesis := types.GenesisState{ - Params: types.ModuleParams{ + devgasGenesis := devgas.GenesisState{ + Params: devgas.ModuleParams{ EnableFeeShare: true, DeveloperShares: developerFeeShare, AllowedDenoms: []string{}, }, - FeeShare: []types.FeeShare{}, + FeeShare: []devgas.FeeShare{}, } bz, err := json.MarshalIndent(&devgasGenesis, "", " ") @@ -43,5 +43,5 @@ func RandomizedGenState(simState *module.SimulationState) { panic(err) } fmt.Printf("Selected randomly generated x/devgas parameters:\n%s\n", bz) - simState.GenState[types.ModuleName] = simState.Cdc.MustMarshalJSON(&devgasGenesis) + simState.GenState[devgas.ModuleName] = simState.Cdc.MustMarshalJSON(&devgasGenesis) } diff --git a/x/devgas/v1/types/tx.pb.go b/x/devgas/tx.pb.go similarity index 93% rename from x/devgas/v1/types/tx.pb.go rename to x/devgas/tx.pb.go index 90fd5d17f7..93b971d3da 100644 --- a/x/devgas/v1/types/tx.pb.go +++ b/x/devgas/tx.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. // source: nibiru/devgas/v1/tx.proto -package types +package devgas import ( context "context" @@ -445,43 +445,43 @@ func init() { func init() { proto.RegisterFile("nibiru/devgas/v1/tx.proto", fileDescriptor_72949c99a02cd615) } var fileDescriptor_72949c99a02cd615 = []byte{ - // 566 bytes of a gzipped FileDescriptorProto + // 562 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x94, 0xc1, 0x6a, 0x13, 0x41, 0x18, 0xc7, 0xb3, 0x6d, 0x28, 0x74, 0x94, 0x36, 0x5d, 0x0b, 0x6d, 0x52, 0xdd, 0xea, 0xaa, 0xa5, - 0x55, 0xb3, 0x43, 0x23, 0x78, 0x28, 0x5e, 0x4c, 0xc1, 0x93, 0x11, 0x49, 0xf1, 0x22, 0x42, 0x98, - 0xec, 0x0e, 0x93, 0x81, 0x64, 0x67, 0x99, 0x99, 0xa4, 0xcd, 0xb5, 0x4f, 0x50, 0xf0, 0xa0, 0x27, - 0xe9, 0xc1, 0x07,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, 0x73, 0x62, 0x1a, 0x2a, 0x3d, 0xbc, 0x04, + 0x94, 0x48, 0x3d, 0x52, 0x52, 0x5b, 0xee, 0xbd, 0x4c, 0xa9, 0xbe, 0x2a, 0x4a, 0x2b, 0x4d, 0xad, + 0x5d, 0xb6, 0x52, 0x1a, 0x3a, 0x47, 0xe9, 0x9c, 0x7d, 0xba, 0x58, 0xc9, 0x57, 0x45, 0x13, 0xa5, + 0x37, 0xe0, 0x7a, 0x6a, 0xf3, 0xee, 0x5c, 0xf0, 0xf4, 0x1a, 0x29, 0x95, 0xff, 0x89, 0xc4, 0x2e, + 0xb5, 0xfa, 0xe9, 0xd0, 0xb1, 0xce, 0x86, 0x8e, 0xf5, 0x63, 0xe8, 0x58, 0xc7, 0x23, 0x27, 0x77, + 0x36, 0x72, 0x72, 0xdf, 0x46, 0x4e, 0xee, 0x75, 0x99, 0x50, 0xd9, 0xe9, 0xb7, 0x3d, 0x9f, 0xf5, + 0xe0, 0x0b, 0xd5, 0xae, 0xde, 0x41, 0x34, 0x8c, 0x9d, 0x07, 0x55, 0x78, 0x60, 0xc4, 0xdb, 0x0b, + 0xea, 0xab, 0xf9, 0xf8, 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xc1, 0x57, 0x97, 0x3d, 0xec, 0x05, + 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/x/devgas/v1/types/tx.pb.gw.go b/x/devgas/tx.pb.gw.go similarity index 99% rename from x/devgas/v1/types/tx.pb.gw.go rename to x/devgas/tx.pb.gw.go index 20372e2770..9c0d6de460 100644 --- a/x/devgas/v1/types/tx.pb.gw.go +++ b/x/devgas/tx.pb.gw.go @@ -2,11 +2,11 @@ // source: nibiru/devgas/v1/tx.proto /* -Package types is a reverse proxy. +Package devgas is a reverse proxy. It translates gRPC into RESTful JSON APIs. */ -package types +package devgas import ( "context" From 3f90675d793d8ea85daecd2f2fbd76f9a4f35f81 Mon Sep 17 00:00:00 2001 From: expertdicer Date: Tue, 11 Feb 2025 16:28:39 +0700 Subject: [PATCH 2/5] chore: update imports --- app/keepers.go | 6 +++--- x/devgas/devgasmodule/genesis.go | 2 +- x/devgas/devgasmodule/genesis_test.go | 2 +- x/devgas/devgasmodule/module.go | 4 ++-- x/devgas/devgasmodule/module_test.go | 6 +++--- x/devgas/keeper/msg_server_test.go | 16 ++++++++-------- 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/app/keepers.go b/app/keepers.go index fa814ba9e2..57bda43075 100644 --- a/app/keepers.go +++ b/app/keepers.go @@ -111,9 +111,9 @@ import ( "github.com/NibiruChain/nibiru/v2/app/wasmext" "github.com/NibiruChain/nibiru/v2/eth" "github.com/NibiruChain/nibiru/v2/x/common" + "github.com/NibiruChain/nibiru/v2/x/devgas" "github.com/NibiruChain/nibiru/v2/x/devgas/devgasmodule" devgaskeeper "github.com/NibiruChain/nibiru/v2/x/devgas/keeper" - devgas "github.com/NibiruChain/nibiru/v2/x/devgas" "github.com/NibiruChain/nibiru/v2/x/epochs" epochskeeper "github.com/NibiruChain/nibiru/v2/x/epochs/keeper" epochstypes "github.com/NibiruChain/nibiru/v2/x/epochs/types" @@ -675,7 +675,7 @@ func (app *NibiruApp) initAppModules( appCodec, &app.WasmKeeper, app.StakingKeeper, app.AccountKeeper, app.BankKeeper, app.MsgServiceRouter(), app.GetSubspace(wasmtypes.ModuleName)), - devgas.NewAppModule( + devgasmodule.NewAppModule( app.DevGasKeeper, app.AccountKeeper, app.GetSubspace(devgas.ModuleName)), tokenfactory.NewAppModule( @@ -851,7 +851,7 @@ func ModuleBasicManager() module.BasicManager { inflation.AppModuleBasic{}, sudo.AppModuleBasic{}, wasm.AppModuleBasic{}, - devgas.AppModuleBasic{}, + devgasmodule.AppModuleBasic{}, tokenfactory.AppModuleBasic{}, ibcfee.AppModuleBasic{}, genmsg.AppModule{}, diff --git a/x/devgas/devgasmodule/genesis.go b/x/devgas/devgasmodule/genesis.go index e566b07059..5339cbbfc9 100644 --- a/x/devgas/devgasmodule/genesis.go +++ b/x/devgas/devgasmodule/genesis.go @@ -1,4 +1,4 @@ -package devgas +package devgasmodule import ( sdk "github.com/cosmos/cosmos-sdk/types" diff --git a/x/devgas/devgasmodule/genesis_test.go b/x/devgas/devgasmodule/genesis_test.go index d151877062..85061e4569 100644 --- a/x/devgas/devgasmodule/genesis_test.go +++ b/x/devgas/devgasmodule/genesis_test.go @@ -1,4 +1,4 @@ -package devgas_test +package devgasmodule_test import ( "fmt" diff --git a/x/devgas/devgasmodule/module.go b/x/devgas/devgasmodule/module.go index 77c7e0869b..185a38c726 100644 --- a/x/devgas/devgasmodule/module.go +++ b/x/devgas/devgasmodule/module.go @@ -1,4 +1,4 @@ -package devgas +package devgasmodule import ( "context" @@ -16,11 +16,11 @@ import ( "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/spf13/cobra" + "github.com/NibiruChain/nibiru/v2/x/devgas" "github.com/NibiruChain/nibiru/v2/x/devgas/client/cli" "github.com/NibiruChain/nibiru/v2/x/devgas/exported" "github.com/NibiruChain/nibiru/v2/x/devgas/keeper" "github.com/NibiruChain/nibiru/v2/x/devgas/simulation" - "github.com/NibiruChain/nibiru/v2/x/devgas" ) // type check to ensure the interface is properly implemented diff --git a/x/devgas/devgasmodule/module_test.go b/x/devgas/devgasmodule/module_test.go index b3ea02e2f2..06bfd94632 100644 --- a/x/devgas/devgasmodule/module_test.go +++ b/x/devgas/devgasmodule/module_test.go @@ -1,11 +1,11 @@ -package devgas_test +package devgasmodule_test import ( abci "github.com/cometbft/cometbft/abci/types" "github.com/NibiruChain/nibiru/v2/app/codec" - devgasmodule "github.com/NibiruChain/nibiru/v2/x/devgas/devgasmodule" "github.com/NibiruChain/nibiru/v2/x/devgas" + devgasmodule "github.com/NibiruChain/nibiru/v2/x/devgas/devgasmodule" ) func (s *GenesisTestSuite) TestAppModule() { @@ -13,7 +13,7 @@ func (s *GenesisTestSuite) TestAppModule() { appModule := devgasmodule.NewAppModule( s.app.DevGasKeeper, s.app.AccountKeeper, - s.app.GetSubspace(devgastypes.ModuleName), + s.app.GetSubspace(devgas.ModuleName), ) s.NotPanics(func() { diff --git a/x/devgas/keeper/msg_server_test.go b/x/devgas/keeper/msg_server_test.go index 2f586fbf44..7b7fb815a5 100644 --- a/x/devgas/keeper/msg_server_test.go +++ b/x/devgas/keeper/msg_server_test.go @@ -23,13 +23,13 @@ var wasmContract []byte func (s *KeeperTestSuite) StoreCode() { _, _, sender := testdata.KeyTestPubAddr() - msg := wasmdevgas.MsgStoreCodeFixture(func(m *wasmdevgas.MsgStoreCode) { + msg := wasmtypes.MsgStoreCodeFixture(func(m *wasmtypes.MsgStoreCode) { m.WASMByteCode = wasmContract m.Sender = sender.String() }) rsp, err := s.app.MsgServiceRouter().Handler(msg)(s.ctx, msg) s.Require().NoError(err) - var result wasmdevgas.MsgStoreCodeResponse + var result wasmtypes.MsgStoreCodeResponse s.Require().NoError(s.app.AppCodec().Unmarshal(rsp.Data, &result)) s.Require().Equal(uint64(1), result.CodeID) expHash := sha256.Sum256(wasmContract) @@ -39,25 +39,25 @@ func (s *KeeperTestSuite) StoreCode() { s.Require().NotNil(info) s.Require().Equal(expHash[:], info.CodeHash) s.Require().Equal(sender.String(), info.Creator) - s.Require().Equal(wasmdevgas.DefaultParams().InstantiateDefaultPermission.With(sender), info.InstantiateConfig) + s.Require().Equal(wasmtypes.DefaultParams().InstantiateDefaultPermission.With(sender), info.InstantiateConfig) } func (s *KeeperTestSuite) InstantiateContract(sender string, admin string) string { - msgStoreCode := wasmdevgas.MsgStoreCodeFixture(func(m *wasmdevgas.MsgStoreCode) { + msgStoreCode := wasmtypes.MsgStoreCodeFixture(func(m *wasmtypes.MsgStoreCode) { m.WASMByteCode = wasmContract m.Sender = sender }) _, err := s.app.MsgServiceRouter().Handler(msgStoreCode)(s.ctx, msgStoreCode) s.Require().NoError(err) - msgInstantiate := wasmdevgas.MsgInstantiateContractFixture(func(m *wasmdevgas.MsgInstantiateContract) { + msgInstantiate := wasmtypes.MsgInstantiateContractFixture(func(m *wasmtypes.MsgInstantiateContract) { m.Sender = sender m.Admin = admin m.Msg = []byte(`{}`) }) resp, err := s.app.MsgServiceRouter().Handler(msgInstantiate)(s.ctx, msgInstantiate) s.Require().NoError(err) - var result wasmdevgas.MsgInstantiateContractResponse + var result wasmtypes.MsgInstantiateContractResponse s.Require().NoError(s.app.AppCodec().Unmarshal(resp.Data, &result)) contractInfo := s.app.WasmKeeper.GetContractInfo(s.ctx, sdk.MustAccAddressFromBech32(result.Address)) s.Require().Equal(contractInfo.CodeID, uint64(1)) @@ -122,7 +122,7 @@ func (s *KeeperTestSuite) TestRegisterFeeShare() { _, _, sender := testdata.KeyTestPubAddr() _ = s.FundAccount(s.ctx, sender, sdk.NewCoins(sdk.NewCoin("stake", math.NewInt(1_000_000)))) - gov := s.app.AccountKeeper.GetModuleAddress(govdevgas.ModuleName).String() + gov := s.app.AccountKeeper.GetModuleAddress(govtypes.ModuleName).String() govContract := s.InstantiateContract(sender.String(), gov) contractAddress := s.InstantiateContract(sender.String(), "") @@ -411,7 +411,7 @@ func (s *KeeperTestSuite) TestCancelFeeShare() { } func (s *KeeperTestSuite) TestUpdateParams() { - govModuleAddr := authdevgas.NewModuleAddress(govdevgas.ModuleName).String() + govModuleAddr := authtypes.NewModuleAddress(govtypes.ModuleName).String() goCtx := sdk.WrapSDKContext(s.ctx) for _, tc := range []struct { From 3b5a77d214cb33cdae3797653465c56f352a2553 Mon Sep 17 00:00:00 2001 From: expertdicer Date: Tue, 11 Feb 2025 16:32:32 +0700 Subject: [PATCH 3/5] chore: lint --- x/devgas/devgasmodule/genesis.go | 2 +- x/devgas/devgasmodule/genesis_test.go | 2 +- x/devgas/keeper/grpc_query_test.go | 2 +- x/devgas/keeper/keeper_test.go | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/x/devgas/devgasmodule/genesis.go b/x/devgas/devgasmodule/genesis.go index 5339cbbfc9..8f040afda7 100644 --- a/x/devgas/devgasmodule/genesis.go +++ b/x/devgas/devgasmodule/genesis.go @@ -5,8 +5,8 @@ import ( "github.com/NibiruChain/collections" - "github.com/NibiruChain/nibiru/v2/x/devgas/keeper" "github.com/NibiruChain/nibiru/v2/x/devgas" + "github.com/NibiruChain/nibiru/v2/x/devgas/keeper" ) // InitGenesis import module genesis diff --git a/x/devgas/devgasmodule/genesis_test.go b/x/devgas/devgasmodule/genesis_test.go index 85061e4569..6e34945144 100644 --- a/x/devgas/devgasmodule/genesis_test.go +++ b/x/devgas/devgasmodule/genesis_test.go @@ -12,8 +12,8 @@ import ( "github.com/NibiruChain/nibiru/v2/app" "github.com/NibiruChain/nibiru/v2/x/common/testutil" "github.com/NibiruChain/nibiru/v2/x/common/testutil/testapp" - "github.com/NibiruChain/nibiru/v2/x/devgas/devgasmodule" devgas "github.com/NibiruChain/nibiru/v2/x/devgas" + "github.com/NibiruChain/nibiru/v2/x/devgas/devgasmodule" ) type GenesisTestSuite struct { diff --git a/x/devgas/keeper/grpc_query_test.go b/x/devgas/keeper/grpc_query_test.go index b1b541c1ab..825df3b1b2 100644 --- a/x/devgas/keeper/grpc_query_test.go +++ b/x/devgas/keeper/grpc_query_test.go @@ -7,8 +7,8 @@ import ( "cosmossdk.io/math" "github.com/NibiruChain/nibiru/v2/x/common/testutil" - devgaskeeper "github.com/NibiruChain/nibiru/v2/x/devgas/keeper" devgas "github.com/NibiruChain/nibiru/v2/x/devgas" + devgaskeeper "github.com/NibiruChain/nibiru/v2/x/devgas/keeper" ) func (s *KeeperTestSuite) TestQueryFeeShares() { diff --git a/x/devgas/keeper/keeper_test.go b/x/devgas/keeper/keeper_test.go index 0a40248855..4dc0866dcf 100644 --- a/x/devgas/keeper/keeper_test.go +++ b/x/devgas/keeper/keeper_test.go @@ -12,8 +12,8 @@ import ( "github.com/NibiruChain/nibiru/v2/app" "github.com/NibiruChain/nibiru/v2/x/common/testutil/testapp" - devgaskeeper "github.com/NibiruChain/nibiru/v2/x/devgas/keeper" devgas "github.com/NibiruChain/nibiru/v2/x/devgas" + devgaskeeper "github.com/NibiruChain/nibiru/v2/x/devgas/keeper" ) // BankKeeper defines the expected interface needed to retrieve account balances. From 7e5aef3b8279dd5c493093c4ef6249fceca39b81 Mon Sep 17 00:00:00 2001 From: expertdicer Date: Tue, 11 Feb 2025 16:42:26 +0700 Subject: [PATCH 4/5] chore: update unit test --- x/devgas/client/cli/cli_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x/devgas/client/cli/cli_test.go b/x/devgas/client/cli/cli_test.go index 842297787c..2cf0ef6573 100644 --- a/x/devgas/client/cli/cli_test.go +++ b/x/devgas/client/cli/cli_test.go @@ -21,8 +21,8 @@ import ( svrcmd "github.com/cosmos/cosmos-sdk/server/cmd" "github.com/NibiruChain/nibiru/v2/x/common/testutil" - devgas "github.com/NibiruChain/nibiru/v2/x/devgas" "github.com/NibiruChain/nibiru/v2/x/devgas/client/cli" + "github.com/NibiruChain/nibiru/v2/x/devgas/devgasmodule" ) // CLITestSuite: Tests all tx commands for the module. @@ -43,7 +43,7 @@ func TestCLITestSuite(t *testing.T) { // Runs once before the entire test suite. func (s *CLITestSuite) SetupSuite() { - s.encCfg = testutilmod.MakeTestEncodingConfig(devgas.AppModuleBasic{}) + s.encCfg = testutilmod.MakeTestEncodingConfig(devgasmodule.AppModuleBasic{}) s.keyring = keyring.NewInMemory(s.encCfg.Codec) s.baseCtx = sdkclient.Context{}. WithKeyring(s.keyring). From b192f30623f36c5374934da6e6fafd2f16a57377 Mon Sep 17 00:00:00 2001 From: expertdicer Date: Tue, 11 Feb 2025 17:14:48 +0700 Subject: [PATCH 5/5] chore: update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 33c525a4d8..ed6d30af4f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -98,6 +98,7 @@ needed to include double quotes around the hexadecimal string. - [#2192](https://github.com/NibiruChain/nibiru/pull/2192) - fix(oracle): correctly handle misscount - [#2197](https://github.com/NibiruChain/nibiru/pull/2197) - chore(evm): Create ethers v6 adapters for Nibiru. Publish as a library on npm (`@nibiruchain/evm-core`) - [#2200](https://github.com/NibiruChain/nibiru/pull/2200) - fix(test): evm e2e oracle test fixed pair name +- [#2199](https://github.com/NibiruChain/nibiru/pull/2199) - refactor(devgas): For #1866 #### Nibiru EVM | Before Audit 2 - 2024-12-06