From 8853e8d3d184654ecad3d964670cad6703a37573 Mon Sep 17 00:00:00 2001 From: Federico Kunze Date: Thu, 30 Apr 2020 10:13:31 -0400 Subject: [PATCH] linters and format --- .github/lint.yml | 12 ++++ Makefile | 13 ++++ app/sim_test.go | 9 +-- cmd/kvcli/main.go | 6 +- cmd/kvd/add_account.go | 3 +- go.mod | 1 + golangci.yml | 63 +++++++++++++++++++ rest_test/setup/setuptest.go | 9 +-- x/auction/alias.go | 46 +++++++------- x/auction/keeper/auctions.go | 1 + x/auction/keeper/params.go | 1 + x/auction/keeper/querier_test.go | 7 ++- x/bep3/client/cli/tx.go | 3 +- x/bep3/client/rest/query.go | 1 + x/bep3/keeper/asset_test.go | 7 ++- x/bep3/keeper/integration_test.go | 5 +- x/bep3/keeper/keeper.go | 3 +- x/bep3/keeper/keeper_test.go | 7 ++- x/bep3/keeper/params_test.go | 7 ++- x/bep3/keeper/swap.go | 14 ++--- x/bep3/simulation/genesis.go | 1 + x/bep3/types/common_test.go | 3 +- x/bep3/types/genesis_test.go | 3 +- x/bep3/types/hash_test.go | 5 +- x/bep3/types/params_test.go | 3 +- x/cdp/abci.go | 3 +- x/cdp/abci_test.go | 7 ++- x/cdp/genesis.go | 1 + x/cdp/genesis_test.go | 3 +- x/cdp/handler_test.go | 5 +- x/cdp/integration_test.go | 15 ++--- x/cdp/keeper/auctions.go | 1 + x/cdp/keeper/auctions_test.go | 1 + x/cdp/keeper/cdp.go | 3 +- x/cdp/keeper/cdp_test.go | 7 ++- x/cdp/keeper/deposit.go | 1 + x/cdp/keeper/deposit_test.go | 7 ++- x/cdp/keeper/draw.go | 1 + x/cdp/keeper/draw_test.go | 7 ++- x/cdp/keeper/fees.go | 1 + x/cdp/keeper/fees_test.go | 5 +- x/cdp/keeper/integration_test.go | 15 ++--- x/cdp/keeper/keeper.go | 1 + x/cdp/keeper/keeper_bench_test.go | 5 +- x/cdp/keeper/params.go | 1 + x/cdp/keeper/querier_test.go | 7 ++- x/cdp/keeper/savings.go | 1 + x/cdp/keeper/savings_test.go | 7 ++- x/cdp/keeper/seize.go | 1 + x/cdp/simulation/genesis.go | 1 + x/cdp/simulation/utils_test.go | 3 +- x/cdp/types/expected_keepers.go | 1 + x/cdp/types/genesis_test.go | 2 +- x/cdp/types/keys.go | 2 +- x/cdp/types/params_test.go | 3 +- x/cdp/types/utils_test.go | 1 - x/committee/genesis.go | 1 + x/committee/proposal_handler_test.go | 4 +- x/committee/types/committee.go | 5 +- x/committee/types/genesis.go | 4 +- x/committee/types/proposal.go | 2 +- x/incentive/abci.go | 1 + x/incentive/client/cli/query.go | 3 +- x/incentive/client/cli/tx.go | 3 +- x/incentive/client/rest/query.go | 1 + x/incentive/client/rest/tx.go | 1 + x/incentive/genesis.go | 1 + x/incentive/handler.go | 1 + x/incentive/handler_test.go | 7 ++- x/incentive/keeper/keeper.go | 1 + x/incentive/keeper/keeper_test.go | 7 ++- x/incentive/keeper/params.go | 1 + x/incentive/keeper/payout.go | 1 + x/incentive/keeper/payout_test.go | 3 +- x/incentive/keeper/querier.go | 3 +- x/incentive/keeper/querier_test.go | 3 +- x/incentive/keeper/rewards.go | 3 +- x/incentive/keeper/rewards_test.go | 9 +-- x/incentive/module.go | 5 +- x/incentive/simulation/params.go | 1 + x/incentive/types/account_test.go | 5 +- x/incentive/types/expected_keepers.go | 1 + x/incentive/types/msg_test.go | 9 +-- x/incentive/types/params.go | 3 +- x/incentive/types/params_test.go | 19 +++--- x/kavadist/genesis.go | 3 +- x/kavadist/keeper/keeper.go | 1 + x/kavadist/keeper/mint.go | 3 +- x/kavadist/keeper/mint_test.go | 7 ++- x/kavadist/keeper/params.go | 1 + x/kavadist/module.go | 3 +- x/kavadist/types/params.go | 3 +- x/kavadist/types/params_test.go | 9 +-- x/pricefeed/client/cli/query.go | 3 +- x/pricefeed/client/cli/tx.go | 3 +- x/pricefeed/client/rest/tx.go | 3 +- x/pricefeed/genesis_test.go | 1 + x/pricefeed/integration_test.go | 16 ++--- x/pricefeed/keeper/integration_test.go | 8 +-- x/pricefeed/keeper/params_test.go | 5 +- x/validator-vesting/abci.go | 3 +- x/validator-vesting/abci_test.go | 7 ++- x/validator-vesting/client/rest/query.go | 1 + x/validator-vesting/genesis.go | 1 + x/validator-vesting/keeper/keeper.go | 3 +- x/validator-vesting/keeper/keeper_test.go | 9 +-- x/validator-vesting/keeper/test_common.go | 1 + x/validator-vesting/module.go | 1 + x/validator-vesting/simulation/decoder.go | 3 +- .../simulation/decoder_test.go | 3 +- x/validator-vesting/simulation/genesis.go | 1 + x/validator-vesting/test_common.go | 1 + .../types/validator_vesting_account.go | 2 +- .../types/validator_vesting_account_test.go | 4 +- 114 files changed, 377 insertions(+), 192 deletions(-) create mode 100644 .github/lint.yml create mode 100644 golangci.yml diff --git a/.github/lint.yml b/.github/lint.yml new file mode 100644 index 00000000..de312698 --- /dev/null +++ b/.github/lint.yml @@ -0,0 +1,12 @@ +name: Lint +on: [pull_request] +jobs: + golangci-lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + - name: golangci-lint + uses: reviewdog/action-golangci-lint@v1 + with: + github_token: ${{ secrets.github_token }} + reporter: github-pr-review diff --git a/Makefile b/Makefile index 7becb364..23bc0592 100644 --- a/Makefile +++ b/Makefile @@ -103,6 +103,19 @@ clean: link-check: @go run github.com/raviqqe/liche -r . --exclude "^http://127.*|^https://riot.im/app*|^http://kava-testnet*|^https://testnet-dex*" + +lint: + golangci-lint run + find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" | xargs gofmt -d -s + go mod verify +.PHONY: lint + +format: + find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -name '*.pb.go' | xargs gofmt -w -s + find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -name '*.pb.go' | xargs misspell -w + find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -name '*.pb.go' | xargs goimports -w -local github.com/kava-labs/kava +.PHONY: format + ######################################## ### Testing diff --git a/app/sim_test.go b/app/sim_test.go index d6bd256b..3b341cbd 100644 --- a/app/sim_test.go +++ b/app/sim_test.go @@ -20,6 +20,11 @@ import ( "github.com/cosmos/cosmos-sdk/x/slashing" "github.com/cosmos/cosmos-sdk/x/staking" "github.com/cosmos/cosmos-sdk/x/supply" + "github.com/stretchr/testify/require" + abci "github.com/tendermint/tendermint/abci/types" + "github.com/tendermint/tendermint/libs/log" + dbm "github.com/tendermint/tm-db" + "github.com/kava-labs/kava/x/auction" "github.com/kava-labs/kava/x/bep3" "github.com/kava-labs/kava/x/cdp" @@ -27,10 +32,6 @@ import ( "github.com/kava-labs/kava/x/kavadist" "github.com/kava-labs/kava/x/pricefeed" validatorvesting "github.com/kava-labs/kava/x/validator-vesting" - "github.com/stretchr/testify/require" - abci "github.com/tendermint/tendermint/abci/types" - "github.com/tendermint/tendermint/libs/log" - dbm "github.com/tendermint/tm-db" ) type StoreKeysPrefixes struct { diff --git a/cmd/kvcli/main.go b/cmd/kvcli/main.go index 8700f0ac..5c637dd4 100644 --- a/cmd/kvcli/main.go +++ b/cmd/kvcli/main.go @@ -8,13 +8,13 @@ import ( "github.com/spf13/cobra" "github.com/spf13/viper" - amino "github.com/tendermint/go-amino" "github.com/tendermint/tendermint/libs/cli" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/client/lcd" "github.com/cosmos/cosmos-sdk/client/rpc" + "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/version" "github.com/cosmos/cosmos-sdk/x/auth" @@ -79,7 +79,7 @@ func main() { } } -func queryCmd(cdc *amino.Codec) *cobra.Command { +func queryCmd(cdc *codec.Codec) *cobra.Command { queryCmd := &cobra.Command{ Use: "query", Aliases: []string{"q"}, @@ -102,7 +102,7 @@ func queryCmd(cdc *amino.Codec) *cobra.Command { return queryCmd } -func txCmd(cdc *amino.Codec) *cobra.Command { +func txCmd(cdc *codec.Codec) *cobra.Command { txCmd := &cobra.Command{ Use: "tx", Short: "Transactions subcommands", diff --git a/cmd/kvd/add_account.go b/cmd/kvd/add_account.go index 95ae9b0e..9349a078 100644 --- a/cmd/kvd/add_account.go +++ b/cmd/kvd/add_account.go @@ -9,9 +9,10 @@ import ( "github.com/spf13/cobra" "github.com/spf13/viper" - validatorvesting "github.com/kava-labs/kava/x/validator-vesting" "github.com/tendermint/tendermint/libs/cli" + validatorvesting "github.com/kava-labs/kava/x/validator-vesting" + "github.com/cosmos/cosmos-sdk/client/keys" "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/server" diff --git a/go.mod b/go.mod index 2b057cfa..ed8d8905 100644 --- a/go.mod +++ b/go.mod @@ -5,6 +5,7 @@ go 1.13 require ( github.com/btcsuite/btcd v0.20.1-beta // indirect github.com/cosmos/cosmos-sdk v0.38.3 + github.com/gogo/protobuf v1.3.1 github.com/gorilla/mux v1.7.3 github.com/spf13/cobra v0.0.6 github.com/spf13/viper v1.6.2 diff --git a/golangci.yml b/golangci.yml new file mode 100644 index 00000000..307611ef --- /dev/null +++ b/golangci.yml @@ -0,0 +1,63 @@ +run: + tests: false +# # timeout for analysis, e.g. 30s, 5m, default is 1m +# timeout: 5m + +linters: + disable-all: true + enable: + - bodyclose + - deadcode + - depguard + - dogsled + # - errcheck + - goconst + - gocritic + - gofmt + - goimports + - golint + - gosec + - gosimple + - govet + - ineffassign + - interfacer + - maligned + - misspell + - nakedret + - prealloc + - scopelint + - staticcheck + - structcheck + - stylecheck + - typecheck + - unconvert + - unused + - misspell + - wsl + +issues: + exclude-rules: + - text: "Use of weak random number generator" + linters: + - gosec + - text: "comment on exported var" + linters: + - golint + - text: "don't use an underscore in package name" + linters: + - golint + - text: "ST1003:" + linters: + - stylecheck + # FIXME: Disabled until golangci-lint updates stylecheck with this fix: + # https://github.com/dominikh/go-tools/issues/389 + - text: "ST1016:" + linters: + - stylecheck + +linters-settings: + dogsled: + max-blank-identifiers: 3 + maligned: + # print struct with more effective memory layout or not, false by default + suggest-new: true diff --git a/rest_test/setup/setuptest.go b/rest_test/setup/setuptest.go index 6419b88c..4f7daca6 100644 --- a/rest_test/setup/setuptest.go +++ b/rest_test/setup/setuptest.go @@ -10,6 +10,7 @@ import ( "time" "github.com/cosmos/cosmos-sdk/client/keys" + "github.com/cosmos/cosmos-sdk/codec" crkeys "github.com/cosmos/cosmos-sdk/crypto/keys" sdk "github.com/cosmos/cosmos-sdk/types" sdkrest "github.com/cosmos/cosmos-sdk/types/rest" @@ -21,11 +22,11 @@ import ( "github.com/cosmos/cosmos-sdk/x/gov" "github.com/cosmos/cosmos-sdk/x/gov/types" "github.com/cosmos/cosmos-sdk/x/staking" + tmtime "github.com/tendermint/tendermint/types/time" + "github.com/kava-labs/kava/app" "github.com/kava-labs/kava/x/cdp" "github.com/kava-labs/kava/x/pricefeed" - "github.com/tendermint/go-amino" - tmtime "github.com/tendermint/tendermint/types/time" ) func init() { @@ -394,7 +395,7 @@ func getKeybase() crkeys.Keybase { } // sendMsgToBlockchain sends a message to the blockchain via the rest api -func sendMsgToBlockchain(cdc *amino.Codec, address string, keyname string, +func sendMsgToBlockchain(cdc *codec.Codec, address string, keyname string, password string, msg []sdk.Msg, keybase crkeys.Keybase) { // get the account number and sequence number @@ -450,7 +451,7 @@ func sendMsgToBlockchain(cdc *amino.Codec, address string, keyname string, } // getAccountNumberAndSequenceNumber gets an account number and sequence number from the blockchain -func getAccountNumberAndSequenceNumber(cdc *amino.Codec, address string) (accountNumber uint64, sequenceNumber uint64) { +func getAccountNumberAndSequenceNumber(cdc *codec.Codec, address string) (accountNumber uint64, sequenceNumber uint64) { // we need to setup the account number and sequence in order to have a valid transaction resp, err := http.Get("http://localhost:1317/auth/accounts/" + address) diff --git a/x/auction/alias.go b/x/auction/alias.go index 0ac1a7dd..1cbf3593 100644 --- a/x/auction/alias.go +++ b/x/auction/alias.go @@ -12,29 +12,29 @@ import ( // ALIASGEN: github.com/kava-labs/kava/x/auction/types const ( - EventTypeAuctionStart = types.EventTypeAuctionStart - EventTypeAuctionBid = types.EventTypeAuctionBid - EventTypeAuctionClose = types.EventTypeAuctionClose - AttributeValueCategory = types.AttributeValueCategory - AttributeKeyAuctionID = types.AttributeKeyAuctionID - AttributeKeyAuctionType = types.AttributeKeyAuctionType - AttributeKeyBidder = types.AttributeKeyBidder - AttributeKeyBidDenom = types.AttributeKeyBidDenom - AttributeKeyLotDenom = types.AttributeKeyLotDenom - AttributeKeyBidAmount = types.AttributeKeyBidAmount - AttributeKeyLotAmount = types.AttributeKeyLotAmount - AttributeKeyEndTime = types.AttributeKeyEndTime - DefaultNextAuctionID = types.DefaultNextAuctionID - ModuleName = types.ModuleName - StoreKey = types.StoreKey - RouterKey = types.RouterKey - DefaultParamspace = types.DefaultParamspace - QuerierRoute = types.QuerierRoute - DefaultMaxAuctionDuration = types.DefaultMaxAuctionDuration - DefaultBidDuration = types.DefaultBidDuration - QueryGetAuction = types.QueryGetAuction - QueryGetAuctions = types.QueryGetAuctions - QueryGetParams = types.QueryGetParams + EventTypeAuctionStart = types.EventTypeAuctionStart + EventTypeAuctionBid = types.EventTypeAuctionBid + EventTypeAuctionClose = types.EventTypeAuctionClose + AttributeValueCategory = types.AttributeValueCategory + AttributeKeyAuctionID = types.AttributeKeyAuctionID + AttributeKeyAuctionType = types.AttributeKeyAuctionType + AttributeKeyBidder = types.AttributeKeyBidder + AttributeKeyBidDenom = types.AttributeKeyBidDenom + AttributeKeyLotDenom = types.AttributeKeyLotDenom + AttributeKeyBidAmount = types.AttributeKeyBidAmount + AttributeKeyLotAmount = types.AttributeKeyLotAmount + AttributeKeyEndTime = types.AttributeKeyEndTime + DefaultNextAuctionID = types.DefaultNextAuctionID + ModuleName = types.ModuleName + StoreKey = types.StoreKey + RouterKey = types.RouterKey + DefaultParamspace = types.DefaultParamspace + QuerierRoute = types.QuerierRoute + DefaultMaxAuctionDuration = types.DefaultMaxAuctionDuration + DefaultBidDuration = types.DefaultBidDuration + QueryGetAuction = types.QueryGetAuction + QueryGetAuctions = types.QueryGetAuctions + QueryGetParams = types.QueryGetParams ) var ( diff --git a/x/auction/keeper/auctions.go b/x/auction/keeper/auctions.go index c1722dee..c6152652 100644 --- a/x/auction/keeper/auctions.go +++ b/x/auction/keeper/auctions.go @@ -7,6 +7,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/x/supply" + "github.com/kava-labs/kava/x/auction/types" ) diff --git a/x/auction/keeper/params.go b/x/auction/keeper/params.go index 6d7ddfd5..3ffc3da4 100644 --- a/x/auction/keeper/params.go +++ b/x/auction/keeper/params.go @@ -2,6 +2,7 @@ package keeper import ( sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/kava-labs/kava/x/auction/types" ) diff --git a/x/auction/keeper/querier_test.go b/x/auction/keeper/querier_test.go index fa0d1b9f..78ce6b5d 100644 --- a/x/auction/keeper/querier_test.go +++ b/x/auction/keeper/querier_test.go @@ -10,13 +10,14 @@ import ( authexported "github.com/cosmos/cosmos-sdk/x/auth/exported" "github.com/cosmos/cosmos-sdk/x/simulation" "github.com/cosmos/cosmos-sdk/x/supply" + "github.com/stretchr/testify/suite" + abci "github.com/tendermint/tendermint/abci/types" + tmtime "github.com/tendermint/tendermint/types/time" + "github.com/kava-labs/kava/app" "github.com/kava-labs/kava/x/auction/keeper" "github.com/kava-labs/kava/x/auction/types" "github.com/kava-labs/kava/x/cdp" - "github.com/stretchr/testify/suite" - abci "github.com/tendermint/tendermint/abci/types" - tmtime "github.com/tendermint/tendermint/types/time" ) const ( diff --git a/x/bep3/client/cli/tx.go b/x/bep3/client/cli/tx.go index 9543d5c2..6de11a45 100644 --- a/x/bep3/client/cli/tx.go +++ b/x/bep3/client/cli/tx.go @@ -14,9 +14,10 @@ import ( "github.com/cosmos/cosmos-sdk/version" "github.com/cosmos/cosmos-sdk/x/auth" "github.com/cosmos/cosmos-sdk/x/auth/client/utils" - "github.com/kava-labs/kava/x/bep3/types" "github.com/spf13/cobra" tmtime "github.com/tendermint/tendermint/types/time" + + "github.com/kava-labs/kava/x/bep3/types" ) // GetTxCmd returns the transaction commands for this module diff --git a/x/bep3/client/rest/query.go b/x/bep3/client/rest/query.go index 559919f5..7ae9bc35 100644 --- a/x/bep3/client/rest/query.go +++ b/x/bep3/client/rest/query.go @@ -8,6 +8,7 @@ import ( "github.com/cosmos/cosmos-sdk/client/context" "github.com/cosmos/cosmos-sdk/types/rest" + "github.com/kava-labs/kava/x/bep3/types" ) diff --git a/x/bep3/keeper/asset_test.go b/x/bep3/keeper/asset_test.go index 9c167289..4d4f2748 100644 --- a/x/bep3/keeper/asset_test.go +++ b/x/bep3/keeper/asset_test.go @@ -4,12 +4,13 @@ import ( "testing" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/kava-labs/kava/app" - "github.com/kava-labs/kava/x/bep3/keeper" - "github.com/kava-labs/kava/x/bep3/types" "github.com/stretchr/testify/suite" abci "github.com/tendermint/tendermint/abci/types" tmtime "github.com/tendermint/tendermint/types/time" + + "github.com/kava-labs/kava/app" + "github.com/kava-labs/kava/x/bep3/keeper" + "github.com/kava-labs/kava/x/bep3/types" ) type AssetTestSuite struct { diff --git a/x/bep3/keeper/integration_test.go b/x/bep3/keeper/integration_test.go index 5e4d4a37..6b231bb2 100644 --- a/x/bep3/keeper/integration_test.go +++ b/x/bep3/keeper/integration_test.go @@ -4,11 +4,12 @@ import ( "time" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/tendermint/tendermint/crypto" + tmtime "github.com/tendermint/tendermint/types/time" + "github.com/kava-labs/kava/app" "github.com/kava-labs/kava/x/bep3" "github.com/kava-labs/kava/x/bep3/types" - "github.com/tendermint/tendermint/crypto" - tmtime "github.com/tendermint/tendermint/types/time" ) const ( diff --git a/x/bep3/keeper/keeper.go b/x/bep3/keeper/keeper.go index 3a800422..f7612aaf 100644 --- a/x/bep3/keeper/keeper.go +++ b/x/bep3/keeper/keeper.go @@ -7,8 +7,9 @@ import ( "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/params/subspace" - "github.com/kava-labs/kava/x/bep3/types" "github.com/tendermint/tendermint/libs/log" + + "github.com/kava-labs/kava/x/bep3/types" ) // Keeper of the bep3 store diff --git a/x/bep3/keeper/keeper_test.go b/x/bep3/keeper/keeper_test.go index 9837a747..4bd4e109 100644 --- a/x/bep3/keeper/keeper_test.go +++ b/x/bep3/keeper/keeper_test.go @@ -5,12 +5,13 @@ import ( "time" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/kava-labs/kava/app" - "github.com/kava-labs/kava/x/bep3/keeper" - "github.com/kava-labs/kava/x/bep3/types" "github.com/stretchr/testify/suite" abci "github.com/tendermint/tendermint/abci/types" tmtime "github.com/tendermint/tendermint/types/time" + + "github.com/kava-labs/kava/app" + "github.com/kava-labs/kava/x/bep3/keeper" + "github.com/kava-labs/kava/x/bep3/types" ) const LongtermStorageDuration = 86400 diff --git a/x/bep3/keeper/params_test.go b/x/bep3/keeper/params_test.go index 3c4bae7d..b4131dc0 100644 --- a/x/bep3/keeper/params_test.go +++ b/x/bep3/keeper/params_test.go @@ -5,12 +5,13 @@ import ( "testing" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/kava-labs/kava/app" - "github.com/kava-labs/kava/x/bep3/keeper" - "github.com/kava-labs/kava/x/bep3/types" "github.com/stretchr/testify/suite" abci "github.com/tendermint/tendermint/abci/types" tmtime "github.com/tendermint/tendermint/types/time" + + "github.com/kava-labs/kava/app" + "github.com/kava-labs/kava/x/bep3/keeper" + "github.com/kava-labs/kava/x/bep3/types" ) type ParamsTestSuite struct { diff --git a/x/bep3/keeper/swap.go b/x/bep3/keeper/swap.go index 58d53121..6e94e555 100644 --- a/x/bep3/keeper/swap.go +++ b/x/bep3/keeper/swap.go @@ -245,13 +245,13 @@ func (k Keeper) UpdateExpiredAtomicSwaps(ctx sdk.Context) error { } // Emit 'swaps_expired' event - ctx.EventManager().EmitEvent( - sdk.NewEvent( - types.EventTypeSwapsExpired, - sdk.NewAttribute(types.AttributeKeyAtomicSwapIDs, fmt.Sprintf("%s", expiredSwapIDs)), - sdk.NewAttribute(types.AttributeExpirationBlock, fmt.Sprintf("%d", ctx.BlockHeight())), - ), - ) + ctx.EventManager().EmitEvent( + sdk.NewEvent( + types.EventTypeSwapsExpired, + sdk.NewAttribute(types.AttributeKeyAtomicSwapIDs, fmt.Sprintf("%s", expiredSwapIDs)), + sdk.NewAttribute(types.AttributeExpirationBlock, fmt.Sprintf("%d", ctx.BlockHeight())), + ), + ) return nil } diff --git a/x/bep3/simulation/genesis.go b/x/bep3/simulation/genesis.go index bfac2d88..f2a8e34a 100644 --- a/x/bep3/simulation/genesis.go +++ b/x/bep3/simulation/genesis.go @@ -12,6 +12,7 @@ import ( authexported "github.com/cosmos/cosmos-sdk/x/auth/exported" "github.com/cosmos/cosmos-sdk/x/simulation" "github.com/cosmos/cosmos-sdk/x/supply" + "github.com/kava-labs/kava/x/bep3/types" ) diff --git a/x/bep3/types/common_test.go b/x/bep3/types/common_test.go index 57601d1e..0e0d9743 100644 --- a/x/bep3/types/common_test.go +++ b/x/bep3/types/common_test.go @@ -4,8 +4,9 @@ import ( "time" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/kava-labs/kava/x/bep3/types" tmtime "github.com/tendermint/tendermint/types/time" + + "github.com/kava-labs/kava/x/bep3/types" ) func i(in int64) sdk.Int { return sdk.NewInt(in) } diff --git a/x/bep3/types/genesis_test.go b/x/bep3/types/genesis_test.go index b72f9be8..772a84f0 100644 --- a/x/bep3/types/genesis_test.go +++ b/x/bep3/types/genesis_test.go @@ -4,9 +4,10 @@ import ( "testing" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/suite" + "github.com/kava-labs/kava/app" "github.com/kava-labs/kava/x/bep3/types" - "github.com/stretchr/testify/suite" ) type GenesisTestSuite struct { diff --git a/x/bep3/types/hash_test.go b/x/bep3/types/hash_test.go index 0161a059..b38c59a7 100644 --- a/x/bep3/types/hash_test.go +++ b/x/bep3/types/hash_test.go @@ -4,9 +4,10 @@ import ( "testing" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/suite" + "github.com/kava-labs/kava/app" "github.com/kava-labs/kava/x/bep3/types" - "github.com/stretchr/testify/suite" ) type HashTestSuite struct { @@ -58,4 +59,4 @@ func (suite *HashTestSuite) TestCalculateSwapID() { func TestHashTestSuite(t *testing.T) { suite.Run(t, new(HashTestSuite)) -} \ No newline at end of file +} diff --git a/x/bep3/types/params_test.go b/x/bep3/types/params_test.go index 65e49cfd..0965a447 100644 --- a/x/bep3/types/params_test.go +++ b/x/bep3/types/params_test.go @@ -4,9 +4,10 @@ import ( "testing" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/suite" + "github.com/kava-labs/kava/app" "github.com/kava-labs/kava/x/bep3/types" - "github.com/stretchr/testify/suite" ) type ParamsTestSuite struct { diff --git a/x/cdp/abci.go b/x/cdp/abci.go index f8c031ce..7df7e69d 100644 --- a/x/cdp/abci.go +++ b/x/cdp/abci.go @@ -4,8 +4,9 @@ import ( "fmt" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/kava-labs/kava/x/cdp/types" abci "github.com/tendermint/tendermint/abci/types" + + "github.com/kava-labs/kava/x/cdp/types" ) // BeginBlocker compounds the debt in outstanding cdps and liquidates cdps that are below the required collateralization ratio diff --git a/x/cdp/abci_test.go b/x/cdp/abci_test.go index 74af46da..d9a37977 100644 --- a/x/cdp/abci_test.go +++ b/x/cdp/abci_test.go @@ -7,12 +7,13 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/simulation" - "github.com/kava-labs/kava/app" - "github.com/kava-labs/kava/x/auction" - "github.com/kava-labs/kava/x/cdp" "github.com/stretchr/testify/suite" abci "github.com/tendermint/tendermint/abci/types" tmtime "github.com/tendermint/tendermint/types/time" + + "github.com/kava-labs/kava/app" + "github.com/kava-labs/kava/x/auction" + "github.com/kava-labs/kava/x/cdp" ) type ModuleTestSuite struct { diff --git a/x/cdp/genesis.go b/x/cdp/genesis.go index 241fdcd7..176554c3 100644 --- a/x/cdp/genesis.go +++ b/x/cdp/genesis.go @@ -4,6 +4,7 @@ import ( "fmt" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/kava-labs/kava/x/cdp/types" ) diff --git a/x/cdp/genesis_test.go b/x/cdp/genesis_test.go index 3d34b7c9..c02574e2 100644 --- a/x/cdp/genesis_test.go +++ b/x/cdp/genesis_test.go @@ -6,9 +6,10 @@ import ( "time" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/suite" + "github.com/kava-labs/kava/app" "github.com/kava-labs/kava/x/cdp" - "github.com/stretchr/testify/suite" ) type GenesisTestSuite struct { diff --git a/x/cdp/handler_test.go b/x/cdp/handler_test.go index fd452a65..7d26c1de 100644 --- a/x/cdp/handler_test.go +++ b/x/cdp/handler_test.go @@ -4,11 +4,12 @@ import ( "testing" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/kava-labs/kava/app" - "github.com/kava-labs/kava/x/cdp" abci "github.com/tendermint/tendermint/abci/types" tmtime "github.com/tendermint/tendermint/types/time" + "github.com/kava-labs/kava/app" + "github.com/kava-labs/kava/x/cdp" + "github.com/stretchr/testify/suite" ) diff --git a/x/cdp/integration_test.go b/x/cdp/integration_test.go index eb50665c..b258a3e0 100644 --- a/x/cdp/integration_test.go +++ b/x/cdp/integration_test.go @@ -5,10 +5,11 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" + tmtime "github.com/tendermint/tendermint/types/time" + "github.com/kava-labs/kava/app" "github.com/kava-labs/kava/x/cdp" "github.com/kava-labs/kava/x/pricefeed" - tmtime "github.com/tendermint/tendermint/types/time" ) // Avoid cluttering test cases with long function names @@ -21,11 +22,11 @@ func NewPricefeedGenState(asset string, price sdk.Dec) app.GenesisState { pfGenesis := pricefeed.GenesisState{ Params: pricefeed.Params{ Markets: []pricefeed.Market{ - pricefeed.Market{MarketID: asset + ":usd", BaseAsset: asset, QuoteAsset: "usd", Oracles: []sdk.AccAddress{}, Active: true}, + {MarketID: asset + ":usd", BaseAsset: asset, QuoteAsset: "usd", Oracles: []sdk.AccAddress{}, Active: true}, }, }, PostedPrices: []pricefeed.PostedPrice{ - pricefeed.PostedPrice{ + { MarketID: asset + ":usd", OracleAddress: sdk.AccAddress{}, Price: price, @@ -77,18 +78,18 @@ func NewPricefeedGenStateMulti() app.GenesisState { pfGenesis := pricefeed.GenesisState{ Params: pricefeed.Params{ Markets: []pricefeed.Market{ - pricefeed.Market{MarketID: "btc:usd", BaseAsset: "btc", QuoteAsset: "usd", Oracles: []sdk.AccAddress{}, Active: true}, - pricefeed.Market{MarketID: "xrp:usd", BaseAsset: "xrp", QuoteAsset: "usd", Oracles: []sdk.AccAddress{}, Active: true}, + {MarketID: "btc:usd", BaseAsset: "btc", QuoteAsset: "usd", Oracles: []sdk.AccAddress{}, Active: true}, + {MarketID: "xrp:usd", BaseAsset: "xrp", QuoteAsset: "usd", Oracles: []sdk.AccAddress{}, Active: true}, }, }, PostedPrices: []pricefeed.PostedPrice{ - pricefeed.PostedPrice{ + { MarketID: "btc:usd", OracleAddress: sdk.AccAddress{}, Price: sdk.MustNewDecFromStr("8000.00"), Expiry: time.Now().Add(1 * time.Hour), }, - pricefeed.PostedPrice{ + { MarketID: "xrp:usd", OracleAddress: sdk.AccAddress{}, Price: sdk.MustNewDecFromStr("0.25"), diff --git a/x/cdp/keeper/auctions.go b/x/cdp/keeper/auctions.go index 67b7b292..640a21e7 100644 --- a/x/cdp/keeper/auctions.go +++ b/x/cdp/keeper/auctions.go @@ -2,6 +2,7 @@ package keeper import ( sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/kava-labs/kava/x/cdp/types" ) diff --git a/x/cdp/keeper/auctions_test.go b/x/cdp/keeper/auctions_test.go index 59cb45fa..4be3af65 100644 --- a/x/cdp/keeper/auctions_test.go +++ b/x/cdp/keeper/auctions_test.go @@ -4,6 +4,7 @@ import ( "testing" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/kava-labs/kava/app" "github.com/kava-labs/kava/x/auction" "github.com/kava-labs/kava/x/cdp/keeper" diff --git a/x/cdp/keeper/cdp.go b/x/cdp/keeper/cdp.go index 712f817f..6b2ad8e4 100644 --- a/x/cdp/keeper/cdp.go +++ b/x/cdp/keeper/cdp.go @@ -7,6 +7,7 @@ import ( "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/kava-labs/kava/x/cdp/types" ) @@ -431,7 +432,7 @@ func (k Keeper) LoadAugmentedCDP(ctx sdk.Context, cdp types.CDP) (types.Augmente return types.AugmentedCDP{}, err } - // total debt is the sum of all oustanding principal and fees + // total debt is the sum of all outstanding principal and fees var totalDebt int64 totalDebt += cdp.Principal.Amount.Int64() totalDebt += cdp.AccumulatedFees.Amount.Int64() diff --git a/x/cdp/keeper/cdp_test.go b/x/cdp/keeper/cdp_test.go index d98ee299..a7630c49 100644 --- a/x/cdp/keeper/cdp_test.go +++ b/x/cdp/keeper/cdp_test.go @@ -6,12 +6,13 @@ import ( "time" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/kava-labs/kava/app" - "github.com/kava-labs/kava/x/cdp/keeper" - "github.com/kava-labs/kava/x/cdp/types" "github.com/stretchr/testify/suite" abci "github.com/tendermint/tendermint/abci/types" tmtime "github.com/tendermint/tendermint/types/time" + + "github.com/kava-labs/kava/app" + "github.com/kava-labs/kava/x/cdp/keeper" + "github.com/kava-labs/kava/x/cdp/types" ) type CdpTestSuite struct { diff --git a/x/cdp/keeper/deposit.go b/x/cdp/keeper/deposit.go index 735e9b1d..7d1d46bb 100644 --- a/x/cdp/keeper/deposit.go +++ b/x/cdp/keeper/deposit.go @@ -6,6 +6,7 @@ import ( "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/kava-labs/kava/x/cdp/types" ) diff --git a/x/cdp/keeper/deposit_test.go b/x/cdp/keeper/deposit_test.go index 1eb11650..76a0a1b3 100644 --- a/x/cdp/keeper/deposit_test.go +++ b/x/cdp/keeper/deposit_test.go @@ -5,12 +5,13 @@ import ( "testing" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/kava-labs/kava/app" - "github.com/kava-labs/kava/x/cdp/keeper" - "github.com/kava-labs/kava/x/cdp/types" "github.com/stretchr/testify/suite" abci "github.com/tendermint/tendermint/abci/types" tmtime "github.com/tendermint/tendermint/types/time" + + "github.com/kava-labs/kava/app" + "github.com/kava-labs/kava/x/cdp/keeper" + "github.com/kava-labs/kava/x/cdp/types" ) type DepositTestSuite struct { diff --git a/x/cdp/keeper/draw.go b/x/cdp/keeper/draw.go index 655038a6..e1543a1f 100644 --- a/x/cdp/keeper/draw.go +++ b/x/cdp/keeper/draw.go @@ -5,6 +5,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/kava-labs/kava/x/cdp/types" ) diff --git a/x/cdp/keeper/draw_test.go b/x/cdp/keeper/draw_test.go index 44a26374..e4a9991b 100644 --- a/x/cdp/keeper/draw_test.go +++ b/x/cdp/keeper/draw_test.go @@ -6,12 +6,13 @@ import ( "time" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/kava-labs/kava/app" - "github.com/kava-labs/kava/x/cdp/keeper" - "github.com/kava-labs/kava/x/cdp/types" "github.com/stretchr/testify/suite" abci "github.com/tendermint/tendermint/abci/types" tmtime "github.com/tendermint/tendermint/types/time" + + "github.com/kava-labs/kava/app" + "github.com/kava-labs/kava/x/cdp/keeper" + "github.com/kava-labs/kava/x/cdp/types" ) type DrawTestSuite struct { diff --git a/x/cdp/keeper/fees.go b/x/cdp/keeper/fees.go index 109ae0af..ec1e7a4e 100644 --- a/x/cdp/keeper/fees.go +++ b/x/cdp/keeper/fees.go @@ -3,6 +3,7 @@ package keeper import ( "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/kava-labs/kava/x/cdp/types" ) diff --git a/x/cdp/keeper/fees_test.go b/x/cdp/keeper/fees_test.go index 90513e73..7c7ced3b 100644 --- a/x/cdp/keeper/fees_test.go +++ b/x/cdp/keeper/fees_test.go @@ -6,11 +6,12 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/kava-labs/kava/app" - "github.com/kava-labs/kava/x/cdp/keeper" "github.com/stretchr/testify/suite" abci "github.com/tendermint/tendermint/abci/types" tmtime "github.com/tendermint/tendermint/types/time" + + "github.com/kava-labs/kava/app" + "github.com/kava-labs/kava/x/cdp/keeper" ) type FeeTestSuite struct { diff --git a/x/cdp/keeper/integration_test.go b/x/cdp/keeper/integration_test.go index f936298d..ae3be395 100644 --- a/x/cdp/keeper/integration_test.go +++ b/x/cdp/keeper/integration_test.go @@ -5,10 +5,11 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" + tmtime "github.com/tendermint/tendermint/types/time" + "github.com/kava-labs/kava/app" "github.com/kava-labs/kava/x/cdp" "github.com/kava-labs/kava/x/pricefeed" - tmtime "github.com/tendermint/tendermint/types/time" ) // Avoid cluttering test cases with long function names @@ -21,11 +22,11 @@ func NewPricefeedGenState(asset string, price sdk.Dec) app.GenesisState { pfGenesis := pricefeed.GenesisState{ Params: pricefeed.Params{ Markets: []pricefeed.Market{ - pricefeed.Market{MarketID: asset + ":usd", BaseAsset: asset, QuoteAsset: "usd", Oracles: []sdk.AccAddress{}, Active: true}, + {MarketID: asset + ":usd", BaseAsset: asset, QuoteAsset: "usd", Oracles: []sdk.AccAddress{}, Active: true}, }, }, PostedPrices: []pricefeed.PostedPrice{ - pricefeed.PostedPrice{ + { MarketID: asset + ":usd", OracleAddress: sdk.AccAddress{}, Price: price, @@ -77,18 +78,18 @@ func NewPricefeedGenStateMulti() app.GenesisState { pfGenesis := pricefeed.GenesisState{ Params: pricefeed.Params{ Markets: []pricefeed.Market{ - pricefeed.Market{MarketID: "btc:usd", BaseAsset: "btc", QuoteAsset: "usd", Oracles: []sdk.AccAddress{}, Active: true}, - pricefeed.Market{MarketID: "xrp:usd", BaseAsset: "xrp", QuoteAsset: "usd", Oracles: []sdk.AccAddress{}, Active: true}, + {MarketID: "btc:usd", BaseAsset: "btc", QuoteAsset: "usd", Oracles: []sdk.AccAddress{}, Active: true}, + {MarketID: "xrp:usd", BaseAsset: "xrp", QuoteAsset: "usd", Oracles: []sdk.AccAddress{}, Active: true}, }, }, PostedPrices: []pricefeed.PostedPrice{ - pricefeed.PostedPrice{ + { MarketID: "btc:usd", OracleAddress: sdk.AccAddress{}, Price: sdk.MustNewDecFromStr("8000.00"), Expiry: time.Now().Add(1 * time.Hour), }, - pricefeed.PostedPrice{ + { MarketID: "xrp:usd", OracleAddress: sdk.AccAddress{}, Price: sdk.MustNewDecFromStr("0.25"), diff --git a/x/cdp/keeper/keeper.go b/x/cdp/keeper/keeper.go index f7d3e585..0e028b59 100644 --- a/x/cdp/keeper/keeper.go +++ b/x/cdp/keeper/keeper.go @@ -7,6 +7,7 @@ import ( "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/params/subspace" + "github.com/kava-labs/kava/x/cdp/types" ) diff --git a/x/cdp/keeper/keeper_bench_test.go b/x/cdp/keeper/keeper_bench_test.go index 76e61331..462d3275 100644 --- a/x/cdp/keeper/keeper_bench_test.go +++ b/x/cdp/keeper/keeper_bench_test.go @@ -5,11 +5,12 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth/exported" + abci "github.com/tendermint/tendermint/abci/types" + tmtime "github.com/tendermint/tendermint/types/time" + "github.com/kava-labs/kava/app" "github.com/kava-labs/kava/x/cdp" "github.com/kava-labs/kava/x/cdp/keeper" - abci "github.com/tendermint/tendermint/abci/types" - tmtime "github.com/tendermint/tendermint/types/time" ) // saving the result to a module level variable ensures the compiler doesn't optimize the test away diff --git a/x/cdp/keeper/params.go b/x/cdp/keeper/params.go index 08a3bc9e..703cd273 100644 --- a/x/cdp/keeper/params.go +++ b/x/cdp/keeper/params.go @@ -4,6 +4,7 @@ import ( "fmt" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/kava-labs/kava/x/cdp/types" ) diff --git a/x/cdp/keeper/querier_test.go b/x/cdp/keeper/querier_test.go index be4c8fa9..171bbdb5 100644 --- a/x/cdp/keeper/querier_test.go +++ b/x/cdp/keeper/querier_test.go @@ -9,14 +9,15 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/simulation" + "github.com/stretchr/testify/suite" + abci "github.com/tendermint/tendermint/abci/types" + tmtime "github.com/tendermint/tendermint/types/time" + "github.com/kava-labs/kava/app" "github.com/kava-labs/kava/x/cdp/keeper" "github.com/kava-labs/kava/x/cdp/types" pfkeeper "github.com/kava-labs/kava/x/pricefeed/keeper" pftypes "github.com/kava-labs/kava/x/pricefeed/types" - "github.com/stretchr/testify/suite" - abci "github.com/tendermint/tendermint/abci/types" - tmtime "github.com/tendermint/tendermint/types/time" ) const ( diff --git a/x/cdp/keeper/savings.go b/x/cdp/keeper/savings.go index ec9c5944..fe5a8840 100644 --- a/x/cdp/keeper/savings.go +++ b/x/cdp/keeper/savings.go @@ -9,6 +9,7 @@ import ( authexported "github.com/cosmos/cosmos-sdk/x/auth/exported" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" supplyexported "github.com/cosmos/cosmos-sdk/x/supply/exported" + auctiontypes "github.com/kava-labs/kava/x/auction/types" "github.com/kava-labs/kava/x/cdp/types" ) diff --git a/x/cdp/keeper/savings_test.go b/x/cdp/keeper/savings_test.go index 5c04b269..8d64889d 100644 --- a/x/cdp/keeper/savings_test.go +++ b/x/cdp/keeper/savings_test.go @@ -4,12 +4,13 @@ import ( "testing" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/kava-labs/kava/app" - "github.com/kava-labs/kava/x/cdp/keeper" - "github.com/kava-labs/kava/x/cdp/types" "github.com/stretchr/testify/suite" abci "github.com/tendermint/tendermint/abci/types" tmtime "github.com/tendermint/tendermint/types/time" + + "github.com/kava-labs/kava/app" + "github.com/kava-labs/kava/x/cdp/keeper" + "github.com/kava-labs/kava/x/cdp/types" ) type SavingsTestSuite struct { diff --git a/x/cdp/keeper/seize.go b/x/cdp/keeper/seize.go index 46183f77..5a3fa8cf 100644 --- a/x/cdp/keeper/seize.go +++ b/x/cdp/keeper/seize.go @@ -4,6 +4,7 @@ import ( "fmt" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/kava-labs/kava/x/cdp/types" ) diff --git a/x/cdp/simulation/genesis.go b/x/cdp/simulation/genesis.go index a954476e..e0f4591d 100644 --- a/x/cdp/simulation/genesis.go +++ b/x/cdp/simulation/genesis.go @@ -10,6 +10,7 @@ import ( authexported "github.com/cosmos/cosmos-sdk/x/auth/exported" "github.com/cosmos/cosmos-sdk/x/supply" supplyexported "github.com/cosmos/cosmos-sdk/x/supply/exported" + "github.com/kava-labs/kava/x/cdp/types" ) diff --git a/x/cdp/simulation/utils_test.go b/x/cdp/simulation/utils_test.go index 448366fa..216c057f 100644 --- a/x/cdp/simulation/utils_test.go +++ b/x/cdp/simulation/utils_test.go @@ -4,8 +4,9 @@ import ( "testing" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/kava-labs/kava/x/cdp/simulation" "github.com/stretchr/testify/require" + + "github.com/kava-labs/kava/x/cdp/simulation" ) func TestShiftDec(t *testing.T) { diff --git a/x/cdp/types/expected_keepers.go b/x/cdp/types/expected_keepers.go index c0e2e3d9..b960ed79 100644 --- a/x/cdp/types/expected_keepers.go +++ b/x/cdp/types/expected_keepers.go @@ -6,6 +6,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" authexported "github.com/cosmos/cosmos-sdk/x/auth/exported" supplyexported "github.com/cosmos/cosmos-sdk/x/supply/exported" + pftypes "github.com/kava-labs/kava/x/pricefeed/types" ) diff --git a/x/cdp/types/genesis_test.go b/x/cdp/types/genesis_test.go index f894492f..5895e370 100644 --- a/x/cdp/types/genesis_test.go +++ b/x/cdp/types/genesis_test.go @@ -19,4 +19,4 @@ func TestEqualProposalID(t *testing.T) { state2.StartingCdpID = 1 require.Equal(t, state1, state2) require.True(t, state1.Equal(state2)) -} \ No newline at end of file +} diff --git a/x/cdp/types/keys.go b/x/cdp/types/keys.go index 8f4a8097..1469ffa5 100644 --- a/x/cdp/types/keys.go +++ b/x/cdp/types/keys.go @@ -140,7 +140,7 @@ func CollateralRatioKey(denomByte byte, cdpID uint64, ratio sdk.Dec) []byte { // SplitCollateralRatioKey split the collateral ratio key and return the denom, cdp id, and collateral:debt ratio func SplitCollateralRatioKey(key []byte) (denom byte, cdpID uint64, ratio sdk.Dec) { - cdpID = GetCdpIDFromBytes(key[len(key)-8 : len(key)]) + cdpID = GetCdpIDFromBytes(key[len(key)-8:]) split := bytes.Split(key[:len(key)-8], sep) denom = split[0][0] diff --git a/x/cdp/types/params_test.go b/x/cdp/types/params_test.go index 38879436..ea2c1e72 100644 --- a/x/cdp/types/params_test.go +++ b/x/cdp/types/params_test.go @@ -6,8 +6,9 @@ import ( "time" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/kava-labs/kava/x/cdp/types" "github.com/stretchr/testify/suite" + + "github.com/kava-labs/kava/x/cdp/types" ) type ParamsTestSuite struct { diff --git a/x/cdp/types/utils_test.go b/x/cdp/types/utils_test.go index 7a32d4e8..9b8b41c0 100644 --- a/x/cdp/types/utils_test.go +++ b/x/cdp/types/utils_test.go @@ -6,7 +6,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - ) func TestSortableDecBytes(t *testing.T) { diff --git a/x/committee/genesis.go b/x/committee/genesis.go index af29c0e1..3a0b4110 100644 --- a/x/committee/genesis.go +++ b/x/committee/genesis.go @@ -4,6 +4,7 @@ import ( "fmt" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/kava-labs/kava/x/committee/types" ) diff --git a/x/committee/proposal_handler_test.go b/x/committee/proposal_handler_test.go index 0a97cfc0..f0ef01ea 100644 --- a/x/committee/proposal_handler_test.go +++ b/x/committee/proposal_handler_test.go @@ -100,7 +100,7 @@ func (suite *ProposalHandlerTestSuite) TestProposalHandler_ChangeCommittee() { { name: "invalid title", proposal: committee.NewCommitteeChangeProposal( - "A Title That Is Much Too Long And Really Quite Unreasonable Given That It Is Trying To Fullfill The Roll Of An Acceptable Governance Proposal Title That Should Succinctly Communicate The Goal And Contents Of The Proposed Proposal To All Parties Involved", + "A Title That Is Much Too Long And Really Quite Unreasonable Given That It Is Trying To Fulfill The Roll Of An Acceptable Governance Proposal Title That Should Succinctly Communicate The Goal And Contents Of The Proposed Proposal To All Parties Involved", "A proposal description.", suite.testGenesis.Committees[0], ), @@ -177,7 +177,7 @@ func (suite *ProposalHandlerTestSuite) TestProposalHandler_DeleteCommittee() { { name: "invalid title", proposal: committee.NewCommitteeDeleteProposal( - "A Title That Is Much Too Long And Really Quite Unreasonable Given That It Is Trying To Fullfill The Roll Of An Acceptable Governance Proposal Title That Should Succinctly Communicate The Goal And Contents Of The Proposed Proposal To All Parties Involved", + "A Title That Is Much Too Long And Really Quite Unreasonable Given That It Is Trying To Fulfill The Roll Of An Acceptable Governance Proposal Title That Should Succinctly Communicate The Goal And Contents Of The Proposed Proposal To All Parties Involved", "A proposal description.", suite.testGenesis.Committees[1].ID, ), diff --git a/x/committee/types/committee.go b/x/committee/types/committee.go index c240ac52..fcb54720 100644 --- a/x/committee/types/committee.go +++ b/x/committee/types/committee.go @@ -4,9 +4,10 @@ import ( "fmt" "time" + yaml "gopkg.in/yaml.v2" + sdk "github.com/cosmos/cosmos-sdk/types" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" - "gopkg.in/yaml.v2" ) const MaxCommitteeDescriptionLength int = 512 @@ -98,7 +99,7 @@ func (c Committee) Validate() error { // PubProposal is the interface that all proposals must fulfill to be submitted to a committee. // Proposal types can be created external to this module. For example a ParamChangeProposal, or CommunityPoolSpendProposal. -// It is pinned to the equivalent type in the gov module to create compatability between proposal types. +// It is pinned to the equivalent type in the gov module to create compatibility between proposal types. type PubProposal govtypes.Content // Proposal is an internal record of a governance proposal submitted to a committee. diff --git a/x/committee/types/genesis.go b/x/committee/types/genesis.go index fda51064..a7539a45 100644 --- a/x/committee/types/genesis.go +++ b/x/committee/types/genesis.go @@ -81,7 +81,7 @@ func (gs GenesisState) Validate() error { // check committee exists if !committeeMap[p.CommitteeID] { - return fmt.Errorf("proposal refers to non existant committee; proposal: %+v", p) + return fmt.Errorf("proposal refers to non existent committee; proposal: %+v", p) } // validate pubProposal @@ -94,7 +94,7 @@ func (gs GenesisState) Validate() error { for _, v := range gs.Votes { // check proposal exists if !proposalMap[v.ProposalID] { - return fmt.Errorf("vote refers to non existant proposal; vote: %+v", v) + return fmt.Errorf("vote refers to non existent proposal; vote: %+v", v) } // validate address if v.Voter.Empty() { diff --git a/x/committee/types/proposal.go b/x/committee/types/proposal.go index 426df42d..ebc1baaf 100644 --- a/x/committee/types/proposal.go +++ b/x/committee/types/proposal.go @@ -1,7 +1,7 @@ package types import ( - "gopkg.in/yaml.v2" + yaml "gopkg.in/yaml.v2" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" diff --git a/x/incentive/abci.go b/x/incentive/abci.go index e6c0b293..f9786c0f 100644 --- a/x/incentive/abci.go +++ b/x/incentive/abci.go @@ -2,6 +2,7 @@ package incentive import ( sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/kava-labs/kava/x/incentive/keeper" ) diff --git a/x/incentive/client/cli/query.go b/x/incentive/client/cli/query.go index c9201c53..f36300b9 100644 --- a/x/incentive/client/cli/query.go +++ b/x/incentive/client/cli/query.go @@ -9,8 +9,9 @@ import ( "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/version" - "github.com/kava-labs/kava/x/incentive/types" "github.com/spf13/cobra" + + "github.com/kava-labs/kava/x/incentive/types" ) // GetQueryCmd returns the cli query commands for the incentive module diff --git a/x/incentive/client/cli/tx.go b/x/incentive/client/cli/tx.go index 559cbd37..c17e1047 100644 --- a/x/incentive/client/cli/tx.go +++ b/x/incentive/client/cli/tx.go @@ -12,8 +12,9 @@ import ( "github.com/cosmos/cosmos-sdk/version" "github.com/cosmos/cosmos-sdk/x/auth" "github.com/cosmos/cosmos-sdk/x/auth/client/utils" - "github.com/kava-labs/kava/x/incentive/types" "github.com/spf13/cobra" + + "github.com/kava-labs/kava/x/incentive/types" ) // GetTxCmd returns the transaction cli commands for the incentive module diff --git a/x/incentive/client/rest/query.go b/x/incentive/client/rest/query.go index e8e0e5e1..9f541b1e 100644 --- a/x/incentive/client/rest/query.go +++ b/x/incentive/client/rest/query.go @@ -8,6 +8,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/rest" "github.com/gorilla/mux" + "github.com/kava-labs/kava/x/incentive/types" ) diff --git a/x/incentive/client/rest/tx.go b/x/incentive/client/rest/tx.go index 13ccd94a..254fbb36 100644 --- a/x/incentive/client/rest/tx.go +++ b/x/incentive/client/rest/tx.go @@ -8,6 +8,7 @@ import ( "github.com/cosmos/cosmos-sdk/types/rest" "github.com/cosmos/cosmos-sdk/x/auth/client/utils" "github.com/gorilla/mux" + "github.com/kava-labs/kava/x/incentive/types" ) diff --git a/x/incentive/genesis.go b/x/incentive/genesis.go index 5a38e146..5b14a944 100644 --- a/x/incentive/genesis.go +++ b/x/incentive/genesis.go @@ -4,6 +4,7 @@ import ( "fmt" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/kava-labs/kava/x/incentive/keeper" "github.com/kava-labs/kava/x/incentive/types" ) diff --git a/x/incentive/handler.go b/x/incentive/handler.go index 1fdf8a58..bd8f430e 100644 --- a/x/incentive/handler.go +++ b/x/incentive/handler.go @@ -3,6 +3,7 @@ package incentive import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/kava-labs/kava/x/incentive/keeper" "github.com/kava-labs/kava/x/incentive/types" ) diff --git a/x/incentive/handler_test.go b/x/incentive/handler_test.go index 70253ef3..a2d4c5f0 100644 --- a/x/incentive/handler_test.go +++ b/x/incentive/handler_test.go @@ -5,12 +5,13 @@ import ( "time" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/kava-labs/kava/app" - "github.com/kava-labs/kava/x/incentive" - "github.com/kava-labs/kava/x/kavadist" "github.com/stretchr/testify/suite" abci "github.com/tendermint/tendermint/abci/types" tmtime "github.com/tendermint/tendermint/types/time" + + "github.com/kava-labs/kava/app" + "github.com/kava-labs/kava/x/incentive" + "github.com/kava-labs/kava/x/kavadist" ) func cs(coins ...sdk.Coin) sdk.Coins { return sdk.NewCoins(coins...) } diff --git a/x/incentive/keeper/keeper.go b/x/incentive/keeper/keeper.go index 3c2aa383..cf7705b7 100644 --- a/x/incentive/keeper/keeper.go +++ b/x/incentive/keeper/keeper.go @@ -7,6 +7,7 @@ import ( "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/params/subspace" + "github.com/kava-labs/kava/x/incentive/types" ) diff --git a/x/incentive/keeper/keeper_test.go b/x/incentive/keeper/keeper_test.go index 0d56b2d5..de8e61e7 100644 --- a/x/incentive/keeper/keeper_test.go +++ b/x/incentive/keeper/keeper_test.go @@ -7,12 +7,13 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" authexported "github.com/cosmos/cosmos-sdk/x/auth/exported" supplyexported "github.com/cosmos/cosmos-sdk/x/supply/exported" - "github.com/kava-labs/kava/app" - "github.com/kava-labs/kava/x/incentive/keeper" - "github.com/kava-labs/kava/x/incentive/types" "github.com/stretchr/testify/suite" abci "github.com/tendermint/tendermint/abci/types" tmtime "github.com/tendermint/tendermint/types/time" + + "github.com/kava-labs/kava/app" + "github.com/kava-labs/kava/x/incentive/keeper" + "github.com/kava-labs/kava/x/incentive/types" ) // Test suite used for all keeper tests diff --git a/x/incentive/keeper/params.go b/x/incentive/keeper/params.go index ad80a0e8..0d6b6f78 100644 --- a/x/incentive/keeper/params.go +++ b/x/incentive/keeper/params.go @@ -2,6 +2,7 @@ package keeper import ( sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/kava-labs/kava/x/incentive/types" ) diff --git a/x/incentive/keeper/payout.go b/x/incentive/keeper/payout.go index ac3142b8..20b339fe 100644 --- a/x/incentive/keeper/payout.go +++ b/x/incentive/keeper/payout.go @@ -9,6 +9,7 @@ import ( authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/cosmos/cosmos-sdk/x/auth/vesting" supplyExported "github.com/cosmos/cosmos-sdk/x/supply/exported" + "github.com/kava-labs/kava/x/incentive/types" validatorvesting "github.com/kava-labs/kava/x/validator-vesting" ) diff --git a/x/incentive/keeper/payout_test.go b/x/incentive/keeper/payout_test.go index caefc6dd..e7152d74 100644 --- a/x/incentive/keeper/payout_test.go +++ b/x/incentive/keeper/payout_test.go @@ -7,12 +7,13 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth" "github.com/cosmos/cosmos-sdk/x/auth/vesting" + abci "github.com/tendermint/tendermint/abci/types" + "github.com/kava-labs/kava/app" "github.com/kava-labs/kava/x/cdp" "github.com/kava-labs/kava/x/incentive/types" "github.com/kava-labs/kava/x/kavadist" validatorvesting "github.com/kava-labs/kava/x/validator-vesting" - abci "github.com/tendermint/tendermint/abci/types" ) func (suite *KeeperTestSuite) setupChain() { diff --git a/x/incentive/keeper/querier.go b/x/incentive/keeper/querier.go index f5a3654c..d56d2432 100644 --- a/x/incentive/keeper/querier.go +++ b/x/incentive/keeper/querier.go @@ -4,8 +4,9 @@ import ( "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/kava-labs/kava/x/incentive/types" abci "github.com/tendermint/tendermint/abci/types" + + "github.com/kava-labs/kava/x/incentive/types" ) // NewQuerier is the module level router for state queries diff --git a/x/incentive/keeper/querier_test.go b/x/incentive/keeper/querier_test.go index 156d0e8d..9e1e9d17 100644 --- a/x/incentive/keeper/querier_test.go +++ b/x/incentive/keeper/querier_test.go @@ -3,9 +3,10 @@ package keeper_test import ( "strings" + abci "github.com/tendermint/tendermint/abci/types" + "github.com/kava-labs/kava/x/incentive/keeper" "github.com/kava-labs/kava/x/incentive/types" - abci "github.com/tendermint/tendermint/abci/types" ) func (suite *KeeperTestSuite) TestQuerier() { diff --git a/x/incentive/keeper/rewards.go b/x/incentive/keeper/rewards.go index 83faf7b1..9fd11d20 100644 --- a/x/incentive/keeper/rewards.go +++ b/x/incentive/keeper/rewards.go @@ -5,6 +5,7 @@ import ( "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" + cdptypes "github.com/kava-labs/kava/x/cdp/types" "github.com/kava-labs/kava/x/incentive/types" ) @@ -19,7 +20,7 @@ func (k Keeper) HandleRewardPeriodExpiry(ctx sdk.Context, rp types.RewardPeriod) // CreateNewRewardPeriod creates a new reward period from the input reward func (k Keeper) CreateNewRewardPeriod(ctx sdk.Context, reward types.Reward) { - // reward periods store the amount of rewards payed PER SECOND + // reward periods store the amount of rewards paid PER SECOND rewardsPerSecond := sdk.NewDecFromInt(reward.AvailableRewards.Amount).Quo(sdk.NewDecFromInt(sdk.NewInt(int64(reward.Duration.Seconds())))).TruncateInt() rewardCoinPerSecond := sdk.NewCoin(reward.AvailableRewards.Denom, rewardsPerSecond) rp := types.RewardPeriod{ diff --git a/x/incentive/keeper/rewards_test.go b/x/incentive/keeper/rewards_test.go index b61cac31..f62e5d7b 100644 --- a/x/incentive/keeper/rewards_test.go +++ b/x/incentive/keeper/rewards_test.go @@ -4,12 +4,13 @@ import ( "time" sdk "github.com/cosmos/cosmos-sdk/types" + abci "github.com/tendermint/tendermint/abci/types" + tmtime "github.com/tendermint/tendermint/types/time" + "github.com/kava-labs/kava/app" "github.com/kava-labs/kava/x/cdp" "github.com/kava-labs/kava/x/incentive/types" "github.com/kava-labs/kava/x/pricefeed" - abci "github.com/tendermint/tendermint/abci/types" - tmtime "github.com/tendermint/tendermint/types/time" ) func (suite *KeeperTestSuite) TestExpireRewardPeriod() { @@ -160,11 +161,11 @@ func (suite *KeeperTestSuite) setupCdpChain() { pricefeedGS := pricefeed.GenesisState{ Params: pricefeed.Params{ Markets: []pricefeed.Market{ - pricefeed.Market{MarketID: "bnb:usd", BaseAsset: "bnb", QuoteAsset: "usd", Oracles: []sdk.AccAddress{}, Active: true}, + {MarketID: "bnb:usd", BaseAsset: "bnb", QuoteAsset: "usd", Oracles: []sdk.AccAddress{}, Active: true}, }, }, PostedPrices: []pricefeed.PostedPrice{ - pricefeed.PostedPrice{ + { MarketID: "bnb:usd", OracleAddress: sdk.AccAddress{}, Price: d("12.29"), diff --git a/x/incentive/module.go b/x/incentive/module.go index 9c464e00..b6b8bcc5 100644 --- a/x/incentive/module.go +++ b/x/incentive/module.go @@ -11,13 +11,14 @@ import ( "github.com/cosmos/cosmos-sdk/x/auth" sim "github.com/cosmos/cosmos-sdk/x/simulation" "github.com/gorilla/mux" + "github.com/spf13/cobra" + abci "github.com/tendermint/tendermint/abci/types" + "github.com/kava-labs/kava/x/incentive/client/cli" "github.com/kava-labs/kava/x/incentive/client/rest" "github.com/kava-labs/kava/x/incentive/keeper" "github.com/kava-labs/kava/x/incentive/simulation" "github.com/kava-labs/kava/x/incentive/types" - "github.com/spf13/cobra" - abci "github.com/tendermint/tendermint/abci/types" ) var ( diff --git a/x/incentive/simulation/params.go b/x/incentive/simulation/params.go index dd47e83f..a8306bf2 100644 --- a/x/incentive/simulation/params.go +++ b/x/incentive/simulation/params.go @@ -5,6 +5,7 @@ import ( "math/rand" "github.com/cosmos/cosmos-sdk/x/simulation" + "github.com/kava-labs/kava/x/incentive/types" ) diff --git a/x/incentive/types/account_test.go b/x/incentive/types/account_test.go index 525a3d02..9bef19fe 100644 --- a/x/incentive/types/account_test.go +++ b/x/incentive/types/account_test.go @@ -5,8 +5,9 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth/vesting" - "github.com/kava-labs/kava/x/incentive/types" "github.com/stretchr/testify/suite" + + "github.com/kava-labs/kava/x/incentive/types" ) type accountTest struct { @@ -22,7 +23,7 @@ type AccountTestSuite struct { func (suite *AccountTestSuite) SetupTest() { tests := []accountTest{ - accountTest{ + { periods: vesting.Periods{ vesting.Period{ Length: int64(100), diff --git a/x/incentive/types/expected_keepers.go b/x/incentive/types/expected_keepers.go index ccb20830..83cb47a6 100644 --- a/x/incentive/types/expected_keepers.go +++ b/x/incentive/types/expected_keepers.go @@ -4,6 +4,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" authexported "github.com/cosmos/cosmos-sdk/x/auth/exported" supplyexported "github.com/cosmos/cosmos-sdk/x/supply/exported" + cdptypes "github.com/kava-labs/kava/x/cdp/types" ) diff --git a/x/incentive/types/msg_test.go b/x/incentive/types/msg_test.go index dbe06fe7..d1456291 100644 --- a/x/incentive/types/msg_test.go +++ b/x/incentive/types/msg_test.go @@ -4,9 +4,10 @@ import ( "testing" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/kava-labs/kava/x/incentive/types" "github.com/stretchr/testify/suite" "github.com/tendermint/tendermint/crypto" + + "github.com/kava-labs/kava/x/incentive/types" ) type msgTest struct { @@ -23,17 +24,17 @@ type MsgTestSuite struct { func (suite *MsgTestSuite) SetupTest() { tests := []msgTest{ - msgTest{ + { from: sdk.AccAddress(crypto.AddressHash([]byte("KavaTest1"))), denom: "bnb", expectPass: true, }, - msgTest{ + { from: sdk.AccAddress(crypto.AddressHash([]byte("KavaTest1"))), denom: "", expectPass: false, }, - msgTest{ + { from: sdk.AccAddress{}, denom: "bnb", expectPass: false, diff --git a/x/incentive/types/params.go b/x/incentive/types/params.go index 524cfb83..8348bb65 100644 --- a/x/incentive/types/params.go +++ b/x/incentive/types/params.go @@ -7,9 +7,10 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/params" + tmtime "github.com/tendermint/tendermint/types/time" + cdptypes "github.com/kava-labs/kava/x/cdp/types" kavadistTypes "github.com/kava-labs/kava/x/kavadist/types" - tmtime "github.com/tendermint/tendermint/types/time" ) // Parameter keys and default values diff --git a/x/incentive/types/params_test.go b/x/incentive/types/params_test.go index a35a2508..9c0baf68 100644 --- a/x/incentive/types/params_test.go +++ b/x/incentive/types/params_test.go @@ -6,8 +6,9 @@ import ( "time" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/kava-labs/kava/x/incentive/types" "github.com/stretchr/testify/suite" + + "github.com/kava-labs/kava/x/incentive/types" ) type paramTest struct { @@ -29,7 +30,7 @@ type ParamTestSuite struct { func (suite *ParamTestSuite) SetupTest() { suite.tests = []paramTest{ - paramTest{ + { name: "valid - active", params: types.Params{ Active: true, @@ -49,7 +50,7 @@ func (suite *ParamTestSuite) SetupTest() { contains: "", }, }, - paramTest{ + { name: "valid - inactive", params: types.Params{ Active: false, @@ -69,7 +70,7 @@ func (suite *ParamTestSuite) SetupTest() { contains: "", }, }, - paramTest{ + { name: "duplicate reward", params: types.Params{ Active: true, @@ -97,7 +98,7 @@ func (suite *ParamTestSuite) SetupTest() { contains: "cannot have duplicate reward denoms", }, }, - paramTest{ + { name: "negative reward duration", params: types.Params{ Active: true, @@ -117,7 +118,7 @@ func (suite *ParamTestSuite) SetupTest() { contains: "reward duration must be positive", }, }, - paramTest{ + { name: "negative time lock", params: types.Params{ Active: true, @@ -137,7 +138,7 @@ func (suite *ParamTestSuite) SetupTest() { contains: "reward timelock must be non-negative", }, }, - paramTest{ + { name: "zero claim duration", params: types.Params{ Active: true, @@ -157,7 +158,7 @@ func (suite *ParamTestSuite) SetupTest() { contains: "claim duration must be positive", }, }, - paramTest{ + { name: "zero reward", params: types.Params{ Active: true, @@ -177,7 +178,7 @@ func (suite *ParamTestSuite) SetupTest() { contains: "reward amount must be positive", }, }, - paramTest{ + { name: "empty reward denom", params: types.Params{ Active: true, diff --git a/x/kavadist/genesis.go b/x/kavadist/genesis.go index c4219a02..d1e7d25d 100644 --- a/x/kavadist/genesis.go +++ b/x/kavadist/genesis.go @@ -4,6 +4,7 @@ import ( "fmt" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/kava-labs/kava/x/kavadist/types" ) @@ -35,5 +36,5 @@ func ExportGenesis(ctx sdk.Context, k Keeper) GenesisState { if !found { previousBlockTime = DefaultPreviousBlockTime } - return NewGenesisState(params,previousBlockTime) + return NewGenesisState(params, previousBlockTime) } diff --git a/x/kavadist/keeper/keeper.go b/x/kavadist/keeper/keeper.go index 34faa329..25e9ff1c 100644 --- a/x/kavadist/keeper/keeper.go +++ b/x/kavadist/keeper/keeper.go @@ -7,6 +7,7 @@ import ( "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/params/subspace" + "github.com/kava-labs/kava/x/kavadist/types" ) diff --git a/x/kavadist/keeper/mint.go b/x/kavadist/keeper/mint.go index c5d19215..8f909cd7 100644 --- a/x/kavadist/keeper/mint.go +++ b/x/kavadist/keeper/mint.go @@ -2,11 +2,12 @@ package keeper import ( sdk "github.com/cosmos/cosmos-sdk/types" + cdptypes "github.com/kava-labs/kava/x/cdp/types" "github.com/kava-labs/kava/x/kavadist/types" ) -// MintPeriodInflation mints new tokens according to the inflation schedule specified in the paramters +// MintPeriodInflation mints new tokens according to the inflation schedule specified in the parameters func (k Keeper) MintPeriodInflation(ctx sdk.Context) error { params := k.GetParams(ctx) if !params.Active { diff --git a/x/kavadist/keeper/mint_test.go b/x/kavadist/keeper/mint_test.go index c9b77753..b7ceb6de 100644 --- a/x/kavadist/keeper/mint_test.go +++ b/x/kavadist/keeper/mint_test.go @@ -5,12 +5,13 @@ import ( "time" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/kava-labs/kava/app" - "github.com/kava-labs/kava/x/kavadist/keeper" - "github.com/kava-labs/kava/x/kavadist/types" "github.com/stretchr/testify/suite" abci "github.com/tendermint/tendermint/abci/types" tmtime "github.com/tendermint/tendermint/types/time" + + "github.com/kava-labs/kava/app" + "github.com/kava-labs/kava/x/kavadist/keeper" + "github.com/kava-labs/kava/x/kavadist/types" ) type MintTestSuite struct { diff --git a/x/kavadist/keeper/params.go b/x/kavadist/keeper/params.go index 526cb255..fe2c4a11 100644 --- a/x/kavadist/keeper/params.go +++ b/x/kavadist/keeper/params.go @@ -2,6 +2,7 @@ package keeper import ( sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/kava-labs/kava/x/kavadist/types" ) diff --git a/x/kavadist/module.go b/x/kavadist/module.go index f24005c8..e9dc22e4 100644 --- a/x/kavadist/module.go +++ b/x/kavadist/module.go @@ -12,9 +12,10 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" sim "github.com/cosmos/cosmos-sdk/x/simulation" + abci "github.com/tendermint/tendermint/abci/types" + "github.com/kava-labs/kava/x/kavadist/simulation" "github.com/kava-labs/kava/x/kavadist/types" - abci "github.com/tendermint/tendermint/abci/types" ) var ( diff --git a/x/kavadist/types/params.go b/x/kavadist/types/params.go index 9eb01b08..46a2906d 100644 --- a/x/kavadist/types/params.go +++ b/x/kavadist/types/params.go @@ -6,8 +6,9 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/params" - cdptypes "github.com/kava-labs/kava/x/cdp/types" tmtime "github.com/tendermint/tendermint/types/time" + + cdptypes "github.com/kava-labs/kava/x/cdp/types" ) // Parameter keys and default values diff --git a/x/kavadist/types/params_test.go b/x/kavadist/types/params_test.go index f2e02b90..e612fda3 100644 --- a/x/kavadist/types/params_test.go +++ b/x/kavadist/types/params_test.go @@ -5,8 +5,9 @@ import ( "time" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/kava-labs/kava/x/kavadist/types" "github.com/stretchr/testify/suite" + + "github.com/kava-labs/kava/x/kavadist/types" ) type paramTest struct { @@ -68,15 +69,15 @@ func (suite *ParamTestSuite) SetupTest() { } suite.tests = []paramTest{ - paramTest{ + { params: p1, expectPass: true, }, - paramTest{ + { params: p2, expectPass: false, }, - paramTest{ + { params: p3, expectPass: false, }, diff --git a/x/pricefeed/client/cli/query.go b/x/pricefeed/client/cli/query.go index b41d388a..3930bbf9 100644 --- a/x/pricefeed/client/cli/query.go +++ b/x/pricefeed/client/cli/query.go @@ -8,8 +8,9 @@ import ( "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/kava-labs/kava/x/pricefeed/types" "github.com/spf13/cobra" + + "github.com/kava-labs/kava/x/pricefeed/types" ) // GetQueryCmd returns the cli query commands for this module diff --git a/x/pricefeed/client/cli/tx.go b/x/pricefeed/client/cli/tx.go index 2aec48d6..726a8050 100644 --- a/x/pricefeed/client/cli/tx.go +++ b/x/pricefeed/client/cli/tx.go @@ -14,8 +14,9 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth" "github.com/cosmos/cosmos-sdk/x/auth/client/utils" - "github.com/kava-labs/kava/x/pricefeed/types" tmtime "github.com/tendermint/tendermint/types/time" + + "github.com/kava-labs/kava/x/pricefeed/types" ) // GetTxCmd returns the transaction commands for this module diff --git a/x/pricefeed/client/rest/tx.go b/x/pricefeed/client/rest/tx.go index 6e0b87e6..89a8df42 100644 --- a/x/pricefeed/client/rest/tx.go +++ b/x/pricefeed/client/rest/tx.go @@ -10,8 +10,9 @@ import ( "github.com/cosmos/cosmos-sdk/types/rest" "github.com/cosmos/cosmos-sdk/x/auth/client/utils" "github.com/gorilla/mux" - "github.com/kava-labs/kava/x/pricefeed/types" tmtime "github.com/tendermint/tendermint/types/time" + + "github.com/kava-labs/kava/x/pricefeed/types" ) func registerTxRoutes(cliCtx context.CLIContext, r *mux.Router) { diff --git a/x/pricefeed/genesis_test.go b/x/pricefeed/genesis_test.go index 968729bc..8c92b209 100644 --- a/x/pricefeed/genesis_test.go +++ b/x/pricefeed/genesis_test.go @@ -4,6 +4,7 @@ import ( "testing" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/kava-labs/kava/app" "github.com/kava-labs/kava/x/pricefeed" diff --git a/x/pricefeed/integration_test.go b/x/pricefeed/integration_test.go index 4d5f2c76..24629f4c 100644 --- a/x/pricefeed/integration_test.go +++ b/x/pricefeed/integration_test.go @@ -13,18 +13,18 @@ func NewPricefeedGenStateMulti() app.GenesisState { pfGenesis := pricefeed.GenesisState{ Params: pricefeed.Params{ Markets: []pricefeed.Market{ - pricefeed.Market{MarketID: "btc:usd", BaseAsset: "btc", QuoteAsset: "usd", Oracles: []sdk.AccAddress{}, Active: true}, - pricefeed.Market{MarketID: "xrp:usd", BaseAsset: "xrp", QuoteAsset: "usd", Oracles: []sdk.AccAddress{}, Active: true}, + {MarketID: "btc:usd", BaseAsset: "btc", QuoteAsset: "usd", Oracles: []sdk.AccAddress{}, Active: true}, + {MarketID: "xrp:usd", BaseAsset: "xrp", QuoteAsset: "usd", Oracles: []sdk.AccAddress{}, Active: true}, }, }, PostedPrices: []pricefeed.PostedPrice{ - pricefeed.PostedPrice{ + { MarketID: "btc:usd", OracleAddress: sdk.AccAddress{}, Price: sdk.MustNewDecFromStr("8000.00"), Expiry: time.Now().Add(1 * time.Hour), }, - pricefeed.PostedPrice{ + { MarketID: "xrp:usd", OracleAddress: sdk.AccAddress{}, Price: sdk.MustNewDecFromStr("0.25"), @@ -39,18 +39,18 @@ func NewPricefeedGenStateWithOracles(addrs []sdk.AccAddress) app.GenesisState { pfGenesis := pricefeed.GenesisState{ Params: pricefeed.Params{ Markets: []pricefeed.Market{ - pricefeed.Market{MarketID: "btc:usd", BaseAsset: "btc", QuoteAsset: "usd", Oracles: addrs, Active: true}, - pricefeed.Market{MarketID: "xrp:usd", BaseAsset: "xrp", QuoteAsset: "usd", Oracles: addrs, Active: true}, + {MarketID: "btc:usd", BaseAsset: "btc", QuoteAsset: "usd", Oracles: addrs, Active: true}, + {MarketID: "xrp:usd", BaseAsset: "xrp", QuoteAsset: "usd", Oracles: addrs, Active: true}, }, }, PostedPrices: []pricefeed.PostedPrice{ - pricefeed.PostedPrice{ + { MarketID: "btc:usd", OracleAddress: addrs[0], Price: sdk.MustNewDecFromStr("8000.00"), Expiry: time.Now().Add(1 * time.Hour), }, - pricefeed.PostedPrice{ + { MarketID: "xrp:usd", OracleAddress: addrs[0], Price: sdk.MustNewDecFromStr("0.25"), diff --git a/x/pricefeed/keeper/integration_test.go b/x/pricefeed/keeper/integration_test.go index 5594cda8..f9397c97 100644 --- a/x/pricefeed/keeper/integration_test.go +++ b/x/pricefeed/keeper/integration_test.go @@ -13,18 +13,18 @@ func NewPricefeedGenStateMulti() app.GenesisState { pfGenesis := pricefeed.GenesisState{ Params: pricefeed.Params{ Markets: []pricefeed.Market{ - pricefeed.Market{MarketID: "btc:usd", BaseAsset: "btc", QuoteAsset: "usd", Oracles: []sdk.AccAddress{}, Active: true}, - pricefeed.Market{MarketID: "xrp:usd", BaseAsset: "xrp", QuoteAsset: "usd", Oracles: []sdk.AccAddress{}, Active: true}, + {MarketID: "btc:usd", BaseAsset: "btc", QuoteAsset: "usd", Oracles: []sdk.AccAddress{}, Active: true}, + {MarketID: "xrp:usd", BaseAsset: "xrp", QuoteAsset: "usd", Oracles: []sdk.AccAddress{}, Active: true}, }, }, PostedPrices: []pricefeed.PostedPrice{ - pricefeed.PostedPrice{ + { MarketID: "btc:usd", OracleAddress: sdk.AccAddress{}, Price: sdk.MustNewDecFromStr("8000.00"), Expiry: time.Now().Add(1 * time.Hour), }, - pricefeed.PostedPrice{ + { MarketID: "xrp:usd", OracleAddress: sdk.AccAddress{}, Price: sdk.MustNewDecFromStr("0.25"), diff --git a/x/pricefeed/keeper/params_test.go b/x/pricefeed/keeper/params_test.go index d4ccc483..c9849d39 100644 --- a/x/pricefeed/keeper/params_test.go +++ b/x/pricefeed/keeper/params_test.go @@ -4,11 +4,12 @@ import ( "testing" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/kava-labs/kava/app" - "github.com/kava-labs/kava/x/pricefeed/keeper" "github.com/stretchr/testify/suite" abci "github.com/tendermint/tendermint/abci/types" tmtime "github.com/tendermint/tendermint/types/time" + + "github.com/kava-labs/kava/app" + "github.com/kava-labs/kava/x/pricefeed/keeper" ) type KeeperTestSuite struct { diff --git a/x/validator-vesting/abci.go b/x/validator-vesting/abci.go index bd896d56..6b9c6d14 100644 --- a/x/validator-vesting/abci.go +++ b/x/validator-vesting/abci.go @@ -7,8 +7,9 @@ import ( tmtime "github.com/tendermint/tendermint/types/time" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/kava-labs/kava/x/validator-vesting/keeper" abci "github.com/tendermint/tendermint/abci/types" + + "github.com/kava-labs/kava/x/validator-vesting/keeper" ) // BeginBlocker updates the vote signing information for each validator vesting account, updates account when period changes, and updates the previousBlockTime value in the store. diff --git a/x/validator-vesting/abci_test.go b/x/validator-vesting/abci_test.go index dcac8266..16b7e1ab 100644 --- a/x/validator-vesting/abci_test.go +++ b/x/validator-vesting/abci_test.go @@ -11,6 +11,7 @@ import ( "github.com/cosmos/cosmos-sdk/x/staking" stakingexported "github.com/cosmos/cosmos-sdk/x/staking/exported" + "github.com/kava-labs/kava/x/validator-vesting/keeper" "github.com/kava-labs/kava/x/validator-vesting/types" ) @@ -260,7 +261,7 @@ func TestBeginBlockerSuccessfulPeriod(t *testing.T) { vva = vvk.GetAccountFromAuthKeeper(ctx, vva.Address) // t.Log(vva.MarshalYAML()) - require.Equal(t, []types.VestingProgress{types.VestingProgress{true, true}, types.VestingProgress{false, false}, types.VestingProgress{false, false}}, vva.VestingPeriodProgress) + require.Equal(t, []types.VestingProgress{{true, true}, {false, false}, {false, false}}, vva.VestingPeriodProgress) } func TestBeginBlockerUnsuccessfulPeriod(t *testing.T) { @@ -320,8 +321,8 @@ func TestBeginBlockerUnsuccessfulPeriod(t *testing.T) { } vva = vvk.GetAccountFromAuthKeeper(ctx, vva.Address) - // check that the period was unsucessful - require.Equal(t, []types.VestingProgress{types.VestingProgress{true, false}, types.VestingProgress{false, false}, types.VestingProgress{false, false}}, vva.VestingPeriodProgress) + // check that the period was unsuccessful + require.Equal(t, []types.VestingProgress{{true, false}, {false, false}, {false, false}}, vva.VestingPeriodProgress) // check that there is debt after the period. require.Equal(t, sdk.Coins{sdk.NewInt64Coin("stake", 30000000)}, vva.DebtAfterFailedVesting) diff --git a/x/validator-vesting/client/rest/query.go b/x/validator-vesting/client/rest/query.go index ebe1de2e..f132ed35 100644 --- a/x/validator-vesting/client/rest/query.go +++ b/x/validator-vesting/client/rest/query.go @@ -8,6 +8,7 @@ import ( "github.com/cosmos/cosmos-sdk/client/context" "github.com/cosmos/cosmos-sdk/types/rest" "github.com/gorilla/mux" + "github.com/kava-labs/kava/x/validator-vesting/types" ) diff --git a/x/validator-vesting/genesis.go b/x/validator-vesting/genesis.go index e987b00c..00b6fd5f 100644 --- a/x/validator-vesting/genesis.go +++ b/x/validator-vesting/genesis.go @@ -2,6 +2,7 @@ package validatorvesting import ( sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/kava-labs/kava/x/validator-vesting/types" ) diff --git a/x/validator-vesting/keeper/keeper.go b/x/validator-vesting/keeper/keeper.go index f6bdade1..1bda605a 100644 --- a/x/validator-vesting/keeper/keeper.go +++ b/x/validator-vesting/keeper/keeper.go @@ -7,8 +7,9 @@ import ( "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" stakingexported "github.com/cosmos/cosmos-sdk/x/staking/exported" - "github.com/kava-labs/kava/x/validator-vesting/types" "github.com/tendermint/tendermint/libs/log" + + "github.com/kava-labs/kava/x/validator-vesting/types" ) // Keeper of the validatorvesting store diff --git a/x/validator-vesting/keeper/keeper_test.go b/x/validator-vesting/keeper/keeper_test.go index c3aaafb8..393ffa8d 100644 --- a/x/validator-vesting/keeper/keeper_test.go +++ b/x/validator-vesting/keeper/keeper_test.go @@ -11,6 +11,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/staking" stakingexported "github.com/cosmos/cosmos-sdk/x/staking/exported" + "github.com/kava-labs/kava/x/validator-vesting/types" ) @@ -152,7 +153,7 @@ func TestUpdateVestedCoinsProgress(t *testing.T) { ak.SetAccount(ctx, vva) // require all vesting period tracking variables to be zero after validator vesting account is initialized - require.Equal(t, []types.VestingProgress{types.VestingProgress{false, false}, types.VestingProgress{false, false}, types.VestingProgress{false, false}}, vva.VestingPeriodProgress) + require.Equal(t, []types.VestingProgress{{false, false}, {false, false}, {false, false}}, vva.VestingPeriodProgress) // period 0 passes with all blocks signed vva.CurrentPeriodProgress.MissedBlocks = 0 @@ -164,7 +165,7 @@ func TestUpdateVestedCoinsProgress(t *testing.T) { // require that debt is zerox require.Equal(t, sdk.Coins(nil), vva.DebtAfterFailedVesting) // require that the first vesting progress variable is successful - require.Equal(t, []types.VestingProgress{types.VestingProgress{true, true}, types.VestingProgress{false, false}, types.VestingProgress{false, false}}, vva.VestingPeriodProgress) + require.Equal(t, []types.VestingProgress{{true, true}, {false, false}, {false, false}}, vva.VestingPeriodProgress) // require that the missing block counter has reset require.Equal(t, types.CurrentPeriodProgress{0, 0}, vva.CurrentPeriodProgress) @@ -183,7 +184,7 @@ func TestUpdateVestedCoinsProgress(t *testing.T) { // require that debt is zero require.Equal(t, sdk.Coins(nil), vva.DebtAfterFailedVesting) // require that the first vesting progress variable is successful - require.Equal(t, []types.VestingProgress{types.VestingProgress{true, true}, types.VestingProgress{false, false}, types.VestingProgress{false, false}}, vva.VestingPeriodProgress) + require.Equal(t, []types.VestingProgress{{true, true}, {false, false}, {false, false}}, vva.VestingPeriodProgress) // require that the missing block counter has reset require.Equal(t, types.CurrentPeriodProgress{0, 0}, vva.CurrentPeriodProgress) @@ -199,7 +200,7 @@ func TestUpdateVestedCoinsProgress(t *testing.T) { // require that period 1 coins have become debt require.Equal(t, sdk.NewCoins(sdk.NewInt64Coin(feeDenom, 500), sdk.NewInt64Coin(stakeDenom, 50)), vva.DebtAfterFailedVesting) // require that the first vesting progress variable is {true, false} - require.Equal(t, []types.VestingProgress{types.VestingProgress{true, false}, types.VestingProgress{false, false}, types.VestingProgress{false, false}}, vva.VestingPeriodProgress) + require.Equal(t, []types.VestingProgress{{true, false}, {false, false}, {false, false}}, vva.VestingPeriodProgress) // require that the missing block counter has reset require.Equal(t, types.CurrentPeriodProgress{0, 0}, vva.CurrentPeriodProgress) } diff --git a/x/validator-vesting/keeper/test_common.go b/x/validator-vesting/keeper/test_common.go index fbb817ca..a9cc1e9b 100644 --- a/x/validator-vesting/keeper/test_common.go +++ b/x/validator-vesting/keeper/test_common.go @@ -25,6 +25,7 @@ import ( "github.com/cosmos/cosmos-sdk/x/params" "github.com/cosmos/cosmos-sdk/x/staking" "github.com/cosmos/cosmos-sdk/x/supply" + "github.com/kava-labs/kava/x/validator-vesting/types" ) diff --git a/x/validator-vesting/module.go b/x/validator-vesting/module.go index f918d028..c4a3e704 100644 --- a/x/validator-vesting/module.go +++ b/x/validator-vesting/module.go @@ -13,6 +13,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" sim "github.com/cosmos/cosmos-sdk/x/simulation" + "github.com/kava-labs/kava/x/validator-vesting/client/cli" "github.com/kava-labs/kava/x/validator-vesting/client/rest" "github.com/kava-labs/kava/x/validator-vesting/simulation" diff --git a/x/validator-vesting/simulation/decoder.go b/x/validator-vesting/simulation/decoder.go index 7dc83ff6..d0533eb9 100644 --- a/x/validator-vesting/simulation/decoder.go +++ b/x/validator-vesting/simulation/decoder.go @@ -7,8 +7,9 @@ import ( "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/kava-labs/kava/x/validator-vesting/types" "github.com/tendermint/tendermint/libs/kv" + + "github.com/kava-labs/kava/x/validator-vesting/types" ) // DecodeStore unmarshals the KVPair's Value to the corresponding auth type diff --git a/x/validator-vesting/simulation/decoder_test.go b/x/validator-vesting/simulation/decoder_test.go index c029499b..4451e1b5 100644 --- a/x/validator-vesting/simulation/decoder_test.go +++ b/x/validator-vesting/simulation/decoder_test.go @@ -8,10 +8,11 @@ import ( "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth" - "github.com/kava-labs/kava/x/validator-vesting/types" "github.com/stretchr/testify/require" "github.com/tendermint/tendermint/crypto/ed25519" "github.com/tendermint/tendermint/libs/kv" + + "github.com/kava-labs/kava/x/validator-vesting/types" ) var ( diff --git a/x/validator-vesting/simulation/genesis.go b/x/validator-vesting/simulation/genesis.go index 414bb0f9..9a39dd5b 100644 --- a/x/validator-vesting/simulation/genesis.go +++ b/x/validator-vesting/simulation/genesis.go @@ -11,6 +11,7 @@ import ( vestexported "github.com/cosmos/cosmos-sdk/x/auth/vesting/exported" vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" "github.com/cosmos/cosmos-sdk/x/simulation" + "github.com/kava-labs/kava/x/validator-vesting/types" ) diff --git a/x/validator-vesting/test_common.go b/x/validator-vesting/test_common.go index fdb4f83f..176d1737 100644 --- a/x/validator-vesting/test_common.go +++ b/x/validator-vesting/test_common.go @@ -18,6 +18,7 @@ import ( "github.com/cosmos/cosmos-sdk/x/staking" "github.com/cosmos/cosmos-sdk/x/supply" supplyexported "github.com/cosmos/cosmos-sdk/x/supply/exported" + "github.com/kava-labs/kava/x/validator-vesting/keeper" "github.com/kava-labs/kava/x/validator-vesting/types" ) diff --git a/x/validator-vesting/types/validator_vesting_account.go b/x/validator-vesting/types/validator_vesting_account.go index 27eb452e..a1180e88 100644 --- a/x/validator-vesting/types/validator_vesting_account.go +++ b/x/validator-vesting/types/validator_vesting_account.go @@ -5,7 +5,7 @@ import ( "errors" "time" - "gopkg.in/yaml.v2" + yaml "gopkg.in/yaml.v2" sdk "github.com/cosmos/cosmos-sdk/types" authexported "github.com/cosmos/cosmos-sdk/x/auth/exported" diff --git a/x/validator-vesting/types/validator_vesting_account_test.go b/x/validator-vesting/types/validator_vesting_account_test.go index 5bb91d76..4abad811 100644 --- a/x/validator-vesting/types/validator_vesting_account_test.go +++ b/x/validator-vesting/types/validator_vesting_account_test.go @@ -254,7 +254,7 @@ func TestGetFailedVestedCoins(t *testing.T) { vva := NewValidatorVestingAccount(&bacc, now.Unix(), periods, testConsAddr, nil, 90) vva.VestingPeriodProgress[0] = VestingProgress{true, false} - // require that period 1 coins are failed if the period completed unsucessfully. + // require that period 1 coins are failed if the period completed unsuccessfully. require.Equal(t, sdk.Coins{sdk.NewInt64Coin(feeDenom, 500), sdk.NewInt64Coin(stakeDenom, 50)}, vva.GetFailedVestedCoins(), @@ -362,7 +362,7 @@ func TestTrackUndelegationPeriodicVestingAcc(t *testing.T) { require.Nil(t, vva.DelegatedFree) require.Nil(t, vva.DelegatedVesting) - // successfuly vest period 1 and delegate to two validators + // successfully vest period 1 and delegate to two validators vva = NewValidatorVestingAccount(&bacc, now.Unix(), periods, testConsAddr, nil, 90) vva.VestingPeriodProgress[0] = VestingProgress{true, true} vva.TrackDelegation(now.Add(12*time.Hour), sdk.Coins{sdk.NewInt64Coin(stakeDenom, 50)})