diff --git a/x/colinearcore/keeper/auction_state.go b/x/colinearcore/keeper/auction_state.go index 2a4f578..7d36d48 100644 --- a/x/colinearcore/keeper/auction_state.go +++ b/x/colinearcore/keeper/auction_state.go @@ -81,6 +81,14 @@ func (k Keeper) FinalizeExpiredAuctions(ctx sdk.Context) { // end auction k.SetAuction(ctx, auction) + + // emit finalization event + ctx.EventManager().EmitEvent( + sdk.NewEvent(types.AuctionFinalizedEventType, + sdk.NewAttribute(types.AuctionFinalizedIndex, auction.Index), + ), + ) + } return nil diff --git a/x/colinearcore/keeper/msg_server_claim_funds.go b/x/colinearcore/keeper/msg_server_claim_funds.go index 0ca7a44..231dba6 100644 --- a/x/colinearcore/keeper/msg_server_claim_funds.go +++ b/x/colinearcore/keeper/msg_server_claim_funds.go @@ -70,5 +70,13 @@ func (k msgServer) ClaimFunds(goCtx context.Context, msg *types.MsgClaimFunds) ( auction.Remaining = newRemaining.String() k.Keeper.SetAuction(ctx, auction) + ctx.EventManager().EmitEvent( + sdk.NewEvent(types.LeaseFundsClaimedEventType, + sdk.NewAttribute(types.LeaseFundsClaimedEventCreator, msg.Creator), + sdk.NewAttribute(types.LeaseFundsClaimedAmountClaimed, subAmt.String()), + sdk.NewAttribute(types.LeaseFundsClaimedAmountRemaining, auction.Remaining), + ), + ) + return &types.MsgClaimFundsResponse{}, nil } diff --git a/x/colinearcore/keeper/msg_server_new_auction.go b/x/colinearcore/keeper/msg_server_new_auction.go index 2311ede..ce6ee24 100644 --- a/x/colinearcore/keeper/msg_server_new_auction.go +++ b/x/colinearcore/keeper/msg_server_new_auction.go @@ -112,6 +112,15 @@ found: k.Keeper.SetNextAuction(ctx, types.NextAuction{AuctionId: next.AuctionId}) + ctx.EventManager().EmitEvent( + sdk.NewEvent( + types.AuctionCreatedEventType, + sdk.NewAttribute(types.AuctionCreatedIndex, auction.Index), + sdk.NewAttribute(types.AuctionCreatedEventCreator, msg.Creator), + sdk.NewAttribute(types.AuctionCreatedCeiling, msg.Ceiling), + ), + ) + return &types.MsgNewAuctionResponse{ AuctionId: strconv.FormatUint(next.AuctionId, 10), }, nil diff --git a/x/colinearcore/keeper/msg_server_new_bid.go b/x/colinearcore/keeper/msg_server_new_bid.go index d13c592..3cdda62 100644 --- a/x/colinearcore/keeper/msg_server_new_bid.go +++ b/x/colinearcore/keeper/msg_server_new_bid.go @@ -104,5 +104,15 @@ bidderVerified: return nil, fmt.Errorf("failed to add bid: %s", err) } + // emit bid event + + ctx.EventManager().EmitEvent( + sdk.NewEvent(types.BidCreatedEventType, + sdk.NewAttribute(types.BidCreatedEventCreator, msg.Creator), + sdk.NewAttribute(types.BidCreatedAuctionIndex, msg.AuctionIndex), + sdk.NewAttribute(types.BidCreatedAmount, msg.Amount), + ), + ) + return &types.MsgNewBidResponse{}, nil } diff --git a/x/colinearcore/types/keys.go b/x/colinearcore/types/keys.go index 33fa233..c7fd06e 100644 --- a/x/colinearcore/types/keys.go +++ b/x/colinearcore/types/keys.go @@ -28,3 +28,31 @@ const ( const ( LockedUsersKey = "LockedUsers-value-" ) + +// Module Events + +const ( + AuctionCreatedEventType = "auction-created" + AuctionCreatedEventCreator = "creator" + AuctionCreatedIndex = "auction-id" + AuctionCreatedCeiling = "ceiling" +) + +const ( + BidCreatedEventType = "bid-created" + BidCreatedEventCreator = "creator" + BidCreatedAuctionIndex = "auction-id" + BidCreatedAmount = "amount" +) + +const ( + AuctionFinalizedEventType = "auction-finalized" + AuctionFinalizedIndex = "auction-id" +) + +const ( + LeaseFundsClaimedEventType = "lease-claimed" + LeaseFundsClaimedEventCreator = "claimer" + LeaseFundsClaimedAmountClaimed = "amount-claimed" + LeaseFundsClaimedAmountRemaining = "amount-remaining" +)