diff --git a/go.mod b/go.mod index b6418b16..20470fee 100644 --- a/go.mod +++ b/go.mod @@ -3,6 +3,7 @@ module github.com/DecentralCardGame/Cardchain go 1.20 require ( + cosmossdk.io/errors v1.0.0-beta.7 github.com/DecentralCardGame/cardobject v0.5.0 github.com/cosmos/cosmos-sdk v0.46.15 github.com/cosmos/ibc-go/v6 v6.1.0 @@ -29,7 +30,6 @@ require ( cloud.google.com/go/compute/metadata v0.2.3 // indirect cloud.google.com/go/iam v1.1.0 // indirect cloud.google.com/go/storage v1.30.1 // indirect - cosmossdk.io/errors v1.0.0-beta.7 // indirect cosmossdk.io/math v1.0.0-rc.0 // indirect filippo.io/edwards25519 v1.0.0-rc.1 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect diff --git a/x/cardchain/handler.go b/x/cardchain/handler.go index 1fd3c9f4..aac0da42 100644 --- a/x/cardchain/handler.go +++ b/x/cardchain/handler.go @@ -3,10 +3,11 @@ package cardchain import ( "fmt" + sdkerrors "cosmossdk.io/errors" "github.com/DecentralCardGame/Cardchain/x/cardchain/keeper" "github.com/DecentralCardGame/Cardchain/x/cardchain/types" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" ) // NewHandler ... @@ -134,7 +135,7 @@ func NewHandler(k keeper.Keeper) sdk.Handler { // this line is used by starport scaffolding # 1 default: errMsg := fmt.Sprintf("unrecognized %s message type: %T", types.ModuleName, msg) - return nil, sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, errMsg) + return nil, sdkerrors.Wrap(errors.ErrUnknownRequest, errMsg) } } } diff --git a/x/cardchain/keeper/coin.go b/x/cardchain/keeper/coin.go index 6dd3b5a5..ef566399 100644 --- a/x/cardchain/keeper/coin.go +++ b/x/cardchain/keeper/coin.go @@ -1,9 +1,9 @@ package keeper import ( + sdkerrors "cosmossdk.io/errors" "github.com/DecentralCardGame/Cardchain/x/cardchain/types" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "math/big" ) diff --git a/x/cardchain/keeper/collection.go b/x/cardchain/keeper/collection.go index 33e3c9de..51b404d5 100644 --- a/x/cardchain/keeper/collection.go +++ b/x/cardchain/keeper/collection.go @@ -3,11 +3,11 @@ package keeper import ( "errors" + sdkerrors "cosmossdk.io/errors" "github.com/DecentralCardGame/Cardchain/x/cardchain/types" "github.com/DecentralCardGame/cardobject/cardobject" "github.com/DecentralCardGame/cardobject/keywords" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) // CollectCollectionFee Collects a fee from a user diff --git a/x/cardchain/keeper/grpc_query_q_card.go b/x/cardchain/keeper/grpc_query_q_card.go index ebe6e7d2..ee100da7 100644 --- a/x/cardchain/keeper/grpc_query_q_card.go +++ b/x/cardchain/keeper/grpc_query_q_card.go @@ -7,8 +7,10 @@ import ( "strconv" "github.com/DecentralCardGame/Cardchain/x/cardchain/types" + + sdkerrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" ) @@ -23,12 +25,12 @@ func (k Keeper) QCard(goCtx context.Context, req *types.QueryQCardRequest) (*typ // Start of query code cardId, err := strconv.ParseUint(req.CardId, 10, 64) if err != nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, "could not parse cardId") + return nil, sdkerrors.Wrap(errors.ErrUnknownRequest, "could not parse cardId") } card := k.Cards.Get(ctx, cardId) if card == nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, "cardId does not represent a card") + return nil, sdkerrors.Wrap(errors.ErrUnknownRequest, "cardId does not represent a card") } image := k.Images.Get(ctx, card.ImageId) @@ -50,7 +52,7 @@ func (k Keeper) QCard(goCtx context.Context, req *types.QueryQCardRequest) (*typ UnderpoweredVotes: card.UnderpoweredVotes, InappropriateVotes: card.InappropriateVotes, Nerflevel: card.Nerflevel, - BalanceAnchor: card.BalanceAnchor, + BalanceAnchor: card.BalanceAnchor, Hash: hash, } diff --git a/x/cardchain/keeper/grpc_query_q_card_content.go b/x/cardchain/keeper/grpc_query_q_card_content.go index b732d87a..e5085627 100644 --- a/x/cardchain/keeper/grpc_query_q_card_content.go +++ b/x/cardchain/keeper/grpc_query_q_card_content.go @@ -5,11 +5,12 @@ import ( "crypto/md5" "encoding/hex" "fmt" + "github.com/cosmos/cosmos-sdk/types/errors" "strconv" + sdkerrors "cosmossdk.io/errors" "github.com/DecentralCardGame/Cardchain/x/cardchain/types" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" ) @@ -23,12 +24,12 @@ func (k Keeper) QCardContent(goCtx context.Context, req *types.QueryQCardContent cardId, err := strconv.ParseUint(req.CardId, 10, 64) if err != nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, "could not parse cardId") + return nil, sdkerrors.Wrap(errors.ErrUnknownRequest, "could not parse cardId") } card := k.Cards.Get(ctx, cardId) if &card == nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, "cardId does not represent a card") + return nil, sdkerrors.Wrap(errors.ErrUnknownRequest, "cardId does not represent a card") } image := k.Images.Get(ctx, card.ImageId) diff --git a/x/cardchain/keeper/grpc_query_q_cards.go b/x/cardchain/keeper/grpc_query_q_cards.go index 0c5f09f8..ba03dea5 100644 --- a/x/cardchain/keeper/grpc_query_q_cards.go +++ b/x/cardchain/keeper/grpc_query_q_cards.go @@ -4,14 +4,15 @@ import ( "context" "encoding/json" "sort" - "strings" "strconv" + "strings" + sdkerrors "cosmossdk.io/errors" "github.com/DecentralCardGame/Cardchain/x/cardchain/types" "github.com/DecentralCardGame/cardobject/cardobject" "github.com/DecentralCardGame/cardobject/keywords" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" "golang.org/x/exp/slices" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" @@ -135,7 +136,7 @@ func (k Keeper) QCards(goCtx context.Context, req *types.QueryQCardsRequest) (*t if req.NameContains != "" || req.CardType != "" || req.SortBy != "" || req.Classes != "" || req.KeywordsContains != "" { cardobj, err := keywords.Unmarshal(gottenCard.Content) if err != nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrJSONMarshal, err.Error()+"cardid="+strconv.FormatUint(idx, 10)) + return nil, sdkerrors.Wrap(errors.ErrJSONMarshal, err.Error()+"cardid="+strconv.FormatUint(idx, 10)) } if cardobj.Action != nil { diff --git a/x/cardchain/keeper/grpc_query_q_sell_offers.go b/x/cardchain/keeper/grpc_query_q_sell_offers.go index 66385b40..78b35a5d 100644 --- a/x/cardchain/keeper/grpc_query_q_sell_offers.go +++ b/x/cardchain/keeper/grpc_query_q_sell_offers.go @@ -3,9 +3,9 @@ package keeper import ( "context" + sdkerrors "cosmossdk.io/errors" "github.com/DecentralCardGame/Cardchain/x/cardchain/types" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" ) diff --git a/x/cardchain/keeper/grpc_query_q_user.go b/x/cardchain/keeper/grpc_query_q_user.go index 0f65c1e7..d4d12311 100644 --- a/x/cardchain/keeper/grpc_query_q_user.go +++ b/x/cardchain/keeper/grpc_query_q_user.go @@ -3,9 +3,9 @@ package keeper import ( "context" + sdkerrors "cosmossdk.io/errors" "github.com/DecentralCardGame/Cardchain/x/cardchain/types" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" ) diff --git a/x/cardchain/keeper/grpc_query_q_votable_cards.go b/x/cardchain/keeper/grpc_query_q_votable_cards.go index 59d06a3a..39ee0e46 100644 --- a/x/cardchain/keeper/grpc_query_q_votable_cards.go +++ b/x/cardchain/keeper/grpc_query_q_votable_cards.go @@ -3,9 +3,10 @@ package keeper import ( "context" + sdkerrors "cosmossdk.io/errors" "github.com/DecentralCardGame/Cardchain/x/cardchain/types" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" ) @@ -19,7 +20,7 @@ func (k Keeper) QVotableCards(goCtx context.Context, req *types.QueryQVotableCar address, err := sdk.AccAddressFromBech32(req.Address) if err != nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, "could not parse user address") + return nil, sdkerrors.Wrap(errors.ErrUnknownRequest, "could not parse user address") } unreg := true diff --git a/x/cardchain/keeper/keeper.go b/x/cardchain/keeper/keeper.go index 27b91510..c625f2b7 100644 --- a/x/cardchain/keeper/keeper.go +++ b/x/cardchain/keeper/keeper.go @@ -3,6 +3,7 @@ package keeper import ( "encoding/json" "fmt" + "github.com/cosmos/cosmos-sdk/types/errors" "sort" "github.com/DecentralCardGame/Cardchain/x/cardchain/types" @@ -12,7 +13,6 @@ import ( "github.com/cosmos/cosmos-sdk/codec" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" "github.com/tendermint/tendermint/libs/log" ) @@ -89,7 +89,7 @@ func (k Keeper) Logger(ctx sdk.Context) log.Logger { func (k Keeper) TransferSchemeToCard(ctx sdk.Context, cardId uint64, user *User) (err error) { user.OwnedCardSchemes, err = PopItemFromArr(cardId, user.OwnedCardSchemes) if err != nil { - return sdkerrors.ErrUnauthorized + return errors.ErrUnauthorized } user.OwnedPrototypes = append(user.OwnedPrototypes, cardId) @@ -118,10 +118,10 @@ func (k Keeper) GetLastVotingResults(ctx sdk.Context) (results types.VotingResul // NerfBuffCards Nerfes or buffs certain cards // TODO maybe the whole auto balancing stuff should be moved into its own file func (k Keeper) NerfBuffCards(ctx sdk.Context, cardIds []uint64, buff bool) { - if len(cardIds) > 0 { - k.SetLastCardModifiedNow(ctx) + if len(cardIds) > 0 { + k.SetLastCardModifiedNow(ctx) } - + for _, val := range cardIds { buffCard := k.Cards.Get(ctx, val) @@ -221,8 +221,8 @@ func (k Keeper) UpdateBanStatus(ctx sdk.Context, newBannedIds []uint64) { k.Cards.Set(ctx, id, banCard) } - if len(newBannedIds) > 0 { - k.SetLastCardModifiedNow(ctx) + if len(newBannedIds) > 0 { + k.SetLastCardModifiedNow(ctx) } } diff --git a/x/cardchain/keeper/match.go b/x/cardchain/keeper/match.go index 9ec6f987..c1028193 100644 --- a/x/cardchain/keeper/match.go +++ b/x/cardchain/keeper/match.go @@ -2,9 +2,11 @@ package keeper import ( "fmt" + "github.com/cosmos/cosmos-sdk/types/errors" + + sdkerrors "cosmossdk.io/errors" "github.com/DecentralCardGame/Cardchain/x/cardchain/types" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "golang.org/x/exp/slices" ) @@ -78,7 +80,7 @@ func (k Keeper) DistributeCoins(ctx sdk.Context, match *types.Match, outcome typ if !amounts[idx].IsZero() { err := k.MintCoinsToAddr(ctx, address, sdk.Coins{amounts[idx]}) if err != nil { - return sdkerrors.Wrap(sdkerrors.ErrInsufficientFunds, err.Error()) + return sdkerrors.Wrap(errors.ErrInsufficientFunds, err.Error()) } k.SubPoolCredits(ctx, WinnersPoolKey, amounts[idx]) diff --git a/x/cardchain/keeper/msg_server_add_artwork.go b/x/cardchain/keeper/msg_server_add_artwork.go index 3a3abb5d..85b173c1 100644 --- a/x/cardchain/keeper/msg_server_add_artwork.go +++ b/x/cardchain/keeper/msg_server_add_artwork.go @@ -3,10 +3,11 @@ package keeper import ( "context" "fmt" + "github.com/cosmos/cosmos-sdk/types/errors" + sdkerrors "cosmossdk.io/errors" "github.com/DecentralCardGame/Cardchain/x/cardchain/types" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) func (k msgServer) AddArtwork(goCtx context.Context, msg *types.MsgAddArtwork) (*types.MsgAddArtworkResponse, error) { @@ -21,7 +22,7 @@ func (k msgServer) AddArtwork(goCtx context.Context, msg *types.MsgAddArtwork) ( //} if card.Artist != msg.Creator { - return nil, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "Incorrect Artist") + return nil, sdkerrors.Wrap(errors.ErrUnauthorized, "Incorrect Artist") } if len(msg.Image) > 500000 { diff --git a/x/cardchain/keeper/msg_server_add_artwork_to_collection.go b/x/cardchain/keeper/msg_server_add_artwork_to_collection.go index 26a3225d..9cc60d90 100644 --- a/x/cardchain/keeper/msg_server_add_artwork_to_collection.go +++ b/x/cardchain/keeper/msg_server_add_artwork_to_collection.go @@ -4,9 +4,10 @@ import ( "context" "fmt" + sdkerrors "cosmossdk.io/errors" "github.com/DecentralCardGame/Cardchain/x/cardchain/types" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" ) func (k msgServer) AddArtworkToCollection(goCtx context.Context, msg *types.MsgAddArtworkToCollection) (*types.MsgAddArtworkToCollectionResponse, error) { @@ -16,7 +17,7 @@ func (k msgServer) AddArtworkToCollection(goCtx context.Context, msg *types.MsgA image := k.Images.Get(ctx, collection.ArtworkId) if collection.Artist != msg.Creator { - return nil, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "Incorrect Artist") + return nil, sdkerrors.Wrap(errors.ErrUnauthorized, "Incorrect Artist") } if collection.Status != types.CStatus_design { return nil, types.ErrCollectionNotInDesign @@ -28,7 +29,7 @@ func (k msgServer) AddArtworkToCollection(goCtx context.Context, msg *types.MsgA err := k.CollectCollectionConributionFee(ctx, msg.Creator) if err != nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrInsufficientFunds, err.Error()) + return nil, sdkerrors.Wrap(errors.ErrInsufficientFunds, err.Error()) } image.Image = msg.Image diff --git a/x/cardchain/keeper/msg_server_add_card_to_collection.go b/x/cardchain/keeper/msg_server_add_card_to_collection.go index 7b3e9d1a..b182c626 100644 --- a/x/cardchain/keeper/msg_server_add_card_to_collection.go +++ b/x/cardchain/keeper/msg_server_add_card_to_collection.go @@ -3,9 +3,10 @@ package keeper import ( "context" + sdkerrors "cosmossdk.io/errors" "github.com/DecentralCardGame/Cardchain/x/cardchain/types" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" "golang.org/x/exp/slices" ) @@ -16,7 +17,7 @@ func (k msgServer) AddCardToCollection(goCtx context.Context, msg *types.MsgAddC collection := k.Collections.Get(ctx, msg.CollectionId) if !slices.Contains(collection.Contributors, msg.Creator) { - return nil, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "Invalid contributor") + return nil, sdkerrors.Wrap(errors.ErrUnauthorized, "Invalid contributor") } if collection.Status != types.CStatus_design { return nil, types.ErrCollectionNotInDesign @@ -36,7 +37,7 @@ func (k msgServer) AddCardToCollection(goCtx context.Context, msg *types.MsgAddC } if card.Owner != msg.Creator { - return nil, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "Invalid creator") + return nil, sdkerrors.Wrap(errors.ErrUnauthorized, "Invalid creator") } if len(collection.Cards) >= collectionSize { @@ -49,7 +50,7 @@ func (k msgServer) AddCardToCollection(goCtx context.Context, msg *types.MsgAddC err := k.CollectCollectionConributionFee(ctx, msg.Creator) if err != nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrInsufficientFunds, err.Error()) + return nil, sdkerrors.Wrap(errors.ErrInsufficientFunds, err.Error()) } collection.Cards = append(collection.Cards, msg.CardId) diff --git a/x/cardchain/keeper/msg_server_add_contributor_to_collection.go b/x/cardchain/keeper/msg_server_add_contributor_to_collection.go index c74f1c32..2d881398 100644 --- a/x/cardchain/keeper/msg_server_add_contributor_to_collection.go +++ b/x/cardchain/keeper/msg_server_add_contributor_to_collection.go @@ -3,9 +3,10 @@ package keeper import ( "context" + sdkerrors "cosmossdk.io/errors" "github.com/DecentralCardGame/Cardchain/x/cardchain/types" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" "golang.org/x/exp/slices" ) @@ -14,7 +15,7 @@ func (k msgServer) AddContributorToCollection(goCtx context.Context, msg *types. collection := k.Collections.Get(ctx, msg.CollectionId) if msg.Creator != collection.Contributors[0] { - return nil, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "Invalid creator") + return nil, sdkerrors.Wrap(errors.ErrUnauthorized, "Invalid creator") } if collection.Status != types.CStatus_design { return nil, types.ErrCollectionNotInDesign @@ -26,7 +27,7 @@ func (k msgServer) AddContributorToCollection(goCtx context.Context, msg *types. err := k.CollectCollectionConributionFee(ctx, msg.Creator) if err != nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrInsufficientFunds, err.Error()) + return nil, sdkerrors.Wrap(errors.ErrInsufficientFunds, err.Error()) } collection.Contributors = append(collection.Contributors, msg.User) diff --git a/x/cardchain/keeper/msg_server_add_story_to_collection.go b/x/cardchain/keeper/msg_server_add_story_to_collection.go index be327078..ac3c9de3 100644 --- a/x/cardchain/keeper/msg_server_add_story_to_collection.go +++ b/x/cardchain/keeper/msg_server_add_story_to_collection.go @@ -3,9 +3,10 @@ package keeper import ( "context" + sdkerrors "cosmossdk.io/errors" "github.com/DecentralCardGame/Cardchain/x/cardchain/types" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" ) func (k msgServer) AddStoryToCollection(goCtx context.Context, msg *types.MsgAddStoryToCollection) (*types.MsgAddStoryToCollectionResponse, error) { @@ -13,7 +14,7 @@ func (k msgServer) AddStoryToCollection(goCtx context.Context, msg *types.MsgAdd collection := k.Collections.Get(ctx, msg.CollectionId) if collection.StoryWriter != msg.Creator { - return nil, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "Incorrect StoryWriter") + return nil, sdkerrors.Wrap(errors.ErrUnauthorized, "Incorrect StoryWriter") } if collection.Status != types.CStatus_design { return nil, types.ErrCollectionNotInDesign @@ -21,7 +22,7 @@ func (k msgServer) AddStoryToCollection(goCtx context.Context, msg *types.MsgAdd err := k.CollectCollectionConributionFee(ctx, msg.Creator) if err != nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrInsufficientFunds, err.Error()) + return nil, sdkerrors.Wrap(errors.ErrInsufficientFunds, err.Error()) } collection.Story = msg.Story diff --git a/x/cardchain/keeper/msg_server_buy_card.go b/x/cardchain/keeper/msg_server_buy_card.go index 7b745ed1..9f324b26 100644 --- a/x/cardchain/keeper/msg_server_buy_card.go +++ b/x/cardchain/keeper/msg_server_buy_card.go @@ -3,9 +3,10 @@ package keeper import ( "context" + sdkerrors "cosmossdk.io/errors" "github.com/DecentralCardGame/Cardchain/x/cardchain/types" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" ) func (k msgServer) BuyCard(goCtx context.Context, msg *types.MsgBuyCard) (*types.MsgBuyCardResponse, error) { @@ -29,7 +30,7 @@ func (k msgServer) BuyCard(goCtx context.Context, msg *types.MsgBuyCard) (*types err = k.BankKeeper.SendCoins(ctx, buyer.Addr, sellerAddr, sdk.Coins{sellOffer.Price}) if err != nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrInsufficientFunds, err.Error()) + return nil, sdkerrors.Wrap(errors.ErrInsufficientFunds, err.Error()) } buyer.Cards = append(buyer.Cards, sellOffer.Card) diff --git a/x/cardchain/keeper/msg_server_buy_card_scheme.go b/x/cardchain/keeper/msg_server_buy_card_scheme.go index 8e316e4a..a5527f17 100644 --- a/x/cardchain/keeper/msg_server_buy_card_scheme.go +++ b/x/cardchain/keeper/msg_server_buy_card_scheme.go @@ -4,9 +4,10 @@ import ( "context" "math" + sdkerrors "cosmossdk.io/errors" "github.com/DecentralCardGame/Cardchain/x/cardchain/types" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" ) func (k msgServer) BuyCardScheme(goCtx context.Context, msg *types.MsgBuyCardScheme) (*types.MsgBuyCardSchemeResponse, error) { @@ -22,12 +23,12 @@ func (k msgServer) BuyCardScheme(goCtx context.Context, msg *types.MsgBuyCardSch } if bid.IsLT(price) { // Checks if the bid is less than price - return nil, sdkerrors.Wrap(sdkerrors.ErrInsufficientFunds, "Bid not high enough") + return nil, sdkerrors.Wrap(errors.ErrInsufficientFunds, "Bid not high enough") } err = k.BurnCoinsFromAddr(ctx, buyer, sdk.Coins{price}) // If so, deduct the Bid amount from the sender if err != nil { - return nil, sdkerrors.Wrapf(sdkerrors.ErrInsufficientFunds, "Buyer does not have enough coins %s", err) + return nil, sdkerrors.Wrapf(errors.ErrInsufficientFunds, "Buyer does not have enough coins %s", err) } k.AddPoolCredits(ctx, PublicPoolKey, price) diff --git a/x/cardchain/keeper/msg_server_buy_collection.go b/x/cardchain/keeper/msg_server_buy_collection.go index ccefe71d..24e1b4b8 100644 --- a/x/cardchain/keeper/msg_server_buy_collection.go +++ b/x/cardchain/keeper/msg_server_buy_collection.go @@ -5,9 +5,10 @@ import ( "fmt" "strconv" + sdkerrors "cosmossdk.io/errors" "github.com/DecentralCardGame/Cardchain/x/cardchain/types" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" ) func (k msgServer) BuyCollection(goCtx context.Context, msg *types.MsgBuyCollection) (*types.MsgBuyCollectionResponse, error) { @@ -41,7 +42,7 @@ func (k msgServer) BuyCollection(goCtx context.Context, msg *types.MsgBuyCollect err = k.BankKeeper.SendCoins(ctx, creator.Addr, contribAddr, sdk.Coins{QuoCoin(params.CollectionPrice, int64(len(contribs)))}) if err != nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrInsufficientFunds, err.Error()) + return nil, sdkerrors.Wrap(errors.ErrInsufficientFunds, err.Error()) } } diff --git a/x/cardchain/keeper/msg_server_change_artist.go b/x/cardchain/keeper/msg_server_change_artist.go index 32f04bb3..d4868f06 100644 --- a/x/cardchain/keeper/msg_server_change_artist.go +++ b/x/cardchain/keeper/msg_server_change_artist.go @@ -3,9 +3,10 @@ package keeper import ( "context" + sdkerrors "cosmossdk.io/errors" "github.com/DecentralCardGame/Cardchain/x/cardchain/types" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" ) func (k msgServer) ChangeArtist(goCtx context.Context, msg *types.MsgChangeArtist) (*types.MsgChangeArtistResponse, error) { @@ -18,7 +19,7 @@ func (k msgServer) ChangeArtist(goCtx context.Context, msg *types.MsgChangeArtis } if card.Owner != msg.Creator { - return nil, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "Incorrect Owner") + return nil, sdkerrors.Wrap(errors.ErrUnauthorized, "Incorrect Owner") } newArtist, err := sdk.AccAddressFromBech32(msg.Artist) diff --git a/x/cardchain/keeper/msg_server_commit_council_response.go b/x/cardchain/keeper/msg_server_commit_council_response.go index 41903d86..675ba5ad 100644 --- a/x/cardchain/keeper/msg_server_commit_council_response.go +++ b/x/cardchain/keeper/msg_server_commit_council_response.go @@ -3,9 +3,10 @@ package keeper import ( "context" + sdkerrors "cosmossdk.io/errors" "github.com/DecentralCardGame/Cardchain/x/cardchain/types" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" "golang.org/x/exp/slices" ) @@ -21,7 +22,7 @@ func (k msgServer) CommitCouncilResponse(goCtx context.Context, msg *types.MsgCo council := k.Councils.Get(ctx, msg.CouncilId) if !slices.Contains(council.Voters, msg.Creator) { - return nil, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "Invalid Voter") + return nil, sdkerrors.Wrap(errors.ErrUnauthorized, "Invalid Voter") } if council.Status != types.CouncelingStatus_councilCreated { @@ -34,7 +35,7 @@ func (k msgServer) CommitCouncilResponse(goCtx context.Context, msg *types.MsgCo } if slices.Contains(allreadyVoted, msg.Creator) { - return nil, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "Allready voted") + return nil, sdkerrors.Wrap(errors.ErrUnauthorized, "Allready voted") } resp := types.WrapHashResponse{ @@ -57,7 +58,7 @@ func (k msgServer) CommitCouncilResponse(goCtx context.Context, msg *types.MsgCo err = k.BurnCoinsFromAddr(ctx, creator.Addr, sdk.Coins{collateralDeposit}) if err != nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrInsufficientFunds, "Voter does not have enough coins") + return nil, sdkerrors.Wrap(errors.ErrInsufficientFunds, "Voter does not have enough coins") } council.Treasury = council.Treasury.Add(collateralDeposit) diff --git a/x/cardchain/keeper/msg_server_confirm_match.go b/x/cardchain/keeper/msg_server_confirm_match.go index 51f0c662..a5a00ffe 100644 --- a/x/cardchain/keeper/msg_server_confirm_match.go +++ b/x/cardchain/keeper/msg_server_confirm_match.go @@ -3,9 +3,10 @@ package keeper import ( "context" + sdkerrors "cosmossdk.io/errors" "github.com/DecentralCardGame/Cardchain/x/cardchain/types" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" "golang.org/x/exp/slices" ) @@ -24,14 +25,14 @@ func (k msgServer) ConfirmMatch(goCtx context.Context, msg *types.MsgConfirmMatc case match.PlayerB.Addr: player = match.PlayerB default: - return nil, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "Didn't participate in match") + return nil, sdkerrors.Wrap(errors.ErrUnauthorized, "Didn't participate in match") } if player.Confirmed { - return nil, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "Already reported") + return nil, sdkerrors.Wrap(errors.ErrUnauthorized, "Already reported") } if match.Outcome == types.Outcome_Aborted { - return nil, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "Can't report, because match was aborted") + return nil, sdkerrors.Wrap(errors.ErrUnauthorized, "Can't report, because match was aborted") } player.Outcome = msg.Outcome diff --git a/x/cardchain/keeper/msg_server_create_collection.go b/x/cardchain/keeper/msg_server_create_collection.go index e13344d7..048ea0c2 100644 --- a/x/cardchain/keeper/msg_server_create_collection.go +++ b/x/cardchain/keeper/msg_server_create_collection.go @@ -3,9 +3,10 @@ package keeper import ( "context" + sdkerrors "cosmossdk.io/errors" "github.com/DecentralCardGame/Cardchain/x/cardchain/types" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" ) func (k msgServer) CreateCollection(goCtx context.Context, msg *types.MsgCreateCollection) (*types.MsgCreateCollectionResponse, error) { @@ -14,7 +15,7 @@ func (k msgServer) CreateCollection(goCtx context.Context, msg *types.MsgCreateC err := k.CollectCollectionCreationFee(ctx, msg.Creator) if err != nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrInsufficientFunds, err.Error()) + return nil, sdkerrors.Wrap(errors.ErrInsufficientFunds, err.Error()) } collection := types.Collection{ diff --git a/x/cardchain/keeper/msg_server_create_council.go b/x/cardchain/keeper/msg_server_create_council.go index 625e8e83..ec4082ca 100644 --- a/x/cardchain/keeper/msg_server_create_council.go +++ b/x/cardchain/keeper/msg_server_create_council.go @@ -4,9 +4,10 @@ import ( "context" "math/rand" + sdkerrors "cosmossdk.io/errors" "github.com/DecentralCardGame/Cardchain/x/cardchain/types" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" ) func (k msgServer) CreateCouncil(goCtx context.Context, msg *types.MsgCreateCouncil) (*types.MsgCreateCouncilResponse, error) { @@ -22,7 +23,7 @@ func (k msgServer) CreateCouncil(goCtx context.Context, msg *types.MsgCreateCoun // return nil, sdkerrors.Wrapf(types.ErrInvalidCardStatus, "%s", card.Status.String()) //} else if card.Owner != msg.Creator { - return nil, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "Incorrect Creator") + return nil, sdkerrors.Wrap(errors.ErrUnauthorized, "Incorrect Creator") } var possibleVoters []User @@ -54,7 +55,7 @@ func (k msgServer) CreateCouncil(goCtx context.Context, msg *types.MsgCreateCoun err = k.BurnCoinsFromAddr(ctx, creator.Addr, sdk.Coins{treasury}) if err != nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrInsufficientFunds, "Creator does not have enough coins") + return nil, sdkerrors.Wrap(errors.ErrInsufficientFunds, "Creator does not have enough coins") } for _, user := range fiveVoters { diff --git a/x/cardchain/keeper/msg_server_create_sell_offer.go b/x/cardchain/keeper/msg_server_create_sell_offer.go index b266ec64..66f44d5b 100644 --- a/x/cardchain/keeper/msg_server_create_sell_offer.go +++ b/x/cardchain/keeper/msg_server_create_sell_offer.go @@ -3,9 +3,9 @@ package keeper import ( "context" + sdkerrors "cosmossdk.io/errors" "github.com/DecentralCardGame/Cardchain/x/cardchain/types" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) func (k msgServer) CreateSellOffer(goCtx context.Context, msg *types.MsgCreateSellOffer) (*types.MsgCreateSellOfferResponse, error) { diff --git a/x/cardchain/keeper/msg_server_donate_to_card.go b/x/cardchain/keeper/msg_server_donate_to_card.go index d93031f4..6009b017 100644 --- a/x/cardchain/keeper/msg_server_donate_to_card.go +++ b/x/cardchain/keeper/msg_server_donate_to_card.go @@ -3,9 +3,10 @@ package keeper import ( "context" + sdkerrors "cosmossdk.io/errors" "github.com/DecentralCardGame/Cardchain/x/cardchain/types" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" ) func (k msgServer) DonateToCard(goCtx context.Context, msg *types.MsgDonateToCard) (*types.MsgDonateToCardResponse, error) { @@ -13,7 +14,7 @@ func (k msgServer) DonateToCard(goCtx context.Context, msg *types.MsgDonateToCar err := k.BurnCoinsFromString(ctx, msg.Creator, sdk.Coins{msg.Amount}) // If so, deduct the Bid amount from the sender if err != nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrInsufficientFunds, "Donator does not have enough coins") + return nil, sdkerrors.Wrap(errors.ErrInsufficientFunds, "Donator does not have enough coins") } card := k.Cards.Get(ctx, msg.CardId) diff --git a/x/cardchain/keeper/msg_server_finalize_collection.go b/x/cardchain/keeper/msg_server_finalize_collection.go index 92d8707a..4908621f 100644 --- a/x/cardchain/keeper/msg_server_finalize_collection.go +++ b/x/cardchain/keeper/msg_server_finalize_collection.go @@ -4,9 +4,10 @@ import ( "context" "fmt" + sdkerrors "cosmossdk.io/errors" "github.com/DecentralCardGame/Cardchain/x/cardchain/types" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" ) func (k msgServer) FinalizeCollection(goCtx context.Context, msg *types.MsgFinalizeCollection) (*types.MsgFinalizeCollectionResponse, error) { @@ -16,7 +17,7 @@ func (k msgServer) FinalizeCollection(goCtx context.Context, msg *types.MsgFinal collection := k.Collections.Get(ctx, msg.CollectionId) if msg.Creator != collection.Contributors[0] { - return nil, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "Invalid creator") + return nil, sdkerrors.Wrap(errors.ErrUnauthorized, "Invalid creator") } if collection.Status != types.CStatus_design { @@ -29,7 +30,7 @@ func (k msgServer) FinalizeCollection(goCtx context.Context, msg *types.MsgFinal err := k.CollectCollectionCreationFee(ctx, msg.Creator) if err != nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrInsufficientFunds, err.Error()) + return nil, sdkerrors.Wrap(errors.ErrInsufficientFunds, err.Error()) } dist, err := k.GetRarityDistribution(ctx, *collection, uint64(collectionSize)) diff --git a/x/cardchain/keeper/msg_server_multi_vote_card.go b/x/cardchain/keeper/msg_server_multi_vote_card.go index 3e578df3..11334059 100644 --- a/x/cardchain/keeper/msg_server_multi_vote_card.go +++ b/x/cardchain/keeper/msg_server_multi_vote_card.go @@ -3,8 +3,7 @@ package keeper import ( "context" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - + sdkerrors "cosmossdk.io/errors" "github.com/DecentralCardGame/Cardchain/x/cardchain/types" sdk "github.com/cosmos/cosmos-sdk/types" ) diff --git a/x/cardchain/keeper/msg_server_open_booster_pack.go b/x/cardchain/keeper/msg_server_open_booster_pack.go index 732e5636..7d7d6671 100644 --- a/x/cardchain/keeper/msg_server_open_booster_pack.go +++ b/x/cardchain/keeper/msg_server_open_booster_pack.go @@ -6,11 +6,11 @@ import ( "golang.org/x/exp/slices" + sdkerrors "cosmossdk.io/errors" "github.com/DecentralCardGame/Cardchain/x/cardchain/types" "github.com/DecentralCardGame/cardobject/cardobject" "github.com/DecentralCardGame/cardobject/keywords" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) func (k msgServer) OpenBoosterPack(goCtx context.Context, msg *types.MsgOpenBoosterPack) (*types.MsgOpenBoosterPackResponse, error) { diff --git a/x/cardchain/keeper/msg_server_register_for_council.go b/x/cardchain/keeper/msg_server_register_for_council.go index 78f14969..1e476e36 100644 --- a/x/cardchain/keeper/msg_server_register_for_council.go +++ b/x/cardchain/keeper/msg_server_register_for_council.go @@ -3,9 +3,9 @@ package keeper import ( "context" + sdkerrors "cosmossdk.io/errors" "github.com/DecentralCardGame/Cardchain/x/cardchain/types" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) func (k msgServer) RegisterForCouncil(goCtx context.Context, msg *types.MsgRegisterForCouncil) (*types.MsgRegisterForCouncilResponse, error) { diff --git a/x/cardchain/keeper/msg_server_remove_card_from_collection.go b/x/cardchain/keeper/msg_server_remove_card_from_collection.go index 7b6105ad..1163e84b 100644 --- a/x/cardchain/keeper/msg_server_remove_card_from_collection.go +++ b/x/cardchain/keeper/msg_server_remove_card_from_collection.go @@ -3,9 +3,10 @@ package keeper import ( "context" + sdkerrors "cosmossdk.io/errors" "github.com/DecentralCardGame/Cardchain/x/cardchain/types" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" "golang.org/x/exp/slices" ) @@ -14,7 +15,7 @@ func (k msgServer) RemoveCardFromCollection(goCtx context.Context, msg *types.Ms collection := k.Collections.Get(ctx, msg.CollectionId) if !slices.Contains(collection.Contributors, msg.Creator) { - return nil, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "Invalid contributor") + return nil, sdkerrors.Wrap(errors.ErrUnauthorized, "Invalid contributor") } if collection.Status != types.CStatus_design { return nil, types.ErrCollectionNotInDesign diff --git a/x/cardchain/keeper/msg_server_remove_contributor_from_collection.go b/x/cardchain/keeper/msg_server_remove_contributor_from_collection.go index 17408ed1..b47bac31 100644 --- a/x/cardchain/keeper/msg_server_remove_contributor_from_collection.go +++ b/x/cardchain/keeper/msg_server_remove_contributor_from_collection.go @@ -3,9 +3,10 @@ package keeper import ( "context" + sdkerrors "cosmossdk.io/errors" "github.com/DecentralCardGame/Cardchain/x/cardchain/types" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" ) func (k msgServer) RemoveContributorFromCollection(goCtx context.Context, msg *types.MsgRemoveContributorFromCollection) (*types.MsgRemoveContributorFromCollectionResponse, error) { @@ -13,7 +14,7 @@ func (k msgServer) RemoveContributorFromCollection(goCtx context.Context, msg *t collection := k.Collections.Get(ctx, msg.CollectionId) if msg.Creator != collection.Contributors[0] { - return nil, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "Invalid creator") + return nil, sdkerrors.Wrap(errors.ErrUnauthorized, "Invalid creator") } if collection.Status != types.CStatus_design { return nil, types.ErrCollectionNotInDesign diff --git a/x/cardchain/keeper/msg_server_remove_sell_offer.go b/x/cardchain/keeper/msg_server_remove_sell_offer.go index b162e253..562a92fe 100644 --- a/x/cardchain/keeper/msg_server_remove_sell_offer.go +++ b/x/cardchain/keeper/msg_server_remove_sell_offer.go @@ -3,9 +3,10 @@ package keeper import ( "context" + sdkerrors "cosmossdk.io/errors" "github.com/DecentralCardGame/Cardchain/x/cardchain/types" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" ) func (k msgServer) RemoveSellOffer(goCtx context.Context, msg *types.MsgRemoveSellOffer) (*types.MsgRemoveSellOfferResponse, error) { @@ -19,7 +20,7 @@ func (k msgServer) RemoveSellOffer(goCtx context.Context, msg *types.MsgRemoveSe sellOffer := k.SellOffers.Get(ctx, msg.SellOfferId) if sellOffer.Seller != msg.Creator { - return nil, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "Incorrect Seller") + return nil, sdkerrors.Wrap(errors.ErrUnauthorized, "Incorrect Seller") } if sellOffer.Status != types.SellOfferStatus_open { diff --git a/x/cardchain/keeper/msg_server_report_match.go b/x/cardchain/keeper/msg_server_report_match.go index fce997ed..eadf6543 100644 --- a/x/cardchain/keeper/msg_server_report_match.go +++ b/x/cardchain/keeper/msg_server_report_match.go @@ -4,9 +4,10 @@ import ( "context" "time" + sdkerrors "cosmossdk.io/errors" "github.com/DecentralCardGame/Cardchain/x/cardchain/types" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" ) func (k msgServer) ReportMatch(goCtx context.Context, msg *types.MsgReportMatch) (*types.MsgReportMatchResponse, error) { @@ -17,7 +18,7 @@ func (k msgServer) ReportMatch(goCtx context.Context, msg *types.MsgReportMatch) return nil, sdkerrors.Wrap(types.ErrUserDoesNotExist, err.Error()) } if creator.ReportMatches == false { - return nil, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "Incorrect Reporter") + return nil, sdkerrors.Wrap(errors.ErrUnauthorized, "Incorrect Reporter") } matchId := k.Matches.GetNum(ctx) diff --git a/x/cardchain/keeper/msg_server_restart_council.go b/x/cardchain/keeper/msg_server_restart_council.go index 79f2cf00..df38863f 100644 --- a/x/cardchain/keeper/msg_server_restart_council.go +++ b/x/cardchain/keeper/msg_server_restart_council.go @@ -3,9 +3,10 @@ package keeper import ( "context" + sdkerrors "cosmossdk.io/errors" "github.com/DecentralCardGame/Cardchain/x/cardchain/types" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" ) func (k msgServer) RestartCouncil(goCtx context.Context, msg *types.MsgRestartCouncil) (*types.MsgRestartCouncilResponse, error) { @@ -14,7 +15,7 @@ func (k msgServer) RestartCouncil(goCtx context.Context, msg *types.MsgRestartCo council := k.Councils.Get(ctx, msg.CouncilId) card := k.Cards.Get(ctx, council.CardId) if card.Owner != msg.Creator { - return nil, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "Invalid Owner") + return nil, sdkerrors.Wrap(errors.ErrUnauthorized, "Invalid Owner") } if council.Status != types.CouncelingStatus_suggestionsMade { diff --git a/x/cardchain/keeper/msg_server_reveal_council_response.go b/x/cardchain/keeper/msg_server_reveal_council_response.go index 2ecda4cb..d9faab1b 100644 --- a/x/cardchain/keeper/msg_server_reveal_council_response.go +++ b/x/cardchain/keeper/msg_server_reveal_council_response.go @@ -3,9 +3,10 @@ package keeper import ( "context" + sdkerrors "cosmossdk.io/errors" "github.com/DecentralCardGame/Cardchain/x/cardchain/types" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" "golang.org/x/exp/slices" ) @@ -21,7 +22,7 @@ func (k msgServer) RevealCouncilResponse(goCtx context.Context, msg *types.MsgRe council := k.Councils.Get(ctx, msg.CouncilId) if !slices.Contains(council.Voters, msg.Creator) { - return nil, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "Invalid Voter") + return nil, sdkerrors.Wrap(errors.ErrUnauthorized, "Invalid Voter") } if council.Status != types.CouncelingStatus_commited { @@ -34,7 +35,7 @@ func (k msgServer) RevealCouncilResponse(goCtx context.Context, msg *types.MsgRe } if slices.Contains(allreadyVoted, msg.Creator) { - return nil, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "Already voted") + return nil, sdkerrors.Wrap(errors.ErrUnauthorized, "Already voted") } hashStringResponse := GetResponseHash(msg.Response, msg.Secret) @@ -60,7 +61,7 @@ func (k msgServer) RevealCouncilResponse(goCtx context.Context, msg *types.MsgRe err = k.BurnCoinsFromAddr(ctx, creator.Addr, sdk.Coins{collateralDeposit}) if err != nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrInsufficientFunds, "Voter does not have enough coins") + return nil, sdkerrors.Wrap(errors.ErrInsufficientFunds, "Voter does not have enough coins") } council.Treasury = council.Treasury.Add(collateralDeposit) diff --git a/x/cardchain/keeper/msg_server_rewoke_council_registration.go b/x/cardchain/keeper/msg_server_rewoke_council_registration.go index f76ee33b..913f3323 100644 --- a/x/cardchain/keeper/msg_server_rewoke_council_registration.go +++ b/x/cardchain/keeper/msg_server_rewoke_council_registration.go @@ -3,9 +3,9 @@ package keeper import ( "context" + sdkerrors "cosmossdk.io/errors" "github.com/DecentralCardGame/Cardchain/x/cardchain/types" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) func (k msgServer) RewokeCouncilRegistration(goCtx context.Context, msg *types.MsgRewokeCouncilRegistration) (*types.MsgRewokeCouncilRegistrationResponse, error) { diff --git a/x/cardchain/keeper/msg_server_save_card_content.go b/x/cardchain/keeper/msg_server_save_card_content.go index 8e4b19d5..2f627e7b 100644 --- a/x/cardchain/keeper/msg_server_save_card_content.go +++ b/x/cardchain/keeper/msg_server_save_card_content.go @@ -4,10 +4,11 @@ import ( "context" "encoding/json" + sdkerrors "cosmossdk.io/errors" "github.com/DecentralCardGame/Cardchain/x/cardchain/types" "github.com/DecentralCardGame/cardobject/keywords" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" ) func (k msgServer) SaveCardContent(goCtx context.Context, msg *types.MsgSaveCardContent) (*types.MsgSaveCardContentResponse, error) { @@ -26,9 +27,9 @@ func (k msgServer) SaveCardContent(goCtx context.Context, msg *types.MsgSaveCard //} if card.Owner == "" { - return nil, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "Card has no owner") + return nil, sdkerrors.Wrap(errors.ErrUnauthorized, "Card has no owner") } else if msg.Creator != card.Owner { // Checks if the the msg sender is the same as the current owner - return nil, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "Incorrect Owner") + return nil, sdkerrors.Wrap(errors.ErrUnauthorized, "Incorrect Owner") } cardobj, err := keywords.Unmarshal([]byte(msg.Content)) @@ -48,7 +49,7 @@ func (k msgServer) SaveCardContent(goCtx context.Context, msg *types.MsgSaveCard if card.Status == types.Status_scheme { err = k.TransferSchemeToCard(ctx, msg.CardId, &msgOwner) if err != nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "An error accured while converting a card to a scheme: "+err.Error()) + return nil, sdkerrors.Wrap(errors.ErrUnauthorized, "An error accured while converting a card to a scheme: "+err.Error()) } } diff --git a/x/cardchain/keeper/msg_server_set_card_rarity.go b/x/cardchain/keeper/msg_server_set_card_rarity.go index 4d8fc51e..4a3b3aac 100644 --- a/x/cardchain/keeper/msg_server_set_card_rarity.go +++ b/x/cardchain/keeper/msg_server_set_card_rarity.go @@ -5,11 +5,12 @@ import ( "encoding/json" "errors" + sdkerrors "cosmossdk.io/errors" "github.com/DecentralCardGame/Cardchain/x/cardchain/types" "github.com/DecentralCardGame/cardobject/cardobject" "github.com/DecentralCardGame/cardobject/keywords" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + sdkerrors2 "github.com/cosmos/cosmos-sdk/types/errors" "golang.org/x/exp/slices" ) @@ -20,7 +21,7 @@ func (k msgServer) SetCardRarity(goCtx context.Context, msg *types.MsgSetCardRar collection := k.Collections.Get(ctx, msg.CollectionId) if collection.Contributors[0] != msg.Creator || !slices.Contains(collection.Cards, msg.CardId) { - return nil, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "Incorrect Creator") + return nil, sdkerrors.Wrap(sdkerrors2.ErrUnauthorized, "Incorrect Creator") } cardobj, err := keywords.Unmarshal(card.Content) diff --git a/x/cardchain/keeper/msg_server_set_collection_artist.go b/x/cardchain/keeper/msg_server_set_collection_artist.go index 23b9977c..d26fc995 100644 --- a/x/cardchain/keeper/msg_server_set_collection_artist.go +++ b/x/cardchain/keeper/msg_server_set_collection_artist.go @@ -3,9 +3,10 @@ package keeper import ( "context" + sdkerrors "cosmossdk.io/errors" "github.com/DecentralCardGame/Cardchain/x/cardchain/types" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" ) func (k msgServer) SetCollectionArtist(goCtx context.Context, msg *types.MsgSetCollectionArtist) (*types.MsgSetCollectionArtistResponse, error) { @@ -13,7 +14,7 @@ func (k msgServer) SetCollectionArtist(goCtx context.Context, msg *types.MsgSetC collection := k.Collections.Get(ctx, msg.CollectionId) if msg.Creator != collection.Contributors[0] { - return nil, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "Invalid creator") + return nil, sdkerrors.Wrap(errors.ErrUnauthorized, "Invalid creator") } if collection.Status != types.CStatus_design { diff --git a/x/cardchain/keeper/msg_server_set_collection_story_writer.go b/x/cardchain/keeper/msg_server_set_collection_story_writer.go index a07eccf1..6f2edc24 100644 --- a/x/cardchain/keeper/msg_server_set_collection_story_writer.go +++ b/x/cardchain/keeper/msg_server_set_collection_story_writer.go @@ -3,9 +3,10 @@ package keeper import ( "context" + sdkerrors "cosmossdk.io/errors" "github.com/DecentralCardGame/Cardchain/x/cardchain/types" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" ) func (k msgServer) SetCollectionStoryWriter(goCtx context.Context, msg *types.MsgSetCollectionStoryWriter) (*types.MsgSetCollectionStoryWriterResponse, error) { @@ -13,7 +14,7 @@ func (k msgServer) SetCollectionStoryWriter(goCtx context.Context, msg *types.Ms collection := k.Collections.Get(ctx, msg.CollectionId) if msg.Creator != collection.Contributors[0] { - return nil, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "Invalid creator") + return nil, sdkerrors.Wrap(errors.ErrUnauthorized, "Invalid creator") } if collection.Status != types.CStatus_design { diff --git a/x/cardchain/keeper/msg_server_set_profile_card.go b/x/cardchain/keeper/msg_server_set_profile_card.go index 0fbeacd2..cac8438f 100644 --- a/x/cardchain/keeper/msg_server_set_profile_card.go +++ b/x/cardchain/keeper/msg_server_set_profile_card.go @@ -3,9 +3,10 @@ package keeper import ( "context" + sdkerrors "cosmossdk.io/errors" "github.com/DecentralCardGame/Cardchain/x/cardchain/types" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" "golang.org/x/exp/slices" ) @@ -19,9 +20,9 @@ func (k msgServer) SetProfileCard(goCtx context.Context, msg *types.MsgSetProfil card := k.Cards.Get(ctx, msg.CardId) if card.Owner != msg.Creator { - return nil, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "You have to own the card") + return nil, sdkerrors.Wrap(errors.ErrUnauthorized, "You have to own the card") } else if !slices.Contains([]types.Status{types.Status_trial, types.Status_permanent}, card.Status) { - return nil, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "The card has to be playable") + return nil, sdkerrors.Wrap(errors.ErrUnauthorized, "The card has to be playable") } user.ProfileCard = msg.CardId diff --git a/x/cardchain/keeper/msg_server_set_user_biography.go b/x/cardchain/keeper/msg_server_set_user_biography.go index 161bfec4..05539586 100644 --- a/x/cardchain/keeper/msg_server_set_user_biography.go +++ b/x/cardchain/keeper/msg_server_set_user_biography.go @@ -3,9 +3,9 @@ package keeper import ( "context" + sdkerrors "cosmossdk.io/errors" "github.com/DecentralCardGame/Cardchain/x/cardchain/types" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) func (k msgServer) SetUserBiography(goCtx context.Context, msg *types.MsgSetUserBiography) (*types.MsgSetUserBiographyResponse, error) { diff --git a/x/cardchain/keeper/msg_server_set_user_website.go b/x/cardchain/keeper/msg_server_set_user_website.go index 25f18ff0..3b5f1c32 100644 --- a/x/cardchain/keeper/msg_server_set_user_website.go +++ b/x/cardchain/keeper/msg_server_set_user_website.go @@ -5,7 +5,7 @@ import ( "github.com/DecentralCardGame/Cardchain/x/cardchain/types" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + sdkerrors "cosmossdk.io/errors" ) func (k msgServer) SetUserWebsite(goCtx context.Context, msg *types.MsgSetUserWebsite) (*types.MsgSetUserWebsiteResponse, error) { diff --git a/x/cardchain/keeper/msg_server_transfer_booster_pack.go b/x/cardchain/keeper/msg_server_transfer_booster_pack.go index 7485bd87..83ab1388 100644 --- a/x/cardchain/keeper/msg_server_transfer_booster_pack.go +++ b/x/cardchain/keeper/msg_server_transfer_booster_pack.go @@ -3,9 +3,9 @@ package keeper import ( "context" + sdkerrors "cosmossdk.io/errors" "github.com/DecentralCardGame/Cardchain/x/cardchain/types" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "golang.org/x/exp/slices" ) diff --git a/x/cardchain/keeper/msg_server_transfer_card.go b/x/cardchain/keeper/msg_server_transfer_card.go index 82873c86..fdbfc847 100644 --- a/x/cardchain/keeper/msg_server_transfer_card.go +++ b/x/cardchain/keeper/msg_server_transfer_card.go @@ -3,9 +3,10 @@ package keeper import ( "context" + sdkerrors "cosmossdk.io/errors" "github.com/DecentralCardGame/Cardchain/x/cardchain/types" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" ) func (k msgServer) TransferCard(goCtx context.Context, msg *types.MsgTransferCard) (*types.MsgTransferCardResponse, error) { @@ -23,21 +24,21 @@ func (k msgServer) TransferCard(goCtx context.Context, msg *types.MsgTransferCar } if card.Owner == "" { - return nil, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "Card has no owner") + return nil, sdkerrors.Wrap(errors.ErrUnauthorized, "Card has no owner") } else if msg.Creator != card.Owner { // Checks if the the msg sender is the same as the current owner - return nil, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "Incorrect Owner") // If not, throw an error + return nil, sdkerrors.Wrap(errors.ErrUnauthorized, "Incorrect Owner") // If not, throw an error } if card.Status == types.Status_scheme { creator.OwnedCardSchemes, err = PopItemFromArr(msg.CardId, creator.OwnedCardSchemes) if err != nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, err.Error()) + return nil, sdkerrors.Wrap(errors.ErrUnauthorized, err.Error()) } receiver.OwnedCardSchemes = append(receiver.OwnedCardSchemes, msg.CardId) } else { creator.OwnedPrototypes, err = PopItemFromArr(msg.CardId, creator.OwnedPrototypes) if err != nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, err.Error()) + return nil, sdkerrors.Wrap(errors.ErrUnauthorized, err.Error()) } receiver.OwnedPrototypes = append(receiver.OwnedPrototypes, msg.CardId) } diff --git a/x/cardchain/keeper/msg_server_vote_card.go b/x/cardchain/keeper/msg_server_vote_card.go index 4355e813..684a4937 100644 --- a/x/cardchain/keeper/msg_server_vote_card.go +++ b/x/cardchain/keeper/msg_server_vote_card.go @@ -3,9 +3,9 @@ package keeper import ( "context" + sdkerrors "cosmossdk.io/errors" "github.com/DecentralCardGame/Cardchain/x/cardchain/types" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) func (k msgServer) VoteCard(goCtx context.Context, msg *types.MsgVoteCard) (*types.MsgVoteCardResponse, error) { @@ -16,7 +16,10 @@ func (k msgServer) VoteCard(goCtx context.Context, msg *types.MsgVoteCard) (*typ return nil, sdkerrors.Wrap(types.ErrInvalidAccAddress, "Unable to convert to AccAddress") } - k.voteCard(ctx, &voter, msg.CardId, msg.VoteType) + err = k.voteCard(ctx, &voter, msg.CardId, msg.VoteType) + if err != nil { + return nil, err + } k.incVotesAverageBy(ctx, 1) diff --git a/x/cardchain/keeper/user.go b/x/cardchain/keeper/user.go index b9597622..9153626a 100644 --- a/x/cardchain/keeper/user.go +++ b/x/cardchain/keeper/user.go @@ -1,9 +1,9 @@ package keeper import ( + sdkerrors "cosmossdk.io/errors" "github.com/DecentralCardGame/Cardchain/x/cardchain/types" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) // User Combines types.User and it's account address for better usability @@ -17,7 +17,10 @@ func (k Keeper) CreateUser(ctx sdk.Context, addr sdk.AccAddress, alias string) e // check if user already exists _, err := k.GetUser(ctx, addr) if err != nil { - k.InitUser(ctx, addr, alias) + err = k.InitUser(ctx, addr, alias) + if err != nil { + return err + } } else { return types.ErrUserAlreadyExists } @@ -25,19 +28,23 @@ func (k Keeper) CreateUser(ctx sdk.Context, addr sdk.AccAddress, alias string) e } // InitUser Initializes a new user -func (k Keeper) InitUser(ctx sdk.Context, address sdk.AccAddress, alias string) { +func (k Keeper) InitUser(ctx sdk.Context, address sdk.AccAddress, alias string) error { if alias == "" { alias = "newbie" } newUser := types.NewUser() newUser.Alias = alias - k.MintCoinsToAddr(ctx, address, sdk.Coins{sdk.NewInt64Coin("ucredits", 10000000000)}) + err := k.MintCoinsToAddr(ctx, address, sdk.Coins{sdk.NewInt64Coin("ucredits", 10000000000)}) + if err != nil { + return err + } newUser.VoteRights = k.GetVoteRightToAllCards(ctx, ctx.BlockHeight()+k.GetParams(ctx).VotingRightsExpirationTime) // TODO this might be a good thing to remove later, so that sybil voting is not possible // Yes yes remove later, this is pretty heavy on the chain and gas prices userObj := User{newUser, address} k.ClaimAirDrop(ctx, &userObj, types.AirDrop_user) k.SetUserFromUser(ctx, userObj) + return nil } // GetUser Gets a user from store diff --git a/x/cardchain/keeper/voting.go b/x/cardchain/keeper/voting.go index 1a3acfef..bad7f45c 100644 --- a/x/cardchain/keeper/voting.go +++ b/x/cardchain/keeper/voting.go @@ -3,9 +3,11 @@ package keeper import ( "fmt" + "github.com/cosmos/cosmos-sdk/types/errors" + + sdkerrors "cosmossdk.io/errors" "github.com/DecentralCardGame/Cardchain/x/cardchain/types" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "golang.org/x/exp/slices" ) @@ -33,7 +35,7 @@ func (k msgServer) voteCard( // check if card status is valid if card.Status != types.Status_permanent && card.Status != types.Status_trial { - return sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, "Voting on a card is only possible if it is in trial or a permanent card") + return sdkerrors.Wrap(errors.ErrUnknownRequest, "Voting on a card is only possible if it is in trial or a permanent card") } switch voteType { @@ -47,7 +49,7 @@ func (k msgServer) voteCard( card.UnderpoweredVotes++ default: errMsg := fmt.Sprintf("Unrecognized card vote type: %s", voteType) - return sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, errMsg) + return sdkerrors.Wrap(errors.ErrUnknownRequest, errMsg) } card.Voters = append(card.Voters, voter.Addr.String()) @@ -56,16 +58,19 @@ func (k msgServer) voteCard( reward := k.GetParams(ctx).TrialVoteReward err := k.MintCoinsToAddr(ctx, voter.Addr, sdk.Coins{reward}) if err != nil { - return sdkerrors.Wrap(sdkerrors.ErrInsufficientFunds, err.Error()) + return sdkerrors.Wrap(errors.ErrInsufficientFunds, err.Error()) } card.VotePool.Sub(reward) // TODO actually if there is less than 1cr then it should be adjusted } amount := k.GetVoteReward(ctx) - k.MintCoinsToAddr(ctx, voter.Addr, sdk.Coins{amount}) + err := k.MintCoinsToAddr(ctx, voter.Addr, sdk.Coins{amount}) + if err != nil { + return err + } k.SubPoolCredits(ctx, BalancersPoolKey, amount) k.RemoveVoteRight(ctx, voter, rightsIndex) - + k.Cards.Set(ctx, cardId, card) return nil diff --git a/x/cardchain/proposal_handler.go b/x/cardchain/proposal_handler.go index 70ecc575..b375a2cb 100644 --- a/x/cardchain/proposal_handler.go +++ b/x/cardchain/proposal_handler.go @@ -3,10 +3,11 @@ package cardchain import ( "sort" + sdkerrors "cosmossdk.io/errors" "github.com/DecentralCardGame/Cardchain/x/cardchain/keeper" "github.com/DecentralCardGame/Cardchain/x/cardchain/types" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" ) @@ -22,7 +23,7 @@ func NewProposalHandler(k keeper.Keeper) govtypes.Handler { return handleCollectionProposal(ctx, k, c) default: - return sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "unrecognized proposal content type: %T", c) + return sdkerrors.Wrapf(errors.ErrUnknownRequest, "unrecognized proposal content type: %T", c) } } } diff --git a/x/cardchain/types/errors.go b/x/cardchain/types/errors.go index 709793db..e07146f5 100644 --- a/x/cardchain/types/errors.go +++ b/x/cardchain/types/errors.go @@ -3,7 +3,7 @@ package types // DONTCOVER import ( - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + sdkerrors "cosmossdk.io/errors" ) // x/cardchain module sentinel errors diff --git a/x/cardchain/types/message_add_artwork.go b/x/cardchain/types/message_add_artwork.go index c655e41f..bcbbfc0b 100644 --- a/x/cardchain/types/message_add_artwork.go +++ b/x/cardchain/types/message_add_artwork.go @@ -1,8 +1,9 @@ package types import ( + sdkerrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" ) const TypeMsgAddArtwork = "add_artwork" @@ -42,7 +43,7 @@ func (msg *MsgAddArtwork) GetSignBytes() []byte { func (msg *MsgAddArtwork) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Creator) if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) + return sdkerrors.Wrapf(errors.ErrInvalidAddress, "invalid creator address (%s)", err) } return nil } diff --git a/x/cardchain/types/message_add_artwork_test.go b/x/cardchain/types/message_add_artwork_test.go index e6dce4de..cd24cab5 100644 --- a/x/cardchain/types/message_add_artwork_test.go +++ b/x/cardchain/types/message_add_artwork_test.go @@ -4,7 +4,7 @@ import ( "testing" "github.com/DecentralCardGame/Cardchain/testutil/sample" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" "github.com/stretchr/testify/require" ) @@ -19,7 +19,7 @@ func TestMsgAddArtwork_ValidateBasic(t *testing.T) { msg: MsgAddArtwork{ Creator: "invalid_address", }, - err: sdkerrors.ErrInvalidAddress, + err: errors.ErrInvalidAddress, }, { name: "valid address", msg: MsgAddArtwork{ diff --git a/x/cardchain/types/message_add_artwork_to_collection.go b/x/cardchain/types/message_add_artwork_to_collection.go index 729a33f3..0f67a718 100644 --- a/x/cardchain/types/message_add_artwork_to_collection.go +++ b/x/cardchain/types/message_add_artwork_to_collection.go @@ -1,8 +1,9 @@ package types import ( + sdkerrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" ) const TypeMsgAddArtworkToCollection = "add_artwork_to_collection" @@ -41,7 +42,7 @@ func (msg *MsgAddArtworkToCollection) GetSignBytes() []byte { func (msg *MsgAddArtworkToCollection) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Creator) if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) + return sdkerrors.Wrapf(errors.ErrInvalidAddress, "invalid creator address (%s)", err) } return nil } diff --git a/x/cardchain/types/message_add_artwork_to_collection_test.go b/x/cardchain/types/message_add_artwork_to_collection_test.go index 07164b72..86321ccf 100644 --- a/x/cardchain/types/message_add_artwork_to_collection_test.go +++ b/x/cardchain/types/message_add_artwork_to_collection_test.go @@ -4,7 +4,7 @@ import ( "testing" "github.com/DecentralCardGame/Cardchain/testutil/sample" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" "github.com/stretchr/testify/require" ) @@ -19,7 +19,7 @@ func TestMsgAddArtworkToCollection_ValidateBasic(t *testing.T) { msg: MsgAddArtworkToCollection{ Creator: "invalid_address", }, - err: sdkerrors.ErrInvalidAddress, + err: errors.ErrInvalidAddress, }, { name: "valid address", msg: MsgAddArtworkToCollection{ diff --git a/x/cardchain/types/message_add_card_to_collection.go b/x/cardchain/types/message_add_card_to_collection.go index cf3a2bb1..95d97327 100644 --- a/x/cardchain/types/message_add_card_to_collection.go +++ b/x/cardchain/types/message_add_card_to_collection.go @@ -1,8 +1,9 @@ package types import ( + sdkerrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" ) const TypeMsgAddCardToCollection = "add_card_to_collection" @@ -41,7 +42,7 @@ func (msg *MsgAddCardToCollection) GetSignBytes() []byte { func (msg *MsgAddCardToCollection) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Creator) if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) + return sdkerrors.Wrapf(errors.ErrInvalidAddress, "invalid creator address (%s)", err) } return nil } diff --git a/x/cardchain/types/message_add_card_to_collection_test.go b/x/cardchain/types/message_add_card_to_collection_test.go index 9853e186..e98e69b0 100644 --- a/x/cardchain/types/message_add_card_to_collection_test.go +++ b/x/cardchain/types/message_add_card_to_collection_test.go @@ -4,7 +4,7 @@ import ( "testing" "github.com/DecentralCardGame/Cardchain/testutil/sample" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" "github.com/stretchr/testify/require" ) @@ -19,7 +19,7 @@ func TestMsgAddCardToCollection_ValidateBasic(t *testing.T) { msg: MsgAddCardToCollection{ Creator: "invalid_address", }, - err: sdkerrors.ErrInvalidAddress, + err: errors.ErrInvalidAddress, }, { name: "valid address", msg: MsgAddCardToCollection{ diff --git a/x/cardchain/types/message_add_contributor_to_collection.go b/x/cardchain/types/message_add_contributor_to_collection.go index 6b18950d..a1bdd869 100644 --- a/x/cardchain/types/message_add_contributor_to_collection.go +++ b/x/cardchain/types/message_add_contributor_to_collection.go @@ -1,8 +1,9 @@ package types import ( + sdkerrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" ) const TypeMsgAddContributorToCollection = "add_contributor_to_collection" @@ -41,7 +42,7 @@ func (msg *MsgAddContributorToCollection) GetSignBytes() []byte { func (msg *MsgAddContributorToCollection) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Creator) if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) + return sdkerrors.Wrapf(errors.ErrInvalidAddress, "invalid creator address (%s)", err) } return nil } diff --git a/x/cardchain/types/message_add_contributor_to_collection_test.go b/x/cardchain/types/message_add_contributor_to_collection_test.go index a6743f3e..db729e73 100644 --- a/x/cardchain/types/message_add_contributor_to_collection_test.go +++ b/x/cardchain/types/message_add_contributor_to_collection_test.go @@ -4,7 +4,7 @@ import ( "testing" "github.com/DecentralCardGame/Cardchain/testutil/sample" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" "github.com/stretchr/testify/require" ) @@ -19,7 +19,7 @@ func TestMsgAddContributorToCollection_ValidateBasic(t *testing.T) { msg: MsgAddContributorToCollection{ Creator: "invalid_address", }, - err: sdkerrors.ErrInvalidAddress, + err: errors.ErrInvalidAddress, }, { name: "valid address", msg: MsgAddContributorToCollection{ diff --git a/x/cardchain/types/message_add_story_to_collection.go b/x/cardchain/types/message_add_story_to_collection.go index c797d9a6..3c9c388d 100644 --- a/x/cardchain/types/message_add_story_to_collection.go +++ b/x/cardchain/types/message_add_story_to_collection.go @@ -1,8 +1,9 @@ package types import ( + sdkerrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" ) const TypeMsgAddStoryToCollection = "add_story_to_collection" @@ -41,7 +42,7 @@ func (msg *MsgAddStoryToCollection) GetSignBytes() []byte { func (msg *MsgAddStoryToCollection) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Creator) if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) + return sdkerrors.Wrapf(errors.ErrInvalidAddress, "invalid creator address (%s)", err) } return nil } diff --git a/x/cardchain/types/message_add_story_to_collection_test.go b/x/cardchain/types/message_add_story_to_collection_test.go index 1c32732f..93ab3e03 100644 --- a/x/cardchain/types/message_add_story_to_collection_test.go +++ b/x/cardchain/types/message_add_story_to_collection_test.go @@ -4,7 +4,7 @@ import ( "testing" "github.com/DecentralCardGame/Cardchain/testutil/sample" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" "github.com/stretchr/testify/require" ) @@ -19,9 +19,9 @@ func TestMsgAddStoryToCollection_ValidateBasic(t *testing.T) { msg: MsgAddStoryToCollection{ Creator: "invalid_address", }, - err: sdkerrors.ErrInvalidAddress, }, { name: "valid address", + err: errors.ErrInvalidAddress, msg: MsgAddStoryToCollection{ Creator: sample.AccAddress(), }, diff --git a/x/cardchain/types/message_apoint_match_reporter.go b/x/cardchain/types/message_apoint_match_reporter.go index ea524ef4..cc780fb1 100644 --- a/x/cardchain/types/message_apoint_match_reporter.go +++ b/x/cardchain/types/message_apoint_match_reporter.go @@ -1,8 +1,9 @@ package types import ( + sdkerrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" ) const TypeMsgApointMatchReporter = "apoint_match_reporter" @@ -40,7 +41,7 @@ func (msg *MsgApointMatchReporter) GetSignBytes() []byte { func (msg *MsgApointMatchReporter) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Creator) if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) + return sdkerrors.Wrapf(errors.ErrInvalidAddress, "invalid creator address (%s)", err) } return nil } diff --git a/x/cardchain/types/message_apoint_match_reporter_test.go b/x/cardchain/types/message_apoint_match_reporter_test.go index 0e213ae8..bef5c873 100644 --- a/x/cardchain/types/message_apoint_match_reporter_test.go +++ b/x/cardchain/types/message_apoint_match_reporter_test.go @@ -4,7 +4,7 @@ import ( "testing" "github.com/DecentralCardGame/Cardchain/testutil/sample" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" "github.com/stretchr/testify/require" ) @@ -19,7 +19,7 @@ func TestMsgApointMatchReporter_ValidateBasic(t *testing.T) { msg: MsgApointMatchReporter{ Creator: "invalid_address", }, - err: sdkerrors.ErrInvalidAddress, + err: errors.ErrInvalidAddress, }, { name: "valid address", msg: MsgApointMatchReporter{ diff --git a/x/cardchain/types/message_buy_card.go b/x/cardchain/types/message_buy_card.go index 17262f9e..d65fada6 100644 --- a/x/cardchain/types/message_buy_card.go +++ b/x/cardchain/types/message_buy_card.go @@ -1,8 +1,9 @@ package types import ( + sdkerrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" ) const TypeMsgBuyCard = "buy_card" @@ -40,7 +41,7 @@ func (msg *MsgBuyCard) GetSignBytes() []byte { func (msg *MsgBuyCard) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Creator) if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) + return sdkerrors.Wrapf(errors.ErrInvalidAddress, "invalid creator address (%s)", err) } return nil } diff --git a/x/cardchain/types/message_buy_card_scheme.go b/x/cardchain/types/message_buy_card_scheme.go index a746890b..d961f094 100644 --- a/x/cardchain/types/message_buy_card_scheme.go +++ b/x/cardchain/types/message_buy_card_scheme.go @@ -1,8 +1,9 @@ package types import ( + sdkerrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" ) const TypeMsgBuyCardScheme = "buy_card_scheme" @@ -40,7 +41,7 @@ func (msg MsgBuyCardScheme) GetSignBytes() []byte { func (msg *MsgBuyCardScheme) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Creator) if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) + return sdkerrors.Wrapf(errors.ErrInvalidAddress, "invalid creator address (%s)", err) } return nil diff --git a/x/cardchain/types/message_buy_card_scheme_test.go b/x/cardchain/types/message_buy_card_scheme_test.go index e9f4e3b3..394ffa91 100644 --- a/x/cardchain/types/message_buy_card_scheme_test.go +++ b/x/cardchain/types/message_buy_card_scheme_test.go @@ -4,7 +4,7 @@ import ( "testing" "github.com/DecentralCardGame/Cardchain/testutil/sample" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" "github.com/stretchr/testify/require" ) @@ -19,7 +19,7 @@ func TestMsgBuyCardScheme_ValidateBasic(t *testing.T) { msg: MsgBuyCardScheme{ Creator: "invalid_address", }, - err: sdkerrors.ErrInvalidAddress, + err: errors.ErrInvalidAddress, }, { name: "valid address", msg: MsgBuyCardScheme{ diff --git a/x/cardchain/types/message_buy_card_test.go b/x/cardchain/types/message_buy_card_test.go index 635bc1f6..4871ea55 100644 --- a/x/cardchain/types/message_buy_card_test.go +++ b/x/cardchain/types/message_buy_card_test.go @@ -4,7 +4,7 @@ import ( "testing" "github.com/DecentralCardGame/Cardchain/testutil/sample" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" "github.com/stretchr/testify/require" ) @@ -19,7 +19,7 @@ func TestMsgBuyCard_ValidateBasic(t *testing.T) { msg: MsgBuyCard{ Creator: "invalid_address", }, - err: sdkerrors.ErrInvalidAddress, + err: errors.ErrInvalidAddress, }, { name: "valid address", msg: MsgBuyCard{ diff --git a/x/cardchain/types/message_buy_collection.go b/x/cardchain/types/message_buy_collection.go index 944f5c48..1d6a9e4e 100644 --- a/x/cardchain/types/message_buy_collection.go +++ b/x/cardchain/types/message_buy_collection.go @@ -1,8 +1,9 @@ package types import ( + sdkerrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" ) const TypeMsgBuyCollection = "buy_collection" @@ -40,7 +41,7 @@ func (msg *MsgBuyCollection) GetSignBytes() []byte { func (msg *MsgBuyCollection) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Creator) if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) + return sdkerrors.Wrapf(errors.ErrInvalidAddress, "invalid creator address (%s)", err) } return nil } diff --git a/x/cardchain/types/message_buy_collection_test.go b/x/cardchain/types/message_buy_collection_test.go index 3ac41043..f4af5e9f 100644 --- a/x/cardchain/types/message_buy_collection_test.go +++ b/x/cardchain/types/message_buy_collection_test.go @@ -4,7 +4,7 @@ import ( "testing" "github.com/DecentralCardGame/Cardchain/testutil/sample" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" "github.com/stretchr/testify/require" ) @@ -19,7 +19,7 @@ func TestMsgBuyCollection_ValidateBasic(t *testing.T) { msg: MsgBuyCollection{ Creator: "invalid_address", }, - err: sdkerrors.ErrInvalidAddress, + err: errors.ErrInvalidAddress, }, { name: "valid address", msg: MsgBuyCollection{ diff --git a/x/cardchain/types/message_change_artist.go b/x/cardchain/types/message_change_artist.go index 81de3fe0..20e01a8a 100644 --- a/x/cardchain/types/message_change_artist.go +++ b/x/cardchain/types/message_change_artist.go @@ -1,8 +1,9 @@ package types import ( + sdkerrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" ) const TypeMsgChangeArtist = "change_artist" @@ -41,7 +42,7 @@ func (msg *MsgChangeArtist) GetSignBytes() []byte { func (msg *MsgChangeArtist) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Creator) if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) + return sdkerrors.Wrapf(errors.ErrInvalidAddress, "invalid creator address (%s)", err) } return nil } diff --git a/x/cardchain/types/message_change_artist_test.go b/x/cardchain/types/message_change_artist_test.go index 8fb1d4f1..2e720c72 100644 --- a/x/cardchain/types/message_change_artist_test.go +++ b/x/cardchain/types/message_change_artist_test.go @@ -4,7 +4,7 @@ import ( "testing" "github.com/DecentralCardGame/Cardchain/testutil/sample" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" "github.com/stretchr/testify/require" ) @@ -19,7 +19,7 @@ func TestMsgChangeArtist_ValidateBasic(t *testing.T) { msg: MsgChangeArtist{ Creator: "invalid_address", }, - err: sdkerrors.ErrInvalidAddress, + err: errors.ErrInvalidAddress, }, { name: "valid address", msg: MsgChangeArtist{ diff --git a/x/cardchain/types/message_commit_council_response.go b/x/cardchain/types/message_commit_council_response.go index 435c433a..65c062df 100644 --- a/x/cardchain/types/message_commit_council_response.go +++ b/x/cardchain/types/message_commit_council_response.go @@ -1,8 +1,9 @@ package types import ( + sdkerrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" ) const TypeMsgCommitCouncilResponse = "commit_council_response" @@ -42,7 +43,7 @@ func (msg *MsgCommitCouncilResponse) GetSignBytes() []byte { func (msg *MsgCommitCouncilResponse) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Creator) if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) + return sdkerrors.Wrapf(errors.ErrInvalidAddress, "invalid creator address (%s)", err) } return nil } diff --git a/x/cardchain/types/message_commit_council_response_test.go b/x/cardchain/types/message_commit_council_response_test.go index 4d84b27e..8199b181 100644 --- a/x/cardchain/types/message_commit_council_response_test.go +++ b/x/cardchain/types/message_commit_council_response_test.go @@ -4,7 +4,7 @@ import ( "testing" "github.com/DecentralCardGame/Cardchain/testutil/sample" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" "github.com/stretchr/testify/require" ) @@ -19,7 +19,7 @@ func TestMsgCommitCouncilResponse_ValidateBasic(t *testing.T) { msg: MsgCommitCouncilResponse{ Creator: "invalid_address", }, - err: sdkerrors.ErrInvalidAddress, + err: errors.ErrInvalidAddress, }, { name: "valid address", msg: MsgCommitCouncilResponse{ diff --git a/x/cardchain/types/message_confirm_match.go b/x/cardchain/types/message_confirm_match.go index 95aa1511..b526f8dc 100644 --- a/x/cardchain/types/message_confirm_match.go +++ b/x/cardchain/types/message_confirm_match.go @@ -1,8 +1,9 @@ package types import ( + sdkerrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" ) const TypeMsgConfirmMatch = "confirm_match" @@ -41,7 +42,7 @@ func (msg *MsgConfirmMatch) GetSignBytes() []byte { func (msg *MsgConfirmMatch) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Creator) if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) + return sdkerrors.Wrapf(errors.ErrInvalidAddress, "invalid creator address (%s)", err) } return nil } diff --git a/x/cardchain/types/message_confirm_match_test.go b/x/cardchain/types/message_confirm_match_test.go index 3e8df40f..60a05156 100644 --- a/x/cardchain/types/message_confirm_match_test.go +++ b/x/cardchain/types/message_confirm_match_test.go @@ -4,7 +4,7 @@ import ( "testing" "github.com/DecentralCardGame/Cardchain/testutil/sample" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" "github.com/stretchr/testify/require" ) @@ -19,7 +19,7 @@ func TestMsgConfirmMatch_ValidateBasic(t *testing.T) { msg: MsgConfirmMatch{ Creator: "invalid_address", }, - err: sdkerrors.ErrInvalidAddress, + err: errors.ErrInvalidAddress, }, { name: "valid address", msg: MsgConfirmMatch{ diff --git a/x/cardchain/types/message_create_collection.go b/x/cardchain/types/message_create_collection.go index b24bbf01..8de78e23 100644 --- a/x/cardchain/types/message_create_collection.go +++ b/x/cardchain/types/message_create_collection.go @@ -1,8 +1,9 @@ package types import ( + sdkerrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" ) const TypeMsgCreateCollection = "create_collection" @@ -43,7 +44,7 @@ func (msg *MsgCreateCollection) GetSignBytes() []byte { func (msg *MsgCreateCollection) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Creator) if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) + return sdkerrors.Wrapf(errors.ErrInvalidAddress, "invalid creator address (%s)", err) } return nil } diff --git a/x/cardchain/types/message_create_collection_test.go b/x/cardchain/types/message_create_collection_test.go index d6652ed7..797f4c73 100644 --- a/x/cardchain/types/message_create_collection_test.go +++ b/x/cardchain/types/message_create_collection_test.go @@ -4,7 +4,7 @@ import ( "testing" "github.com/DecentralCardGame/Cardchain/testutil/sample" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" "github.com/stretchr/testify/require" ) @@ -19,7 +19,7 @@ func TestMsgCreateCollection_ValidateBasic(t *testing.T) { msg: MsgCreateCollection{ Creator: "invalid_address", }, - err: sdkerrors.ErrInvalidAddress, + err: errors.ErrInvalidAddress, }, { name: "valid address", msg: MsgCreateCollection{ diff --git a/x/cardchain/types/message_create_council.go b/x/cardchain/types/message_create_council.go index befdceb3..5aadd9a4 100644 --- a/x/cardchain/types/message_create_council.go +++ b/x/cardchain/types/message_create_council.go @@ -1,8 +1,9 @@ package types import ( + sdkerrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" ) const TypeMsgCreateCouncil = "create_council" @@ -40,7 +41,7 @@ func (msg *MsgCreateCouncil) GetSignBytes() []byte { func (msg *MsgCreateCouncil) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Creator) if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) + return sdkerrors.Wrapf(errors.ErrInvalidAddress, "invalid creator address (%s)", err) } return nil } diff --git a/x/cardchain/types/message_create_council_test.go b/x/cardchain/types/message_create_council_test.go index 6dd553c5..607e7987 100644 --- a/x/cardchain/types/message_create_council_test.go +++ b/x/cardchain/types/message_create_council_test.go @@ -4,7 +4,7 @@ import ( "testing" "github.com/DecentralCardGame/Cardchain/testutil/sample" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" "github.com/stretchr/testify/require" ) @@ -19,7 +19,7 @@ func TestMsgCreateCouncil_ValidateBasic(t *testing.T) { msg: MsgCreateCouncil{ Creator: "invalid_address", }, - err: sdkerrors.ErrInvalidAddress, + err: errors.ErrInvalidAddress, }, { name: "valid address", msg: MsgCreateCouncil{ diff --git a/x/cardchain/types/message_create_sell_offer.go b/x/cardchain/types/message_create_sell_offer.go index a9b6758d..4e9bd33a 100644 --- a/x/cardchain/types/message_create_sell_offer.go +++ b/x/cardchain/types/message_create_sell_offer.go @@ -1,8 +1,9 @@ package types import ( + sdkerrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" ) const TypeMsgCreateSellOffer = "create_sell_offer" @@ -41,7 +42,7 @@ func (msg *MsgCreateSellOffer) GetSignBytes() []byte { func (msg *MsgCreateSellOffer) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Creator) if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) + return sdkerrors.Wrapf(errors.ErrInvalidAddress, "invalid creator address (%s)", err) } return nil } diff --git a/x/cardchain/types/message_create_sell_offer_test.go b/x/cardchain/types/message_create_sell_offer_test.go index 449c9261..1fb520d3 100644 --- a/x/cardchain/types/message_create_sell_offer_test.go +++ b/x/cardchain/types/message_create_sell_offer_test.go @@ -4,7 +4,7 @@ import ( "testing" "github.com/DecentralCardGame/Cardchain/testutil/sample" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" "github.com/stretchr/testify/require" ) @@ -19,7 +19,7 @@ func TestMsgCreateSellOffer_ValidateBasic(t *testing.T) { msg: MsgCreateSellOffer{ Creator: "invalid_address", }, - err: sdkerrors.ErrInvalidAddress, + err: errors.ErrInvalidAddress, }, { name: "valid address", msg: MsgCreateSellOffer{ diff --git a/x/cardchain/types/message_createuser.go b/x/cardchain/types/message_createuser.go index 8e4e3d27..2568eb6f 100644 --- a/x/cardchain/types/message_createuser.go +++ b/x/cardchain/types/message_createuser.go @@ -1,8 +1,9 @@ package types import ( + sdkerrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" ) const TypeMsgCreateuser = "createuser" @@ -49,7 +50,7 @@ func (msg *MsgCreateuser) GetSignBytes() []byte { func (msg *MsgCreateuser) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Creator) if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) + return sdkerrors.Wrapf(errors.ErrInvalidAddress, "invalid creator address (%s)", err) } return nil } diff --git a/x/cardchain/types/message_createuser_test.go b/x/cardchain/types/message_createuser_test.go index 574fb3c1..8ca9c5b7 100644 --- a/x/cardchain/types/message_createuser_test.go +++ b/x/cardchain/types/message_createuser_test.go @@ -4,7 +4,7 @@ import ( "testing" "github.com/DecentralCardGame/Cardchain/testutil/sample" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" "github.com/stretchr/testify/require" ) @@ -19,7 +19,7 @@ func TestMsgCreateuser_ValidateBasic(t *testing.T) { msg: MsgCreateuser{ Creator: "invalid_address", }, - err: sdkerrors.ErrInvalidAddress, + err: errors.ErrInvalidAddress, }, { name: "valid address", msg: MsgCreateuser{ diff --git a/x/cardchain/types/message_donate_to_card.go b/x/cardchain/types/message_donate_to_card.go index ee6b1d59..b54ef0fe 100644 --- a/x/cardchain/types/message_donate_to_card.go +++ b/x/cardchain/types/message_donate_to_card.go @@ -1,8 +1,9 @@ package types import ( + sdkerrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" ) const TypeMsgDonateToCard = "donate_to_card" @@ -41,7 +42,7 @@ func (msg *MsgDonateToCard) GetSignBytes() []byte { func (msg *MsgDonateToCard) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Creator) if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) + return sdkerrors.Wrapf(errors.ErrInvalidAddress, "invalid creator address (%s)", err) } return nil } diff --git a/x/cardchain/types/message_donate_to_card_test.go b/x/cardchain/types/message_donate_to_card_test.go index e4604cc3..194c8305 100644 --- a/x/cardchain/types/message_donate_to_card_test.go +++ b/x/cardchain/types/message_donate_to_card_test.go @@ -4,7 +4,7 @@ import ( "testing" "github.com/DecentralCardGame/Cardchain/testutil/sample" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" "github.com/stretchr/testify/require" ) @@ -19,7 +19,7 @@ func TestMsgDonateToCard_ValidateBasic(t *testing.T) { msg: MsgDonateToCard{ Creator: "invalid_address", }, - err: sdkerrors.ErrInvalidAddress, + err: errors.ErrInvalidAddress, }, { name: "valid address", msg: MsgDonateToCard{ diff --git a/x/cardchain/types/message_finalize_collection.go b/x/cardchain/types/message_finalize_collection.go index 8884074c..4d1019ca 100644 --- a/x/cardchain/types/message_finalize_collection.go +++ b/x/cardchain/types/message_finalize_collection.go @@ -1,8 +1,9 @@ package types import ( + sdkerrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" ) const TypeMsgFinalizeCollection = "finalize_collection" @@ -40,7 +41,7 @@ func (msg *MsgFinalizeCollection) GetSignBytes() []byte { func (msg *MsgFinalizeCollection) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Creator) if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) + return sdkerrors.Wrapf(errors.ErrInvalidAddress, "invalid creator address (%s)", err) } return nil } diff --git a/x/cardchain/types/message_finalize_collection_test.go b/x/cardchain/types/message_finalize_collection_test.go index 2df69861..0391a46d 100644 --- a/x/cardchain/types/message_finalize_collection_test.go +++ b/x/cardchain/types/message_finalize_collection_test.go @@ -4,7 +4,7 @@ import ( "testing" "github.com/DecentralCardGame/Cardchain/testutil/sample" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" "github.com/stretchr/testify/require" ) @@ -19,7 +19,7 @@ func TestMsgFinalizeCollection_ValidateBasic(t *testing.T) { msg: MsgFinalizeCollection{ Creator: "invalid_address", }, - err: sdkerrors.ErrInvalidAddress, + err: errors.ErrInvalidAddress, }, { name: "valid address", msg: MsgFinalizeCollection{ diff --git a/x/cardchain/types/message_multi_vote_card.go b/x/cardchain/types/message_multi_vote_card.go index 673070fc..77c89e49 100644 --- a/x/cardchain/types/message_multi_vote_card.go +++ b/x/cardchain/types/message_multi_vote_card.go @@ -1,8 +1,9 @@ package types import ( + sdkerrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" ) const TypeMsgMultiVoteCard = "multi_vote_card" @@ -39,7 +40,7 @@ func (msg *MsgMultiVoteCard) GetSignBytes() []byte { func (msg *MsgMultiVoteCard) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Creator) if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) + return sdkerrors.Wrapf(errors.ErrInvalidAddress, "invalid creator address (%s)", err) } return nil } diff --git a/x/cardchain/types/message_multi_vote_card_test.go b/x/cardchain/types/message_multi_vote_card_test.go index 14e3f2a2..9dc82004 100644 --- a/x/cardchain/types/message_multi_vote_card_test.go +++ b/x/cardchain/types/message_multi_vote_card_test.go @@ -4,7 +4,7 @@ import ( "testing" "github.com/DecentralCardGame/Cardchain/testutil/sample" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" "github.com/stretchr/testify/require" ) @@ -19,7 +19,7 @@ func TestMsgMultiVoteCard_ValidateBasic(t *testing.T) { msg: MsgMultiVoteCard{ Creator: "invalid_address", }, - err: sdkerrors.ErrInvalidAddress, + err: errors.ErrInvalidAddress, }, { name: "valid address", msg: MsgMultiVoteCard{ diff --git a/x/cardchain/types/message_open_booster_pack.go b/x/cardchain/types/message_open_booster_pack.go index eae4956a..1d6b4c61 100644 --- a/x/cardchain/types/message_open_booster_pack.go +++ b/x/cardchain/types/message_open_booster_pack.go @@ -1,8 +1,9 @@ package types import ( + sdkerrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" ) const TypeMsgOpenBoosterPack = "open_booster_pack" @@ -40,7 +41,7 @@ func (msg *MsgOpenBoosterPack) GetSignBytes() []byte { func (msg *MsgOpenBoosterPack) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Creator) if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) + return sdkerrors.Wrapf(errors.ErrInvalidAddress, "invalid creator address (%s)", err) } return nil } diff --git a/x/cardchain/types/message_open_booster_pack_test.go b/x/cardchain/types/message_open_booster_pack_test.go index fb90d54e..0921ebab 100644 --- a/x/cardchain/types/message_open_booster_pack_test.go +++ b/x/cardchain/types/message_open_booster_pack_test.go @@ -4,7 +4,7 @@ import ( "testing" "github.com/DecentralCardGame/Cardchain/testutil/sample" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" "github.com/stretchr/testify/require" ) @@ -19,7 +19,7 @@ func TestMsgOpenBoosterPack_ValidateBasic(t *testing.T) { msg: MsgOpenBoosterPack{ Creator: "invalid_address", }, - err: sdkerrors.ErrInvalidAddress, + err: errors.ErrInvalidAddress, }, { name: "valid address", msg: MsgOpenBoosterPack{ diff --git a/x/cardchain/types/message_register_for_council.go b/x/cardchain/types/message_register_for_council.go index b25cc103..7e3d186c 100644 --- a/x/cardchain/types/message_register_for_council.go +++ b/x/cardchain/types/message_register_for_council.go @@ -1,8 +1,9 @@ package types import ( + sdkerrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" ) const TypeMsgRegisterForCouncil = "register_for_council" @@ -39,7 +40,7 @@ func (msg *MsgRegisterForCouncil) GetSignBytes() []byte { func (msg *MsgRegisterForCouncil) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Creator) if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) + return sdkerrors.Wrapf(errors.ErrInvalidAddress, "invalid creator address (%s)", err) } return nil } diff --git a/x/cardchain/types/message_register_for_council_test.go b/x/cardchain/types/message_register_for_council_test.go index b2854f30..66cf6382 100644 --- a/x/cardchain/types/message_register_for_council_test.go +++ b/x/cardchain/types/message_register_for_council_test.go @@ -4,7 +4,7 @@ import ( "testing" "github.com/DecentralCardGame/Cardchain/testutil/sample" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" "github.com/stretchr/testify/require" ) @@ -19,7 +19,7 @@ func TestMsgRegisterForCouncil_ValidateBasic(t *testing.T) { msg: MsgRegisterForCouncil{ Creator: "invalid_address", }, - err: sdkerrors.ErrInvalidAddress, + err: errors.ErrInvalidAddress, }, { name: "valid address", msg: MsgRegisterForCouncil{ diff --git a/x/cardchain/types/message_remove_card_from_collection.go b/x/cardchain/types/message_remove_card_from_collection.go index bf48b5e8..1c87c5aa 100644 --- a/x/cardchain/types/message_remove_card_from_collection.go +++ b/x/cardchain/types/message_remove_card_from_collection.go @@ -1,8 +1,9 @@ package types import ( + sdkerrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" ) const TypeMsgRemoveCardFromCollection = "remove_card_from_collection" @@ -41,7 +42,7 @@ func (msg *MsgRemoveCardFromCollection) GetSignBytes() []byte { func (msg *MsgRemoveCardFromCollection) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Creator) if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) + return sdkerrors.Wrapf(errors.ErrInvalidAddress, "invalid creator address (%s)", err) } return nil } diff --git a/x/cardchain/types/message_remove_card_from_collection_test.go b/x/cardchain/types/message_remove_card_from_collection_test.go index cf2cd460..cdb5ffae 100644 --- a/x/cardchain/types/message_remove_card_from_collection_test.go +++ b/x/cardchain/types/message_remove_card_from_collection_test.go @@ -4,7 +4,7 @@ import ( "testing" "github.com/DecentralCardGame/Cardchain/testutil/sample" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" "github.com/stretchr/testify/require" ) @@ -19,7 +19,7 @@ func TestMsgRemoveCardFromCollection_ValidateBasic(t *testing.T) { msg: MsgRemoveCardFromCollection{ Creator: "invalid_address", }, - err: sdkerrors.ErrInvalidAddress, + err: errors.ErrInvalidAddress, }, { name: "valid address", msg: MsgRemoveCardFromCollection{ diff --git a/x/cardchain/types/message_remove_contributor_from_collection.go b/x/cardchain/types/message_remove_contributor_from_collection.go index 81f230ad..e9ffeac0 100644 --- a/x/cardchain/types/message_remove_contributor_from_collection.go +++ b/x/cardchain/types/message_remove_contributor_from_collection.go @@ -1,8 +1,9 @@ package types import ( + sdkerrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" ) const TypeMsgRemoveContributorFromCollection = "remove_contributor_from_collection" @@ -41,7 +42,7 @@ func (msg *MsgRemoveContributorFromCollection) GetSignBytes() []byte { func (msg *MsgRemoveContributorFromCollection) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Creator) if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) + return sdkerrors.Wrapf(errors.ErrInvalidAddress, "invalid creator address (%s)", err) } return nil } diff --git a/x/cardchain/types/message_remove_contributor_from_collection_test.go b/x/cardchain/types/message_remove_contributor_from_collection_test.go index 402b7a60..e902498d 100644 --- a/x/cardchain/types/message_remove_contributor_from_collection_test.go +++ b/x/cardchain/types/message_remove_contributor_from_collection_test.go @@ -4,7 +4,7 @@ import ( "testing" "github.com/DecentralCardGame/Cardchain/testutil/sample" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" "github.com/stretchr/testify/require" ) @@ -19,7 +19,7 @@ func TestMsgRemoveContributorFromCollection_ValidateBasic(t *testing.T) { msg: MsgRemoveContributorFromCollection{ Creator: "invalid_address", }, - err: sdkerrors.ErrInvalidAddress, + err: errors.ErrInvalidAddress, }, { name: "valid address", msg: MsgRemoveContributorFromCollection{ diff --git a/x/cardchain/types/message_remove_sell_offer.go b/x/cardchain/types/message_remove_sell_offer.go index 375b4c0c..1fdcf74c 100644 --- a/x/cardchain/types/message_remove_sell_offer.go +++ b/x/cardchain/types/message_remove_sell_offer.go @@ -1,8 +1,9 @@ package types import ( + sdkerrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" ) const TypeMsgRemoveSellOffer = "remove_sell_offer" @@ -40,7 +41,7 @@ func (msg *MsgRemoveSellOffer) GetSignBytes() []byte { func (msg *MsgRemoveSellOffer) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Creator) if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) + return sdkerrors.Wrapf(errors.ErrInvalidAddress, "invalid creator address (%s)", err) } return nil } diff --git a/x/cardchain/types/message_remove_sell_offer_test.go b/x/cardchain/types/message_remove_sell_offer_test.go index 48f7a36f..fa4d8ba9 100644 --- a/x/cardchain/types/message_remove_sell_offer_test.go +++ b/x/cardchain/types/message_remove_sell_offer_test.go @@ -4,7 +4,7 @@ import ( "testing" "github.com/DecentralCardGame/Cardchain/testutil/sample" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" "github.com/stretchr/testify/require" ) @@ -19,7 +19,7 @@ func TestMsgRemoveSellOffer_ValidateBasic(t *testing.T) { msg: MsgRemoveSellOffer{ Creator: "invalid_address", }, - err: sdkerrors.ErrInvalidAddress, + err: errors.ErrInvalidAddress, }, { name: "valid address", msg: MsgRemoveSellOffer{ diff --git a/x/cardchain/types/message_report_match.go b/x/cardchain/types/message_report_match.go index 75d88028..12aaecf4 100644 --- a/x/cardchain/types/message_report_match.go +++ b/x/cardchain/types/message_report_match.go @@ -1,8 +1,9 @@ package types import ( + sdkerrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" ) const TypeMsgReportMatch = "report_match" @@ -44,7 +45,7 @@ func (msg *MsgReportMatch) GetSignBytes() []byte { func (msg *MsgReportMatch) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Creator) if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) + return sdkerrors.Wrapf(errors.ErrInvalidAddress, "invalid creator address (%s)", err) } return nil } diff --git a/x/cardchain/types/message_report_match_test.go b/x/cardchain/types/message_report_match_test.go index b6194c24..5945be8e 100644 --- a/x/cardchain/types/message_report_match_test.go +++ b/x/cardchain/types/message_report_match_test.go @@ -4,7 +4,7 @@ import ( "testing" "github.com/DecentralCardGame/Cardchain/testutil/sample" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" "github.com/stretchr/testify/require" ) @@ -19,7 +19,7 @@ func TestMsgReportMatch_ValidateBasic(t *testing.T) { msg: MsgReportMatch{ Creator: "invalid_address", }, - err: sdkerrors.ErrInvalidAddress, + err: errors.ErrInvalidAddress, }, { name: "valid address", msg: MsgReportMatch{ diff --git a/x/cardchain/types/message_restart_council.go b/x/cardchain/types/message_restart_council.go index fe273566..170d6ea3 100644 --- a/x/cardchain/types/message_restart_council.go +++ b/x/cardchain/types/message_restart_council.go @@ -1,8 +1,9 @@ package types import ( + sdkerrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" ) const TypeMsgRestartCouncil = "restart_council" @@ -40,7 +41,7 @@ func (msg *MsgRestartCouncil) GetSignBytes() []byte { func (msg *MsgRestartCouncil) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Creator) if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) + return sdkerrors.Wrapf(errors.ErrInvalidAddress, "invalid creator address (%s)", err) } return nil } diff --git a/x/cardchain/types/message_restart_council_test.go b/x/cardchain/types/message_restart_council_test.go index 0848616d..e497957c 100644 --- a/x/cardchain/types/message_restart_council_test.go +++ b/x/cardchain/types/message_restart_council_test.go @@ -4,7 +4,7 @@ import ( "testing" "github.com/DecentralCardGame/Cardchain/testutil/sample" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" "github.com/stretchr/testify/require" ) @@ -19,7 +19,7 @@ func TestMsgRestartCouncil_ValidateBasic(t *testing.T) { msg: MsgRestartCouncil{ Creator: "invalid_address", }, - err: sdkerrors.ErrInvalidAddress, + err: errors.ErrInvalidAddress, }, { name: "valid address", msg: MsgRestartCouncil{ diff --git a/x/cardchain/types/message_reveal_council_response.go b/x/cardchain/types/message_reveal_council_response.go index 113569fa..b4712ee0 100644 --- a/x/cardchain/types/message_reveal_council_response.go +++ b/x/cardchain/types/message_reveal_council_response.go @@ -1,8 +1,9 @@ package types import ( + sdkerrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" ) const TypeMsgRevealCouncilResponse = "reveal_council_response" @@ -42,7 +43,7 @@ func (msg *MsgRevealCouncilResponse) GetSignBytes() []byte { func (msg *MsgRevealCouncilResponse) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Creator) if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) + return sdkerrors.Wrapf(errors.ErrInvalidAddress, "invalid creator address (%s)", err) } return nil } diff --git a/x/cardchain/types/message_reveal_council_response_test.go b/x/cardchain/types/message_reveal_council_response_test.go index a8f8ec0e..678c123c 100644 --- a/x/cardchain/types/message_reveal_council_response_test.go +++ b/x/cardchain/types/message_reveal_council_response_test.go @@ -4,7 +4,7 @@ import ( "testing" "github.com/DecentralCardGame/Cardchain/testutil/sample" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" "github.com/stretchr/testify/require" ) @@ -19,7 +19,7 @@ func TestMsgRevealCouncilResponse_ValidateBasic(t *testing.T) { msg: MsgRevealCouncilResponse{ Creator: "invalid_address", }, - err: sdkerrors.ErrInvalidAddress, + err: errors.ErrInvalidAddress, }, { name: "valid address", msg: MsgRevealCouncilResponse{ diff --git a/x/cardchain/types/message_rewoke_council_registration.go b/x/cardchain/types/message_rewoke_council_registration.go index 3d34cdbc..76652620 100644 --- a/x/cardchain/types/message_rewoke_council_registration.go +++ b/x/cardchain/types/message_rewoke_council_registration.go @@ -1,8 +1,9 @@ package types import ( + sdkerrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" ) const TypeMsgRewokeCouncilRegistration = "rewoke_council_registration" @@ -39,7 +40,7 @@ func (msg *MsgRewokeCouncilRegistration) GetSignBytes() []byte { func (msg *MsgRewokeCouncilRegistration) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Creator) if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) + return sdkerrors.Wrapf(errors.ErrInvalidAddress, "invalid creator address (%s)", err) } return nil } diff --git a/x/cardchain/types/message_rewoke_council_registration_test.go b/x/cardchain/types/message_rewoke_council_registration_test.go index ef5495f8..749e15db 100644 --- a/x/cardchain/types/message_rewoke_council_registration_test.go +++ b/x/cardchain/types/message_rewoke_council_registration_test.go @@ -4,7 +4,7 @@ import ( "testing" "github.com/DecentralCardGame/Cardchain/testutil/sample" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" "github.com/stretchr/testify/require" ) @@ -19,7 +19,7 @@ func TestMsgRewokeCouncilRegistration_ValidateBasic(t *testing.T) { msg: MsgRewokeCouncilRegistration{ Creator: "invalid_address", }, - err: sdkerrors.ErrInvalidAddress, + err: errors.ErrInvalidAddress, }, { name: "valid address", msg: MsgRewokeCouncilRegistration{ diff --git a/x/cardchain/types/message_save_card_content.go b/x/cardchain/types/message_save_card_content.go index a885aa56..51512f74 100644 --- a/x/cardchain/types/message_save_card_content.go +++ b/x/cardchain/types/message_save_card_content.go @@ -1,8 +1,9 @@ package types import ( + sdkerrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" ) const TypeMsgSaveCardContent = "save_card_content" @@ -43,7 +44,7 @@ func (msg *MsgSaveCardContent) GetSignBytes() []byte { func (msg *MsgSaveCardContent) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Creator) if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) + return sdkerrors.Wrapf(errors.ErrInvalidAddress, "invalid creator address (%s)", err) } return nil } diff --git a/x/cardchain/types/message_save_card_content_test.go b/x/cardchain/types/message_save_card_content_test.go index 6cb77c42..caf1e227 100644 --- a/x/cardchain/types/message_save_card_content_test.go +++ b/x/cardchain/types/message_save_card_content_test.go @@ -4,7 +4,7 @@ import ( "testing" "github.com/DecentralCardGame/Cardchain/testutil/sample" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" "github.com/stretchr/testify/require" ) @@ -19,7 +19,7 @@ func TestMsgSaveCardContent_ValidateBasic(t *testing.T) { msg: MsgSaveCardContent{ Creator: "invalid_address", }, - err: sdkerrors.ErrInvalidAddress, + err: errors.ErrInvalidAddress, }, { name: "valid address", msg: MsgSaveCardContent{ diff --git a/x/cardchain/types/message_set_card_rarity.go b/x/cardchain/types/message_set_card_rarity.go index a0f71d53..a5c173cd 100644 --- a/x/cardchain/types/message_set_card_rarity.go +++ b/x/cardchain/types/message_set_card_rarity.go @@ -1,8 +1,9 @@ package types import ( + sdkerrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" ) const TypeMsgSetCardRarity = "set_card_rarity" @@ -42,7 +43,7 @@ func (msg *MsgSetCardRarity) GetSignBytes() []byte { func (msg *MsgSetCardRarity) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Creator) if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) + return sdkerrors.Wrapf(errors.ErrInvalidAddress, "invalid creator address (%s)", err) } return nil } diff --git a/x/cardchain/types/message_set_card_rarity_test.go b/x/cardchain/types/message_set_card_rarity_test.go index dd1c1ff9..c7f21b99 100644 --- a/x/cardchain/types/message_set_card_rarity_test.go +++ b/x/cardchain/types/message_set_card_rarity_test.go @@ -4,7 +4,7 @@ import ( "testing" "github.com/DecentralCardGame/Cardchain/testutil/sample" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" "github.com/stretchr/testify/require" ) @@ -19,7 +19,7 @@ func TestMsgSetCardRarity_ValidateBasic(t *testing.T) { msg: MsgSetCardRarity{ Creator: "invalid_address", }, - err: sdkerrors.ErrInvalidAddress, + err: errors.ErrInvalidAddress, }, { name: "valid address", msg: MsgSetCardRarity{ diff --git a/x/cardchain/types/message_set_collection_artist.go b/x/cardchain/types/message_set_collection_artist.go index 9c297f18..4fa589dc 100644 --- a/x/cardchain/types/message_set_collection_artist.go +++ b/x/cardchain/types/message_set_collection_artist.go @@ -1,8 +1,9 @@ package types import ( + sdkerrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" ) const TypeMsgSetCollectionArtist = "set_collection_artist" @@ -41,7 +42,7 @@ func (msg *MsgSetCollectionArtist) GetSignBytes() []byte { func (msg *MsgSetCollectionArtist) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Creator) if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) + return sdkerrors.Wrapf(errors.ErrInvalidAddress, "invalid creator address (%s)", err) } return nil } diff --git a/x/cardchain/types/message_set_collection_artist_test.go b/x/cardchain/types/message_set_collection_artist_test.go index 4f05e015..675c29e2 100644 --- a/x/cardchain/types/message_set_collection_artist_test.go +++ b/x/cardchain/types/message_set_collection_artist_test.go @@ -4,12 +4,12 @@ import ( "testing" "github.com/DecentralCardGame/Cardchain/testutil/sample" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" "github.com/stretchr/testify/require" ) func TestMsgSetCollectionArtist_ValidateBasic(t *testing.T) { - tests := []struct { + var tests = []struct { name string msg MsgSetCollectionArtist err error @@ -19,7 +19,7 @@ func TestMsgSetCollectionArtist_ValidateBasic(t *testing.T) { msg: MsgSetCollectionArtist{ Creator: "invalid_address", }, - err: sdkerrors.ErrInvalidAddress, + err: errors.ErrInvalidAddress, }, { name: "valid address", msg: MsgSetCollectionArtist{ diff --git a/x/cardchain/types/message_set_collection_story_writer.go b/x/cardchain/types/message_set_collection_story_writer.go index dfaf4c5f..01db2eb7 100644 --- a/x/cardchain/types/message_set_collection_story_writer.go +++ b/x/cardchain/types/message_set_collection_story_writer.go @@ -1,8 +1,9 @@ package types import ( + sdkerrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" ) const TypeMsgSetCollectionStoryWriter = "set_collection_story_writer" @@ -41,7 +42,7 @@ func (msg *MsgSetCollectionStoryWriter) GetSignBytes() []byte { func (msg *MsgSetCollectionStoryWriter) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Creator) if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) + return sdkerrors.Wrapf(errors.ErrInvalidAddress, "invalid creator address (%s)", err) } return nil } diff --git a/x/cardchain/types/message_set_collection_story_writer_test.go b/x/cardchain/types/message_set_collection_story_writer_test.go index f1b66965..8aff5d52 100644 --- a/x/cardchain/types/message_set_collection_story_writer_test.go +++ b/x/cardchain/types/message_set_collection_story_writer_test.go @@ -4,7 +4,7 @@ import ( "testing" "github.com/DecentralCardGame/Cardchain/testutil/sample" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" "github.com/stretchr/testify/require" ) @@ -19,7 +19,7 @@ func TestMsgSetCollectionStoryWriter_ValidateBasic(t *testing.T) { msg: MsgSetCollectionStoryWriter{ Creator: "invalid_address", }, - err: sdkerrors.ErrInvalidAddress, + err: errors.ErrInvalidAddress, }, { name: "valid address", msg: MsgSetCollectionStoryWriter{ diff --git a/x/cardchain/types/message_set_profile_card.go b/x/cardchain/types/message_set_profile_card.go index 955145ac..aa5f82dc 100644 --- a/x/cardchain/types/message_set_profile_card.go +++ b/x/cardchain/types/message_set_profile_card.go @@ -1,8 +1,9 @@ package types import ( + sdkerrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" ) const TypeMsgSetProfileCard = "set_profile_card" @@ -40,7 +41,7 @@ func (msg *MsgSetProfileCard) GetSignBytes() []byte { func (msg *MsgSetProfileCard) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Creator) if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) + return sdkerrors.Wrapf(errors.ErrInvalidAddress, "invalid creator address (%s)", err) } return nil } diff --git a/x/cardchain/types/message_set_profile_card_test.go b/x/cardchain/types/message_set_profile_card_test.go index 9239a095..cc2d6d07 100644 --- a/x/cardchain/types/message_set_profile_card_test.go +++ b/x/cardchain/types/message_set_profile_card_test.go @@ -4,7 +4,7 @@ import ( "testing" "github.com/DecentralCardGame/Cardchain/testutil/sample" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" "github.com/stretchr/testify/require" ) @@ -19,7 +19,7 @@ func TestMsgSetProfileCard_ValidateBasic(t *testing.T) { msg: MsgSetProfileCard{ Creator: "invalid_address", }, - err: sdkerrors.ErrInvalidAddress, + err: errors.ErrInvalidAddress, }, { name: "valid address", msg: MsgSetProfileCard{ diff --git a/x/cardchain/types/message_set_user_biography.go b/x/cardchain/types/message_set_user_biography.go index e398c535..50a39e78 100644 --- a/x/cardchain/types/message_set_user_biography.go +++ b/x/cardchain/types/message_set_user_biography.go @@ -1,8 +1,9 @@ package types import ( + sdkerrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" ) const TypeMsgSetUserBiography = "set_user_biography" @@ -40,7 +41,7 @@ func (msg *MsgSetUserBiography) GetSignBytes() []byte { func (msg *MsgSetUserBiography) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Creator) if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) + return sdkerrors.Wrapf(errors.ErrInvalidAddress, "invalid creator address (%s)", err) } return nil } diff --git a/x/cardchain/types/message_set_user_biography_test.go b/x/cardchain/types/message_set_user_biography_test.go index 7f3e0bea..a6ee84dd 100644 --- a/x/cardchain/types/message_set_user_biography_test.go +++ b/x/cardchain/types/message_set_user_biography_test.go @@ -4,7 +4,7 @@ import ( "testing" "github.com/DecentralCardGame/Cardchain/testutil/sample" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" "github.com/stretchr/testify/require" ) @@ -19,7 +19,7 @@ func TestMsgSetUserBiography_ValidateBasic(t *testing.T) { msg: MsgSetUserBiography{ Creator: "invalid_address", }, - err: sdkerrors.ErrInvalidAddress, + err: errors.ErrInvalidAddress, }, { name: "valid address", msg: MsgSetUserBiography{ diff --git a/x/cardchain/types/message_set_user_website.go b/x/cardchain/types/message_set_user_website.go index daae40f8..939a777b 100644 --- a/x/cardchain/types/message_set_user_website.go +++ b/x/cardchain/types/message_set_user_website.go @@ -1,8 +1,9 @@ package types import ( + sdkerrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" ) const TypeMsgSetUserWebsite = "set_user_website" @@ -40,7 +41,7 @@ func (msg *MsgSetUserWebsite) GetSignBytes() []byte { func (msg *MsgSetUserWebsite) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Creator) if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) + return sdkerrors.Wrapf(errors.ErrInvalidAddress, "invalid creator address (%s)", err) } return nil } diff --git a/x/cardchain/types/message_set_user_website_test.go b/x/cardchain/types/message_set_user_website_test.go index d733b971..d7385d9a 100644 --- a/x/cardchain/types/message_set_user_website_test.go +++ b/x/cardchain/types/message_set_user_website_test.go @@ -4,7 +4,7 @@ import ( "testing" "github.com/DecentralCardGame/Cardchain/testutil/sample" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" "github.com/stretchr/testify/require" ) @@ -19,7 +19,7 @@ func TestMsgSetUserWebsite_ValidateBasic(t *testing.T) { msg: MsgSetUserWebsite{ Creator: "invalid_address", }, - err: sdkerrors.ErrInvalidAddress, + err: errors.ErrInvalidAddress, }, { name: "valid address", msg: MsgSetUserWebsite{ diff --git a/x/cardchain/types/message_submit_collection_proposal.go b/x/cardchain/types/message_submit_collection_proposal.go index c594f4e1..704f5211 100644 --- a/x/cardchain/types/message_submit_collection_proposal.go +++ b/x/cardchain/types/message_submit_collection_proposal.go @@ -1,8 +1,9 @@ package types import ( + sdkerrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" ) const TypeMsgSubmitCollectionProposal = "submit_collection_proposal" @@ -40,7 +41,7 @@ func (msg *MsgSubmitCollectionProposal) GetSignBytes() []byte { func (msg *MsgSubmitCollectionProposal) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Creator) if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) + return sdkerrors.Wrapf(errors.ErrInvalidAddress, "invalid creator address (%s)", err) } return nil } diff --git a/x/cardchain/types/message_submit_collection_proposal_test.go b/x/cardchain/types/message_submit_collection_proposal_test.go index 681afc4f..2bd3e0a1 100644 --- a/x/cardchain/types/message_submit_collection_proposal_test.go +++ b/x/cardchain/types/message_submit_collection_proposal_test.go @@ -4,7 +4,7 @@ import ( "testing" "github.com/DecentralCardGame/Cardchain/testutil/sample" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" "github.com/stretchr/testify/require" ) @@ -19,7 +19,7 @@ func TestMsgSubmitCollectionProposal_ValidateBasic(t *testing.T) { msg: MsgSubmitCollectionProposal{ Creator: "invalid_address", }, - err: sdkerrors.ErrInvalidAddress, + err: errors.ErrInvalidAddress, }, { name: "valid address", msg: MsgSubmitCollectionProposal{ diff --git a/x/cardchain/types/message_submit_copyright_proposal.go b/x/cardchain/types/message_submit_copyright_proposal.go index a50e2a98..72ec6f61 100644 --- a/x/cardchain/types/message_submit_copyright_proposal.go +++ b/x/cardchain/types/message_submit_copyright_proposal.go @@ -1,8 +1,9 @@ package types import ( + sdkerrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" ) const TypeMsgSubmitCopyrightProposal = "submit_copyright_proposal" @@ -42,7 +43,7 @@ func (msg *MsgSubmitCopyrightProposal) GetSignBytes() []byte { func (msg *MsgSubmitCopyrightProposal) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Creator) if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) + return sdkerrors.Wrapf(errors.ErrInvalidAddress, "invalid creator address (%s)", err) } return nil } diff --git a/x/cardchain/types/message_submit_copyright_proposal_test.go b/x/cardchain/types/message_submit_copyright_proposal_test.go index 94a6fc06..d433545d 100644 --- a/x/cardchain/types/message_submit_copyright_proposal_test.go +++ b/x/cardchain/types/message_submit_copyright_proposal_test.go @@ -4,7 +4,7 @@ import ( "testing" "github.com/DecentralCardGame/Cardchain/testutil/sample" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" "github.com/stretchr/testify/require" ) @@ -19,7 +19,7 @@ func TestMsgSubmitCopyrightProposal_ValidateBasic(t *testing.T) { msg: MsgSubmitCopyrightProposal{ Creator: "invalid_address", }, - err: sdkerrors.ErrInvalidAddress, + err: errors.ErrInvalidAddress, }, { name: "valid address", msg: MsgSubmitCopyrightProposal{ diff --git a/x/cardchain/types/message_submit_match_reporter_proposal.go b/x/cardchain/types/message_submit_match_reporter_proposal.go index 78c94471..d2a7b8a5 100644 --- a/x/cardchain/types/message_submit_match_reporter_proposal.go +++ b/x/cardchain/types/message_submit_match_reporter_proposal.go @@ -1,8 +1,9 @@ package types import ( + sdkerrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" ) const TypeMsgSubmitMatchReporterProposal = "submit_match_reporter_proposal" @@ -42,7 +43,7 @@ func (msg *MsgSubmitMatchReporterProposal) GetSignBytes() []byte { func (msg *MsgSubmitMatchReporterProposal) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Creator) if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) + return sdkerrors.Wrapf(errors.ErrInvalidAddress, "invalid creator address (%s)", err) } return nil } diff --git a/x/cardchain/types/message_submit_match_reporter_proposal_test.go b/x/cardchain/types/message_submit_match_reporter_proposal_test.go index ff61f9f4..fe5bea64 100644 --- a/x/cardchain/types/message_submit_match_reporter_proposal_test.go +++ b/x/cardchain/types/message_submit_match_reporter_proposal_test.go @@ -4,7 +4,7 @@ import ( "testing" "github.com/DecentralCardGame/Cardchain/testutil/sample" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" "github.com/stretchr/testify/require" ) @@ -19,7 +19,7 @@ func TestMsgSubmitMatchReporterProposal_ValidateBasic(t *testing.T) { msg: MsgSubmitMatchReporterProposal{ Creator: "invalid_address", }, - err: sdkerrors.ErrInvalidAddress, + err: errors.ErrInvalidAddress, }, { name: "valid address", msg: MsgSubmitMatchReporterProposal{ diff --git a/x/cardchain/types/message_transfer_booster_pack.go b/x/cardchain/types/message_transfer_booster_pack.go index 28fe4997..bf628d96 100644 --- a/x/cardchain/types/message_transfer_booster_pack.go +++ b/x/cardchain/types/message_transfer_booster_pack.go @@ -1,8 +1,9 @@ package types import ( + sdkerrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" ) const TypeMsgTransferBoosterPack = "transfer_booster_pack" @@ -41,7 +42,7 @@ func (msg *MsgTransferBoosterPack) GetSignBytes() []byte { func (msg *MsgTransferBoosterPack) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Creator) if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) + return sdkerrors.Wrapf(errors.ErrInvalidAddress, "invalid creator address (%s)", err) } return nil } diff --git a/x/cardchain/types/message_transfer_booster_pack_test.go b/x/cardchain/types/message_transfer_booster_pack_test.go index 1e9aafb7..7c2ac31f 100644 --- a/x/cardchain/types/message_transfer_booster_pack_test.go +++ b/x/cardchain/types/message_transfer_booster_pack_test.go @@ -4,7 +4,7 @@ import ( "testing" "github.com/DecentralCardGame/Cardchain/testutil/sample" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" "github.com/stretchr/testify/require" ) @@ -19,7 +19,7 @@ func TestMsgTransferBoosterPack_ValidateBasic(t *testing.T) { msg: MsgTransferBoosterPack{ Creator: "invalid_address", }, - err: sdkerrors.ErrInvalidAddress, + err: errors.ErrInvalidAddress, }, { name: "valid address", msg: MsgTransferBoosterPack{ diff --git a/x/cardchain/types/message_transfer_card.go b/x/cardchain/types/message_transfer_card.go index 6fa95096..c6d606bd 100644 --- a/x/cardchain/types/message_transfer_card.go +++ b/x/cardchain/types/message_transfer_card.go @@ -1,8 +1,9 @@ package types import ( + sdkerrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" ) const TypeMsgTransferCard = "transfer_card" @@ -41,7 +42,7 @@ func (msg *MsgTransferCard) GetSignBytes() []byte { func (msg *MsgTransferCard) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Creator) if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) + return sdkerrors.Wrapf(errors.ErrInvalidAddress, "invalid creator address (%s)", err) } return nil } diff --git a/x/cardchain/types/message_transfer_card_test.go b/x/cardchain/types/message_transfer_card_test.go index 399a19d9..1c4b5ae8 100644 --- a/x/cardchain/types/message_transfer_card_test.go +++ b/x/cardchain/types/message_transfer_card_test.go @@ -4,7 +4,7 @@ import ( "testing" "github.com/DecentralCardGame/Cardchain/testutil/sample" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" "github.com/stretchr/testify/require" ) @@ -19,7 +19,7 @@ func TestMsgTransferCard_ValidateBasic(t *testing.T) { msg: MsgTransferCard{ Creator: "invalid_address", }, - err: sdkerrors.ErrInvalidAddress, + err: errors.ErrInvalidAddress, }, { name: "valid address", msg: MsgTransferCard{ diff --git a/x/cardchain/types/message_vote_card.go b/x/cardchain/types/message_vote_card.go index 2e281667..24010901 100644 --- a/x/cardchain/types/message_vote_card.go +++ b/x/cardchain/types/message_vote_card.go @@ -1,8 +1,9 @@ package types import ( + sdkerrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" ) const TypeMsgVoteCard = "vote_card" @@ -41,7 +42,7 @@ func (msg *MsgVoteCard) GetSignBytes() []byte { func (msg *MsgVoteCard) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Creator) if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) + return sdkerrors.Wrapf(errors.ErrInvalidAddress, "invalid creator address (%s)", err) } return nil } diff --git a/x/cardchain/types/message_vote_card_test.go b/x/cardchain/types/message_vote_card_test.go index 336d60fe..cae806fe 100644 --- a/x/cardchain/types/message_vote_card_test.go +++ b/x/cardchain/types/message_vote_card_test.go @@ -4,7 +4,7 @@ import ( "testing" "github.com/DecentralCardGame/Cardchain/testutil/sample" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/errors" "github.com/stretchr/testify/require" ) @@ -19,7 +19,7 @@ func TestMsgVoteCard_ValidateBasic(t *testing.T) { msg: MsgVoteCard{ Creator: "invalid_address", }, - err: sdkerrors.ErrInvalidAddress, + err: errors.ErrInvalidAddress, }, { name: "valid address", msg: MsgVoteCard{