From 9e379c24ab1055f3d39120ffaebf7678a0c9a8b6 Mon Sep 17 00:00:00 2001 From: nkitlabs Date: Thu, 12 Dec 2024 14:28:59 +0700 Subject: [PATCH 1/2] add event setMemberIsActive --- x/tss/keeper/keeper_member.go | 9 +++++++++ x/tss/types/events.go | 36 ++++++++++++++++++----------------- 2 files changed, 28 insertions(+), 17 deletions(-) diff --git a/x/tss/keeper/keeper_member.go b/x/tss/keeper/keeper_member.go index 00536a635..dc83d68a3 100644 --- a/x/tss/keeper/keeper_member.go +++ b/x/tss/keeper/keeper_member.go @@ -1,6 +1,7 @@ package keeper import ( + "fmt" "sort" dbm "github.com/cosmos/cosmos-db" @@ -198,6 +199,14 @@ func (k Keeper) SetMemberIsActive(ctx sdk.Context, groupID tss.GroupID, address m.IsActive = status k.SetMember(ctx, m) + + ctx.EventManager().EmitEvent(sdk.NewEvent( + types.EventTypeSetMemberIsActive, + sdk.NewAttribute(types.AttributeKeyAddress, address.String()), + sdk.NewAttribute(types.AttributeKeyGroupID, fmt.Sprintf("%d", groupID)), + sdk.NewAttribute(types.AttributeKeyMemberStatus, fmt.Sprintf("%t", status)), + )) + return nil } diff --git a/x/tss/types/events.go b/x/tss/types/events.go index a3d215449..bbb77504c 100644 --- a/x/tss/types/events.go +++ b/x/tss/types/events.go @@ -1,23 +1,24 @@ package types const ( - EventTypeCreateGroup = "create_group" - EventTypeExpiredGroup = "expired_group" - EventTypeSubmitDKGRound1 = "submit_dkg_round1" - EventTypeRound1Success = "round1_success" - EventTypeSubmitDKGRound2 = "submit_dkg_round2" - EventTypeRound2Success = "round2_success" - EventTypeComplainSuccess = "complain_success" - EventTypeComplainFailed = "complain_failed" - EventTypeConfirmSuccess = "confirm_success" - EventTypeRound3Success = "round3_success" - EventTypeRound3Failed = "round3_failed" - EventTypeRequestSignature = "request_signature" - EventTypeCreateSigning = "create_signing_request" - EventTypeSigningSuccess = "signing_success" - EventTypeSigningFailed = "signing_failed" - EventTypeSubmitSignature = "submit_signature" - EventTypeDEDeleted = "de_deleted" + EventTypeCreateGroup = "create_group" + EventTypeExpiredGroup = "expired_group" + EventTypeSubmitDKGRound1 = "submit_dkg_round1" + EventTypeRound1Success = "round1_success" + EventTypeSubmitDKGRound2 = "submit_dkg_round2" + EventTypeRound2Success = "round2_success" + EventTypeComplainSuccess = "complain_success" + EventTypeComplainFailed = "complain_failed" + EventTypeConfirmSuccess = "confirm_success" + EventTypeRound3Success = "round3_success" + EventTypeRound3Failed = "round3_failed" + EventTypeRequestSignature = "request_signature" + EventTypeCreateSigning = "create_signing_request" + EventTypeSigningSuccess = "signing_success" + EventTypeSigningFailed = "signing_failed" + EventTypeSubmitSignature = "submit_signature" + EventTypeDEDeleted = "de_deleted" + EventTypeSetMemberIsActive = "set_member_is_active" AttributeKeyGroupID = "group_id" AttributeKeyMemberID = "member_id" @@ -48,4 +49,5 @@ const ( AttributeKeyContentType = "content_type" AttributeKeyOriginator = "originator" AttributeKeyOriginatorType = "originator_type" + AttributeKeyMemberStatus = "member_status" ) From ad1a5e031b9664826238f16fb108254685606f66 Mon Sep 17 00:00:00 2001 From: nkitlabs Date: Thu, 12 Dec 2024 14:48:05 +0700 Subject: [PATCH 2/2] fix to memberID --- x/tss/keeper/keeper_member.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/tss/keeper/keeper_member.go b/x/tss/keeper/keeper_member.go index dc83d68a3..5f6fe29b6 100644 --- a/x/tss/keeper/keeper_member.go +++ b/x/tss/keeper/keeper_member.go @@ -202,8 +202,8 @@ func (k Keeper) SetMemberIsActive(ctx sdk.Context, groupID tss.GroupID, address ctx.EventManager().EmitEvent(sdk.NewEvent( types.EventTypeSetMemberIsActive, - sdk.NewAttribute(types.AttributeKeyAddress, address.String()), sdk.NewAttribute(types.AttributeKeyGroupID, fmt.Sprintf("%d", groupID)), + sdk.NewAttribute(types.AttributeKeyMemberID, fmt.Sprintf("%d", m.ID)), sdk.NewAttribute(types.AttributeKeyMemberStatus, fmt.Sprintf("%t", status)), ))