From 57bcb8d5dfbf25a6e3e5fc97fc4778893ecc4d38 Mon Sep 17 00:00:00 2001 From: scorpioborn <97235353+scorpioborn@users.noreply.github.com> Date: Wed, 28 Jun 2023 11:08:11 +0330 Subject: [PATCH 1/3] refactor: separate bet place fields and payload --- x/bet/types/place_bet_fields.go | 24 ++++++ x/bet/types/place_bet_fields_test.go | 80 +++++++++++++++++++ x/bet/types/ticket.go | 48 +++++++++++ .../{validation_test.go => ticket_test.go} | 71 ---------------- x/bet/types/validation.go | 65 --------------- 5 files changed, 152 insertions(+), 136 deletions(-) create mode 100644 x/bet/types/place_bet_fields.go create mode 100644 x/bet/types/place_bet_fields_test.go create mode 100644 x/bet/types/ticket.go rename x/bet/types/{validation_test.go => ticket_test.go} (68%) delete mode 100644 x/bet/types/validation.go diff --git a/x/bet/types/place_bet_fields.go b/x/bet/types/place_bet_fields.go new file mode 100644 index 00000000..b96d0672 --- /dev/null +++ b/x/bet/types/place_bet_fields.go @@ -0,0 +1,24 @@ +package types + +import ( + "strings" + + "github.com/sge-network/sge/utils" +) + +// BetFieldsValidation validates fields of the given bet +func BetFieldsValidation(bet *PlaceBetFields) error { + if !utils.IsValidUID(bet.UID) { + return ErrInvalidBetUID + } + + if bet.Amount.IsNil() || !bet.Amount.IsPositive() { + return ErrInvalidAmount + } + + if bet.Ticket == "" || strings.Contains(bet.Ticket, " ") { + return ErrInvalidTicket + } + + return nil +} diff --git a/x/bet/types/place_bet_fields_test.go b/x/bet/types/place_bet_fields_test.go new file mode 100644 index 00000000..bf797118 --- /dev/null +++ b/x/bet/types/place_bet_fields_test.go @@ -0,0 +1,80 @@ +package types_test + +import ( + "testing" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/sge-network/sge/x/bet/types" + "github.com/stretchr/testify/require" +) + +func TestBetFieldsValidation(t *testing.T) { + tcs := []struct { + desc string + bet *types.PlaceBetFields + err error + }{ + { + desc: "space in UID", + bet: &types.PlaceBetFields{ + UID: " ", + Amount: sdk.NewInt(int64(10)), + Ticket: "Ticket", + }, + err: types.ErrInvalidBetUID, + }, + { + desc: "invalid UID", + bet: &types.PlaceBetFields{ + UID: "invalidUID", + Amount: sdk.NewInt(int64(10)), + Ticket: "Ticket", + }, + err: types.ErrInvalidBetUID, + }, + { + desc: "invalid amount", + bet: &types.PlaceBetFields{ + UID: "6e31c60f-2025-48ce-ae79-1dc110f16355", + Amount: sdk.NewInt(int64(-1)), + Ticket: "Ticket", + }, + err: types.ErrInvalidAmount, + }, + { + desc: "empty amount", + bet: &types.PlaceBetFields{ + UID: "6e31c60f-2025-48ce-ae79-1dc110f16355", + Ticket: "Ticket", + }, + err: types.ErrInvalidAmount, + }, + { + desc: "space in ticket", + bet: &types.PlaceBetFields{ + UID: "6e31c60f-2025-48ce-ae79-1dc110f16355", + Amount: sdk.NewInt(int64(10)), + Ticket: " ", + }, + err: types.ErrInvalidTicket, + }, + { + desc: "valid message", + bet: &types.PlaceBetFields{ + UID: "6e31c60f-2025-48ce-ae79-1dc110f16355", + Amount: sdk.NewInt(int64(10)), + Ticket: "Ticket", + }, + }, + } + for _, tc := range tcs { + t.Run(tc.desc, func(t *testing.T) { + err := types.BetFieldsValidation(tc.bet) + if tc.err != nil { + require.ErrorIs(t, err, tc.err) + return + } + require.NoError(t, err) + }) + } +} diff --git a/x/bet/types/ticket.go b/x/bet/types/ticket.go new file mode 100644 index 00000000..2c43d955 --- /dev/null +++ b/x/bet/types/ticket.go @@ -0,0 +1,48 @@ +package types + +import ( + "strings" + + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/sge-network/sge/utils" +) + +// Validate validates fields of the given ticketData +func (payload *BetPlacementTicketPayload) Validate(creator string) error { + if payload.SelectedOdds == nil { + return ErrOddsDataNotFound + } + + if !payload.KycData.Validate(creator) { + return sdkerrors.Wrapf(ErrUserKycFailed, "%s", creator) + } + + if !utils.IsValidUID(payload.SelectedOdds.MarketUID) { + return ErrInvalidMarketUID + } + + if !utils.IsValidUID(payload.SelectedOdds.UID) { + return ErrInvalidOddsUID + } + + if len(strings.TrimSpace(payload.SelectedOdds.Value)) == 0 { + return ErrEmptyOddsValue + } + + if payload.SelectedOdds.MaxLossMultiplier.IsNil() || + payload.SelectedOdds.MaxLossMultiplier.LTE(sdk.ZeroDec()) { + return ErrMaxLossMultiplierCanNotBeZero + } + + if payload.SelectedOdds.MaxLossMultiplier.GT(sdk.OneDec()) { + return ErrMaxLossMultiplierCanNotBeMoreThanOne + } + + if payload.OddsType < OddsType_ODDS_TYPE_DECIMAL || + payload.OddsType > OddsType_ODDS_TYPE_MONEYLINE { + return ErrInvalidOddsType + } + + return nil +} diff --git a/x/bet/types/validation_test.go b/x/bet/types/ticket_test.go similarity index 68% rename from x/bet/types/validation_test.go rename to x/bet/types/ticket_test.go index 8370bd9c..fecc0500 100644 --- a/x/bet/types/validation_test.go +++ b/x/bet/types/ticket_test.go @@ -9,77 +9,6 @@ import ( "github.com/stretchr/testify/require" ) -func TestBetFieldsValidation(t *testing.T) { - tcs := []struct { - desc string - bet *types.PlaceBetFields - err error - }{ - { - desc: "space in UID", - bet: &types.PlaceBetFields{ - UID: " ", - Amount: sdk.NewInt(int64(10)), - Ticket: "Ticket", - }, - err: types.ErrInvalidBetUID, - }, - { - desc: "invalid UID", - bet: &types.PlaceBetFields{ - UID: "invalidUID", - Amount: sdk.NewInt(int64(10)), - Ticket: "Ticket", - }, - err: types.ErrInvalidBetUID, - }, - { - desc: "invalid amount", - bet: &types.PlaceBetFields{ - UID: "6e31c60f-2025-48ce-ae79-1dc110f16355", - Amount: sdk.NewInt(int64(-1)), - Ticket: "Ticket", - }, - err: types.ErrInvalidAmount, - }, - { - desc: "empty amount", - bet: &types.PlaceBetFields{ - UID: "6e31c60f-2025-48ce-ae79-1dc110f16355", - Ticket: "Ticket", - }, - err: types.ErrInvalidAmount, - }, - { - desc: "space in ticket", - bet: &types.PlaceBetFields{ - UID: "6e31c60f-2025-48ce-ae79-1dc110f16355", - Amount: sdk.NewInt(int64(10)), - Ticket: " ", - }, - err: types.ErrInvalidTicket, - }, - { - desc: "valid message", - bet: &types.PlaceBetFields{ - UID: "6e31c60f-2025-48ce-ae79-1dc110f16355", - Amount: sdk.NewInt(int64(10)), - Ticket: "Ticket", - }, - }, - } - for _, tc := range tcs { - t.Run(tc.desc, func(t *testing.T) { - err := types.BetFieldsValidation(tc.bet) - if tc.err != nil { - require.ErrorIs(t, err, tc.err) - return - } - require.NoError(t, err) - }) - } -} - func TestTicketFieldsValidation(t *testing.T) { tcs := []struct { desc string diff --git a/x/bet/types/validation.go b/x/bet/types/validation.go deleted file mode 100644 index 1add2ab0..00000000 --- a/x/bet/types/validation.go +++ /dev/null @@ -1,65 +0,0 @@ -package types - -import ( - "strings" - - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/sge-network/sge/utils" -) - -// BetFieldsValidation validates fields of the given bet -func BetFieldsValidation(bet *PlaceBetFields) error { - if !utils.IsValidUID(bet.UID) { - return ErrInvalidBetUID - } - - if bet.Amount.IsNil() || !bet.Amount.IsPositive() { - return ErrInvalidAmount - } - - if bet.Ticket == "" || strings.Contains(bet.Ticket, " ") { - return ErrInvalidTicket - } - - return nil -} - -// Validate validates fields of the given ticketData -func (ticketData *BetPlacementTicketPayload) Validate(creator string) error { - if ticketData.SelectedOdds == nil { - return ErrOddsDataNotFound - } - - if !ticketData.KycData.Validate(creator) { - return sdkerrors.Wrapf(ErrUserKycFailed, "%s", creator) - } - - if !utils.IsValidUID(ticketData.SelectedOdds.MarketUID) { - return ErrInvalidMarketUID - } - - if !utils.IsValidUID(ticketData.SelectedOdds.UID) { - return ErrInvalidOddsUID - } - - if len(strings.TrimSpace(ticketData.SelectedOdds.Value)) == 0 { - return ErrEmptyOddsValue - } - - if ticketData.SelectedOdds.MaxLossMultiplier.IsNil() || - ticketData.SelectedOdds.MaxLossMultiplier.LTE(sdk.ZeroDec()) { - return ErrMaxLossMultiplierCanNotBeZero - } - - if ticketData.SelectedOdds.MaxLossMultiplier.GT(sdk.OneDec()) { - return ErrMaxLossMultiplierCanNotBeMoreThanOne - } - - if ticketData.OddsType < OddsType_ODDS_TYPE_DECIMAL || - ticketData.OddsType > OddsType_ODDS_TYPE_MONEYLINE { - return ErrInvalidOddsType - } - - return nil -} From 1ff8f3215ae65ed8711185255ca7c49a615fcca3 Mon Sep 17 00:00:00 2001 From: scorpioborn <97235353+scorpioborn@users.noreply.github.com> Date: Wed, 28 Jun 2023 11:09:18 +0330 Subject: [PATCH 2/3] refactor: bet place and settle file names match orderbook --- x/bet/keeper/{place_bet.go => bet_place.go} | 0 x/bet/keeper/{place_bet_test.go => bet_place_test.go} | 0 x/bet/keeper/{settle_bet.go => bet_settle.go} | 0 x/bet/keeper/{settle_bet_test.go => bet_settle_test.go} | 0 x/bet/keeper/msg_server_bet.go | 8 ++++---- 5 files changed, 4 insertions(+), 4 deletions(-) rename x/bet/keeper/{place_bet.go => bet_place.go} (100%) rename x/bet/keeper/{place_bet_test.go => bet_place_test.go} (100%) rename x/bet/keeper/{settle_bet.go => bet_settle.go} (100%) rename x/bet/keeper/{settle_bet_test.go => bet_settle_test.go} (100%) diff --git a/x/bet/keeper/place_bet.go b/x/bet/keeper/bet_place.go similarity index 100% rename from x/bet/keeper/place_bet.go rename to x/bet/keeper/bet_place.go diff --git a/x/bet/keeper/place_bet_test.go b/x/bet/keeper/bet_place_test.go similarity index 100% rename from x/bet/keeper/place_bet_test.go rename to x/bet/keeper/bet_place_test.go diff --git a/x/bet/keeper/settle_bet.go b/x/bet/keeper/bet_settle.go similarity index 100% rename from x/bet/keeper/settle_bet.go rename to x/bet/keeper/bet_settle.go diff --git a/x/bet/keeper/settle_bet_test.go b/x/bet/keeper/bet_settle_test.go similarity index 100% rename from x/bet/keeper/settle_bet_test.go rename to x/bet/keeper/bet_settle_test.go diff --git a/x/bet/keeper/msg_server_bet.go b/x/bet/keeper/msg_server_bet.go index 878a63c5..38e5a79e 100644 --- a/x/bet/keeper/msg_server_bet.go +++ b/x/bet/keeper/msg_server_bet.go @@ -20,17 +20,17 @@ func (k msgServer) PlaceBet( return nil, sdkerrors.Wrapf(types.ErrDuplicateUID, "%s", msg.Bet.UID) } - ticketData := &types.BetPlacementTicketPayload{} - err := k.ovmKeeper.VerifyTicketUnmarshal(sdk.WrapSDKContext(ctx), msg.Bet.Ticket, &ticketData) + payload := &types.BetPlacementTicketPayload{} + err := k.ovmKeeper.VerifyTicketUnmarshal(sdk.WrapSDKContext(ctx), msg.Bet.Ticket, &payload) if err != nil { return nil, sdkerrors.Wrapf(types.ErrInTicketVerification, "%s", err) } - if err = ticketData.Validate(msg.Creator); err != nil { + if err = payload.Validate(msg.Creator); err != nil { return nil, sdkerrors.Wrapf(types.ErrInTicketValidation, "%s", err) } - bet := types.NewBet(msg.Creator, msg.Bet, ticketData.OddsType, ticketData.SelectedOdds) + bet := types.NewBet(msg.Creator, msg.Bet, payload.OddsType, payload.SelectedOdds) if err := k.Keeper.PlaceBet(ctx, bet); err != nil { return nil, sdkerrors.Wrapf(types.ErrInBetPlacement, "%s", err) From fbf93a30b06cd9992093673dcd7d0715ce4d9f31 Mon Sep 17 00:00:00 2001 From: scorpioborn <97235353+scorpioborn@users.noreply.github.com> Date: Wed, 28 Jun 2023 12:38:09 +0330 Subject: [PATCH 3/3] refactor: make app sge keepers pointer --- app/keepers/keepers.go | 92 +++++++++++++++++-------------- x/bet/genesis_test.go | 4 +- x/bet/keeper/keeper_test.go | 8 +-- x/house/keeper/keeper_test.go | 2 +- x/market/genesis_test.go | 4 +- x/market/keeper/keeper_test.go | 4 +- x/orderbook/keeper/keeper_test.go | 2 +- x/ovm/genesis_test.go | 4 +- x/ovm/keeper/keeper_test.go | 2 +- 9 files changed, 66 insertions(+), 56 deletions(-) diff --git a/app/keepers/keepers.go b/app/keepers/keepers.go index f6e91671..0803327f 100644 --- a/app/keepers/keepers.go +++ b/app/keepers/keepers.go @@ -81,13 +81,12 @@ type AppKeepers struct { tkeys map[string]*sdk.TransientStoreKey memKeys map[string]*sdk.MemoryStoreKey - // keepers + // SDK keepers AccountKeeper authkeeper.AccountKeeper BankKeeper bankkeeper.Keeper CapabilityKeeper *capabilitykeeper.Keeper StakingKeeper stakingkeeper.Keeper SlashingKeeper slashingkeeper.Keeper - MintKeeper mintkeeper.Keeper DistrKeeper distrkeeper.Keeper GovKeeper govkeeper.Keeper CrisisKeeper crisiskeeper.Keeper @@ -101,26 +100,30 @@ type AppKeepers struct { FeeGrantKeeper feegrantkeeper.Keeper AuthzKeeper authzkeeper.Keeper - MarketKeeper marketmodulekeeper.Keeper - BetKeeper betmodulekeeper.Keeper - OVMKeeper ovmmodulekeeper.Keeper - OrderbookKeeper orderbookmodulekeeper.Keeper - HouseKeeper housemodulekeeper.Keeper - MarketModule marketmodule.AppModule + //// SGE keepers \\\\ + BetKeeper *betmodulekeeper.Keeper + MarketKeeper *marketmodulekeeper.Keeper + MintKeeper mintkeeper.Keeper + HouseKeeper *housemodulekeeper.Keeper + OrderbookKeeper *orderbookmodulekeeper.Keeper + OVMKeeper *ovmmodulekeeper.Keeper + + //// SGE modules \\\\ BetModule betmodule.AppModule - OrderbookModule orderbookmodule.AppModule + MarketModule marketmodule.AppModule HouseModule housemodule.AppModule - - // modules - ICAModule ica.AppModule - TransferModule transfer.AppModule - OVMModule ovmmodule.AppModule + OrderbookModule orderbookmodule.AppModule + OVMModule ovmmodule.AppModule // make scoped keepers public for test purposes ScopedIBCKeeper capabilitykeeper.ScopedKeeper ScopedTransferKeeper capabilitykeeper.ScopedKeeper ScopedICAControllerKeeper capabilitykeeper.ScopedKeeper ScopedICAHostKeeper capabilitykeeper.ScopedKeeper + + // IBC Modules + ICAModule ica.AppModule + TransferModule transfer.AppModule } func NewAppKeeper( @@ -214,17 +217,6 @@ func NewAppKeeper( appKeepers.GetSubspace(stakingtypes.ModuleName), ) - appKeepers.OrderbookKeeper = *orderbookmodulekeeper.NewKeeper( - appCodec, - appKeepers.keys[orderbookmoduletypes.StoreKey], - appKeepers.GetSubspace(orderbookmoduletypes.ModuleName), - orderbookmodulekeeper.SdkExpectedKeepers{ - BankKeeper: appKeepers.BankKeeper, - AccountKeeper: appKeepers.AccountKeeper, - FeeGrantKeeper: appKeepers.FeeGrantKeeper, - }, - ) - appKeepers.MintKeeper = *mintkeeper.NewKeeper( appCodec, appKeepers.keys[minttypes.StoreKey], @@ -347,14 +339,27 @@ func NewAppKeeper( appKeepers.SlashingKeeper, ) - appKeepers.OVMKeeper = *ovmmodulekeeper.NewKeeper( + //// SGE keepers \\\\ + + appKeepers.OrderbookKeeper = orderbookmodulekeeper.NewKeeper( + appCodec, + appKeepers.keys[orderbookmoduletypes.StoreKey], + appKeepers.GetSubspace(orderbookmoduletypes.ModuleName), + orderbookmodulekeeper.SdkExpectedKeepers{ + BankKeeper: appKeepers.BankKeeper, + AccountKeeper: appKeepers.AccountKeeper, + FeeGrantKeeper: appKeepers.FeeGrantKeeper, + }, + ) + + appKeepers.OVMKeeper = ovmmodulekeeper.NewKeeper( appCodec, appKeepers.keys[ovmmoduletypes.StoreKey], appKeepers.keys[ovmmoduletypes.MemStoreKey], appKeepers.GetSubspace(ovmmoduletypes.ModuleName), ) - appKeepers.MarketKeeper = *marketmodulekeeper.NewKeeper( + appKeepers.MarketKeeper = marketmodulekeeper.NewKeeper( appCodec, appKeepers.keys[marketmoduletypes.StoreKey], appKeepers.keys[marketmoduletypes.MemStoreKey], @@ -363,7 +368,7 @@ func NewAppKeeper( appKeepers.MarketKeeper.SetOVMKeeper(appKeepers.OVMKeeper) appKeepers.MarketKeeper.SetOrderbookKeeper(appKeepers.OrderbookKeeper) - appKeepers.BetKeeper = *betmodulekeeper.NewKeeper( + appKeepers.BetKeeper = betmodulekeeper.NewKeeper( appCodec, appKeepers.keys[betmoduletypes.StoreKey], appKeepers.keys[betmoduletypes.MemStoreKey], @@ -377,7 +382,7 @@ func NewAppKeeper( appKeepers.OrderbookKeeper.SetMarketKeeper(appKeepers.MarketKeeper) appKeepers.OrderbookKeeper.SetOVMKeeper(appKeepers.OVMKeeper) - appKeepers.HouseKeeper = *housemodulekeeper.NewKeeper( + appKeepers.HouseKeeper = housemodulekeeper.NewKeeper( appCodec, appKeepers.keys[housemoduletypes.StoreKey], appKeepers.OrderbookKeeper, @@ -389,32 +394,37 @@ func NewAppKeeper( ) appKeepers.OrderbookKeeper.SetHouseKeeper(appKeepers.HouseKeeper) - appKeepers.OVMModule = ovmmodule.NewAppModule( + //// SGE modules \\\\ + + appKeepers.BetModule = betmodule.NewAppModule( appCodec, - appKeepers.OVMKeeper, + *appKeepers.BetKeeper, appKeepers.AccountKeeper, appKeepers.BankKeeper, + appKeepers.MarketKeeper, + appKeepers.OrderbookKeeper, + appKeepers.OVMKeeper, ) appKeepers.MarketModule = marketmodule.NewAppModule( appCodec, - appKeepers.MarketKeeper, + *appKeepers.MarketKeeper, appKeepers.AccountKeeper, appKeepers.BankKeeper, appKeepers.OVMKeeper, ) - appKeepers.BetModule = betmodule.NewAppModule( + appKeepers.HouseModule = housemodule.NewAppModule( appCodec, - appKeepers.BetKeeper, - appKeepers.AccountKeeper, - appKeepers.BankKeeper, - appKeepers.MarketKeeper, - appKeepers.OrderbookKeeper, - appKeepers.OVMKeeper, + *appKeepers.HouseKeeper, ) - appKeepers.HouseModule = housemodule.NewAppModule(appCodec, appKeepers.HouseKeeper) appKeepers.OrderbookModule = orderbookmodule.NewAppModule( appCodec, - appKeepers.OrderbookKeeper, + *appKeepers.OrderbookKeeper, + ) + appKeepers.OVMModule = ovmmodule.NewAppModule( + appCodec, + *appKeepers.OVMKeeper, + appKeepers.AccountKeeper, + appKeepers.BankKeeper, ) // Create static IBC router, add transfer route, then set and seal it diff --git a/x/bet/genesis_test.go b/x/bet/genesis_test.go index ef305fa1..d41d4394 100644 --- a/x/bet/genesis_test.go +++ b/x/bet/genesis_test.go @@ -54,8 +54,8 @@ func TestGenesis(t *testing.T) { }, } - bet.InitGenesis(ctx, tApp.BetKeeper, genesisState) - got := bet.ExportGenesis(ctx, tApp.BetKeeper) + bet.InitGenesis(ctx, *tApp.BetKeeper, genesisState) + got := bet.ExportGenesis(ctx, *tApp.BetKeeper) require.NotNil(t, got) nullify.Fill(&genesisState) diff --git a/x/bet/keeper/keeper_test.go b/x/bet/keeper/keeper_test.go index 28cc6f6a..189ef814 100644 --- a/x/bet/keeper/keeper_test.go +++ b/x/bet/keeper/keeper_test.go @@ -52,7 +52,7 @@ func setupKeeperAndApp(t testing.TB) (*simappUtil.TestApp, *keeper.KeeperTest, s tApp, ctx, err := simappUtil.GetTestObjects() require.NoError(t, err) - return tApp, &tApp.BetKeeper, ctx + return tApp, tApp.BetKeeper, ctx } func setupKeeper(t testing.TB) (*keeper.KeeperTest, sdk.Context) { @@ -81,7 +81,7 @@ func addTestMarket(t testing.TB, tApp *simappUtil.TestApp, ctx sdk.Context) { Ticket: testAddMarketTicket, } wctx := sdk.WrapSDKContext(ctx) - marketSrv := marketkeeper.NewMsgServerImpl(tApp.MarketKeeper) + marketSrv := marketkeeper.NewMsgServerImpl(*tApp.MarketKeeper) resAddMarket, err := marketSrv.AddMarket(wctx, testAddMarket) require.Nil(t, err) require.NotNil(t, resAddMarket) @@ -115,7 +115,7 @@ func addTestMarketBatch( Ticket: testAddMarketTicket, } wctx := sdk.WrapSDKContext(ctx) - marketSrv := marketkeeper.NewMsgServerImpl(tApp.MarketKeeper) + marketSrv := marketkeeper.NewMsgServerImpl(*tApp.MarketKeeper) resAddMarket, err := marketSrv.AddMarket(wctx, testAddMarket) require.Nil(t, err) require.NotNil(t, resAddMarket) @@ -133,7 +133,7 @@ func placeTestBet( ) { testCreator = simappUtil.TestParamUsers["user1"].Address.String() wctx := sdk.WrapSDKContext(ctx) - betSrv := keeper.NewMsgServerImpl(tApp.BetKeeper) + betSrv := keeper.NewMsgServerImpl(*tApp.BetKeeper) testKyc := &sgetypes.KycDataPayload{ Approved: true, ID: testCreator, diff --git a/x/house/keeper/keeper_test.go b/x/house/keeper/keeper_test.go index a6fc0231..ea6d7223 100644 --- a/x/house/keeper/keeper_test.go +++ b/x/house/keeper/keeper_test.go @@ -33,5 +33,5 @@ func setupKeeperAndApp(t testing.TB) (*simappUtil.TestApp, *keeper.KeeperTest, s tApp, ctx, err := simappUtil.GetTestObjects() require.NoError(t, err) - return tApp, &tApp.HouseKeeper, ctx.WithBlockTime(time.Now()) + return tApp, tApp.HouseKeeper, ctx.WithBlockTime(time.Now()) } diff --git a/x/market/genesis_test.go b/x/market/genesis_test.go index 7b4450a0..d60bbca5 100644 --- a/x/market/genesis_test.go +++ b/x/market/genesis_test.go @@ -27,8 +27,8 @@ func TestGenesis(t *testing.T) { tApp, ctx, err := simappUtil.GetTestObjects() require.NoError(t, err) - market.InitGenesis(ctx, tApp.MarketKeeper, genesisState) - got := market.ExportGenesis(ctx, tApp.MarketKeeper) + market.InitGenesis(ctx, *tApp.MarketKeeper, genesisState) + got := market.ExportGenesis(ctx, *tApp.MarketKeeper) require.NotNil(t, got) nullify.Fill(&genesisState) diff --git a/x/market/keeper/keeper_test.go b/x/market/keeper/keeper_test.go index f87e3aa0..a6b4e417 100644 --- a/x/market/keeper/keeper_test.go +++ b/x/market/keeper/keeper_test.go @@ -15,14 +15,14 @@ func setupKeeperAndApp(t testing.TB) (*simappUtil.TestApp, *keeper.KeeperTest, s tApp, ctx, err := simappUtil.GetTestObjects() require.NoError(t, err) - return tApp, &tApp.MarketKeeper, ctx.WithBlockTime(time.Now()) + return tApp, tApp.MarketKeeper, ctx.WithBlockTime(time.Now()) } func setupKeeper(t testing.TB) (*keeper.KeeperTest, sdk.Context) { tApp, ctx, err := simappUtil.GetTestObjects() require.NoError(t, err) - return &tApp.MarketKeeper, ctx + return tApp.MarketKeeper, ctx } func createJwtTicket(claim jwt.MapClaims) (string, error) { diff --git a/x/orderbook/keeper/keeper_test.go b/x/orderbook/keeper/keeper_test.go index 80f0cbcf..60fa4a11 100644 --- a/x/orderbook/keeper/keeper_test.go +++ b/x/orderbook/keeper/keeper_test.go @@ -26,5 +26,5 @@ func setupKeeperAndApp(t testing.TB) (*simappUtil.TestApp, *keeper.KeeperTest, s tApp, ctx, err := simappUtil.GetTestObjects() require.NoError(t, err) - return tApp, &tApp.OrderbookKeeper, ctx.WithBlockTime(time.Now()) + return tApp, tApp.OrderbookKeeper, ctx.WithBlockTime(time.Now()) } diff --git a/x/ovm/genesis_test.go b/x/ovm/genesis_test.go index 5bf2ad1b..0e144b69 100644 --- a/x/ovm/genesis_test.go +++ b/x/ovm/genesis_test.go @@ -21,8 +21,8 @@ func TestGenesis(t *testing.T) { tApp, ctx, err := simappUtil.GetTestObjects() require.NoError(t, err) - ovm.InitGenesis(ctx, tApp.OVMKeeper, genesisState) - got := ovm.ExportGenesis(ctx, tApp.OVMKeeper) + ovm.InitGenesis(ctx, *tApp.OVMKeeper, genesisState) + got := ovm.ExportGenesis(ctx, *tApp.OVMKeeper) require.NotNil(t, got) nullify.Fill(&genesisState) diff --git a/x/ovm/keeper/keeper_test.go b/x/ovm/keeper/keeper_test.go index b9a4511b..7b0be621 100644 --- a/x/ovm/keeper/keeper_test.go +++ b/x/ovm/keeper/keeper_test.go @@ -13,7 +13,7 @@ func setupKeeperAndApp(t testing.TB) (*simappUtil.TestApp, *keeper.KeeperTest, s tApp, ctx, err := simappUtil.GetTestObjects() require.NoError(t, err) - return tApp, &tApp.OVMKeeper, ctx + return tApp, tApp.OVMKeeper, ctx } func setupKeeper(t testing.TB) (*keeper.KeeperTest, sdk.Context) {