mirror of
https://github.com/colinear-labs/chain.git
synced 2026-03-05 02:54:25 -08:00
emit subscribable events for core module auctions
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user