diff --git a/cmd/crescentd/cmd/genaccounts.go b/cmd/crescentd/cmd/genaccounts.go index 0e0ae059..6d34558a 100644 --- a/cmd/crescentd/cmd/genaccounts.go +++ b/cmd/crescentd/cmd/genaccounts.go @@ -10,7 +10,6 @@ import ( "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/crypto/keyring" "github.com/cosmos/cosmos-sdk/server" sdk "github.com/cosmos/cosmos-sdk/types" @@ -40,8 +39,7 @@ contain valid denominations. Accounts may optionally be supplied with vesting pa Args: cobra.ExactArgs(2), RunE: func(cmd *cobra.Command, args []string) error { clientCtx := client.GetClientContextFromCmd(cmd) - depCdc := clientCtx.Codec - cdc := depCdc.(codec.Codec) + cdc := clientCtx.Codec serverCtx := server.GetServerContextFromCmd(cmd) config := serverCtx.Config @@ -160,7 +158,7 @@ contain valid denominations. Accounts may optionally be supplied with vesting pa appState[authtypes.ModuleName] = authGenStateBz - bankGenState := banktypes.GetGenesisStateFromAppState(depCdc, appState) + bankGenState := banktypes.GetGenesisStateFromAppState(cdc, appState) bankGenState.Balances = append(bankGenState.Balances, balances) bankGenState.Balances = banktypes.SanitizeGenesisBalances(bankGenState.Balances) bankGenState.Supply = bankGenState.Supply.Add(balances.Coins...) diff --git a/x/liquidity/types/common_test.go b/x/liquidity/types/common_test.go index 4fe47d0a..97c97fb2 100644 --- a/x/liquidity/types/common_test.go +++ b/x/liquidity/types/common_test.go @@ -10,6 +10,7 @@ func newBuyOrder(price string, amount int64) *types.Order { return types.NewOrder(sdk.AccAddress{}, types.SwapDirectionBuy, newDec(price), sdk.NewInt(amount)) } +//nolint func newSellOrder(price string, amount int64) *types.Order { return types.NewOrder(sdk.AccAddress{}, types.SwapDirectionSell, newDec(price), sdk.NewInt(amount)) } diff --git a/x/liquidity/types/orderbook_test.go b/x/liquidity/types/orderbook_test.go index 2f6abf2c..57962261 100644 --- a/x/liquidity/types/orderbook_test.go +++ b/x/liquidity/types/orderbook_test.go @@ -60,39 +60,39 @@ func TestOrderBookTicks_FindPrice(t *testing.T) { func TestOrderBookTicks_AddOrder(t *testing.T) { checkSorted := func(ticks *types.OrderBookTicks) { - require.True(t, sort.SliceIsSorted(ticks, func(i, j int) bool { + require.True(t, sort.SliceIsSorted(ticks.Ticks, func(i, j int) bool { return ticks.Ticks[i].Price.GTE(ticks.Ticks[j].Price) }), "ticks must be sorted") } ticks := testOrderBookTicks() checkSorted(ticks) - require.Len(t, ticks, 11) + require.Len(t, ticks.Ticks, 11) // Same price already exists ticks.AddOrder(newBuyOrder("18.0", 1000)) checkSorted(ticks) - require.Len(t, ticks, 11) + require.Len(t, ticks.Ticks, 11) // New price. We don't care about the tick precision here ticks.AddOrder(newBuyOrder("18.000000000000000001", 1000)) checkSorted(ticks) - require.Len(t, ticks, 12) + require.Len(t, ticks.Ticks, 12) // Add an order with same price as above again ticks.AddOrder(newBuyOrder("18.000000000000000001", 1000)) checkSorted(ticks) - require.Len(t, ticks, 12) + require.Len(t, ticks.Ticks, 12) // Add an order with higher price than the highest price in ticks. ticks.AddOrder(newBuyOrder("21.0", 1000)) checkSorted(ticks) - require.Len(t, ticks, 13) + require.Len(t, ticks.Ticks, 13) // Add an order with lower price than the lowest price in ticks. ticks.AddOrder(newBuyOrder("9.0", 1000)) checkSorted(ticks) - require.Len(t, ticks, 14) + require.Len(t, ticks.Ticks, 14) } func TestOrderBookTicks_AmountGTE(t *testing.T) { diff --git a/x/liquidity/types/pool.go b/x/liquidity/types/pool.go index 252e4c67..704a1a63 100644 --- a/x/liquidity/types/pool.go +++ b/x/liquidity/types/pool.go @@ -152,7 +152,6 @@ func (os PoolOrderSource) AmountLTE(price sdk.Dec) sdk.Int { func (os PoolOrderSource) Orders(price sdk.Dec) Orders { panic("not implemented") - return nil } func (os PoolOrderSource) UpTick(price sdk.Dec) (tick sdk.Dec, found bool) {