Skip to content

Commit

Permalink
Added events in subscription and session endblock
Browse files Browse the repository at this point in the history
  • Loading branch information
bsrinivas8687 committed Jun 23, 2021
1 parent b28d534 commit ec4642b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
7 changes: 7 additions & 0 deletions x/session/abci.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ func EndBlock(ctx sdk.Context, k keeper.Keeper) []abcitypes.ValidatorUpdate {
k.SetSession(ctx, item)
k.SetInactiveSessionForAddress(ctx, itemAddress, item.Id)
k.SetInactiveSessionAt(ctx, item.StatusAt.Add(inactiveDuration), item.Id)
ctx.EventManager().EmitTypedEvent(
&types.EventEndSession{
Id: item.Id,
Subscription: item.Subscription,
Node: item.Node,
},
)

return false
}
Expand Down
5 changes: 5 additions & 0 deletions x/subscription/abci.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ func EndBlock(ctx sdk.Context, k keeper.Keeper) []abcitypes.ValidatorUpdate {

k.SetSubscription(ctx, item)
k.SetInactiveSubscriptionAt(ctx, item.StatusAt.Add(inactiveDuration), item.Id)
ctx.EventManager().EmitTypedEvent(
&types.EventCancelSubscription{
Id: item.Id,
},
)

return false
}
Expand Down

0 comments on commit ec4642b

Please sign in to comment.