From 32ab7171667df20008415177c74edaf778ae57b3 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Thu, 29 Aug 2024 14:55:07 +0200 Subject: [PATCH] feat(x/bank): add origin address in event multisend (backport #21460) (#21464) Co-authored-by: Julien Robert --- x/bank/keeper/keeper_test.go | 10 ++++------ x/bank/keeper/send.go | 1 + 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/x/bank/keeper/keeper_test.go b/x/bank/keeper/keeper_test.go index 2c4eb43ff312..4f4f682a7862 100644 --- a/x/bank/keeper/keeper_test.go +++ b/x/bank/keeper/keeper_test.go @@ -1468,10 +1468,10 @@ func (suite *KeeperTestSuite) TestMsgMultiSendEvents() { event1.Attributes = append( event1.Attributes, coreevent.Attribute{Key: banktypes.AttributeKeyRecipient, Value: acc2StrAddr}, + coreevent.Attribute{Key: sdk.AttributeKeySender, Value: acc0StrAddr}, + coreevent.Attribute{Key: sdk.AttributeKeyAmount, Value: newCoins.String()}, ) - event1.Attributes = append( - event1.Attributes, - coreevent.Attribute{Key: sdk.AttributeKeyAmount, Value: newCoins.String()}) + event2 := coreevent.Event{ Type: banktypes.EventTypeTransfer, Attributes: []coreevent.Attribute{}, @@ -1479,9 +1479,7 @@ func (suite *KeeperTestSuite) TestMsgMultiSendEvents() { event2.Attributes = append( event2.Attributes, coreevent.Attribute{Key: banktypes.AttributeKeyRecipient, Value: acc3StrAddr}, - ) - event2.Attributes = append( - event2.Attributes, + coreevent.Attribute{Key: sdk.AttributeKeySender, Value: acc0StrAddr}, coreevent.Attribute{Key: sdk.AttributeKeyAmount, Value: newCoins2.String()}, ) // events are shifted due to the funding account events diff --git a/x/bank/keeper/send.go b/x/bank/keeper/send.go index 31354c1b8566..063417b6ca03 100644 --- a/x/bank/keeper/send.go +++ b/x/bank/keeper/send.go @@ -172,6 +172,7 @@ func (k BaseSendKeeper) InputOutputCoins(ctx context.Context, input types.Input, if err := k.EventService.EventManager(ctx).EmitKV( types.EventTypeTransfer, event.NewAttribute(types.AttributeKeyRecipient, out.Address), + event.NewAttribute(types.AttributeKeySender, input.Address), event.NewAttribute(sdk.AttributeKeyAmount, out.Coins.String()), ); err != nil { return err