emit subscribable events for core module auctions
parent
d51de8f3bc
commit
bfa30082f1
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue