From bcfdfa3f0cb902d1bc581987f88a0ebd4281767a Mon Sep 17 00:00:00 2001 From: beer-1 <147697694+beer-1@users.noreply.github.com> Date: Tue, 9 Apr 2024 14:02:45 +0900 Subject: [PATCH] emit events --- x/opchild/keeper/msg_server.go | 9 +++++++++ x/opchild/types/events.go | 3 +++ 2 files changed, 12 insertions(+) diff --git a/x/opchild/keeper/msg_server.go b/x/opchild/keeper/msg_server.go index 312cc7c7..ae843511 100644 --- a/x/opchild/keeper/msg_server.go +++ b/x/opchild/keeper/msg_server.go @@ -301,6 +301,15 @@ func (ms MsgServer) SetBridgeInfo(ctx context.Context, req *types.MsgSetBridgeIn return nil, err } + sdkCtx := sdk.UnwrapSDKContext(ctx) + sdkCtx.EventManager().EmitEvent( + sdk.NewEvent( + types.EventTypeSetBridgeInfo, + sdk.NewAttribute(types.AttributeKeyBridgeId, strconv.FormatUint(req.BridgeInfo.BridgeId, 10)), + sdk.NewAttribute(types.AttributeKeyBridgeAddr, req.BridgeInfo.BridgeAddr), + ), + ) + return &types.MsgSetBridgeInfoResponse{}, nil } diff --git a/x/opchild/types/events.go b/x/opchild/types/events.go index 9666434b..7396326b 100644 --- a/x/opchild/types/events.go +++ b/x/opchild/types/events.go @@ -9,8 +9,11 @@ const ( EventTypeExecuteMessages = "execute_messages" EventTypeWhitelist = "whitelist" EventTypeParams = "params" + EventTypeSetBridgeInfo = "set_bridge_info" AttributeKeySender = "sender" + AttributeKeyBridgeId = "bridge_id" + AttributeKeyBridgeAddr = "bridge_addr" AttributeKeyRecipient = "recipient" AttributeKeyAmount = "amount" AttributeKeyDenom = "denom"