Skip to content

Commit

Permalink
Merge pull request #39 from noislabs/jhernandezb/emit-claim-rewards-e…
Browse files Browse the repository at this point in the history
…vents

allocation: emit events for claim rewards
  • Loading branch information
jhernandezb authored Mar 27, 2023
2 parents 293d04e + b121b9d commit 2a9a130
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions x/allocation/keeper/claim.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
7 changes: 7 additions & 0 deletions x/allocation/keeper/msg_claim_rewards.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2a9a130

Please sign in to comment.