Skip to content

Commit

Permalink
fix modify bid simulation
Browse files Browse the repository at this point in the history
  • Loading branch information
Pantani committed Aug 22, 2024
1 parent 91f0ab4 commit d6359d4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion docs/static/openapi.yml

Large diffs are not rendered by default.

10 changes: 4 additions & 6 deletions x/fundraising/simulation/modify_bid.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package simulation

import (
"fmt"
"math/rand"

"cosmossdk.io/math"
Expand Down Expand Up @@ -33,14 +34,11 @@ func SimulateMsgModifyBid(

// Select a random auction
auction := auctions[r.Intn(len(auctions))]
if auction.GetStatus() != types.AuctionStatusStarted {
return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "auction must be started status"), nil, nil
}
if auction.GetType() != types.AuctionTypeBatch || auction.GetStatus() != types.AuctionStatusStarted {
return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "incorrect auction type or status"), nil, nil
return simtypes.NoOpMsg(types.ModuleName, msg.Type(), fmt.Sprintf("incorrect auction type or status %v", auction)), nil, nil
}

bids, err := k.Bids(ctx)
bids, err := k.GetBidsByAuctionId(ctx, auction.GetId())
if err != nil {
return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "failed to get bids"), nil, nil
}
Expand All @@ -56,7 +54,7 @@ func SimulateMsgModifyBid(
spendable := bk.SpendableCoins(ctx, account.GetAddress())

msg = types.NewMsgModifyBid(
auction.GetId(),
bid.AuctionId,
account.GetAddress().String(),
bid.Id,
bid.Price,
Expand Down
2 changes: 1 addition & 1 deletion x/fundraising/simulation/place_bid.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func SimulateMsgPlaceBid(

newAllowedBidder := types.NewAllowedBidder(auction.GetId(), bidder, maxBidAmt)
if err := k.AddAllowedBidders(ctx, auction.GetId(), []types.AllowedBidder{newAllowedBidder}); err != nil {
return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "failed to add allowed bidders"), nil, nil
return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "failed to add allowed bidders"), nil, err
}

msg = types.NewMsgPlaceBid(
Expand Down

0 comments on commit d6359d4

Please sign in to comment.