Skip to content

Commit 6c96918

Browse files
authored
fix: fix begin blocker (#112)
<!-- πŸŽ‰ Thank you for the PR!!! πŸŽ‰ --> Closes #<issue number>. _in case of a bug fix, this should point to a bug or any other related issue(s)_ ### What does this PR do? <!-- Describe your changes here - ideally you can get that description straight from your descriptive commit message(s)! --> ### How to test? <!-- What steps in order should someone run to test --> ## Checklist These are the criteria that every PR should meet, please check them off as you review them: - [ ] Include tests - [ ] Respect code style and lint - [ ] Update documentation (*.md) (if needed)
1 parent b6343db commit 6c96918

File tree

4 files changed

+14
-11
lines changed

4 files changed

+14
-11
lines changed

β€Ždocs/static/openapi.ymlβ€Ž

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

β€Žx/fundraising/keeper/abci.goβ€Ž

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package keeper
22

33
import (
44
"context"
5-
"fmt"
65
"time"
76

87
"github.com/cosmos/cosmos-sdk/telemetry"
@@ -21,14 +20,18 @@ func (k Keeper) BeginBlocker(ctx context.Context) error {
2120
for _, auction := range auctions {
2221
switch auction.GetStatus() {
2322
case types.AuctionStatusStandBy:
24-
err = k.ExecuteStandByStatus(ctx, auction)
23+
if err := k.ExecuteStandByStatus(ctx, auction); err != nil {
24+
return err
25+
}
2526
case types.AuctionStatusStarted:
26-
err = k.ExecuteStartedStatus(ctx, auction)
27+
if err := k.ExecuteStartedStatus(ctx, auction); err != nil {
28+
return err
29+
}
2730
case types.AuctionStatusVesting:
28-
err = k.ExecuteVestingStatus(ctx, auction)
29-
default:
30-
err = fmt.Errorf("invalid auction status %s", auction.GetStatus())
31+
if err := k.ExecuteVestingStatus(ctx, auction); err != nil {
32+
return err
33+
}
3134
}
3235
}
33-
return err
36+
return nil
3437
}

β€Žx/fundraising/keeper/bid.goβ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,12 @@ func (k Keeper) PlaceBid(ctx context.Context, msg *types.MsgPlaceBid) (types.Bid
7878
}
7979

8080
if auction.GetStatus() != types.AuctionStatusStarted {
81-
return types.Bid{}, types.ErrInvalidAuctionStatus
81+
return types.Bid{}, sdkerrors.Wrap(types.ErrInvalidAuctionStatus, auction.GetStatus().String())
8282
}
8383

8484
if auction.GetType() == types.AuctionTypeBatch {
8585
if msg.Price.LT(auction.(*types.BatchAuction).MinBidPrice) {
86-
return types.Bid{}, types.ErrInsufficientMinBidPrice
86+
return types.Bid{}, sdkerrors.Wrap(types.ErrInsufficientMinBidPrice, msg.Price.String())
8787
}
8888
}
8989

β€Žx/fundraising/keeper/query_auction.goβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ func (q queryServer) ListAuction(ctx context.Context, req *types.QueryAllAuction
2626
if req.Status != "" && !(req.Status == types.AuctionStatusStandBy.String() || req.Status == types.AuctionStatusStarted.String() ||
2727
req.Status == types.AuctionStatusVesting.String() || req.Status == types.AuctionStatusFinished.String() ||
2828
req.Status == types.AuctionStatusCancelled.String()) {
29-
return nil, status.Errorf(codes.InvalidArgument, "invalid auction status %s", req.Status)
29+
return nil, status.Errorf(codes.InvalidArgument, "invalid auction status field %s", req.Status)
3030
}
3131

3232
auctions, pageRes, err := query.CollectionFilteredPaginate(

0 commit comments

Comments
Β (0)