Skip to content

Commit

Permalink
make format
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolaslara committed Aug 10, 2022
1 parent 6432034 commit 9ffdc37
Show file tree
Hide file tree
Showing 21 changed files with 58 additions and 51 deletions.
7 changes: 4 additions & 3 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
3 changes: 1 addition & 2 deletions x/epochs/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
Expand Down
6 changes: 4 additions & 2 deletions x/gamm/twap/hook_listener.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions x/gamm/twap/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions x/gamm/twap/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ var (
_ module.AppModuleBasic = AppModuleBasic{}
)

type AppModuleBasic struct {
}
type AppModuleBasic struct{}

func (AppModuleBasic) Name() string { return types.ModuleName }

Expand Down
36 changes: 24 additions & 12 deletions x/gamm/twap/store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
},
},
}

Expand Down Expand Up @@ -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() {
Expand Down
6 changes: 4 additions & 2 deletions x/ibc-rate-limit/ibc_middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion x/ibc-rate-limit/rate_limit.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
6 changes: 3 additions & 3 deletions x/ibc-rate-limit/testutil/chain.go
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down Expand Up @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion x/ibc-rate-limit/testutil/wasm.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ 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"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
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) {
Expand Down
2 changes: 1 addition & 1 deletion x/ibc-rate-limit/types/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package types

import (
"fmt"

sdk "github.com/cosmos/cosmos-sdk/types"

paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
Expand Down Expand Up @@ -54,7 +55,6 @@ func validateContractAddress(i interface{}) error {
bech32, err := sdk.AccAddressFromBech32(v)
if err != nil {
return err

}

err = sdk.VerifyAddressFormat(bech32)
Expand Down
1 change: 0 additions & 1 deletion x/incentives/keeper/msg_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ func (suite *KeeperTestSuite) TestCreateGauge_Fee() {
}

func (suite *KeeperTestSuite) TestAddToGauge_Fee() {

tests := []struct {
name string
accountBalanceToFund sdk.Coins
Expand Down
3 changes: 1 addition & 2 deletions x/incentives/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
3 changes: 1 addition & 2 deletions x/lockup/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
Expand Down
4 changes: 1 addition & 3 deletions x/mint/keeper/export_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 1 addition & 3 deletions x/mint/keeper/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,7 @@ func (suite *KeeperTestSuite) TestDistributeMintedCoin() {
mintAmount = 10000
)

var (
params = types.DefaultParams()
)
params := types.DefaultParams()

tests := []struct {
name string
Expand Down
3 changes: 1 addition & 2 deletions x/pool-incentives/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
1 change: 0 additions & 1 deletion x/superfluid/keeper/stake_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,6 @@ func (suite *KeeperTestSuite) TestRefreshIntermediaryDelegationAmounts() {
refreshed := suite.App.BankKeeper.GetBalance(suite.Ctx, intermediaryAcc.GetAccAddress(), sdk.DefaultBondDenom)
suite.Require().True(refreshed.IsZero())
}

})
}
}
Expand Down
3 changes: 1 addition & 2 deletions x/superfluid/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
Expand Down
3 changes: 1 addition & 2 deletions x/tokenfactory/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
Expand Down
3 changes: 1 addition & 2 deletions x/txfees/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
Expand Down

0 comments on commit 9ffdc37

Please sign in to comment.