From b121b9d07fddceedd41801ac81b47e97890d7c03 Mon Sep 17 00:00:00 2001 From: jhernandezb Date: Mon, 27 Mar 2023 08:52:10 -0600 Subject: [PATCH] allocation: emit events for claim rewards --- x/allocation/keeper/claim.go | 7 +++++++ x/allocation/keeper/msg_claim_rewards.go | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/x/allocation/keeper/claim.go b/x/allocation/keeper/claim.go index 15467b7..b0ac899 100644 --- a/x/allocation/keeper/claim.go +++ b/x/allocation/keeper/claim.go @@ -19,5 +19,12 @@ func (k Keeper) ClaimRewards(ctx sdk.Context, operator sdk.AccAddress) (sdk.Coin } // remove the rewards from the store k.DeleteValidatorRewards(ctx, operator) + ctx.EventManager().EmitEvents(sdk.Events{ + sdk.NewEvent( + types.EventTypeWithdrawRewards, + sdk.NewAttribute(sdk.AttributeKeySender, operator.String()), + sdk.NewAttribute(sdk.AttributeKeyAmount, reward.String()), + ), + }) return reward, nil } diff --git a/x/allocation/keeper/msg_claim_rewards.go b/x/allocation/keeper/msg_claim_rewards.go index 441e5c9..baf4dbb 100644 --- a/x/allocation/keeper/msg_claim_rewards.go +++ b/x/allocation/keeper/msg_claim_rewards.go @@ -17,6 +17,13 @@ func (server msgServer) ClaimRewards(goCtx context.Context, msg *types.MsgClaimR if err != nil { return nil, err } + ctx.EventManager().EmitEvents(sdk.Events{ + sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), + sdk.NewAttribute(sdk.AttributeKeySender, msg.Sender), + ), + }) return &types.MsgClaimRewardsResponse{ ClaimedRewards: coins, }, nil