diff --git a/app/app.go b/app/app.go index 9e43cc960281461ceceed490b221c140000675f9..2299c0e198ed6070776a92973e0570315fa169cd 100644 --- a/app/app.go +++ b/app/app.go @@ -2,15 +2,16 @@ package app import ( "fmt" - capabilitykeeper "github.com/cosmos/cosmos-sdk/x/capability/keeper" - stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" - ibckeeper "github.com/cosmos/ibc-go/v3/modules/core/keeper" "io" "net/http" "os" "path/filepath" "strings" + capabilitykeeper "github.com/cosmos/cosmos-sdk/x/capability/keeper" + stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" + ibckeeper "github.com/cosmos/ibc-go/v3/modules/core/keeper" + "github.com/CosmWasm/wasmd/x/wasm" "github.com/gorilla/mux" "github.com/rakyll/statik/fs" diff --git a/x/epochs/module.go b/x/epochs/module.go index 3af73db3c6857e491baaa4cf3fe9d5c3331504df..289ca580926434adfd16b9e753d9cc055c63eb07 100644 --- a/x/epochs/module.go +++ b/x/epochs/module.go @@ -44,8 +44,7 @@ var ( // ---------------------------------------------------------------------------- // AppModuleBasic implements the AppModuleBasic interface for the capability module. -type AppModuleBasic struct { -} +type AppModuleBasic struct{} func NewAppModuleBasic() AppModuleBasic { return AppModuleBasic{} diff --git a/x/gamm/twap/hook_listener.go b/x/gamm/twap/hook_listener.go index cad053ab64a49143de2341918c54efa86a10ebe2..1b3c550ddd376ca0ce83f4c02c2d815d852e2509 100644 --- a/x/gamm/twap/hook_listener.go +++ b/x/gamm/twap/hook_listener.go @@ -9,8 +9,10 @@ import ( "github.com/osmosis-labs/osmosis/v10/x/gamm/types" ) -var _ types.GammHooks = &gammhook{} -var _ epochtypes.EpochHooks = &epochhook{} +var ( + _ types.GammHooks = &gammhook{} + _ epochtypes.EpochHooks = &epochhook{} +) type epochhook struct { k Keeper diff --git a/x/gamm/twap/keeper_test.go b/x/gamm/twap/keeper_test.go index 4ff8a68e015b0961b1a07525f760fbc47d020696..97414ffcc8b94e2987b6eff67c40c18b6a4fa95c 100644 --- a/x/gamm/twap/keeper_test.go +++ b/x/gamm/twap/keeper_test.go @@ -12,8 +12,10 @@ import ( "github.com/osmosis-labs/osmosis/v10/x/gamm/twap/types" ) -var defaultUniV2Coins = sdk.NewCoins(sdk.NewInt64Coin("token/B", 1_000_000_000), sdk.NewInt64Coin("token/A", 1_000_000_000)) -var baseTime = time.Unix(1257894000, 0).UTC() +var ( + defaultUniV2Coins = sdk.NewCoins(sdk.NewInt64Coin("token/B", 1_000_000_000), sdk.NewInt64Coin("token/A", 1_000_000_000)) + baseTime = time.Unix(1257894000, 0).UTC() +) type TestSuite struct { apptesting.KeeperTestHelper diff --git a/x/gamm/twap/module.go b/x/gamm/twap/module.go index 178c65219f5200ec499f1ca9e48fe1b13992ca8f..8a2cecb4921eea3028f5cd78965149c66dcc887b 100644 --- a/x/gamm/twap/module.go +++ b/x/gamm/twap/module.go @@ -23,8 +23,7 @@ var ( _ module.AppModuleBasic = AppModuleBasic{} ) -type AppModuleBasic struct { -} +type AppModuleBasic struct{} func (AppModuleBasic) Name() string { return types.ModuleName } diff --git a/x/gamm/twap/store_test.go b/x/gamm/twap/store_test.go index 50712277af5fba9cf6e558c454975592afdad4f0..74e15b496d83d494a43abc993c336eb9583ab3c4 100644 --- a/x/gamm/twap/store_test.go +++ b/x/gamm/twap/store_test.go @@ -84,12 +84,14 @@ func (s *TestSuite) TestGetAllMostRecentRecordsForPool() { recordsToSet: []types.TwapRecord{ newEmptyPriceRecord(1, baseTime, "tokenB", "tokenA"), newEmptyPriceRecord(1, baseTime, "tokenC", "tokenB"), - newEmptyPriceRecord(1, baseTime, "tokenC", "tokenA")}, + newEmptyPriceRecord(1, baseTime, "tokenC", "tokenA"), + }, poolId: 1, expectedRecords: []types.TwapRecord{ newEmptyPriceRecord(1, baseTime, "tokenB", "tokenA"), newEmptyPriceRecord(1, baseTime, "tokenC", "tokenA"), - newEmptyPriceRecord(1, baseTime, "tokenC", "tokenB")}, + newEmptyPriceRecord(1, baseTime, "tokenC", "tokenB"), + }, }, } @@ -136,40 +138,50 @@ func (s *TestSuite) TestGetRecordAtOrBeforeTime() { "rev at latest (exact)": {[]types.TwapRecord{baseRecord}, defaultRevInputAt(baseTime), baseRecord, true}, "get latest (exact) w/ past entries": { - []types.TwapRecord{tMin1Record, baseRecord}, defaultInputAt(baseTime), baseRecord, false}, + []types.TwapRecord{tMin1Record, baseRecord}, defaultInputAt(baseTime), baseRecord, false, + }, "get entry (exact) w/ a subsequent entry": { - []types.TwapRecord{tMin1Record, baseRecord}, defaultInputAt(tMin1), tMin1Record, false}, + []types.TwapRecord{tMin1Record, baseRecord}, defaultInputAt(tMin1), tMin1Record, false, + }, "get sandwitched entry (exact)": { - []types.TwapRecord{tMin1Record, baseRecord, tPlus1Record}, defaultInputAt(baseTime), baseRecord, false}, + []types.TwapRecord{tMin1Record, baseRecord, tPlus1Record}, defaultInputAt(baseTime), baseRecord, false, + }, "rev sandwitched entry (exact)": { - []types.TwapRecord{tMin1Record, baseRecord, tPlus1Record}, defaultRevInputAt(baseTime), baseRecord, true}, + []types.TwapRecord{tMin1Record, baseRecord, tPlus1Record}, defaultRevInputAt(baseTime), baseRecord, true, + }, "get future": {[]types.TwapRecord{baseRecord}, defaultInputAt(tPlus1), baseRecord, false}, "get future w/ past entries": {[]types.TwapRecord{tMin1Record, baseRecord}, defaultInputAt(tPlus1), baseRecord, false}, "get in between entries (2 entry)": { []types.TwapRecord{tMin1Record, baseRecord}, - defaultInputAt(baseTime.Add(-time.Millisecond)), tMin1Record, false}, + defaultInputAt(baseTime.Add(-time.Millisecond)), tMin1Record, false, + }, "get in between entries (3 entry)": { []types.TwapRecord{tMin1Record, baseRecord, tPlus1Record}, - defaultInputAt(baseTime.Add(-time.Millisecond)), tMin1Record, false}, + defaultInputAt(baseTime.Add(-time.Millisecond)), tMin1Record, false, + }, "get in between entries (3 entry) #2": { []types.TwapRecord{tMin1Record, baseRecord, tPlus1Record}, - defaultInputAt(baseTime.Add(time.Millisecond)), baseRecord, false}, + defaultInputAt(baseTime.Add(time.Millisecond)), baseRecord, false, + }, "query too old": { []types.TwapRecord{tMin1Record, baseRecord, tPlus1Record}, defaultInputAt(baseTime.Add(-time.Second * 2)), - baseRecord, true}, + baseRecord, true, + }, "non-existent pool ID": { []types.TwapRecord{tMin1Record, baseRecord, tPlus1Record}, - wrongPoolIdInputAt(baseTime), baseRecord, true}, + wrongPoolIdInputAt(baseTime), baseRecord, true, + }, "pool2 record get": { recordsToSet: []types.TwapRecord{newEmptyPriceRecord(2, baseTime, "tokenB", "tokenA")}, input: wrongPoolIdInputAt(baseTime), expectedRecord: newEmptyPriceRecord(2, baseTime, "tokenB", "tokenA"), - expErr: false}, + expErr: false, + }, } for name, test := range tests { s.Run(name, func() { diff --git a/x/ibc-rate-limit/ibc_middleware.go b/x/ibc-rate-limit/ibc_middleware.go index fc360e0a6eae06dec5ef727d201f2426519d2139..b23758040041303f0b13b0fe5278607649dc7e40 100644 --- a/x/ibc-rate-limit/ibc_middleware.go +++ b/x/ibc-rate-limit/ibc_middleware.go @@ -16,8 +16,10 @@ import ( lockupkeeper "github.com/osmosis-labs/osmosis/v10/x/lockup/keeper" ) -var _ porttypes.Middleware = &IBCModule{} -var _ porttypes.ICS4Wrapper = &ICS4Middleware{} +var ( + _ porttypes.Middleware = &IBCModule{} + _ porttypes.ICS4Wrapper = &ICS4Middleware{} +) type ICS4Middleware struct { channel porttypes.ICS4Wrapper diff --git a/x/ibc-rate-limit/rate_limit.go b/x/ibc-rate-limit/rate_limit.go index e0fed44596b94bee905b21841ac77aa35fddedfa..82a307ddfa57496355d74b849a76054481e31bc3 100644 --- a/x/ibc-rate-limit/rate_limit.go +++ b/x/ibc-rate-limit/rate_limit.go @@ -3,13 +3,14 @@ package ibc_rate_limit import ( "encoding/json" "fmt" + "strings" + wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" transfertypes "github.com/cosmos/ibc-go/v3/modules/apps/transfer/types" "github.com/cosmos/ibc-go/v3/modules/core/exported" "github.com/osmosis-labs/osmosis/v10/x/ibc-rate-limit/types" - "strings" ) func CheckRateLimits(ctx sdk.Context, wasmKeeper *wasmkeeper.Keeper, msgType, contractParam, channelValue, sourceChannel string, sender sdk.AccAddress, amount string) error { diff --git a/x/ibc-rate-limit/testutil/chain.go b/x/ibc-rate-limit/testutil/chain.go index ca0fc4ffd68300ce6db78a3a96cc92dfefc17ea2..de5fcaeeb5780236d3169b6628a0ea3f4a3791fd 100644 --- a/x/ibc-rate-limit/testutil/chain.go +++ b/x/ibc-rate-limit/testutil/chain.go @@ -1,16 +1,17 @@ package osmosisibctesting import ( + "time" + "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/client" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/ibc-go/v3/testing" + ibctesting "github.com/cosmos/ibc-go/v3/testing" "github.com/cosmos/ibc-go/v3/testing/simapp/helpers" "github.com/osmosis-labs/osmosis/v10/app" abci "github.com/tendermint/tendermint/abci/types" tmproto "github.com/tendermint/tendermint/proto/tendermint/types" - "time" ) type TestChain struct { @@ -56,7 +57,6 @@ func SignAndDeliver( txCfg client.TxConfig, app *baseapp.BaseApp, header tmproto.Header, msgs []sdk.Msg, chainID string, accNums, accSeqs []uint64, priv ...cryptotypes.PrivKey, ) (sdk.GasInfo, *sdk.Result, error) { - tx, _ := helpers.GenTx( txCfg, msgs, diff --git a/x/ibc-rate-limit/testutil/wasm.go b/x/ibc-rate-limit/testutil/wasm.go index 39c4c879f3f61fd7e8eaf8e9a02bb87915c6deab..1aafb15512cf5650123f45504c55f8221a52c251 100644 --- a/x/ibc-rate-limit/testutil/wasm.go +++ b/x/ibc-rate-limit/testutil/wasm.go @@ -2,6 +2,8 @@ package osmosisibctesting import ( "fmt" + "io/ioutil" + wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" sdk "github.com/cosmos/cosmos-sdk/types" @@ -9,7 +11,6 @@ import ( transfertypes "github.com/cosmos/ibc-go/v3/modules/apps/transfer/types" "github.com/osmosis-labs/osmosis/v10/x/ibc-rate-limit/types" "github.com/stretchr/testify/suite" - "io/ioutil" ) func (chain *TestChain) StoreContractCode(suite *suite.Suite) { diff --git a/x/ibc-rate-limit/types/params.go b/x/ibc-rate-limit/types/params.go index 316f946e206b75a7965940d0ade4f334c9cd30a7..2651c6ba42d7b5edd8be42371fb34e73ee5b6a56 100644 --- a/x/ibc-rate-limit/types/params.go +++ b/x/ibc-rate-limit/types/params.go @@ -2,6 +2,7 @@ package types import ( "fmt" + sdk "github.com/cosmos/cosmos-sdk/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" @@ -54,7 +55,6 @@ func validateContractAddress(i interface{}) error { bech32, err := sdk.AccAddressFromBech32(v) if err != nil { return err - } err = sdk.VerifyAddressFormat(bech32) diff --git a/x/incentives/keeper/msg_server_test.go b/x/incentives/keeper/msg_server_test.go index f6c8518a95713cf1e8b691ad31fd2563cf72279d..72b0f04dd21c8aa6a430d6e00a9c9730302c4e13 100644 --- a/x/incentives/keeper/msg_server_test.go +++ b/x/incentives/keeper/msg_server_test.go @@ -134,7 +134,6 @@ func (suite *KeeperTestSuite) TestCreateGauge_Fee() { } func (suite *KeeperTestSuite) TestAddToGauge_Fee() { - tests := []struct { name string accountBalanceToFund sdk.Coins diff --git a/x/incentives/module.go b/x/incentives/module.go index 18f3dfcb9d76c0d5570bc68d46199b3de89d5917..d6bba6ce7a7b337c5b03a075a65e7f5f6d11b36b 100644 --- a/x/incentives/module.go +++ b/x/incentives/module.go @@ -44,8 +44,7 @@ var ( // ---------------------------------------------------------------------------- // Implements the AppModuleBasic interface for the module. -type AppModuleBasic struct { -} +type AppModuleBasic struct{} // NewAppModuleBasic creates a new AppModuleBasic struct. func NewAppModuleBasic() AppModuleBasic { diff --git a/x/lockup/module.go b/x/lockup/module.go index 74522afdca26b3c892ced13cef30c3b4fd0274db..9882046099dc27ae87a8086e8e54d77f418f8742 100644 --- a/x/lockup/module.go +++ b/x/lockup/module.go @@ -47,8 +47,7 @@ var ( // ---------------------------------------------------------------------------- // AppModuleBasic implements the AppModuleBasic interface for the capability module. -type AppModuleBasic struct { -} +type AppModuleBasic struct{} func NewAppModuleBasic() AppModuleBasic { return AppModuleBasic{} diff --git a/x/mint/keeper/export_test.go b/x/mint/keeper/export_test.go index 90cfc2453e8d7504fc4f74fc76623d021db1af68..d7db176e64c6c2d207bc21d07496c9f01833d576 100644 --- a/x/mint/keeper/export_test.go +++ b/x/mint/keeper/export_test.go @@ -16,9 +16,7 @@ const ( DeveloperVestingAmount = developerVestingAmount ) -var ( - GetProportions = getProportions -) +var GetProportions = getProportions func (k Keeper) DistributeToModule(ctx sdk.Context, recipientModule string, mintedCoin sdk.Coin, proportion sdk.Dec) (sdk.Int, error) { return k.distributeToModule(ctx, recipientModule, mintedCoin, proportion) diff --git a/x/mint/keeper/keeper_test.go b/x/mint/keeper/keeper_test.go index d05d0711ecf19d53f56d547715d71dcf78d410b3..acb2da1a059b45ccd82030868b1496fe9478542f 100644 --- a/x/mint/keeper/keeper_test.go +++ b/x/mint/keeper/keeper_test.go @@ -158,9 +158,7 @@ func (suite *KeeperTestSuite) TestDistributeMintedCoin() { mintAmount = 10000 ) - var ( - params = types.DefaultParams() - ) + params := types.DefaultParams() tests := []struct { name string diff --git a/x/pool-incentives/module.go b/x/pool-incentives/module.go index 5f963bde10d7227326b27f7624e9e9208fb8d9d4..fddd674fa32cb7d7368bfe60cde139280917e4f5 100644 --- a/x/pool-incentives/module.go +++ b/x/pool-incentives/module.go @@ -40,8 +40,7 @@ var ( _ module.AppModuleSimulation = AppModule{} ) -type AppModuleBasic struct { -} +type AppModuleBasic struct{} // Name returns the pool-incentives module's name. func (AppModuleBasic) Name() string { return types.ModuleName } diff --git a/x/superfluid/keeper/stake_test.go b/x/superfluid/keeper/stake_test.go index ad1b52b6fac06fb07512d45880d9e3a45508b569..5f16df89e18f764b89b1b8123a74bd8b9b78c9e5 100644 --- a/x/superfluid/keeper/stake_test.go +++ b/x/superfluid/keeper/stake_test.go @@ -514,7 +514,6 @@ func (suite *KeeperTestSuite) TestRefreshIntermediaryDelegationAmounts() { refreshed := suite.App.BankKeeper.GetBalance(suite.Ctx, intermediaryAcc.GetAccAddress(), sdk.DefaultBondDenom) suite.Require().True(refreshed.IsZero()) } - }) } } diff --git a/x/superfluid/module.go b/x/superfluid/module.go index c53127ca2ffb404386a3e919df01be3761b5a0d0..386b20695aea96c771bf620dc505eb144cf42743 100644 --- a/x/superfluid/module.go +++ b/x/superfluid/module.go @@ -43,8 +43,7 @@ var ( // ---------------------------------------------------------------------------- // AppModuleBasic implements the AppModuleBasic interface for the capability module. -type AppModuleBasic struct { -} +type AppModuleBasic struct{} func NewAppModuleBasic() AppModuleBasic { return AppModuleBasic{} diff --git a/x/tokenfactory/module.go b/x/tokenfactory/module.go index 5a694320045f101869fecb0d56df69c0d05cc6de..a368632a01ea03011115bce2f7937a133f4d7fe0 100644 --- a/x/tokenfactory/module.go +++ b/x/tokenfactory/module.go @@ -41,8 +41,7 @@ var ( // ---------------------------------------------------------------------------- // AppModuleBasic implements the AppModuleBasic interface for the capability module. -type AppModuleBasic struct { -} +type AppModuleBasic struct{} func NewAppModuleBasic() AppModuleBasic { return AppModuleBasic{} diff --git a/x/txfees/module.go b/x/txfees/module.go index 943486f51517e8694959491a97a7e1a697687b10..b11927dcf3e36f24858f91e83433c34ae89c6b95 100644 --- a/x/txfees/module.go +++ b/x/txfees/module.go @@ -42,8 +42,7 @@ const ModuleName = types.ModuleName // ---------------------------------------------------------------------------- // AppModuleBasic implements the AppModuleBasic interface for the txfees module. -type AppModuleBasic struct { -} +type AppModuleBasic struct{} func NewAppModuleBasic() AppModuleBasic { return AppModuleBasic{}