diff --git a/.changeset/entries/22c2a6c7f91416899301d06b3b3a7a6bb3a324e0d8575cd332a3558e4eb7e8f0.yaml b/.changeset/entries/22c2a6c7f91416899301d06b3b3a7a6bb3a324e0d8575cd332a3558e4eb7e8f0.yaml new file mode 100644 index 0000000000..c7b582a28a --- /dev/null +++ b/.changeset/entries/22c2a6c7f91416899301d06b3b3a7a6bb3a324e0d8575cd332a3558e4eb7e8f0.yaml @@ -0,0 +1,6 @@ +type: refactor +module: other +pull_request: 1295 +description: Updated the event andattributes names for better naming consistency +backward_compatible: false +date: 2024-02-07T16:14:12.727157086Z diff --git a/types/utils/slices.go b/types/utils/slices.go new file mode 100644 index 0000000000..27ce7489fd --- /dev/null +++ b/types/utils/slices.go @@ -0,0 +1,9 @@ +package utils + +func Map[T, U any](ts []T, f func(T) U) []U { + us := make([]U, len(ts)) + for i := range ts { + us[i] = f(ts[i]) + } + return us +} diff --git a/x/posts/abci.go b/x/posts/abci.go index e8eb512083..3623f0084a 100644 --- a/x/posts/abci.go +++ b/x/posts/abci.go @@ -3,6 +3,8 @@ package posts import ( "fmt" + subspacestypes "github.com/desmos-labs/desmos/v6/x/subspaces/types" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/desmos-labs/desmos/v6/x/posts/keeper" @@ -18,8 +20,8 @@ func EndBlocker(ctx sdk.Context, keeper *keeper.Keeper) { // Emit an event ctx.EventManager().EmitEvent( sdk.NewEvent( - types.EventTypeTallyPoll, - sdk.NewAttribute(types.AttributeKeySubspaceID, fmt.Sprintf("%d", poll.SubspaceID)), + types.EventTypeTalliedPoll, + sdk.NewAttribute(subspacestypes.AttributeKeySubspaceID, fmt.Sprintf("%d", poll.SubspaceID)), sdk.NewAttribute(types.AttributeKeyPostID, fmt.Sprintf("%d", poll.PostID)), sdk.NewAttribute(types.AttributeKeyPollID, fmt.Sprintf("%d", poll.ID)), ), diff --git a/x/posts/keeper/msg_server.go b/x/posts/keeper/msg_server.go index c0f0474c12..ffbb8deb17 100644 --- a/x/posts/keeper/msg_server.go +++ b/x/posts/keeper/msg_server.go @@ -4,8 +4,11 @@ import ( "context" "fmt" "sort" + "strings" "time" + "github.com/desmos-labs/desmos/v6/types/utils" + "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -103,9 +106,9 @@ func (k msgServer) CreatePost(goCtx context.Context, msg *types.MsgCreatePost) ( ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( - types.EventTypeCreatePost, - sdk.NewAttribute(types.AttributeKeySubspaceID, fmt.Sprintf("%d", msg.SubspaceID)), - sdk.NewAttribute(types.AttributeKeySectionID, fmt.Sprintf("%d", msg.SectionID)), + types.EventTypeCreatedPost, + sdk.NewAttribute(subspacestypes.AttributeKeySubspaceID, fmt.Sprintf("%d", msg.SubspaceID)), + sdk.NewAttribute(subspacestypes.AttributeKeySectionID, fmt.Sprintf("%d", msg.SectionID)), sdk.NewAttribute(types.AttributeKeyPostID, fmt.Sprintf("%d", post.ID)), sdk.NewAttribute(types.AttributeKeyAuthor, msg.Author), sdk.NewAttribute(types.AttributeKeyCreationTime, post.CreationDate.Format(time.RFC3339)), @@ -157,8 +160,8 @@ func (k msgServer) EditPost(goCtx context.Context, msg *types.MsgEditPost) (*typ ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( - types.EventTypeEditPost, - sdk.NewAttribute(types.AttributeKeySubspaceID, fmt.Sprintf("%d", msg.SubspaceID)), + types.EventTypeEditedPost, + sdk.NewAttribute(subspacestypes.AttributeKeySubspaceID, fmt.Sprintf("%d", msg.SubspaceID)), sdk.NewAttribute(types.AttributeKeyPostID, fmt.Sprintf("%d", msg.PostID)), sdk.NewAttribute(types.AttributeKeyLastEditTime, updateTime.Format(time.RFC3339)), ), @@ -196,8 +199,8 @@ func (k msgServer) DeletePost(goCtx context.Context, msg *types.MsgDeletePost) ( ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( - types.EventTypeDeletePost, - sdk.NewAttribute(types.AttributeKeySubspaceID, fmt.Sprintf("%d", msg.SubspaceID)), + types.EventTypeDeletedPost, + sdk.NewAttribute(subspacestypes.AttributeKeySubspaceID, fmt.Sprintf("%d", msg.SubspaceID)), sdk.NewAttribute(types.AttributeKeyPostID, fmt.Sprintf("%d", msg.PostID)), ), }) @@ -296,8 +299,8 @@ func (k msgServer) AddPostAttachment(goCtx context.Context, msg *types.MsgAddPos ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( - types.EventTypeAddPostAttachment, - sdk.NewAttribute(types.AttributeKeySubspaceID, fmt.Sprintf("%d", msg.SubspaceID)), + types.EventTypeAddedPostAttachment, + sdk.NewAttribute(subspacestypes.AttributeKeySubspaceID, fmt.Sprintf("%d", msg.SubspaceID)), sdk.NewAttribute(types.AttributeKeyPostID, fmt.Sprintf("%d", msg.PostID)), sdk.NewAttribute(types.AttributeKeyAttachmentID, fmt.Sprintf("%d", attachmentID)), sdk.NewAttribute(types.AttributeKeyLastEditTime, post.LastEditedDate.Format(time.RFC3339)), @@ -353,8 +356,8 @@ func (k msgServer) RemovePostAttachment(goCtx context.Context, msg *types.MsgRem ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( - types.EventTypeRemovePostAttachment, - sdk.NewAttribute(types.AttributeKeySubspaceID, fmt.Sprintf("%d", msg.SubspaceID)), + types.EventTypeRemovedPostAttachment, + sdk.NewAttribute(subspacestypes.AttributeKeySubspaceID, fmt.Sprintf("%d", msg.SubspaceID)), sdk.NewAttribute(types.AttributeKeyPostID, fmt.Sprintf("%d", msg.PostID)), sdk.NewAttribute(types.AttributeKeyAttachmentID, fmt.Sprintf("%d", msg.AttachmentID)), sdk.NewAttribute(types.AttributeKeyLastEditTime, post.LastEditedDate.Format(time.RFC3339)), @@ -432,10 +435,14 @@ func (k msgServer) AnswerPoll(goCtx context.Context, msg *types.MsgAnswerPoll) ( ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( - types.EventTypeAnswerPoll, - sdk.NewAttribute(types.AttributeKeySubspaceID, fmt.Sprintf("%d", msg.SubspaceID)), + types.EventTypeAnsweredPoll, + sdk.NewAttribute(subspacestypes.AttributeKeySubspaceID, fmt.Sprintf("%d", msg.SubspaceID)), sdk.NewAttribute(types.AttributeKeyPostID, fmt.Sprintf("%d", msg.PostID)), sdk.NewAttribute(types.AttributeKeyPollID, fmt.Sprintf("%d", msg.PollID)), + sdk.NewAttribute(types.AttributeKeyAnswersIndexes, strings.Join(utils.Map(msg.AnswersIndexes, func(index uint32) string { + return fmt.Sprintf("%d", index) + }), ",")), + sdk.NewAttribute(types.AttributeKeyAnswerer, msg.Signer), ), }) @@ -530,8 +537,8 @@ func (k msgServer) MovePost(goCtx context.Context, msg *types.MsgMovePost) (*typ ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( - types.EventTypeMovePost, - sdk.NewAttribute(types.AttributeKeySubspaceID, fmt.Sprintf("%d", msg.SubspaceID)), + types.EventTypeMovedPost, + sdk.NewAttribute(subspacestypes.AttributeKeySubspaceID, fmt.Sprintf("%d", msg.SubspaceID)), sdk.NewAttribute(types.AttributeKeyPostID, fmt.Sprintf("%d", msg.PostID)), sdk.NewAttribute(types.AttributeKeyNewSubspaceID, fmt.Sprintf("%d", msg.TargetSubspaceID)), sdk.NewAttribute(types.AttributeKeyNewPostID, fmt.Sprintf("%d", updatedPost.ID)), @@ -586,8 +593,8 @@ func (k msgServer) RequestPostOwnerTransfer(goCtx context.Context, msg *types.Ms ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( - types.EventTypeRequestPostOwnerTransfer, - sdk.NewAttribute(types.AttributeKeySubspaceID, fmt.Sprintf("%d", msg.SubspaceID)), + types.EventTypeRequestedPostOwnerTransfer, + sdk.NewAttribute(subspacestypes.AttributeKeySubspaceID, fmt.Sprintf("%d", msg.SubspaceID)), sdk.NewAttribute(types.AttributeKeyPostID, fmt.Sprintf("%d", msg.PostID)), sdk.NewAttribute(types.AttributeKeyReceiver, msg.Receiver), sdk.NewAttribute(types.AttributeKeySender, msg.Sender), @@ -617,8 +624,8 @@ func (k msgServer) CancelPostOwnerTransferRequest(goCtx context.Context, msg *ty ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( - types.EventTypeCancelPostOwnerTransfer, - sdk.NewAttribute(types.AttributeKeySubspaceID, fmt.Sprintf("%d", msg.SubspaceID)), + types.EventTypeCanceledPostOwnerTransfer, + sdk.NewAttribute(subspacestypes.AttributeKeySubspaceID, fmt.Sprintf("%d", msg.SubspaceID)), sdk.NewAttribute(types.AttributeKeyPostID, fmt.Sprintf("%d", msg.PostID)), sdk.NewAttribute(types.AttributeKeySender, msg.Sender), ), @@ -673,8 +680,8 @@ func (k msgServer) AcceptPostOwnerTransferRequest(goCtx context.Context, msg *ty ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( - types.EventTypeAcceptPostOwnerTransfer, - sdk.NewAttribute(types.AttributeKeySubspaceID, fmt.Sprintf("%d", msg.SubspaceID)), + types.EventTypeAcceptedPostOwnerTransfer, + sdk.NewAttribute(subspacestypes.AttributeKeySubspaceID, fmt.Sprintf("%d", msg.SubspaceID)), sdk.NewAttribute(types.AttributeKeyPostID, fmt.Sprintf("%d", msg.PostID)), sdk.NewAttribute(types.AttributeKeyReceiver, msg.Receiver), ), @@ -703,8 +710,8 @@ func (k msgServer) RefusePostOwnerTransferRequest(goCtx context.Context, msg *ty ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( - types.EventTypeRefusePostOwnerTransfer, - sdk.NewAttribute(types.AttributeKeySubspaceID, fmt.Sprintf("%d", msg.SubspaceID)), + types.EventTypeRefusedPostOwnerTransfer, + sdk.NewAttribute(subspacestypes.AttributeKeySubspaceID, fmt.Sprintf("%d", msg.SubspaceID)), sdk.NewAttribute(types.AttributeKeyPostID, fmt.Sprintf("%d", msg.PostID)), sdk.NewAttribute(types.AttributeKeyReceiver, msg.Receiver), ), diff --git a/x/posts/keeper/msg_server_test.go b/x/posts/keeper/msg_server_test.go index 860163f21c..54c6a19942 100644 --- a/x/posts/keeper/msg_server_test.go +++ b/x/posts/keeper/msg_server_test.go @@ -364,9 +364,9 @@ func (suite *KeeperTestSuite) TestMsgServer_CreatePost() { }, expEvents: sdk.Events{ sdk.NewEvent( - types.EventTypeCreatePost, - sdk.NewAttribute(types.AttributeKeySubspaceID, "1"), - sdk.NewAttribute(types.AttributeKeySectionID, "0"), + types.EventTypeCreatedPost, + sdk.NewAttribute(subspacestypes.AttributeKeySubspaceID, "1"), + sdk.NewAttribute(subspacestypes.AttributeKeySectionID, "0"), sdk.NewAttribute(types.AttributeKeyPostID, "1"), sdk.NewAttribute(types.AttributeKeyAuthor, "cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd"), sdk.NewAttribute(types.AttributeKeyCreationTime, time.Date(2020, 1, 1, 12, 00, 00, 000, time.UTC).Format(time.RFC3339)), @@ -480,9 +480,9 @@ func (suite *KeeperTestSuite) TestMsgServer_CreatePost() { }, expEvents: sdk.Events{ sdk.NewEvent( - types.EventTypeCreatePost, - sdk.NewAttribute(types.AttributeKeySubspaceID, "1"), - sdk.NewAttribute(types.AttributeKeySectionID, "0"), + types.EventTypeCreatedPost, + sdk.NewAttribute(subspacestypes.AttributeKeySubspaceID, "1"), + sdk.NewAttribute(subspacestypes.AttributeKeySectionID, "0"), sdk.NewAttribute(types.AttributeKeyPostID, "2"), sdk.NewAttribute(types.AttributeKeyAuthor, "cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd"), sdk.NewAttribute(types.AttributeKeyCreationTime, time.Date(2020, 1, 1, 12, 00, 00, 000, time.UTC).Format(time.RFC3339)), @@ -767,8 +767,8 @@ func (suite *KeeperTestSuite) TestMsgServer_EditPost() { }, expEvents: sdk.Events{ sdk.NewEvent( - types.EventTypeEditPost, - sdk.NewAttribute(types.AttributeKeySubspaceID, "1"), + types.EventTypeEditedPost, + sdk.NewAttribute(subspacestypes.AttributeKeySubspaceID, "1"), sdk.NewAttribute(types.AttributeKeyPostID, "1"), sdk.NewAttribute(types.AttributeKeyLastEditTime, time.Date(2021, 1, 1, 12, 00, 00, 000, time.UTC).Format(time.RFC3339)), ), @@ -968,8 +968,8 @@ func (suite *KeeperTestSuite) TestMsgServer_DeletePost() { shouldErr: false, expEvents: sdk.Events{ sdk.NewEvent( - types.EventTypeDeletePost, - sdk.NewAttribute(types.AttributeKeySubspaceID, "1"), + types.EventTypeDeletedPost, + sdk.NewAttribute(subspacestypes.AttributeKeySubspaceID, "1"), sdk.NewAttribute(types.AttributeKeyPostID, "1"), ), }, @@ -1019,8 +1019,8 @@ func (suite *KeeperTestSuite) TestMsgServer_DeletePost() { msg: types.NewMsgDeletePost(1, 1, "cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd"), expEvents: sdk.Events{ sdk.NewEvent( - types.EventTypeDeletePost, - sdk.NewAttribute(types.AttributeKeySubspaceID, "1"), + types.EventTypeDeletedPost, + sdk.NewAttribute(subspacestypes.AttributeKeySubspaceID, "1"), sdk.NewAttribute(types.AttributeKeyPostID, "1"), ), }, @@ -1260,8 +1260,8 @@ func (suite *KeeperTestSuite) TestMsgServer_AddPostAttachment() { }, expEvents: sdk.Events{ sdk.NewEvent( - types.EventTypeAddPostAttachment, - sdk.NewAttribute(types.AttributeKeySubspaceID, "1"), + types.EventTypeAddedPostAttachment, + sdk.NewAttribute(subspacestypes.AttributeKeySubspaceID, "1"), sdk.NewAttribute(types.AttributeKeyPostID, "1"), sdk.NewAttribute(types.AttributeKeyAttachmentID, "1"), sdk.NewAttribute(types.AttributeKeyLastEditTime, time.Date(2021, 1, 1, 12, 00, 00, 000, time.UTC).Format(time.RFC3339)), @@ -1584,8 +1584,8 @@ func (suite *KeeperTestSuite) TestMsgServer_RemovePostAttachment() { }, expEvents: sdk.Events{ sdk.NewEvent( - types.EventTypeRemovePostAttachment, - sdk.NewAttribute(types.AttributeKeySubspaceID, "1"), + types.EventTypeRemovedPostAttachment, + sdk.NewAttribute(subspacestypes.AttributeKeySubspaceID, "1"), sdk.NewAttribute(types.AttributeKeyPostID, "1"), sdk.NewAttribute(types.AttributeKeyAttachmentID, "1"), sdk.NewAttribute(types.AttributeKeyLastEditTime, time.Date(2021, 1, 1, 12, 00, 00, 000, time.UTC).Format(time.RFC3339)), @@ -1666,8 +1666,8 @@ func (suite *KeeperTestSuite) TestMsgServer_RemovePostAttachment() { }, expEvents: sdk.Events{ sdk.NewEvent( - types.EventTypeRemovePostAttachment, - sdk.NewAttribute(types.AttributeKeySubspaceID, "1"), + types.EventTypeRemovedPostAttachment, + sdk.NewAttribute(subspacestypes.AttributeKeySubspaceID, "1"), sdk.NewAttribute(types.AttributeKeyPostID, "1"), sdk.NewAttribute(types.AttributeKeyAttachmentID, "1"), sdk.NewAttribute(types.AttributeKeyLastEditTime, time.Date(2021, 1, 1, 12, 00, 00, 000, time.UTC).Format(time.RFC3339)), @@ -2188,10 +2188,12 @@ func (suite *KeeperTestSuite) TestMsgServer_AnswerPoll() { shouldErr: false, expEvents: sdk.Events{ sdk.NewEvent( - types.EventTypeAnswerPoll, - sdk.NewAttribute(types.AttributeKeySubspaceID, "1"), + types.EventTypeAnsweredPoll, + sdk.NewAttribute(subspacestypes.AttributeKeySubspaceID, "1"), sdk.NewAttribute(types.AttributeKeyPostID, "1"), sdk.NewAttribute(types.AttributeKeyPollID, "1"), + sdk.NewAttribute(types.AttributeKeyAnswersIndexes, "0"), + sdk.NewAttribute(types.AttributeKeyAnswerer, "cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd"), ), }, check: func(ctx sdk.Context) { @@ -2269,10 +2271,12 @@ func (suite *KeeperTestSuite) TestMsgServer_AnswerPoll() { shouldErr: false, expEvents: sdk.Events{ sdk.NewEvent( - types.EventTypeAnswerPoll, - sdk.NewAttribute(types.AttributeKeySubspaceID, "1"), + types.EventTypeAnsweredPoll, + sdk.NewAttribute(subspacestypes.AttributeKeySubspaceID, "1"), sdk.NewAttribute(types.AttributeKeyPostID, "1"), sdk.NewAttribute(types.AttributeKeyPollID, "1"), + sdk.NewAttribute(types.AttributeKeyAnswersIndexes, "0,1"), + sdk.NewAttribute(types.AttributeKeyAnswerer, "cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd"), ), }, check: func(ctx sdk.Context) { @@ -2766,8 +2770,8 @@ func (suite *KeeperTestSuite) TestMsgServer_MovePost() { shouldErr: false, expEvents: sdk.Events{ sdk.NewEvent( - types.EventTypeMovePost, - sdk.NewAttribute(types.AttributeKeySubspaceID, "1"), + types.EventTypeMovedPost, + sdk.NewAttribute(subspacestypes.AttributeKeySubspaceID, "1"), sdk.NewAttribute(types.AttributeKeyPostID, "1"), sdk.NewAttribute(types.AttributeKeyNewSubspaceID, "2"), sdk.NewAttribute(types.AttributeKeyNewPostID, "2"), @@ -3155,8 +3159,8 @@ func (suite *KeeperTestSuite) TestMsgServer_RequestPostOwnerTransfer() { expResponse: &types.MsgRequestPostOwnerTransferResponse{}, expEvents: sdk.Events{ sdk.NewEvent( - types.EventTypeRequestPostOwnerTransfer, - sdk.NewAttribute(types.AttributeKeySubspaceID, "1"), + types.EventTypeRequestedPostOwnerTransfer, + sdk.NewAttribute(subspacestypes.AttributeKeySubspaceID, "1"), sdk.NewAttribute(types.AttributeKeyPostID, "1"), sdk.NewAttribute(types.AttributeKeyReceiver, "cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd"), sdk.NewAttribute(types.AttributeKeySender, "cosmos1eqpa6mv2jgevukaqtjmx5535vhc3mm3cf458zg"), @@ -3264,8 +3268,8 @@ func (suite *KeeperTestSuite) TestMsgServer_CancelPostOwnerTransfer() { expResponse: &types.MsgCancelPostOwnerTransferRequestResponse{}, expEvents: sdk.Events{ sdk.NewEvent( - types.EventTypeCancelPostOwnerTransfer, - sdk.NewAttribute(types.AttributeKeySubspaceID, "1"), + types.EventTypeCanceledPostOwnerTransfer, + sdk.NewAttribute(subspacestypes.AttributeKeySubspaceID, "1"), sdk.NewAttribute(types.AttributeKeyPostID, "1"), sdk.NewAttribute(types.AttributeKeySender, "cosmos1eqpa6mv2jgevukaqtjmx5535vhc3mm3cf458zg"), ), @@ -3504,8 +3508,8 @@ func (suite *KeeperTestSuite) TestMsgServer_AcceptPostOwnerTransfer() { expResponse: &types.MsgAcceptPostOwnerTransferRequestResponse{}, expEvents: sdk.Events{ sdk.NewEvent( - types.EventTypeAcceptPostOwnerTransfer, - sdk.NewAttribute(types.AttributeKeySubspaceID, "1"), + types.EventTypeAcceptedPostOwnerTransfer, + sdk.NewAttribute(subspacestypes.AttributeKeySubspaceID, "1"), sdk.NewAttribute(types.AttributeKeyPostID, "1"), sdk.NewAttribute(types.AttributeKeyReceiver, "cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd"), ), @@ -3599,8 +3603,8 @@ func (suite *KeeperTestSuite) TestMsgServer_RefusePostOwnerTransfer() { expResponse: &types.MsgRefusePostOwnerTransferRequestResponse{}, expEvents: sdk.Events{ sdk.NewEvent( - types.EventTypeRefusePostOwnerTransfer, - sdk.NewAttribute(types.AttributeKeySubspaceID, "1"), + types.EventTypeRefusedPostOwnerTransfer, + sdk.NewAttribute(subspacestypes.AttributeKeySubspaceID, "1"), sdk.NewAttribute(types.AttributeKeyPostID, "1"), sdk.NewAttribute(types.AttributeKeyReceiver, "cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd"), ), diff --git a/x/posts/spec/05-events.md b/x/posts/spec/05-events.md index b2075a6213..1924f9ab23 100644 --- a/x/posts/spec/05-events.md +++ b/x/posts/spec/05-events.md @@ -13,72 +13,72 @@ The posts module emits the following events: ### MsgCreatePost -| **Type** | **Attribute Key** | **Attribute Value** | -|:------------|:------------------|:------------------------------| -| create_post | subspace_id | {subspaceID} | -| create_post | section_id | {sectionID} | -| create_post | post_id | {postID} | -| create_post | author | {userAddress} | -| create_post | creation_time | {CreationTime} | -| message | module | posts | -| message | action | desmos.posts.v3.MsgCreatePost | -| message | sender | {userAddress} | +| **Type** | **Attribute Key** | **Attribute Value** | +|:-------------|:------------------|:------------------------------| +| created_post | subspace_id | {subspaceID} | +| created_post | section_id | {sectionID} | +| created_post | post_id | {postID} | +| created_post | author | {userAddress} | +| created_post | creation_time | {CreationTime} | +| message | module | posts | +| message | action | desmos.posts.v3.MsgCreatePost | +| message | sender | {userAddress} | ### MsgEditPost -| **Type** | **Attribute Key** | **Attribute Value** | -|:----------|:------------------|:----------------------------| -| edit_post | subspace_id | {subspaceID} | -| edit_post | post_id | {postID} | -| edit_post | last_edit_time | {LastEditTime} | -| message | module | posts | -| message | action | desmos.posts.v3.MsgEditPost | -| message | sender | {userAddress} | +| **Type** | **Attribute Key** | **Attribute Value** | +|:------------|:------------------|:----------------------------| +| edited_post | subspace_id | {subspaceID} | +| edited_post | post_id | {postID} | +| edited_post | last_edit_time | {LastEditTime} | +| message | module | posts | +| message | action | desmos.posts.v3.MsgEditPost | +| message | sender | {userAddress} | ### MsgDeletePost -| **Type** | **Attribute Key** | **Attribute Value** | -|:------------|:------------------|:------------------------------| -| delete_post | subspace_id | {subspaceID} | -| delete_post | post_id | {postID} | -| message | module | posts | -| message | action | desmos.posts.v3.MsgDeletePost | -| message | sender | {userAddress} | +| **Type** | **Attribute Key** | **Attribute Value** | +|:-------------|:------------------|:------------------------------| +| deleted_post | subspace_id | {subspaceID} | +| deleted_post | post_id | {postID} | +| message | module | posts | +| message | action | desmos.posts.v3.MsgDeletePost | +| message | sender | {userAddress} | ### MsgAddPostAttachment -| **Type** | **Attribute Key** | **Attribute Value** | -|:--------------------|:------------------|:-------------------------------------| -| add_post_attachment | subspace_id | {subspaceID} | -| add_post_attachment | post_id | {postID} | -| add_post_attachment | attachment_id | {attachmentID} | -| add_post_attachment | last_edit_time | {lastEditTime} | -| message | module | posts | -| message | action | desmos.posts.v3.MsgAddPostAttachment | -| message | sender | {userAddress} | +| **Type** | **Attribute Key** | **Attribute Value** | +|:----------------------|:------------------|:-------------------------------------| +| added_post_attachment | subspace_id | {subspaceID} | +| added_post_attachment | post_id | {postID} | +| added_post_attachment | attachment_id | {attachmentID} | +| added_post_attachment | last_edit_time | {lastEditTime} | +| message | module | posts | +| message | action | desmos.posts.v3.MsgAddPostAttachment | +| message | sender | {userAddress} | ### MsgRemovePostAttachment -| **Type** | **Attribute Key** | **Attribute Value** | -|:-----------------------|:------------------|:----------------------------------------| -| remove_post_attachment | subspace_id | {subspaceID} | -| remove_post_attachment | post_id | {postID} | -| remove_post_attachment | attachment_id | {attachmentID} | -| remove_post_attachment | last_edit_time | {lastEditTime} | -| message | module | posts | -| message | action | desmos.posts.v3.MsgRemovePostAttachment | -| message | sender | {userAddress} | +| **Type** | **Attribute Key** | **Attribute Value** | +|:------------------------|:------------------|:----------------------------------------| +| removed_post_attachment | subspace_id | {subspaceID} | +| removed_post_attachment | post_id | {postID} | +| removed_post_attachment | attachment_id | {attachmentID} | +| removed_post_attachment | last_edit_time | {lastEditTime} | +| message | module | posts | +| message | action | desmos.posts.v3.MsgRemovePostAttachment | +| message | sender | {userAddress} | ### MsgAnswerPoll -| **Type** | **Attribute Key** | **Attribute Value** | -|:------------|:------------------|:------------------------------| -| answer_poll | subspace_id | {subspaceID} | -| answer_poll | post_id | {postID} | -| answer_poll | poll_id | {pollID} | -| message | module | posts | -| message | action | desmos.posts.v3.MsgAnswerPoll | -| message | sender | {userAddress} | +| **Type** | **Attribute Key** | **Attribute Value** | +|:--------------|:------------------|:------------------------------| +| answered_poll | subspace_id | {subspaceID} | +| answered_poll | post_id | {postID} | +| answered_poll | poll_id | {pollID} | +| message | module | posts | +| message | action | desmos.posts.v3.MsgAnswerPoll | +| message | sender | {userAddress} | ### MsgUpdateParams @@ -88,69 +88,69 @@ The posts module emits the following events: | message | action | desmos.posts.v3.MsgUpdateParams | | message | sender | {userAddress} | -## MsgMovePost - -| **Type** | **Attribute Key** | **Attribute Value** | -|:----------|:------------------|:----------------------------| -| move_post | subspace_id | {subspaceID} | -| move_post | post_id | {postID} | -| move_post | new_subspace_id | {newSubspaceID} | -| move_post | new_post_id | {newPostID} | -| message | module | posts | -| message | action | desmos.posts.v3.MsgMovePost | -| message | sender | {userAddress} | - -## MsgRequestPostOwnerTransfer - -| **Type** | **Attribute Key** | **Attribute Value** | -|:----------------------------|:------------------|:--------------------------------------------| -| request_post_owner_transfer | subspace_id | {subspaceID} | -| request_post_owner_transfer | post_id | {postID} | -| request_post_owner_transfer | receiver | {receiverAddress} | -| request_post_owner_transfer | sender | {senderAddress} | -| message | module | posts | -| message | action | desmos.posts.v3.MsgRequestPostOwnerTransfer | -| message | sender | {userAddress} | - -## MsgCancelPostOwnerTransferRequest - -| **Type** | **Attribute Key** | **Attribute Value** | -|:---------------------------|:------------------|:--------------------------------------------------| -| cancel_post_owner_transfer | subspace_id | {subspaceID} | -| cancel_post_owner_transfer | post_id | {postID} | -| cancel_post_owner_transfer | sender | {senderAddress} | -| message | module | posts | -| message | action | desmos.posts.v3.MsgCancelPostOwnerTransferRequest | -| message | sender | {userAddress} | - -## MsgAcceptPostOwnerTransferRequest - -| **Type** | **Attribute Key** | **Attribute Value** | -|:---------------------------|:------------------|:--------------------------------------------------| -| accept_post_owner_transfer | subspace_id | {subspaceID} | -| accept_post_owner_transfer | post_id | {postID} | -| accept_post_owner_transfer | new_subspace_id | {newSubspaceID} | -| accept_post_owner_transfer | new_post_id | {newPostID} | -| accept_post_owner_transfer | receiver | {receiverAddress} | -| message | module | posts | -| message | action | desmos.posts.v3.MsgAcceptPostOwnerTransferRequest | -| message | sender | {userAddress} | - -## MsgRefusePostOwnerTransferRequest - -| **Type** | **Attribute Key** | **Attribute Value** | -|:---------------------------|:------------------|:--------------------------------------------------| -| refuse_post_owner_transfer | subspace_id | {subspaceID} | -| refuse_post_owner_transfer | post_id | {postID} | -| refuse_post_owner_transfer | receiver | {receiverAddress} | -| message | module | posts | -| message | action | desmos.posts.v3.MsgRefusePostOwnerTransferRequest | -| message | sender | {userAddress} | +### MsgMovePost + +| **Type** | **Attribute Key** | **Attribute Value** | +|:-----------|:------------------|:----------------------------| +| moved_post | subspace_id | {subspaceID} | +| moved_post | post_id | {postID} | +| moved_post | new_subspace_id | {newSubspaceID} | +| moved_post | new_post_id | {newPostID} | +| message | module | posts | +| message | action | desmos.posts.v3.MsgMovePost | +| message | sender | {userAddress} | + +### MsgRequestPostOwnerTransfer + +| **Type** | **Attribute Key** | **Attribute Value** | +|:------------------------------|:------------------|:--------------------------------------------| +| requested_post_owner_transfer | subspace_id | {subspaceID} | +| requested_post_owner_transfer | post_id | {postID} | +| requested_post_owner_transfer | receiver | {receiverAddress} | +| requested_post_owner_transfer | sender | {senderAddress} | +| message | module | posts | +| message | action | desmos.posts.v3.MsgRequestPostOwnerTransfer | +| message | sender | {userAddress} | + +### MsgCancelPostOwnerTransferRequest + +| **Type** | **Attribute Key** | **Attribute Value** | +|:-----------------------------|:------------------|:--------------------------------------------------| +| canceled_post_owner_transfer | subspace_id | {subspaceID} | +| canceled_post_owner_transfer | post_id | {postID} | +| canceled_post_owner_transfer | sender | {senderAddress} | +| message | module | posts | +| message | action | desmos.posts.v3.MsgCancelPostOwnerTransferRequest | +| message | sender | {userAddress} | + +### MsgAcceptPostOwnerTransferRequest + +| **Type** | **Attribute Key** | **Attribute Value** | +|:-----------------------------|:------------------|:--------------------------------------------------| +| accepted_post_owner_transfer | subspace_id | {subspaceID} | +| accepted_post_owner_transfer | post_id | {postID} | +| accepted_post_owner_transfer | new_subspace_id | {newSubspaceID} | +| accepted_post_owner_transfer | new_post_id | {newPostID} | +| accepted_post_owner_transfer | receiver | {receiverAddress} | +| message | module | posts | +| message | action | desmos.posts.v3.MsgAcceptPostOwnerTransferRequest | +| message | sender | {userAddress} | + +### MsgRefusePostOwnerTransferRequest + +| **Type** | **Attribute Key** | **Attribute Value** | +|:----------------------------|:------------------|:--------------------------------------------------| +| refused_post_owner_transfer | subspace_id | {subspaceID} | +| refused_post_owner_transfer | post_id | {postID} | +| refused_post_owner_transfer | receiver | {receiverAddress} | +| message | module | posts | +| message | action | desmos.posts.v3.MsgRefusePostOwnerTransferRequest | +| message | sender | {userAddress} | ## Keeper -| **Type** | **Attribute Key** | **Attribute Value** | -|:-----------|:------------------|:--------------------| -| tally_poll | subspace_id | {subspaceID} | -| tally_poll | post_id | {postID} | -| tally_poll | poll_id | {pollID} | \ No newline at end of file +| **Type** | **Attribute Key** | **Attribute Value** | +|:-------------|:------------------|:--------------------| +| tallied_poll | subspace_id | {subspaceID} | +| tallied_poll | post_id | {postID} | +| tallied_poll | poll_id | {pollID} | \ No newline at end of file diff --git a/x/posts/types/events.go b/x/posts/types/events.go index 9a97feec7e..2b1805eaf9 100644 --- a/x/posts/types/events.go +++ b/x/posts/types/events.go @@ -2,29 +2,29 @@ package types // Posts module event types const ( - EventTypeCreatePost = "create_post" - EventTypeEditPost = "edit_post" - EventTypeDeletePost = "delete_post" - EventTypeAddPostAttachment = "add_post_attachment" - EventTypeRemovePostAttachment = "remove_post_attachment" - EventTypeAnswerPoll = "answer_poll" - EventTypeTallyPoll = "tally_poll" - EventTypeMovePost = "move_post" - EventTypeRequestPostOwnerTransfer = "request_post_owner_transfer" - EventTypeCancelPostOwnerTransfer = "cancel_post_owner_transfer" - EventTypeAcceptPostOwnerTransfer = "accept_post_owner_transfer" - EventTypeRefusePostOwnerTransfer = "refuse_post_owner_transfer" + EventTypeCreatedPost = "created_post" + EventTypeEditedPost = "edited_post" + EventTypeDeletedPost = "deleted_post" + EventTypeAddedPostAttachment = "added_post_attachment" + EventTypeRemovedPostAttachment = "removed_post_attachment" + EventTypeAnsweredPoll = "answered_poll" + EventTypeTalliedPoll = "tallied_poll" + EventTypeMovedPost = "moved_post" + EventTypeRequestedPostOwnerTransfer = "requested_post_owner_transfer" + EventTypeCanceledPostOwnerTransfer = "canceled_post_owner_transfer" + EventTypeAcceptedPostOwnerTransfer = "accepted_post_owner_transfer" + EventTypeRefusedPostOwnerTransfer = "refused_post_owner_transfer" - AttributeKeySubspaceID = "subspace_id" - AttributeKeySectionID = "section_id" - AttributeKeyPostID = "post_id" - AttributeKeyAuthor = "author" - AttributeKeyCreationTime = "creation_date" - AttributeKeyLastEditTime = "last_edit_date" - AttributeKeyAttachmentID = "attachment_id" - AttributeKeyPollID = "poll_id" - AttributeKeyNewSubspaceID = "new_subspace_id" - AttributeKeyNewPostID = "new_post_id" - AttributeKeySender = "sender" - AttributeKeyReceiver = "receiver" + AttributeKeyPostID = "post_id" + AttributeKeyAuthor = "author" + AttributeKeyCreationTime = "creation_date" + AttributeKeyLastEditTime = "last_edit_date" + AttributeKeyAttachmentID = "attachment_id" + AttributeKeyPollID = "poll_id" + AttributeKeyAnswersIndexes = "answers_indexes" + AttributeKeyAnswerer = "answerer" + AttributeKeyNewSubspaceID = "new_subspace_id" + AttributeKeyNewPostID = "new_post_id" + AttributeKeySender = "sender" + AttributeKeyReceiver = "receiver" ) diff --git a/x/profiles/abci_test.go b/x/profiles/abci_test.go index bf1984cc1e..b470ecda01 100644 --- a/x/profiles/abci_test.go +++ b/x/profiles/abci_test.go @@ -86,7 +86,7 @@ func TestBeginBlocker(t *testing.T) { }, expEvents: sdk.Events{ sdk.NewEvent( - types.EventTypeApplicationLinkDeleted, + types.EventTypeDeletedApplicationLink, sdk.NewAttribute(types.AttributeKeyUser, "cosmos10nsdxxdvy9qka3zv0lzw8z9cnu6kanld8jh773"), sdk.NewAttribute(types.AttributeKeyApplicationName, "twitter"), sdk.NewAttribute(types.AttributeKeyApplicationUsername, "twitteruser"), diff --git a/x/profiles/ibc_module.go b/x/profiles/ibc_module.go index 5871de9b19..3f61085c47 100644 --- a/x/profiles/ibc_module.go +++ b/x/profiles/ibc_module.go @@ -241,11 +241,11 @@ func handleLinkChainAccountPacketData( ctx.EventManager().EmitEvent( sdk.NewEvent( - types.EventTypeLinkChainAccountPacket, + types.EventTypeReceivedLinkChainAccountPacket, sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName), + sdk.NewAttribute(types.AttributeKeyChainLinkOwner, packetData.DestinationAddress), sdk.NewAttribute(types.AttributeKeyChainLinkExternalAddress, address.GetValue()), sdk.NewAttribute(types.AttributeKeyChainLinkChainName, packetData.SourceChainConfig.Name), - sdk.NewAttribute(types.AttributeKeyChainLinkOwner, packetData.DestinationAddress), sdk.NewAttribute(types.AttributeKeyAckSuccess, fmt.Sprintf("%t", true)), ), ) @@ -253,30 +253,30 @@ func handleLinkChainAccountPacketData( return true, acknowledgement, nil } -// handleOracleRequestPacketData tries handling athe given packet by deserializing the inner data +// handleOracleRequestPacketData tries handling the given packet by deserializing the inner data // as an OracleResponsePacketData instance. func handleOracleRequestPacketData( am IBCModule, ctx sdk.Context, packet channeltypes.Packet, ) (handled bool, ack channeltypes.Acknowledgement, err error) { - var data oracletypes.OracleResponsePacketData - if err := am.cdc.UnmarshalJSON(packet.GetData(), &data); err != nil { + var packetData oracletypes.OracleResponsePacketData + if err := am.cdc.UnmarshalJSON(packet.GetData(), &packetData); err != nil { return false, channeltypes.Acknowledgement{}, nil } acknowledgement := channeltypes.NewResultAcknowledgement([]byte{byte(1)}) - err = am.keeper.OnRecvApplicationLinkPacketData(ctx, data) + err = am.keeper.OnRecvApplicationLinkPacketData(ctx, packetData) if err != nil { acknowledgement = channeltypes.NewErrorAcknowledgement(err) } ctx.EventManager().EmitEvent( sdk.NewEvent( - types.EventTypePacket, + types.EventTypeReceivedOracleResponsePacketData, sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName), - sdk.NewAttribute(types.AttributeKeyClientID, data.ClientID), - sdk.NewAttribute(types.AttributeKeyRequestID, fmt.Sprintf("%d", data.RequestID)), - sdk.NewAttribute(types.AttributeKeyResolveStatus, data.ResolveStatus.String()), + sdk.NewAttribute(types.AttributeKeyClientID, packetData.ClientID), + sdk.NewAttribute(types.AttributeKeyRequestID, fmt.Sprintf("%d", packetData.RequestID)), + sdk.NewAttribute(types.AttributeKeyResolveStatus, packetData.ResolveStatus.String()), sdk.NewAttribute(types.AttributeKeyAckSuccess, fmt.Sprintf("%t", true)), ), ) @@ -315,7 +315,7 @@ func (am IBCModule) OnAcknowledgementPacket( ctx.EventManager().EmitEvent( sdk.NewEvent( - types.EventTypePacket, + types.EventTypeReceivedOracleResponsePacketData, sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName), sdk.NewAttribute(types.AttributeKeyClientID, data.ClientID), sdk.NewAttribute(types.AttributeKeyAck, fmt.Sprintf("%v", ack)), @@ -326,14 +326,14 @@ func (am IBCModule) OnAcknowledgementPacket( case *channeltypes.Acknowledgement_Result: ctx.EventManager().EmitEvent( sdk.NewEvent( - types.EventTypePacket, + types.EventTypeReceivedOracleResponsePacketData, sdk.NewAttribute(types.AttributeKeyAckSuccess, string(resp.Result)), ), ) case *channeltypes.Acknowledgement_Error: ctx.EventManager().EmitEvent( sdk.NewEvent( - types.EventTypePacket, + types.EventTypeReceivedOracleResponsePacketData, sdk.NewAttribute(types.AttributeKeyAckError, resp.Error), ), ) diff --git a/x/profiles/keeper/keeper_app_links.go b/x/profiles/keeper/keeper_app_links.go index 94be07c93a..706c65c503 100644 --- a/x/profiles/keeper/keeper_app_links.go +++ b/x/profiles/keeper/keeper_app_links.go @@ -33,7 +33,7 @@ func (k Keeper) SaveApplicationLink(ctx sdk.Context, link types.ApplicationLink) ctx.EventManager().EmitEvent( sdk.NewEvent( - types.EventTypesApplicationLinkSaved, + types.EventTypeSavedApplicationLink, sdk.NewAttribute(types.AttributeKeyUser, link.User), sdk.NewAttribute(types.AttributeKeyApplicationName, link.Data.Application), sdk.NewAttribute(types.AttributeKeyApplicationUsername, link.Data.Username), @@ -108,7 +108,7 @@ func (k Keeper) DeleteApplicationLink(ctx sdk.Context, appLink types.Application ctx.EventManager().EmitEvent( sdk.NewEvent( - types.EventTypeApplicationLinkDeleted, + types.EventTypeDeletedApplicationLink, sdk.NewAttribute(types.AttributeKeyUser, appLink.User), sdk.NewAttribute(types.AttributeKeyApplicationName, appLink.Data.Application), sdk.NewAttribute(types.AttributeKeyApplicationUsername, appLink.Data.Username), diff --git a/x/profiles/keeper/keeper_app_links_test.go b/x/profiles/keeper/keeper_app_links_test.go index 05610c7488..bb8a12d70d 100644 --- a/x/profiles/keeper/keeper_app_links_test.go +++ b/x/profiles/keeper/keeper_app_links_test.go @@ -62,7 +62,7 @@ func (suite *KeeperTestSuite) Test_SaveApplicationLink() { shouldErr: false, expEvents: sdk.Events{ sdk.NewEvent( - types.EventTypesApplicationLinkSaved, + types.EventTypeSavedApplicationLink, sdk.NewAttribute(types.AttributeKeyUser, "cosmos10nsdxxdvy9qka3zv0lzw8z9cnu6kanld8jh773"), sdk.NewAttribute(types.AttributeKeyApplicationName, "twitter"), sdk.NewAttribute(types.AttributeKeyApplicationUsername, "twitteruser"), @@ -422,7 +422,7 @@ func (suite *KeeperTestSuite) Test_DeleteApplicationLink() { ), expEvents: sdk.Events{ sdk.NewEvent( - types.EventTypeApplicationLinkDeleted, + types.EventTypeDeletedApplicationLink, sdk.NewAttribute(types.AttributeKeyUser, "cosmos1xvvggrlgjkhu4rva9j500rc52za2smxhluvftc"), sdk.NewAttribute(types.AttributeKeyApplicationName, "twitter"), sdk.NewAttribute(types.AttributeKeyApplicationUsername, "twitteruser"), @@ -476,7 +476,7 @@ func (suite *KeeperTestSuite) Test_DeleteApplicationLink() { ), expEvents: sdk.Events{ sdk.NewEvent( - types.EventTypeApplicationLinkDeleted, + types.EventTypeDeletedApplicationLink, sdk.NewAttribute(types.AttributeKeyUser, "cosmos10nsdxxdvy9qka3zv0lzw8z9cnu6kanld8jh773"), sdk.NewAttribute(types.AttributeKeyApplicationName, "github"), sdk.NewAttribute(types.AttributeKeyApplicationUsername, "twitteruser"), @@ -530,7 +530,7 @@ func (suite *KeeperTestSuite) Test_DeleteApplicationLink() { ), expEvents: sdk.Events{ sdk.NewEvent( - types.EventTypeApplicationLinkDeleted, + types.EventTypeDeletedApplicationLink, sdk.NewAttribute(types.AttributeKeyUser, "cosmos10nsdxxdvy9qka3zv0lzw8z9cnu6kanld8jh773"), sdk.NewAttribute(types.AttributeKeyApplicationName, "twitter"), sdk.NewAttribute(types.AttributeKeyApplicationUsername, "another-user"), @@ -584,7 +584,7 @@ func (suite *KeeperTestSuite) Test_DeleteApplicationLink() { ), expEvents: sdk.Events{ sdk.NewEvent( - types.EventTypeApplicationLinkDeleted, + types.EventTypeDeletedApplicationLink, sdk.NewAttribute(types.AttributeKeyUser, "cosmos10nsdxxdvy9qka3zv0lzw8z9cnu6kanld8jh773"), sdk.NewAttribute(types.AttributeKeyApplicationName, "twitter"), sdk.NewAttribute(types.AttributeKeyApplicationUsername, "twitteruser"), diff --git a/x/profiles/keeper/keeper_chain_links.go b/x/profiles/keeper/keeper_chain_links.go index c072a27127..3bb4cf9367 100644 --- a/x/profiles/keeper/keeper_chain_links.go +++ b/x/profiles/keeper/keeper_chain_links.go @@ -56,6 +56,15 @@ func (k Keeper) SaveChainLink(ctx sdk.Context, link types.ChainLink) error { k.SaveDefaultExternalAddress(ctx, link.User, link.ChainConfig.Name, srcAddrData.GetValue()) } + ctx.EventManager().EmitEvent( + sdk.NewEvent( + types.EventTypeSavedChainLink, + sdk.NewAttribute(types.AttributeKeyChainLinkExternalAddress, link.GetAddressData().GetValue()), + sdk.NewAttribute(types.AttributeKeyChainLinkChainName, link.ChainConfig.Name), + sdk.NewAttribute(types.AttributeKeyChainLinkOwner, link.User), + ), + ) + k.AfterChainLinkSaved(ctx, link) return nil } diff --git a/x/profiles/keeper/msg_server_app_link.go b/x/profiles/keeper/msg_server_app_link.go index d4e3edb6a8..c79287ffe3 100644 --- a/x/profiles/keeper/msg_server_app_link.go +++ b/x/profiles/keeper/msg_server_app_link.go @@ -49,7 +49,7 @@ func (k Keeper) LinkApplication( ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( - types.EventTypesApplicationLinkCreated, + types.EventTypeCreatedApplicationLink, sdk.NewAttribute(types.AttributeKeyUser, msg.Sender), sdk.NewAttribute(types.AttributeKeyApplicationName, msg.LinkData.Application), sdk.NewAttribute(types.AttributeKeyApplicationUsername, msg.LinkData.Username), diff --git a/x/profiles/keeper/msg_server_app_link_test.go b/x/profiles/keeper/msg_server_app_link_test.go index 8500841ad3..c20076c310 100644 --- a/x/profiles/keeper/msg_server_app_link_test.go +++ b/x/profiles/keeper/msg_server_app_link_test.go @@ -231,13 +231,13 @@ func (suite *KeeperTestSuite) TestMsgServer_LinkApplication() { ), expEvents: sdk.Events{ sdk.NewEvent( - types.EventTypesApplicationLinkSaved, + types.EventTypeSavedApplicationLink, sdk.NewAttribute(types.AttributeKeyUser, "cosmos10nsdxxdvy9qka3zv0lzw8z9cnu6kanld8jh773"), sdk.NewAttribute(types.AttributeKeyApplicationName, "twitter"), sdk.NewAttribute(types.AttributeKeyApplicationUsername, "twitteruser"), ), sdk.NewEvent( - types.EventTypesApplicationLinkCreated, + types.EventTypeCreatedApplicationLink, sdk.NewAttribute(types.AttributeKeyUser, "cosmos10nsdxxdvy9qka3zv0lzw8z9cnu6kanld8jh773"), sdk.NewAttribute(types.AttributeKeyApplicationName, "twitter"), sdk.NewAttribute(types.AttributeKeyApplicationUsername, "twitteruser"), @@ -337,13 +337,13 @@ func (suite *KeeperTestSuite) TestMsgServer_LinkApplication() { ), expEvents: sdk.Events{ sdk.NewEvent( - types.EventTypesApplicationLinkSaved, + types.EventTypeSavedApplicationLink, sdk.NewAttribute(types.AttributeKeyUser, "cosmos10nsdxxdvy9qka3zv0lzw8z9cnu6kanld8jh773"), sdk.NewAttribute(types.AttributeKeyApplicationName, "twitter"), sdk.NewAttribute(types.AttributeKeyApplicationUsername, "twitteruser"), ), sdk.NewEvent( - types.EventTypesApplicationLinkCreated, + types.EventTypeCreatedApplicationLink, sdk.NewAttribute(types.AttributeKeyUser, "cosmos10nsdxxdvy9qka3zv0lzw8z9cnu6kanld8jh773"), sdk.NewAttribute(types.AttributeKeyApplicationName, "twitter"), sdk.NewAttribute(types.AttributeKeyApplicationUsername, "twitteruser"), @@ -510,7 +510,7 @@ func (suite *KeeperTestSuite) TestMsgServer_UnlinkApplication() { msg: types.NewMsgUnlinkApplication("twitter", "twitteruser", "cosmos10nsdxxdvy9qka3zv0lzw8z9cnu6kanld8jh773"), expEvents: sdk.Events{ sdk.NewEvent( - types.EventTypeApplicationLinkDeleted, + types.EventTypeDeletedApplicationLink, sdk.NewAttribute(types.AttributeKeyUser, "cosmos10nsdxxdvy9qka3zv0lzw8z9cnu6kanld8jh773"), sdk.NewAttribute(types.AttributeKeyApplicationName, "twitter"), sdk.NewAttribute(types.AttributeKeyApplicationUsername, "twitteruser"), diff --git a/x/profiles/keeper/msg_server_chain_link.go b/x/profiles/keeper/msg_server_chain_link.go index 4e0f5a05bb..5f268346cd 100644 --- a/x/profiles/keeper/msg_server_chain_link.go +++ b/x/profiles/keeper/msg_server_chain_link.go @@ -29,7 +29,7 @@ func (k MsgServer) LinkChainAccount(goCtx context.Context, msg *types.MsgLinkCha ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( - types.EventTypeLinkChainAccount, + types.EventTypeCreatedChainLink, sdk.NewAttribute(types.AttributeKeyChainLinkExternalAddress, srcAddrData.GetValue()), sdk.NewAttribute(types.AttributeKeyChainLinkChainName, msg.ChainConfig.Name), sdk.NewAttribute(types.AttributeKeyChainLinkOwner, msg.Signer), @@ -55,7 +55,7 @@ func (k MsgServer) UnlinkChainAccount(goCtx context.Context, msg *types.MsgUnlin ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( - types.EventTypeUnlinkChainAccount, + types.EventTypeDeletedChainLink, sdk.NewAttribute(types.AttributeKeyChainLinkExternalAddress, msg.Target), sdk.NewAttribute(types.AttributeKeyChainLinkChainName, msg.ChainName), sdk.NewAttribute(types.AttributeKeyChainLinkOwner, msg.Owner), diff --git a/x/profiles/keeper/msg_server_chain_link_test.go b/x/profiles/keeper/msg_server_chain_link_test.go index 3de7b23cfa..330e71e589 100644 --- a/x/profiles/keeper/msg_server_chain_link_test.go +++ b/x/profiles/keeper/msg_server_chain_link_test.go @@ -108,7 +108,13 @@ func (suite *KeeperTestSuite) TestMsgServer_LinkChainAccount() { shouldErr: false, expEvents: sdk.Events{ sdk.NewEvent( - types.EventTypeLinkChainAccount, + types.EventTypeSavedChainLink, + sdk.NewAttribute(types.AttributeKeyChainLinkExternalAddress, srcAddr), + sdk.NewAttribute(types.AttributeKeyChainLinkChainName, "cosmos"), + sdk.NewAttribute(types.AttributeKeyChainLinkOwner, destAddr), + ), + sdk.NewEvent( + types.EventTypeCreatedChainLink, sdk.NewAttribute(types.AttributeKeyChainLinkExternalAddress, srcAddr), sdk.NewAttribute(types.AttributeKeyChainLinkChainName, "cosmos"), sdk.NewAttribute(types.AttributeKeyChainLinkOwner, destAddr), @@ -199,7 +205,7 @@ func (suite *KeeperTestSuite) TestMsgServer_UnlinkChainAccount() { shouldErr: false, expEvents: sdk.Events{ sdk.NewEvent( - types.EventTypeUnlinkChainAccount, + types.EventTypeDeletedChainLink, sdk.NewAttribute(types.AttributeKeyChainLinkExternalAddress, "cosmos1cjf97gpzwmaf30pzvaargfgr884mpp5ak8f7ns"), sdk.NewAttribute(types.AttributeKeyChainLinkChainName, "cosmos"), sdk.NewAttribute(types.AttributeKeyChainLinkOwner, "cosmos1y54exmx84cqtasvjnskf9f63djuuj68p7hqf47"), diff --git a/x/profiles/keeper/msg_server_dtag_transfers.go b/x/profiles/keeper/msg_server_dtag_transfers.go index e9e73bc4bd..4ba37a8b17 100644 --- a/x/profiles/keeper/msg_server_dtag_transfers.go +++ b/x/profiles/keeper/msg_server_dtag_transfers.go @@ -45,7 +45,7 @@ func (k MsgServer) RequestDTagTransfer(goCtx context.Context, msg *types.MsgRequ ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( - types.EventTypeDTagTransferRequest, + types.EventTypeRequestedDTagTransfer, sdk.NewAttribute(types.AttributeKeyDTagToTrade, dTagToTrade), sdk.NewAttribute(types.AttributeKeyRequestSender, transferRequest.Sender), sdk.NewAttribute(types.AttributeKeyRequestReceiver, transferRequest.Receiver), @@ -69,7 +69,7 @@ func (k MsgServer) CancelDTagTransferRequest(goCtx context.Context, msg *types.M ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( - types.EventTypeDTagTransferCancel, + types.EventTypeCanceledDTagTransferRequest, sdk.NewAttribute(types.AttributeKeyRequestSender, msg.Sender), sdk.NewAttribute(types.AttributeKeyRequestReceiver, msg.Receiver), ), @@ -166,7 +166,7 @@ func (k MsgServer) AcceptDTagTransferRequest(goCtx context.Context, msg *types.M ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( - types.EventTypeDTagTransferAccept, + types.EventTypeAcceptedDTagTransferRequest, sdk.NewAttribute(types.AttributeKeyDTagToTrade, dTagToTrade), sdk.NewAttribute(types.AttributeKeyNewDTag, msg.NewDTag), sdk.NewAttribute(types.AttributeKeyRequestSender, msg.Sender), @@ -191,7 +191,7 @@ func (k MsgServer) RefuseDTagTransferRequest(goCtx context.Context, msg *types.M ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( - types.EventTypeDTagTransferRefuse, + types.EventTypeRefusedDTagTransferRequest, sdk.NewAttribute(types.AttributeKeyRequestSender, msg.Sender), sdk.NewAttribute(types.AttributeKeyRequestReceiver, msg.Receiver), ), diff --git a/x/profiles/keeper/msg_server_dtag_transfers_test.go b/x/profiles/keeper/msg_server_dtag_transfers_test.go index e280245e3b..b117506d6e 100644 --- a/x/profiles/keeper/msg_server_dtag_transfers_test.go +++ b/x/profiles/keeper/msg_server_dtag_transfers_test.go @@ -83,7 +83,7 @@ func (suite *KeeperTestSuite) TestMsgServer_RequestDTagTransfer() { shouldErr: false, expEvents: sdk.Events{ sdk.NewEvent( - types.EventTypeDTagTransferRequest, + types.EventTypeRequestedDTagTransfer, sdk.NewAttribute(types.AttributeKeyDTagToTrade, fmt.Sprintf("%s-dtag", "cosmos1cjf97gpzwmaf30pzvaargfgr884mpp5ak8f7ns")), sdk.NewAttribute(types.AttributeKeyRequestSender, "cosmos1y54exmx84cqtasvjnskf9f63djuuj68p7hqf47"), sdk.NewAttribute(types.AttributeKeyRequestReceiver, "cosmos1cjf97gpzwmaf30pzvaargfgr884mpp5ak8f7ns"), @@ -150,7 +150,7 @@ func (suite *KeeperTestSuite) TestMsgServer_CancelDTagTransfer() { shouldErr: false, expEvents: sdk.Events{ sdk.NewEvent( - types.EventTypeDTagTransferCancel, + types.EventTypeCanceledDTagTransferRequest, sdk.NewAttribute(types.AttributeKeyRequestSender, "cosmos1y54exmx84cqtasvjnskf9f63djuuj68p7hqf47"), sdk.NewAttribute(types.AttributeKeyRequestReceiver, "cosmos1cjf97gpzwmaf30pzvaargfgr884mpp5ak8f7ns"), ), @@ -367,7 +367,7 @@ func (suite *KeeperTestSuite) TestMsgServer_AcceptDTagTransfer() { shouldErr: false, expEvents: sdk.Events{ sdk.NewEvent( - types.EventTypeDTagTransferAccept, + types.EventTypeAcceptedDTagTransferRequest, sdk.NewAttribute(types.AttributeKeyDTagToTrade, "DTag"), sdk.NewAttribute(types.AttributeKeyNewDTag, "NewDtag"), sdk.NewAttribute(types.AttributeKeyRequestSender, "cosmos1y54exmx84cqtasvjnskf9f63djuuj68p7hqf47"), @@ -396,7 +396,7 @@ func (suite *KeeperTestSuite) TestMsgServer_AcceptDTagTransfer() { ), expEvents: sdk.Events{ sdk.NewEvent( - types.EventTypeDTagTransferAccept, + types.EventTypeAcceptedDTagTransferRequest, sdk.NewAttribute(types.AttributeKeyDTagToTrade, "DTag"), sdk.NewAttribute(types.AttributeKeyNewDTag, "NewDtag"), sdk.NewAttribute(types.AttributeKeyRequestSender, "cosmos1y54exmx84cqtasvjnskf9f63djuuj68p7hqf47"), @@ -434,7 +434,7 @@ func (suite *KeeperTestSuite) TestMsgServer_AcceptDTagTransfer() { ), expEvents: sdk.Events{ sdk.NewEvent( - types.EventTypeDTagTransferAccept, + types.EventTypeAcceptedDTagTransferRequest, sdk.NewAttribute(types.AttributeKeyDTagToTrade, "receiverDTag"), sdk.NewAttribute(types.AttributeKeyNewDTag, "senderDTag"), sdk.NewAttribute(types.AttributeKeyRequestSender, "cosmos1y54exmx84cqtasvjnskf9f63djuuj68p7hqf47"), @@ -511,7 +511,7 @@ func (suite *KeeperTestSuite) TestMsgServer_RefuseDTagTransfer() { shouldErr: false, expEvents: sdk.Events{ sdk.NewEvent( - types.EventTypeDTagTransferRefuse, + types.EventTypeRefusedDTagTransferRequest, sdk.NewAttribute(types.AttributeKeyRequestSender, "cosmos1y54exmx84cqtasvjnskf9f63djuuj68p7hqf47"), sdk.NewAttribute(types.AttributeKeyRequestReceiver, "cosmos1cjf97gpzwmaf30pzvaargfgr884mpp5ak8f7ns"), ), diff --git a/x/profiles/keeper/msgs_server_profile.go b/x/profiles/keeper/msgs_server_profile.go index 0e8b2fb267..3f7517288c 100644 --- a/x/profiles/keeper/msgs_server_profile.go +++ b/x/profiles/keeper/msgs_server_profile.go @@ -71,7 +71,7 @@ func (k MsgServer) SaveProfile(goCtx context.Context, msg *types.MsgSaveProfile) ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( - types.EventTypeProfileSaved, + types.EventTypeSavedProfile, sdk.NewAttribute(types.AttributeKeyProfileDTag, updated.DTag), sdk.NewAttribute(types.AttributeKeyProfileCreator, updated.GetAddress().String()), sdk.NewAttribute(types.AttributeKeyProfileCreationTime, updated.CreationDate.Format(time.RFC3339Nano)), @@ -92,7 +92,7 @@ func (k MsgServer) DeleteProfile(goCtx context.Context, msg *types.MsgDeleteProf ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( - types.EventTypeProfileDeleted, + types.EventTypeDeletedProfile, sdk.NewAttribute(types.AttributeKeyProfileCreator, msg.Creator), ), }) diff --git a/x/profiles/keeper/msgs_server_profile_test.go b/x/profiles/keeper/msgs_server_profile_test.go index 84ba020b12..e7f3338963 100644 --- a/x/profiles/keeper/msgs_server_profile_test.go +++ b/x/profiles/keeper/msgs_server_profile_test.go @@ -51,7 +51,7 @@ func (suite *KeeperTestSuite) TestMsgServer_SaveProfile() { }, expEvents: sdk.Events{ sdk.NewEvent( - types.EventTypeProfileSaved, + types.EventTypeSavedProfile, sdk.NewAttribute(types.AttributeKeyProfileDTag, "custom_dtag"), sdk.NewAttribute(types.AttributeKeyProfileCreator, "cosmos10nsdxxdvy9qka3zv0lzw8z9cnu6kanld8jh773"), sdk.NewAttribute(types.AttributeKeyProfileCreationTime, blockTime.Format(time.RFC3339)), @@ -85,7 +85,7 @@ func (suite *KeeperTestSuite) TestMsgServer_SaveProfile() { ), expEvents: sdk.Events{ sdk.NewEvent( - types.EventTypeProfileSaved, + types.EventTypeSavedProfile, sdk.NewAttribute(types.AttributeKeyProfileDTag, "other_dtag"), sdk.NewAttribute(types.AttributeKeyProfileCreator, "cosmos10nsdxxdvy9qka3zv0lzw8z9cnu6kanld8jh773"), sdk.NewAttribute(types.AttributeKeyProfileCreationTime, blockTime.Format(time.RFC3339)), @@ -125,7 +125,7 @@ func (suite *KeeperTestSuite) TestMsgServer_SaveProfile() { ), expEvents: sdk.Events{ sdk.NewEvent( - types.EventTypeProfileSaved, + types.EventTypeSavedProfile, sdk.NewAttribute(types.AttributeKeyProfileDTag, "Test"), sdk.NewAttribute(types.AttributeKeyProfileCreator, "cosmos10nsdxxdvy9qka3zv0lzw8z9cnu6kanld8jh773"), sdk.NewAttribute(types.AttributeKeyProfileCreationTime, blockTime.Format(time.RFC3339)), @@ -203,7 +203,7 @@ func (suite *KeeperTestSuite) TestMsgServer_SaveProfile() { ), expEvents: sdk.Events{ sdk.NewEvent( - types.EventTypeProfileSaved, + types.EventTypeSavedProfile, sdk.NewAttribute(types.AttributeKeyProfileDTag, "tomtom"), sdk.NewAttribute(types.AttributeKeyProfileCreator, "cosmos1cjf97gpzwmaf30pzvaargfgr884mpp5ak8f7ns"), sdk.NewAttribute(types.AttributeKeyProfileCreationTime, blockTime.Format(time.RFC3339)), @@ -294,7 +294,7 @@ func (suite *KeeperTestSuite) TestMsgServer_DeleteProfile() { shouldErr: false, expEvents: sdk.Events{ sdk.NewEvent( - types.EventTypeProfileDeleted, + types.EventTypeDeletedProfile, sdk.NewAttribute(types.AttributeKeyProfileCreator, "cosmos10nsdxxdvy9qka3zv0lzw8z9cnu6kanld8jh773"), ), }, diff --git a/x/profiles/spec/05-events.md b/x/profiles/spec/05-events.md index 60fd41b867..1f46f14ca7 100644 --- a/x/profiles/spec/05-events.md +++ b/x/profiles/spec/05-events.md @@ -13,89 +13,89 @@ The profiles module emits the following events: ### MsgSaveProfile -| **Type** | **Attribute Key** | **Attribute Value** | -|:-------------|:----------------------|:----------------------------------| -| save_profile | profile_dtag | {profileDTag} | -| save_profile | profile_creator | {userAddress} | -| save_profile | profile_creation_time | {profileCreationTime} | -| message | module | profiles | -| message | action | desmos.profiles.v3.MsgSaveProfile | -| message | sender | {userAddress} | +| **Type** | **Attribute Key** | **Attribute Value** | +|:--------------|:----------------------|:----------------------------------| +| saved_profile | profile_dtag | {profileDTag} | +| saved_profile | profile_creator | {userAddress} | +| saved_profile | profile_creation_time | {profileCreationTime} | +| message | module | profiles | +| message | action | desmos.profiles.v3.MsgSaveProfile | +| message | sender | {userAddress} | ## MsgDeleteProfile -| **Type** | **Attribute Key** | **Attribute Value** | -|:---------------|:------------------|:------------------------------------| -| delete_profile | profile_creator | {userAddress} | -| message | module | profiles | -| message | action | desmos.profiles.v3.MsgDeleteProfile | -| message | sender | {userAddress} | +| **Type** | **Attribute Key** | **Attribute Value** | +|:----------------|:------------------|:------------------------------------| +| deleted_profile | profile_creator | {userAddress} | +| message | module | profiles | +| message | action | desmos.profiles.v3.MsgDeleteProfile | +| message | sender | {userAddress} | ## MsgRequestDTagTransfer -| **Type** | **Attribute Key** | **Attribute Value** | -|:-----------------------------|:------------------|:------------------------------------------| -| create_dtag_transfer_request | dtag_to_trade | {dTagToTrade} | -| create_dtag_transfer_request | request_sender | {requestSenderAddress} | -| create_dtag_transfer_request | request_receiver | {requestReceiverAddress} | -| message | module | profiles | -| message | action | desmos.profiles.v3.MsgRequestDTagTransfer | -| message | sender | {requestSenderAddress} | +| **Type** | **Attribute Key** | **Attribute Value** | +|:------------------------|:------------------|:------------------------------------------| +| requested_dtag_transfer | dtag_to_trade | {dTagToTrade} | +| requested_dtag_transfer | request_sender | {requestSenderAddress} | +| requested_dtag_transfer | request_receiver | {requestReceiverAddress} | +| message | module | profiles | +| message | action | desmos.profiles.v3.MsgRequestDTagTransfer | +| message | sender | {requestSenderAddress} | ## MsgCancelDTagTransferRequest -| **Type** | **Attribute Key** | **Attribute Value** | -|:-----------------------------|:------------------|:------------------------------------------------| -| cancel_dtag_transfer_request | request_sender | {requestSenderAddress} | -| cancel_dtag_transfer_request | request_receiver | {requestReceiverAddress} | -| message | module | profiles | -| message | action | desmos.profiles.v3.MsgCancelDTagTransferRequest | -| message | sender | {userAddress} | +| **Type** | **Attribute Key** | **Attribute Value** | +|:-------------------------------|:------------------|:------------------------------------------------| +| canceled_dtag_transfer_request | request_sender | {requestSenderAddress} | +| canceled_dtag_transfer_request | request_receiver | {requestReceiverAddress} | +| message | module | profiles | +| message | action | desmos.profiles.v3.MsgCancelDTagTransferRequest | +| message | sender | {userAddress} | ## MsgAcceptDTagTransferRequest -| **Type** | **Attribute Key** | **Attribute Value** | -|:-----------------------------|:------------------|:------------------------------------------------| -| accept_dtag_transfer_request | dtag_to_trade | {dTagToTrade} | -| accept_dtag_transfer_request | new_dtag | {newDTag} | -| accept_dtag_transfer_request | request_sender | {requestSenderAddress} | -| accept_dtag_transfer_request | request_receiver | {requestReceiverAddress} | -| message | module | profiles | -| message | action | desmos.profiles.v3.MsgAcceptDTagTransferRequest | -| message | sender | {userAddress} | +| **Type** | **Attribute Key** | **Attribute Value** | +|:-------------------------------|:------------------|:------------------------------------------------| +| accepted_dtag_transfer_request | dtag_to_trade | {dTagToTrade} | +| accepted_dtag_transfer_request | new_dtag | {newDTag} | +| accepted_dtag_transfer_request | request_sender | {requestSenderAddress} | +| accepted_dtag_transfer_request | request_receiver | {requestReceiverAddress} | +| message | module | profiles | +| message | action | desmos.profiles.v3.MsgAcceptDTagTransferRequest | +| message | sender | {userAddress} | ## MsgRefuseDTagTransferRequest -| **Type** | **Attribute Key** | **Attribute Value** | -|:-----------------------------|:------------------|:------------------------------------------------| -| refuse_dtag_transfer_request | request_sender | {requestSenderAddress} | -| refuse_dtag_transfer_request | request_receiver | {requestReceiverAddress} | -| message | module | profiles | -| message | action | desmos.profiles.v3.MsgRefuseDTagTransferRequest | -| message | sender | {userAddress} | +| **Type** | **Attribute Key** | **Attribute Value** | +|:------------------------------|:------------------|:------------------------------------------------| +| refused_dtag_transfer_request | request_sender | {requestSenderAddress} | +| refused_dtag_transfer_request | request_receiver | {requestReceiverAddress} | +| message | module | profiles | +| message | action | desmos.profiles.v3.MsgRefuseDTagTransferRequest | +| message | sender | {userAddress} | ## MsgLinkChainAccount | **Type** | **Attribute Key** | **Attribute Value** | |:-------------------|:-----------------------------|:---------------------------------------| -| link_chain_account | chain_link_account_target | {targetAddress} | -| link_chain_account | chain_link_source_chain_name | {chainName} | -| link_chain_account | chain_link_account_owner | {userAddress} | -| link_chain_account | chain_link_creation_time | {creationTime} | +| created_chain_link | chain_link_account_target | {targetAddress} | +| created_chain_link | chain_link_source_chain_name | {chainName} | +| created_chain_link | chain_link_account_owner | {userAddress} | +| created_chain_link | chain_link_creation_time | {creationTime} | | message | module | profiles | | message | action | desmos.profiles.v3.MsgLinkChainAccount | | message | sender | {userAddress} | ## MsgUnlinkChainAccount -| **Type** | **Attribute Key** | **Attribute Value** | -|:---------------------|:-----------------------------|:-----------------------------------------| -| unlink_chain_account | chain_link_account_target | {targetAddress} | -| unlink_chain_account | chain_link_source_chain_name | {chainName} | -| unlink_chain_account | chain_link_account_owner | {userAddress} | -| message | module | profiles | -| message | action | desmos.profiles.v3.MsgUnlinkChainAccount | -| message | sender | {userAddress} | +| **Type** | **Attribute Key** | **Attribute Value** | +|:-------------------|:-----------------------------|:-----------------------------------------| +| deleted_chain_link | chain_link_account_target | {targetAddress} | +| deleted_chain_link | chain_link_source_chain_name | {chainName} | +| deleted_chain_link | chain_link_account_owner | {userAddress} | +| message | module | profiles | +| message | action | desmos.profiles.v3.MsgUnlinkChainAccount | +| message | sender | {userAddress} | ## MsgSetDefaultExternalAddress @@ -110,32 +110,63 @@ The profiles module emits the following events: ## MsgLinkApplication -| **Type** | **Attribute Key** | **Attribute Value** | -|:-----------------|:-------------------------------|:--------------------------------------| -| link_application | user | {userAddress} | -| link_application | application_name | {applicationName} | -| link_application | application_username | {applicationUsername} | -| link_application | application_link_creation_time | {creationTime} | -| message | module | profiles | -| message | action | desmos.profiles.v3.MsgLinkApplication | -| message | sender | {userAddress} | +| **Type** | **Attribute Key** | **Attribute Value** | +|:-------------------------|:-------------------------------|:--------------------------------------| +| created_application_link | user | {userAddress} | +| created_application_link | application_name | {applicationName} | +| created_application_link | application_username | {applicationUsername} | +| created_application_link | application_link_creation_time | {creationTime} | +| message | module | profiles | +| message | action | desmos.profiles.v3.MsgLinkApplication | +| message | sender | {userAddress} | ## MsgUnlinkApplication -| **Type** | **Attribute Key** | **Attribute Value** | -|:-------------------|:---------------------|:----------------------------------------| -| unlink_application | user | {userAddress} | -| unlink_application | application_name | {applicationName} | -| unlink_application | application_username | {applicationUsername} | -| message | module | profiles | -| message | action | desmos.profiles.v3.MsgUnlinkApplication | -| message | sender | {userAddress} | +| **Type** | **Attribute Key** | **Attribute Value** | +|:-------------------------|:---------------------|:----------------------------------------| +| deleted_application_link | user | {userAddress} | +| deleted_application_link | application_name | {applicationName} | +| deleted_application_link | application_username | {applicationUsername} | +| message | module | profiles | +| message | action | desmos.profiles.v3.MsgUnlinkApplication | +| message | sender | {userAddress} | ## Keeper +### Chain Link Saved + +| **Type** | **Attribute Key** | **Attribute Value** | +|:-----------------|:----------------------------|:--------------------| +| saved_chain_link | chain_link_owner | {userAddress} | +| saved_chain_link | chain_link_chain_name | {chainName} | +| saved_chain_link | chain_link_external_address | {externalAddress} | + ### Application Link Saved -| **Type** | **Attribute Key** | **Attribute Value** | -|:-----------------------|:---------------------|:----------------------------------------| -| application_link_saved | user | {userAddress} | -| application_link_saved | application_name | {applicationName} | -| application_link_saved | application_username | {applicationUsername} | \ No newline at end of file + +| **Type** | **Attribute Key** | **Attribute Value** | +|:-----------------------|:---------------------|:----------------------| +| saved_application_link | user | {userAddress} | +| saved_application_link | application_name | {applicationName} | +| saved_application_link | application_username | {applicationUsername} | + +## IBC + +### Received link chain account IBC packet + +| **Type** | **Attribute Key** | **Attribute Value** | +|:-----------------------------------|:----------------------------|:--------------------| +| received_link_chain_account_packet | module | profiles | +| received_link_chain_account_packet | chain_link_owner | {userAddress} | +| received_link_chain_account_packet | chain_link_chain_name | {chainName} | +| received_link_chain_account_packet | chain_link_external_address | {externalAddress} | +| received_link_chain_account_packet | success | true | + +### Received oracle response IBC packet + +| **Type** | **Attribute Key** | **Attribute Value** | +|:--------------------------------|:------------------|:--------------------| +| received_oracle_response_packet | module | profiles | +| received_oracle_response_packet | client_id | {clientID} | +| received_oracle_response_packet | request_id | {requestID} | +| received_oracle_response_packet | resolve_status | {resolveStatus} | +| received_oracle_response_packet | success | true | diff --git a/x/profiles/types/events.go b/x/profiles/types/events.go index 03fbd539a0..c473abe540 100644 --- a/x/profiles/types/events.go +++ b/x/profiles/types/events.go @@ -3,21 +3,23 @@ package types // DONTCOVER const ( - EventTypeProfileSaved = "save_profile" - EventTypeProfileDeleted = "delete_profile" - EventTypeDTagTransferRequest = "create_dtag_transfer_request" - EventTypeDTagTransferAccept = "accept_dtag_transfer_request" - EventTypeDTagTransferRefuse = "refuse_dtag_transfer_request" - EventTypeDTagTransferCancel = "cancel_dtag_transfer_request" - EventTypeLinkChainAccount = "link_chain_account" - EventTypeUnlinkChainAccount = "unlink_chain_account" - EventTypeSetDefaultExternalAddress = "set_default_external_address" - EventTypeLinkChainAccountPacket = "link_chain_account_packet" - EventTypePacket = "receive_profiles_verification_packet" - EventTypeTimeout = "timeout" - EventTypesApplicationLinkCreated = "link_application" - EventTypeApplicationLinkDeleted = "unlink_application" - EventTypesApplicationLinkSaved = "application_link_saved" + EventTypeSavedProfile = "saved_profile" + EventTypeDeletedProfile = "deleted_profile" + + EventTypeRequestedDTagTransfer = "requested_dtag_transfer" + EventTypeAcceptedDTagTransferRequest = "accepted_dtag_transfer_request" + EventTypeRefusedDTagTransferRequest = "refused_dtag_transfer_request" + EventTypeCanceledDTagTransferRequest = "canceled_dtag_transfer_request" + EventTypeCreatedChainLink = "created_chain_link" + EventTypeDeletedChainLink = "deleted_chain_link" + EventTypeSavedChainLink = "saved_chain_link" + EventTypeSetDefaultExternalAddress = "set_default_external_address" + EventTypeCreatedApplicationLink = "created_application_link" + EventTypeDeletedApplicationLink = "deleted_application_link" + EventTypeSavedApplicationLink = "saved_application_link" + EventTypeReceivedLinkChainAccountPacket = "received_link_chain_account_packet" + EventTypeReceivedOracleResponsePacketData = "received_oracle_response_packet" + EventTypeTimeout = "timeout" AttributeKeyProfileDTag = "profile_dtag" AttributeKeyProfileCreator = "profile_creator" diff --git a/x/reactions/keeper/msg_server.go b/x/reactions/keeper/msg_server.go index 22ca1eac69..8fe46619f6 100644 --- a/x/reactions/keeper/msg_server.go +++ b/x/reactions/keeper/msg_server.go @@ -4,6 +4,8 @@ import ( "context" "fmt" + poststypes "github.com/desmos-labs/desmos/v6/x/posts/types" + "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -90,9 +92,9 @@ func (k msgServer) AddReaction(goCtx context.Context, msg *types.MsgAddReaction) ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( - types.EventTypeAddReaction, - sdk.NewAttribute(types.AttributeKeySubspaceID, fmt.Sprintf("%d", msg.SubspaceID)), - sdk.NewAttribute(types.AttributeKeyPostID, fmt.Sprintf("%d", msg.PostID)), + types.EventTypeAddedReaction, + sdk.NewAttribute(subspacestypes.AttributeKeySubspaceID, fmt.Sprintf("%d", msg.SubspaceID)), + sdk.NewAttribute(poststypes.AttributeKeyPostID, fmt.Sprintf("%d", msg.PostID)), sdk.NewAttribute(types.AttributeKeyReactionID, fmt.Sprintf("%d", reaction.ID)), sdk.NewAttribute(types.AttributeKeyUser, msg.User), ), @@ -139,9 +141,9 @@ func (k msgServer) RemoveReaction(goCtx context.Context, msg *types.MsgRemoveRea ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( - types.EventTypeRemoveReaction, - sdk.NewAttribute(types.AttributeKeySubspaceID, fmt.Sprintf("%d", msg.SubspaceID)), - sdk.NewAttribute(types.AttributeKeyPostID, fmt.Sprintf("%d", msg.PostID)), + types.EventTypeRemovedReaction, + sdk.NewAttribute(subspacestypes.AttributeKeySubspaceID, fmt.Sprintf("%d", msg.SubspaceID)), + sdk.NewAttribute(poststypes.AttributeKeyPostID, fmt.Sprintf("%d", msg.PostID)), sdk.NewAttribute(types.AttributeKeyReactionID, fmt.Sprintf("%d", msg.ReactionID)), ), }) @@ -189,8 +191,8 @@ func (k msgServer) AddRegisteredReaction(goCtx context.Context, msg *types.MsgAd ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( - types.ActionAddRegisteredReaction, - sdk.NewAttribute(types.AttributeKeySubspaceID, fmt.Sprintf("%d", msg.SubspaceID)), + types.EventTypeAddedRegisteredReaction, + sdk.NewAttribute(subspacestypes.AttributeKeySubspaceID, fmt.Sprintf("%d", msg.SubspaceID)), sdk.NewAttribute(types.AttributeKeyRegisteredReactionID, fmt.Sprintf("%d", reaction.ID)), ), }) @@ -233,7 +235,7 @@ func (k msgServer) EditRegisteredReaction(goCtx context.Context, msg *types.MsgE ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( types.ActionEditRegisteredReaction, - sdk.NewAttribute(types.AttributeKeySubspaceID, fmt.Sprintf("%d", msg.SubspaceID)), + sdk.NewAttribute(subspacestypes.AttributeKeySubspaceID, fmt.Sprintf("%d", msg.SubspaceID)), sdk.NewAttribute(types.AttributeKeyRegisteredReactionID, fmt.Sprintf("%d", msg.RegisteredReactionID)), ), }) @@ -265,8 +267,8 @@ func (k msgServer) RemoveRegisteredReaction(goCtx context.Context, msg *types.Ms ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( - types.EventTypeRemoveRegisteredReaction, - sdk.NewAttribute(types.AttributeKeySubspaceID, fmt.Sprintf("%d", msg.SubspaceID)), + types.EventTypeRemovedRegisteredReaction, + sdk.NewAttribute(subspacestypes.AttributeKeySubspaceID, fmt.Sprintf("%d", msg.SubspaceID)), sdk.NewAttribute(types.AttributeKeyRegisteredReactionID, fmt.Sprintf("%d", msg.RegisteredReactionID)), ), }) @@ -301,7 +303,7 @@ func (k msgServer) SetReactionsParams(goCtx context.Context, msg *types.MsgSetRe ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( types.EventTypeSetReactionsParams, - sdk.NewAttribute(types.AttributeKeySubspaceID, fmt.Sprintf("%d", msg.SubspaceID)), + sdk.NewAttribute(subspacestypes.AttributeKeySubspaceID, fmt.Sprintf("%d", msg.SubspaceID)), ), }) diff --git a/x/reactions/keeper/msg_server_test.go b/x/reactions/keeper/msg_server_test.go index 4be4145ff2..3204bb7603 100644 --- a/x/reactions/keeper/msg_server_test.go +++ b/x/reactions/keeper/msg_server_test.go @@ -3,6 +3,8 @@ package keeper_test import ( "time" + subspacestypes "github.com/desmos-labs/desmos/v6/x/subspaces/types" + "github.com/golang/mock/gomock" sdk "github.com/cosmos/cosmos-sdk/types" @@ -416,9 +418,9 @@ func (suite *KeeperTestSuite) TestMsgServer_AddReaction() { }, expEvents: sdk.Events{ sdk.NewEvent( - types.EventTypeAddReaction, - sdk.NewAttribute(types.AttributeKeySubspaceID, "1"), - sdk.NewAttribute(types.AttributeKeyPostID, "1"), + types.EventTypeAddedReaction, + sdk.NewAttribute(subspacestypes.AttributeKeySubspaceID, "1"), + sdk.NewAttribute(poststypes.AttributeKeyPostID, "1"), sdk.NewAttribute(types.AttributeKeyReactionID, "1"), sdk.NewAttribute(types.AttributeKeyUser, "cosmos1efa8l9h4p6hmkps6vk8lu7nxydr46npr8qtg5f"), ), @@ -502,9 +504,9 @@ func (suite *KeeperTestSuite) TestMsgServer_AddReaction() { }, expEvents: sdk.Events{ sdk.NewEvent( - types.EventTypeAddReaction, - sdk.NewAttribute(types.AttributeKeySubspaceID, "1"), - sdk.NewAttribute(types.AttributeKeyPostID, "1"), + types.EventTypeAddedReaction, + sdk.NewAttribute(subspacestypes.AttributeKeySubspaceID, "1"), + sdk.NewAttribute(poststypes.AttributeKeyPostID, "1"), sdk.NewAttribute(types.AttributeKeyReactionID, "1"), sdk.NewAttribute(types.AttributeKeyUser, "cosmos1efa8l9h4p6hmkps6vk8lu7nxydr46npr8qtg5f"), ), @@ -780,9 +782,9 @@ func (suite *KeeperTestSuite) TestMsgServer_RemoveReaction() { shouldErr: false, expEvents: sdk.Events{ sdk.NewEvent( - types.EventTypeRemoveReaction, - sdk.NewAttribute(types.AttributeKeySubspaceID, "1"), - sdk.NewAttribute(types.AttributeKeyPostID, "1"), + types.EventTypeRemovedReaction, + sdk.NewAttribute(subspacestypes.AttributeKeySubspaceID, "1"), + sdk.NewAttribute(poststypes.AttributeKeyPostID, "1"), sdk.NewAttribute(types.AttributeKeyReactionID, "1"), ), }, @@ -947,8 +949,8 @@ func (suite *KeeperTestSuite) TestMsgServer_AddRegisteredReaction() { }, expEvents: sdk.Events{ sdk.NewEvent( - types.EventTypeAddRegisteredReaction, - sdk.NewAttribute(types.AttributeKeySubspaceID, "1"), + types.EventTypeAddedRegisteredReaction, + sdk.NewAttribute(subspacestypes.AttributeKeySubspaceID, "1"), sdk.NewAttribute(types.AttributeKeyRegisteredReactionID, "1"), ), }, @@ -1138,7 +1140,7 @@ func (suite *KeeperTestSuite) TestMsgServer_EditRegisteredReaction() { expEvents: sdk.Events{ sdk.NewEvent( types.ActionEditRegisteredReaction, - sdk.NewAttribute(types.AttributeKeySubspaceID, "1"), + sdk.NewAttribute(subspacestypes.AttributeKeySubspaceID, "1"), sdk.NewAttribute(types.AttributeKeyRegisteredReactionID, "1"), ), }, @@ -1281,8 +1283,8 @@ func (suite *KeeperTestSuite) TestMsgServer_RemoveRegisteredReaction() { shouldErr: false, expEvents: sdk.Events{ sdk.NewEvent( - types.EventTypeRemoveRegisteredReaction, - sdk.NewAttribute(types.AttributeKeySubspaceID, "1"), + types.EventTypeRemovedRegisteredReaction, + sdk.NewAttribute(subspacestypes.AttributeKeySubspaceID, "1"), sdk.NewAttribute(types.AttributeKeyRegisteredReactionID, "1"), ), }, @@ -1415,7 +1417,7 @@ func (suite *KeeperTestSuite) TestMsgServer_SetReactionsParams() { expEvents: sdk.Events{ sdk.NewEvent( types.EventTypeSetReactionsParams, - sdk.NewAttribute(types.AttributeKeySubspaceID, "1"), + sdk.NewAttribute(subspacestypes.AttributeKeySubspaceID, "1"), ), }, check: func(ctx sdk.Context) { diff --git a/x/reactions/spec/05-events.md b/x/reactions/spec/05-events.md index 8fee51f810..7ea1fcfbeb 100644 --- a/x/reactions/spec/05-events.md +++ b/x/reactions/spec/05-events.md @@ -13,56 +13,56 @@ The reactions module emits the following events: ### MsgAddReaction -| **Type** | **Attribute Key** | **Attribute Value** | -|:-------------|:------------------|:-----------------------------------| -| add_reaction | subspace_id | {subspaceID} | -| add_reaction | post_id | {postID} | -| add_reaction | reaction_id | {reactionID} | -| add_reaction | user | {userAddress} | -| message | module | reactions | -| message | action | desmos.reactions.v1.MsgAddReaction | -| message | sender | {userAddress} | +| **Type** | **Attribute Key** | **Attribute Value** | +|:---------------|:------------------|:-----------------------------------| +| added_reaction | subspace_id | {subspaceID} | +| added_reaction | post_id | {postID} | +| added_reaction | reaction_id | {reactionID} | +| added_reaction | user | {userAddress} | +| message | module | reactions | +| message | action | desmos.reactions.v1.MsgAddReaction | +| message | sender | {userAddress} | ### MsgRemoveReaction -| **Type** | **Attribute Key** | **Attribute Value** | -|:----------------|:------------------|:--------------------------------------| -| remove_reaction | subspace_id | {subspaceID} | -| remove_reaction | post_id | {postID} | -| remove_reaction | reaction_id | {reaction_id} | -| message | module | reactions | -| message | action | desmos.reactions.v1.MsgRemoveReaction | -| message | sender | {userAddress} | +| **Type** | **Attribute Key** | **Attribute Value** | +|:-----------------|:------------------|:--------------------------------------| +| removed_reaction | subspace_id | {subspaceID} | +| removed_reaction | post_id | {postID} | +| removed_reaction | reaction_id | {reaction_id} | +| message | module | reactions | +| message | action | desmos.reactions.v1.MsgRemoveReaction | +| message | sender | {userAddress} | ### MsgAddRegisteredReaction -| **Type** | **Attribute Key** | **Attribute Value** | -|:------------------------|:-----------------------|:---------------------------------------------| -| add_registered_reaction | subspace_id | {subspaceID} | -| add_registered_reaction | registered_reaction_id | {registeredReactionID} | -| message | module | reactions | -| message | action | desmos.reactions.v1.MsgAddRegisteredReaction | -| message | sender | {userAddress} | +| **Type** | **Attribute Key** | **Attribute Value** | +|:--------------------------|:-----------------------|:---------------------------------------------| +| added_registered_reaction | subspace_id | {subspaceID} | +| added_registered_reaction | registered_reaction_id | {registeredReactionID} | +| message | module | reactions | +| message | action | desmos.reactions.v1.MsgAddRegisteredReaction | +| message | sender | {userAddress} | ### MsgEditRegisteredReaction -| **Type** | **Attribute Key** | **Attribute Value** | -|:-------------------------|:-----------------------|:----------------------------------------------| -| edit_registered_reaction | subspace_id | {subspaceID} | -| edit_registered_reaction | registered_reaction_id | {registeredReactionID} | -| message | module | reactions | -| message | action | desmos.reactions.v1.MsgEditRegisteredReaction | -| message | sender | {userAddress} | +| **Type** | **Attribute Key** | **Attribute Value** | +|:---------------------------|:-----------------------|:----------------------------------------------| +| edited_registered_reaction | subspace_id | {subspaceID} | +| edited_registered_reaction | registered_reaction_id | {registeredReactionID} | +| message | module | reactions | +| message | action | desmos.reactions.v1.MsgEditRegisteredReaction | +| message | sender | {userAddress} | ### MsgRemoveRegisteredReaction -| **Type** | **Attribute Key** | **Attribute Value** | -|:---------------------------|:-----------------------|:------------------------------------------------| -| remove_registered_reaction | subspace_id | {subspaceID} | -| remove_registered_reaction | registered_reaction_id | {registeredReactionID} | -| message | module | reactions | -| message | action | desmos.reactions.v1.MsgRemoveRegisteredReaction | -| message | sender | {userAddress} | +| **Type** | **Attribute Key** | **Attribute Value** | +|:----------------------------|:-----------------------|:------------------------------------------------| +| removed_registered_reaction | subspace_id | {subspaceID} | +| removed_registered_reaction | registered_reaction_id | {registeredReactionID} | +| message | module | reactions | +| message | action | desmos.reactions.v1.MsgRemoveRegisteredReaction | +| message | sender | {userAddress} | ### MsgSetReactionsParams diff --git a/x/reactions/types/events.go b/x/reactions/types/events.go index e6a8c8bcf0..0738f07b1d 100644 --- a/x/reactions/types/events.go +++ b/x/reactions/types/events.go @@ -3,14 +3,12 @@ package types // DONTCOVER const ( - EventTypeAddReaction = "add_reaction" - EventTypeRemoveReaction = "remove_reaction" - EventTypeAddRegisteredReaction = "add_registered_reaction" - EventTypeRemoveRegisteredReaction = "removed_registered_reaction" - EventTypeSetReactionsParams = "set_reactions_params" + EventTypeAddedReaction = "added_reaction" + EventTypeRemovedReaction = "removed_reaction" + EventTypeAddedRegisteredReaction = "added_registered_reaction" + EventTypeRemovedRegisteredReaction = "removed_registered_reaction" + EventTypeSetReactionsParams = "set_reactions_params" - AttributeKeySubspaceID = "subspace_id" - AttributeKeyPostID = "post_id" AttributeKeyReactionID = "reaction_id" AttributeKeyRegisteredReactionID = "registered_reaction_id" AttributeKeyUser = "user" diff --git a/x/relationships/keeper/msg_server.go b/x/relationships/keeper/msg_server.go index 21d117c43b..c2991d6428 100644 --- a/x/relationships/keeper/msg_server.go +++ b/x/relationships/keeper/msg_server.go @@ -4,6 +4,8 @@ import ( "context" "fmt" + subspacestypes "github.com/desmos-labs/desmos/v6/x/subspaces/types" + "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -48,10 +50,10 @@ func (k msgServer) CreateRelationship(goCtx context.Context, msg *types.MsgCreat ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( - types.EventTypeRelationshipCreated, + types.EventTypeCreatedRelationship, sdk.NewAttribute(types.AttributeRelationshipCreator, msg.Signer), sdk.NewAttribute(types.AttributeRelationshipCounterparty, msg.Counterparty), - sdk.NewAttribute(types.AttributeKeySubspace, fmt.Sprintf("%d", msg.SubspaceID)), + sdk.NewAttribute(subspacestypes.AttributeKeySubspaceID, fmt.Sprintf("%d", msg.SubspaceID)), ), }) @@ -77,10 +79,10 @@ func (k msgServer) DeleteRelationship(goCtx context.Context, msg *types.MsgDelet ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( - types.EventTypeRelationshipDeleted, + types.EventTypeDeletedRelationship, sdk.NewAttribute(types.AttributeRelationshipCreator, msg.Signer), sdk.NewAttribute(types.AttributeRelationshipCounterparty, msg.Counterparty), - sdk.NewAttribute(types.AttributeKeySubspace, fmt.Sprintf("%d", msg.SubspaceID)), + sdk.NewAttribute(subspacestypes.AttributeKeySubspaceID, fmt.Sprintf("%d", msg.SubspaceID)), ), }) @@ -106,10 +108,10 @@ func (k msgServer) BlockUser(goCtx context.Context, msg *types.MsgBlockUser) (*t ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( - types.EventTypeBlockUser, + types.EventTypeBlockedUser, sdk.NewAttribute(types.AttributeKeyUserBlockBlocker, msg.Blocker), sdk.NewAttribute(types.AttributeKeyUserBlockBlocked, msg.Blocked), - sdk.NewAttribute(types.AttributeKeySubspace, fmt.Sprintf("%d", msg.SubspaceID)), + sdk.NewAttribute(subspacestypes.AttributeKeySubspaceID, fmt.Sprintf("%d", msg.SubspaceID)), ), }) @@ -135,10 +137,10 @@ func (k msgServer) UnblockUser(goCtx context.Context, msg *types.MsgUnblockUser) ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( - types.EventTypeUnblockUser, + types.EventTypeUnblockedUser, sdk.NewAttribute(types.AttributeKeyUserBlockBlocker, msg.Blocker), sdk.NewAttribute(types.AttributeKeyUserBlockBlocked, msg.Blocked), - sdk.NewAttribute(types.AttributeKeySubspace, fmt.Sprintf("%d", msg.SubspaceID)), + sdk.NewAttribute(subspacestypes.AttributeKeySubspaceID, fmt.Sprintf("%d", msg.SubspaceID)), ), }) diff --git a/x/relationships/keeper/msg_server_test.go b/x/relationships/keeper/msg_server_test.go index 064d2546ca..4ef74bbcc2 100644 --- a/x/relationships/keeper/msg_server_test.go +++ b/x/relationships/keeper/msg_server_test.go @@ -4,6 +4,8 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/golang/mock/gomock" + subspacestypes "github.com/desmos-labs/desmos/v6/x/subspaces/types" + "github.com/desmos-labs/desmos/v6/x/relationships/keeper" "github.com/desmos-labs/desmos/v6/x/relationships/types" ) @@ -82,10 +84,10 @@ func (suite *KeeperTestSuite) TestMsgServer_CreateRelationship() { shouldErr: false, expEvents: sdk.Events{ sdk.NewEvent( - types.EventTypeRelationshipCreated, + types.EventTypeCreatedRelationship, sdk.NewAttribute(types.AttributeRelationshipCreator, "cosmos1y54exmx84cqtasvjnskf9f63djuuj68p7hqf47"), sdk.NewAttribute(types.AttributeRelationshipCounterparty, "cosmos1cjf97gpzwmaf30pzvaargfgr884mpp5ak8f7ns"), - sdk.NewAttribute(types.AttributeKeySubspace, "1"), + sdk.NewAttribute(subspacestypes.AttributeKeySubspaceID, "1"), ), }, check: func(ctx sdk.Context) { @@ -181,10 +183,10 @@ func (suite *KeeperTestSuite) TestMsgServer_DeleteRelationship() { shouldErr: false, expEvents: sdk.Events{ sdk.NewEvent( - types.EventTypeRelationshipDeleted, + types.EventTypeDeletedRelationship, sdk.NewAttribute(types.AttributeRelationshipCreator, "cosmos1y54exmx84cqtasvjnskf9f63djuuj68p7hqf47"), sdk.NewAttribute(types.AttributeRelationshipCounterparty, "cosmos1cjf97gpzwmaf30pzvaargfgr884mpp5ak8f7ns"), - sdk.NewAttribute(types.AttributeKeySubspace, "1"), + sdk.NewAttribute(subspacestypes.AttributeKeySubspaceID, "1"), ), }, check: func(ctx sdk.Context) { @@ -283,10 +285,10 @@ func (suite *KeeperTestSuite) TestMsgServer_BlockUser() { shouldErr: false, expEvents: sdk.Events{ sdk.NewEvent( - types.EventTypeBlockUser, + types.EventTypeBlockedUser, sdk.NewAttribute(types.AttributeKeyUserBlockBlocker, "cosmos1y54exmx84cqtasvjnskf9f63djuuj68p7hqf47"), sdk.NewAttribute(types.AttributeKeyUserBlockBlocked, "cosmos1cjf97gpzwmaf30pzvaargfgr884mpp5ak8f7ns"), - sdk.NewAttribute(types.AttributeKeySubspace, "1"), + sdk.NewAttribute(subspacestypes.AttributeKeySubspaceID, "1"), ), }, check: func(ctx sdk.Context) { @@ -383,10 +385,10 @@ func (suite *KeeperTestSuite) TestMsgServer_UnblockUser() { shouldErr: false, expEvents: sdk.Events{ sdk.NewEvent( - types.EventTypeUnblockUser, + types.EventTypeUnblockedUser, sdk.NewAttribute(types.AttributeKeyUserBlockBlocker, "cosmos1y54exmx84cqtasvjnskf9f63djuuj68p7hqf47"), sdk.NewAttribute(types.AttributeKeyUserBlockBlocked, "cosmos1cjf97gpzwmaf30pzvaargfgr884mpp5ak8f7ns"), - sdk.NewAttribute(types.AttributeKeySubspace, "1"), + sdk.NewAttribute(subspacestypes.AttributeKeySubspaceID, "1"), ), }, check: func(ctx sdk.Context) { diff --git a/x/relationships/spec/05-events.md b/x/relationships/spec/05-events.md index ec95bd3560..9840365163 100644 --- a/x/relationships/spec/05-events.md +++ b/x/relationships/spec/05-events.md @@ -7,50 +7,50 @@ slug: events # Events -The relationships module emits the following events: +The relationships module emits the following events: ## Handlers ### MsgCreateRelationship -| Type | Attribute Key | Attribute Value | -|:--------------------|:--------------|:-----------------------------------------------| -| create_relationship | creator | {userAddress} | -| create_relationship | counterparty | {counterpartyAddress} | -| create_relationship | subspace | {subspaceID} | -| message | module | relationships | -| message | action | /desmos.relationships.v1.MsgCreateRelationship | -| message | sender | {userAddress} | +| Type | Attribute Key | Attribute Value | +|:---------------------|:--------------|:-----------------------------------------------| +| created_relationship | creator | {userAddress} | +| created_relationship | counterparty | {counterpartyAddress} | +| created_relationship | subspace_id | {subspaceID} | +| message | module | relationships | +| message | action | /desmos.relationships.v1.MsgCreateRelationship | +| message | sender | {userAddress} | ### MsgDeleteRelationship -| Type | Attribute Key | Attribute Value | -|:--------------------|:--------------|:-----------------------------------------------| -| delete_relationship | creator | {userAddress} | -| delete_relationship | counterparty | {counterpartyAddress} | -| delete_relationship | subspace | {subspaceID} | -| message | module | relationships | -| message | action | /desmos.relationships.v1.MsgDeleteRelationship | -| message | sender | {userAddress} | +| Type | Attribute Key | Attribute Value | +|:---------------------|:--------------|:-----------------------------------------------| +| deleted_relationship | creator | {userAddress} | +| deleted_relationship | counterparty | {counterpartyAddress} | +| deleted_relationship | subspace_id | {subspaceID} | +| message | module | relationships | +| message | action | /desmos.relationships.v1.MsgDeleteRelationship | +| message | sender | {userAddress} | ### MsgBlockUser -| Type | Attribute Key | Attribute Value | -|:-----------|:--------------|:--------------------------------------| -| block_user | blocker | {blockerAddress} | -| block_user | blocked | {blockedAddress} | -| block_user | subspace | {subspaceID} | -| message | module | relationships | -| message | action | /desmos.relationships.v1.MsgBlockUser | -| message | sender | {userAddress} | +| Type | Attribute Key | Attribute Value | +|:-------------|:--------------|:--------------------------------------| +| blocked_user | blocker | {blockerAddress} | +| blocked_user | blocked | {blockedAddress} | +| blocked_user | subspace_id | {subspaceID} | +| message | module | relationships | +| message | action | /desmos.relationships.v1.MsgBlockUser | +| message | sender | {userAddress} | ### MsgUnblockUser -| Type | Attribute Key | Attribute Value | -|:-------------|:--------------|:----------------------------------------| -| unblock_user | blocker | {blockerAddress} | -| unblock_user | blocked | {blockedAddress} | -| unblock_user | subspace | {subspaceID} | -| message | module | relationships | -| message | action | /desmos.relationships.v1.MsgUnblockUser | -| message | sender | {userAddress} | \ No newline at end of file +| Type | Attribute Key | Attribute Value | +|:---------------|:--------------|:----------------------------------------| +| unblocked_user | blocker | {blockerAddress} | +| unblocked_user | blocked | {blockedAddress} | +| unblocked_user | subspace_id | {subspaceID} | +| message | module | relationships | +| message | action | /desmos.relationships.v1.MsgUnblockUser | +| message | sender | {userAddress} | \ No newline at end of file diff --git a/x/relationships/types/events.go b/x/relationships/types/events.go index af067d44b4..a7cf7d7762 100644 --- a/x/relationships/types/events.go +++ b/x/relationships/types/events.go @@ -3,14 +3,13 @@ package types // DONTCOVER const ( - EventTypeRelationshipCreated = "create_relationship" - EventTypeRelationshipDeleted = "delete_relationship" - EventTypeBlockUser = "block_user" - EventTypeUnblockUser = "unblock_user" + EventTypeCreatedRelationship = "created_relationship" + EventTypeDeletedRelationship = "deleted_relationship" + EventTypeBlockedUser = "blocked_user" + EventTypeUnblockedUser = "unblocked_user" AttributeRelationshipCreator = "creator" AttributeRelationshipCounterparty = "counterparty" AttributeKeyUserBlockBlocker = "blocker" AttributeKeyUserBlockBlocked = "blocked" - AttributeKeySubspace = "subspace" ) diff --git a/x/reports/keeper/msg_server.go b/x/reports/keeper/msg_server.go index 0798419633..cc07cc324b 100644 --- a/x/reports/keeper/msg_server.go +++ b/x/reports/keeper/msg_server.go @@ -5,6 +5,8 @@ import ( "fmt" "time" + poststypes "github.com/desmos-labs/desmos/v6/x/posts/types" + "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -93,15 +95,15 @@ func (k msgServer) CreateReport(goCtx context.Context, msg *types.MsgCreateRepor switch target := target.(type) { case *types.PostTarget: reportEvent = sdk.NewEvent( - types.EventTypeReportPost, - sdk.NewAttribute(types.AttributeKeySubspaceID, fmt.Sprintf("%d", msg.SubspaceID)), - sdk.NewAttribute(types.AttributeKeyPostID, fmt.Sprintf("%d", target.PostID)), + types.EventTypeReportedPost, + sdk.NewAttribute(subspacestypes.AttributeKeySubspaceID, fmt.Sprintf("%d", msg.SubspaceID)), + sdk.NewAttribute(poststypes.AttributeKeyPostID, fmt.Sprintf("%d", target.PostID)), sdk.NewAttribute(types.AttributeKeyReporter, msg.Reporter), ) case *types.UserTarget: reportEvent = sdk.NewEvent( - types.EventTypeReportUser, - sdk.NewAttribute(types.AttributeKeySubspaceID, fmt.Sprintf("%d", msg.SubspaceID)), + types.EventTypeReportedUser, + sdk.NewAttribute(subspacestypes.AttributeKeySubspaceID, fmt.Sprintf("%d", msg.SubspaceID)), sdk.NewAttribute(types.AttributeKeyUser, target.User), sdk.NewAttribute(types.AttributeKeyReporter, msg.Reporter), ) @@ -111,8 +113,8 @@ func (k msgServer) CreateReport(goCtx context.Context, msg *types.MsgCreateRepor ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( - types.EventTypeCreateReport, - sdk.NewAttribute(types.AttributeKeySubspaceID, fmt.Sprintf("%d", msg.SubspaceID)), + types.EventTypeCreatedReport, + sdk.NewAttribute(subspacestypes.AttributeKeySubspaceID, fmt.Sprintf("%d", msg.SubspaceID)), sdk.NewAttribute(types.AttributeKeyReportID, fmt.Sprintf("%d", report.ID)), sdk.NewAttribute(types.AttributeKeyReporter, msg.Reporter), sdk.NewAttribute(types.AttributeKeyCreationTime, report.CreationDate.Format(time.RFC3339)), @@ -153,8 +155,8 @@ func (k msgServer) DeleteReport(goCtx context.Context, msg *types.MsgDeleteRepor ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( - types.EventTypeDeleteReport, - sdk.NewAttribute(types.AttributeKeySubspaceID, fmt.Sprintf("%d", msg.SubspaceID)), + types.EventTypeDeletedReport, + sdk.NewAttribute(subspacestypes.AttributeKeySubspaceID, fmt.Sprintf("%d", msg.SubspaceID)), sdk.NewAttribute(types.AttributeKeyReportID, fmt.Sprintf("%d", msg.ReportID)), ), }) @@ -203,8 +205,8 @@ func (k msgServer) SupportStandardReason(goCtx context.Context, msg *types.MsgSu ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( - types.EventTypeSupportStandardReason, - sdk.NewAttribute(types.AttributeKeySubspaceID, fmt.Sprintf("%d", msg.SubspaceID)), + types.EventTypeSupportedStandardReason, + sdk.NewAttribute(subspacestypes.AttributeKeySubspaceID, fmt.Sprintf("%d", msg.SubspaceID)), sdk.NewAttribute(types.AttributeKeyStandardReasonID, fmt.Sprintf("%d", msg.StandardReasonID)), sdk.NewAttribute(types.AttributeKeyReasonID, fmt.Sprintf("%d", reason.ID)), ), @@ -250,8 +252,8 @@ func (k msgServer) AddReason(goCtx context.Context, msg *types.MsgAddReason) (*t ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( - types.EventTypeAddReason, - sdk.NewAttribute(types.AttributeKeySubspaceID, fmt.Sprintf("%d", msg.SubspaceID)), + types.EventTypeAddedReportingReason, + sdk.NewAttribute(subspacestypes.AttributeKeySubspaceID, fmt.Sprintf("%d", msg.SubspaceID)), sdk.NewAttribute(types.AttributeKeyReasonID, fmt.Sprintf("%d", reason.ID)), ), }) @@ -285,8 +287,8 @@ func (k msgServer) RemoveReason(goCtx context.Context, msg *types.MsgRemoveReaso ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( - types.EventTypeRemoveReason, - sdk.NewAttribute(types.AttributeKeySubspaceID, fmt.Sprintf("%d", msg.SubspaceID)), + types.EventTypeRemovedReportingReason, + sdk.NewAttribute(subspacestypes.AttributeKeySubspaceID, fmt.Sprintf("%d", msg.SubspaceID)), sdk.NewAttribute(types.AttributeKeyReasonID, fmt.Sprintf("%d", msg.ReasonID)), ), }) diff --git a/x/reports/keeper/msg_server_test.go b/x/reports/keeper/msg_server_test.go index df6c8d8d8a..8df95e83f4 100644 --- a/x/reports/keeper/msg_server_test.go +++ b/x/reports/keeper/msg_server_test.go @@ -280,15 +280,15 @@ func (suite *KeeperTestSuite) TestMsgServer_CreateReport() { }, expEvents: sdk.Events{ sdk.NewEvent( - types.EventTypeCreateReport, - sdk.NewAttribute(types.AttributeKeySubspaceID, "1"), + types.EventTypeCreatedReport, + sdk.NewAttribute(subspacestypes.AttributeKeySubspaceID, "1"), sdk.NewAttribute(types.AttributeKeyReportID, "1"), sdk.NewAttribute(types.AttributeKeyReporter, "cosmos1qycmg40ju50fx2mcc82qtkzuswjs3mj3mqekeh"), sdk.NewAttribute(types.AttributeKeyCreationTime, time.Date(2020, 1, 1, 12, 00, 00, 000, time.UTC).Format(time.RFC3339)), ), sdk.NewEvent( - types.EventTypeReportUser, - sdk.NewAttribute(types.AttributeKeySubspaceID, "1"), + types.EventTypeReportedUser, + sdk.NewAttribute(subspacestypes.AttributeKeySubspaceID, "1"), sdk.NewAttribute(types.AttributeKeyUser, "cosmos1ggzk8tnte9lmzgpvyzzdtmwmn6rjlct4spmjjd"), sdk.NewAttribute(types.AttributeKeyReporter, "cosmos1qycmg40ju50fx2mcc82qtkzuswjs3mj3mqekeh"), ), @@ -376,16 +376,16 @@ func (suite *KeeperTestSuite) TestMsgServer_CreateReport() { }, expEvents: sdk.Events{ sdk.NewEvent( - types.EventTypeCreateReport, - sdk.NewAttribute(types.AttributeKeySubspaceID, "1"), + types.EventTypeCreatedReport, + sdk.NewAttribute(subspacestypes.AttributeKeySubspaceID, "1"), sdk.NewAttribute(types.AttributeKeyReportID, "1"), sdk.NewAttribute(types.AttributeKeyReporter, "cosmos1qycmg40ju50fx2mcc82qtkzuswjs3mj3mqekeh"), sdk.NewAttribute(types.AttributeKeyCreationTime, time.Date(2020, 1, 1, 12, 00, 00, 000, time.UTC).Format(time.RFC3339)), ), sdk.NewEvent( - types.EventTypeReportPost, - sdk.NewAttribute(types.AttributeKeySubspaceID, "1"), - sdk.NewAttribute(types.AttributeKeyPostID, "1"), + types.EventTypeReportedPost, + sdk.NewAttribute(subspacestypes.AttributeKeySubspaceID, "1"), + sdk.NewAttribute(poststypes.AttributeKeyPostID, "1"), sdk.NewAttribute(types.AttributeKeyReporter, "cosmos1qycmg40ju50fx2mcc82qtkzuswjs3mj3mqekeh"), ), }, @@ -591,8 +591,8 @@ func (suite *KeeperTestSuite) TestMsgServer_DeleteReport() { shouldErr: false, expEvents: sdk.Events{ sdk.NewEvent( - types.EventTypeDeleteReport, - sdk.NewAttribute(types.AttributeKeySubspaceID, "1"), + types.EventTypeDeletedReport, + sdk.NewAttribute(subspacestypes.AttributeKeySubspaceID, "1"), sdk.NewAttribute(types.AttributeKeyReportID, "1"), ), }, @@ -633,8 +633,8 @@ func (suite *KeeperTestSuite) TestMsgServer_DeleteReport() { shouldErr: false, expEvents: sdk.Events{ sdk.NewEvent( - types.EventTypeDeleteReport, - sdk.NewAttribute(types.AttributeKeySubspaceID, "1"), + types.EventTypeDeletedReport, + sdk.NewAttribute(subspacestypes.AttributeKeySubspaceID, "1"), sdk.NewAttribute(types.AttributeKeyReportID, "1"), ), }, @@ -798,8 +798,8 @@ func (suite *KeeperTestSuite) TestMsgServer_SupportStandardReason() { }, expEvents: sdk.Events{ sdk.NewEvent( - types.EventTypeSupportStandardReason, - sdk.NewAttribute(types.AttributeKeySubspaceID, "1"), + types.EventTypeSupportedStandardReason, + sdk.NewAttribute(subspacestypes.AttributeKeySubspaceID, "1"), sdk.NewAttribute(types.AttributeKeyStandardReasonID, "1"), sdk.NewAttribute(types.AttributeKeyReasonID, "1"), ), @@ -976,8 +976,8 @@ func (suite *KeeperTestSuite) TestMsgServer_AddReason() { }, expEvents: sdk.Events{ sdk.NewEvent( - types.EventTypeAddReason, - sdk.NewAttribute(types.AttributeKeySubspaceID, "1"), + types.EventTypeAddedReportingReason, + sdk.NewAttribute(subspacestypes.AttributeKeySubspaceID, "1"), sdk.NewAttribute(types.AttributeKeyReasonID, "1"), ), }, @@ -1115,8 +1115,8 @@ func (suite *KeeperTestSuite) TestMsgServer_RemoveReason() { shouldErr: false, expEvents: sdk.Events{ sdk.NewEvent( - types.EventTypeRemoveReason, - sdk.NewAttribute(types.AttributeKeySubspaceID, "1"), + types.EventTypeRemovedReportingReason, + sdk.NewAttribute(subspacestypes.AttributeKeySubspaceID, "1"), sdk.NewAttribute(types.AttributeKeyReasonID, "1"), ), }, diff --git a/x/reports/spec/05-events.md b/x/reports/spec/05-events.md index 217d55749d..6623ce4b61 100644 --- a/x/reports/spec/05-events.md +++ b/x/reports/spec/05-events.md @@ -13,71 +13,70 @@ The reports module emits the following events: ### MsgCreateReport -| **Type** | **Attribute Key** | **Attribute Value** | -|:--------------|:------------------|:----------------------------------| -| create_report | subspace_id | {subspaceID} | -| create_report | report_id | {reportID} | -| create_report | reporter | {userAddress} | -| create_report | creation_time | {creationTime} | -| message | module | reports | -| message | action | desmos.reports.v1.MsgCreateReport | -| message | reporter | {userAddress} | +| **Type** | **Attribute Key** | **Attribute Value** | +|:---------------|:------------------|:----------------------------------| +| created_report | subspace_id | {subspaceID} | +| created_report | report_id | {reportID} | +| created_report | reporter | {userAddress} | +| created_report | creation_time | {creationTime} | +| message | module | reports | +| message | action | desmos.reports.v1.MsgCreateReport | +| message | reporter | {userAddress} | Other events attributes depending on the type of the report target are attached. #### `Post Target` -| **Type** | **Attribute Key** | **Attribute Value** | -|:------------|:------------------|:--------------------| -| report_post | subspace_id | {subspaceID} | -| report_post | post_id | {reportID} | -| report_post | reporter | {userAddress} | +| **Type** | **Attribute Key** | **Attribute Value** | +|:--------------|:------------------|:--------------------| +| reported_post | subspace_id | {subspaceID} | +| reported_post | post_id | {reportID} | +| reported_post | reporter | {userAddress} | #### `User Target` -| **Type** | **Attribute Key** | **Attribute Value** | -|:------------|:------------------|:--------------------| -| report_user | subspace_id | {subspaceID} | -| report_user | user | {userAddress} | -| report_user | reporter | {userAddress} | +| **Type** | **Attribute Key** | **Attribute Value** | +|:--------------|:------------------|:--------------------| +| reported_user | subspace_id | {subspaceID} | +| reported_user | user | {userAddress} | +| reported_user | reporter | {userAddress} | ### MsgDeleteReport -| **Type** | **Attribute Key** | **Attribute Value** | -|:--------------|:------------------|:----------------------------------| -| delete_report | subspace_id | {subspaceID} | -| delete_report | report_id | {reportID} | -| message | module | reports | -| message | action | desmos.reports.v1.MsgDeleteReport | -| message | signer | {userAddress} | +| **Type** | **Attribute Key** | **Attribute Value** | +|:---------------|:------------------|:----------------------------------| +| deleted_report | subspace_id | {subspaceID} | +| deleted_report | report_id | {reportID} | +| message | module | reports | +| message | action | desmos.reports.v1.MsgDeleteReport | +| message | signer | {userAddress} | ### MsgSupportStandardReason -| **Type** | **Attribute Key** | **Attribute Value** | -|:------------------------|:-------------------|:-------------------------------------------| -| support_standard_reason | subspace_id | {subspaceID} | -| support_standard_reason | standard_reason_id | {reasonID} | -| support_standard_reason | reason_id | {reasonID} | -| message | module | reports | -| message | action | desmos.reports.v1.MsgSupportStandardReason | -| message | signer | {userAddress} | +| **Type** | **Attribute Key** | **Attribute Value** | +|:--------------------------|:-------------------|:-------------------------------------------| +| supported_standard_reason | subspace_id | {subspaceID} | +| supported_standard_reason | standard_reason_id | {reasonID} | +| supported_standard_reason | reason_id | {reasonID} | +| message | module | reports | +| message | action | desmos.reports.v1.MsgSupportStandardReason | +| message | signer | {userAddress} | ### MsgAddReason -| **Type** | **Attribute Key** | **Attribute Value** | -|:-----------|:------------------|:-------------------------------| -| add_reason | subspace_id | {subspaceID} | -| add_reason | reason_id | {reasonID} | -| message | module | reports | -| message | action | desmos.reports.v1.MsgAddReason | -| message | signer | {userAddress} | - +| **Type** | **Attribute Key** | **Attribute Value** | +|:-----------------------|:------------------|:-------------------------------| +| added_reporting_reason | subspace_id | {subspaceID} | +| added_reporting_reason | reason_id | {reasonID} | +| message | module | reports | +| message | action | desmos.reports.v1.MsgAddReason | +| message | signer | {userAddress} | ### MsgRemoveReason -| **Type** | **Attribute Key** | **Attribute Value** | -|:--------------|:------------------|:----------------------------------| -| remove_reason | subspace_id | {subspaceID} | -| remove_reason | reason_id | {reasonID} | -| message | module | reports | -| message | action | desmos.reports.v1.MsgRemoveReason | \ No newline at end of file +| **Type** | **Attribute Key** | **Attribute Value** | +|:-------------------------|:------------------|:----------------------------------| +| removed_reporting_reason | subspace_id | {subspaceID} | +| removed_reporting_reason | reason_id | {reasonID} | +| message | module | reports | +| message | action | desmos.reports.v1.MsgRemoveReason | \ No newline at end of file diff --git a/x/reports/types/events.go b/x/reports/types/events.go index 303243da1e..ee693fd03e 100644 --- a/x/reports/types/events.go +++ b/x/reports/types/events.go @@ -3,20 +3,18 @@ package types // DONTCOVER const ( - EventTypeCreateReport = "create_report" - EventTypeReportPost = "report_post" - EventTypeReportUser = "report_user" - EventTypeDeleteReport = "delete_report" - EventTypeSupportStandardReason = "support_standard_reason" - EventTypeAddReason = "add_reason" - EventTypeRemoveReason = "remove_reason" + EventTypeCreatedReport = "created_report" + EventTypeReportedPost = "reported_post" + EventTypeReportedUser = "reported_user" + EventTypeDeletedReport = "deleted_report" + EventTypeSupportedStandardReason = "supported_standard_reason" + EventTypeAddedReportingReason = "added_reporting_reason" + EventTypeRemovedReportingReason = "removed_reporting_reason" - AttributeKeySubspaceID = "subspace_id" AttributeKeyReportID = "report_id" AttributeKeyReporter = "reporter" AttributeKeyCreationTime = "creation_time" AttributeKeyStandardReasonID = "standard_reason_id" AttributeKeyReasonID = "reason_id" - AttributeKeyPostID = "post_id" AttributeKeyUser = "user" ) diff --git a/x/subspaces/keeper/msg_server.go b/x/subspaces/keeper/msg_server.go index 60716922fd..7863556003 100644 --- a/x/subspaces/keeper/msg_server.go +++ b/x/subspaces/keeper/msg_server.go @@ -3,6 +3,7 @@ package keeper import ( "context" "fmt" + "strings" "time" "github.com/desmos-labs/desmos/v6/x/subspaces/types" @@ -51,7 +52,7 @@ func (k msgServer) CreateSubspace(goCtx context.Context, msg *types.MsgCreateSub ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( - types.EventTypeCreateSubspace, + types.EventTypeCreatedSubspace, sdk.NewAttribute(types.AttributeKeySubspaceID, fmt.Sprintf("%d", subspaceID)), sdk.NewAttribute(types.AttributeKeySubspaceName, subspace.Name), sdk.NewAttribute(types.AttributeKeySubspaceCreator, subspace.Creator), @@ -96,7 +97,7 @@ func (k msgServer) EditSubspace(goCtx context.Context, msg *types.MsgEditSubspac ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( - types.EventTypeEditSubspace, + types.EventTypeEditedSubspace, sdk.NewAttribute(types.AttributeKeySubspaceID, fmt.Sprintf("%d", updated.ID)), ), }) @@ -128,7 +129,7 @@ func (k msgServer) DeleteSubspace(goCtx context.Context, msg *types.MsgDeleteSub ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( - types.EventTypeDeleteSubspace, + types.EventTypeDeletedSubspace, sdk.NewAttribute(types.AttributeKeySubspaceID, fmt.Sprintf("%d", msg.SubspaceID)), ), }) @@ -181,7 +182,7 @@ func (k msgServer) CreateSection(goCtx context.Context, msg *types.MsgCreateSect ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( - types.EventTypeCreateSection, + types.EventTypeCreatedSection, sdk.NewAttribute(types.AttributeKeySubspaceID, fmt.Sprintf("%d", section.SubspaceID)), sdk.NewAttribute(types.AttributeKeySectionID, fmt.Sprintf("%d", section.ID)), ), @@ -230,7 +231,7 @@ func (k msgServer) EditSection(goCtx context.Context, msg *types.MsgEditSection) ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( - types.EventTypeEditSection, + types.EventTypeEditedSection, sdk.NewAttribute(types.AttributeKeySubspaceID, fmt.Sprintf("%d", section.SubspaceID)), sdk.NewAttribute(types.AttributeKeySectionID, fmt.Sprintf("%d", section.ID)), ), @@ -286,7 +287,7 @@ func (k msgServer) MoveSection(goCtx context.Context, msg *types.MsgMoveSection) ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( - types.EventTypeMoveSection, + types.EventTypeMovedSection, sdk.NewAttribute(types.AttributeKeySubspaceID, fmt.Sprintf("%d", msg.SubspaceID)), sdk.NewAttribute(types.AttributeKeySectionID, fmt.Sprintf("%d", msg.SectionID)), ), @@ -324,7 +325,7 @@ func (k msgServer) DeleteSection(goCtx context.Context, msg *types.MsgDeleteSect ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( - types.EventTypeDeleteSection, + types.EventTypeDeletedSection, sdk.NewAttribute(types.AttributeKeySubspaceID, fmt.Sprintf("%d", msg.SubspaceID)), sdk.NewAttribute(types.AttributeKeySectionID, fmt.Sprintf("%d", msg.SectionID)), ), @@ -391,7 +392,7 @@ func (k msgServer) CreateUserGroup(goCtx context.Context, msg *types.MsgCreateUs // Add the events to the list of to emit userEvents = append(userEvents, sdk.NewEvent( - types.EventTypeAddUserToGroup, + types.EventTypeAddedUserToGroup, sdk.NewAttribute(types.AttributeKeySubspaceID, fmt.Sprintf("%d", group.SubspaceID)), sdk.NewAttribute(types.AttributeKeyUserGroupID, fmt.Sprintf("%d", group.ID)), sdk.NewAttribute(types.AttributeKeyUser, member), @@ -400,7 +401,7 @@ func (k msgServer) CreateUserGroup(goCtx context.Context, msg *types.MsgCreateUs ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( - types.EventTypeCreateUserGroup, + types.EventTypeCreatedUserGroup, sdk.NewAttribute(types.AttributeKeySubspaceID, fmt.Sprintf("%d", msg.SubspaceID)), sdk.NewAttribute(types.AttributeKeyUserGroupID, fmt.Sprintf("%d", group.ID)), ), @@ -446,7 +447,7 @@ func (k msgServer) EditUserGroup(goCtx context.Context, msg *types.MsgEditUserGr ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( - types.EventTypeEditUserGroup, + types.EventTypeEditedUserGroup, sdk.NewAttribute(types.AttributeKeySubspaceID, fmt.Sprintf("%d", msg.SubspaceID)), sdk.NewAttribute(types.AttributeKeyUserGroupID, fmt.Sprintf("%d", msg.GroupID)), ), @@ -501,7 +502,7 @@ func (k msgServer) MoveUserGroup(goCtx context.Context, msg *types.MsgMoveUserGr ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( - types.EvenTypeMoveUserGroup, + types.EventTypeMovedUserGroup, sdk.NewAttribute(types.AttributeKeySubspaceID, fmt.Sprintf("%d", msg.SubspaceID)), sdk.NewAttribute(types.AttributeKeyUserGroupID, fmt.Sprintf("%d", msg.GroupID)), ), @@ -555,6 +556,7 @@ func (k msgServer) SetUserGroupPermissions(goCtx context.Context, msg *types.Msg types.EventTypeSetUserGroupPermissions, sdk.NewAttribute(types.AttributeKeySubspaceID, fmt.Sprintf("%d", msg.SubspaceID)), sdk.NewAttribute(types.AttributeKeyUserGroupID, fmt.Sprintf("%d", msg.GroupID)), + sdk.NewAttribute(types.AttributeKeyPermissions, strings.Join(msg.Permissions, ",")), ), }) @@ -591,7 +593,7 @@ func (k msgServer) DeleteUserGroup(goCtx context.Context, msg *types.MsgDeleteUs ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( - types.EventTypeDeleteUserGroup, + types.EventTypeDeletedUserGroup, sdk.NewAttribute(types.AttributeKeySubspaceID, fmt.Sprintf("%d", msg.SubspaceID)), sdk.NewAttribute(types.AttributeKeyUserGroupID, fmt.Sprintf("%d", msg.GroupID)), ), @@ -640,7 +642,7 @@ func (k msgServer) AddUserToUserGroup(goCtx context.Context, msg *types.MsgAddUs ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( - types.EventTypeAddUserToGroup, + types.EventTypeAddedUserToGroup, sdk.NewAttribute(types.AttributeKeySubspaceID, fmt.Sprintf("%d", msg.SubspaceID)), sdk.NewAttribute(types.AttributeKeyUserGroupID, fmt.Sprintf("%d", msg.GroupID)), sdk.NewAttribute(types.AttributeKeyUser, msg.User), @@ -685,7 +687,7 @@ func (k msgServer) RemoveUserFromUserGroup(goCtx context.Context, msg *types.Msg ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( - types.EventTypeRemoveUserFromGroup, + types.EventTypeRemovedUserFromGroup, sdk.NewAttribute(types.AttributeKeySubspaceID, fmt.Sprintf("%d", msg.SubspaceID)), sdk.NewAttribute(types.AttributeKeyUserGroupID, fmt.Sprintf("%d", msg.GroupID)), sdk.NewAttribute(types.AttributeKeyUser, msg.User), @@ -736,6 +738,8 @@ func (k msgServer) SetUserPermissions(goCtx context.Context, msg *types.MsgSetUs sdk.NewEvent( types.EventTypeSetUserPermissions, sdk.NewAttribute(types.AttributeKeySubspaceID, fmt.Sprintf("%d", msg.SubspaceID)), + sdk.NewAttribute(types.AttributeKeySectionID, fmt.Sprintf("%d", msg.SectionID)), + sdk.NewAttribute(types.AttributeKeyPermissions, strings.Join(msg.Permissions, ",")), sdk.NewAttribute(types.AttributeKeyUser, msg.User), ), }) @@ -778,7 +782,7 @@ func (k msgServer) GrantTreasuryAuthorization(goCtx context.Context, msg *types. ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( - types.EventTypeGrantTreasuryAuthorization, + types.EventTypeGrantedTreasuryAuthorization, sdk.NewAttribute(types.AttributeKeySubspaceID, fmt.Sprintf("%d", msg.SubspaceID)), sdk.NewAttribute(types.AttributeKeyGranter, msg.Granter), sdk.NewAttribute(types.AttributeKeyGrantee, msg.Grantee), @@ -816,7 +820,7 @@ func (k msgServer) RevokeTreasuryAuthorization(goCtx context.Context, msg *types ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( - types.EventTypeRevokeTreasuryAuthorization, + types.EventTypeRevokedTreasuryAuthorization, sdk.NewAttribute(types.AttributeKeySubspaceID, fmt.Sprintf("%d", msg.SubspaceID)), sdk.NewAttribute(types.AttributeKeyGranter, msg.Granter), sdk.NewAttribute(types.AttributeKeyGrantee, msg.Grantee), @@ -845,7 +849,7 @@ func (k msgServer) GrantAllowance(goCtx context.Context, msg *types.MsgGrantAllo return nil, errors.Wrap(sdkerrors.ErrInvalidRequest, "fee allowance already exists") } events = events.AppendEvent(sdk.NewEvent( - types.EventTypeGrantAllowance, + types.EventTypeGrantedAllowance, sdk.NewAttribute(types.AttributeKeySubspaceID, fmt.Sprintf("%d", msg.SubspaceID)), sdk.NewAttribute(types.AttributeKeyGranter, msg.Granter), sdk.NewAttribute(types.AttributeKeyUserGrantee, grantee.User), @@ -859,7 +863,7 @@ func (k msgServer) GrantAllowance(goCtx context.Context, msg *types.MsgGrantAllo return nil, errors.Wrap(sdkerrors.ErrInvalidRequest, "fee allowance already exists") } events = events.AppendEvent(sdk.NewEvent( - types.EventTypeGrantAllowance, + types.EventTypeGrantedAllowance, sdk.NewAttribute(types.AttributeKeySubspaceID, fmt.Sprintf("%d", msg.SubspaceID)), sdk.NewAttribute(types.AttributeKeyGranter, msg.Granter), sdk.NewAttribute(types.AttributeKeyGroupGrantee, fmt.Sprintf("%d", grantee.GroupID)), @@ -904,7 +908,7 @@ func (k msgServer) RevokeAllowance(goCtx context.Context, msg *types.MsgRevokeAl } k.DeleteUserGrant(ctx, msg.SubspaceID, grantee.User) events = events.AppendEvent(sdk.NewEvent( - types.EventTypeRevokeAllowance, + types.EventTypeRevokedAllowance, sdk.NewAttribute(types.AttributeKeySubspaceID, fmt.Sprintf("%d", msg.SubspaceID)), sdk.NewAttribute(types.AttributeKeyGranter, msg.Granter), sdk.NewAttribute(types.AttributeKeyUserGrantee, grantee.User), @@ -916,7 +920,7 @@ func (k msgServer) RevokeAllowance(goCtx context.Context, msg *types.MsgRevokeAl } k.DeleteGroupGrant(ctx, msg.SubspaceID, grantee.GroupID) events = events.AppendEvent(sdk.NewEvent( - types.EventTypeRevokeAllowance, + types.EventTypeRevokedAllowance, sdk.NewAttribute(types.AttributeKeySubspaceID, fmt.Sprintf("%d", msg.SubspaceID)), sdk.NewAttribute(types.AttributeKeyGranter, msg.Granter), sdk.NewAttribute(types.AttributeKeyGroupGrantee, fmt.Sprintf("%d", grantee.GroupID)), @@ -956,7 +960,7 @@ func (k msgServer) UpdateSubspaceFeeTokens(goCtx context.Context, msg *types.Msg ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( - types.EventTypeUpdateSubspaceFeeToken, + types.EventTypeUpdatedSubspaceFeeToken, sdk.NewAttribute(types.AttributeKeySubspaceID, fmt.Sprintf("%d", updated.ID)), sdk.NewAttribute(types.AttributeKeyUser, msg.Authority), ), diff --git a/x/subspaces/keeper/msg_server_test.go b/x/subspaces/keeper/msg_server_test.go index 5e4cf1315f..c084aa923e 100644 --- a/x/subspaces/keeper/msg_server_test.go +++ b/x/subspaces/keeper/msg_server_test.go @@ -63,7 +63,7 @@ func (suite *KeeperTestSuite) TestMsgServer_CreateSubspace() { expResponse: &types.MsgCreateSubspaceResponse{SubspaceID: 1}, expEvents: sdk.Events{ sdk.NewEvent( - types.EventTypeCreateSubspace, + types.EventTypeCreatedSubspace, sdk.NewAttribute(types.AttributeKeySubspaceID, "1"), sdk.NewAttribute(types.AttributeKeySubspaceName, "Test subspace"), sdk.NewAttribute(types.AttributeKeySubspaceCreator, "cosmos1qzskhrcjnkdz2ln4yeafzsdwht8ch08j4wed69"), @@ -112,7 +112,7 @@ func (suite *KeeperTestSuite) TestMsgServer_CreateSubspace() { expResponse: &types.MsgCreateSubspaceResponse{SubspaceID: 1}, expEvents: sdk.Events{ sdk.NewEvent( - types.EventTypeCreateSubspace, + types.EventTypeCreatedSubspace, sdk.NewAttribute(types.AttributeKeySubspaceID, "1"), sdk.NewAttribute(types.AttributeKeySubspaceName, "Test subspace"), sdk.NewAttribute(types.AttributeKeySubspaceCreator, "cosmos18atyyv6zycryhvnhpr2mjxgusdcah6kdpkffq0"), @@ -166,7 +166,7 @@ func (suite *KeeperTestSuite) TestMsgServer_CreateSubspace() { expResponse: &types.MsgCreateSubspaceResponse{SubspaceID: 2}, expEvents: sdk.Events{ sdk.NewEvent( - types.EventTypeCreateSubspace, + types.EventTypeCreatedSubspace, sdk.NewAttribute(types.AttributeKeySubspaceID, "2"), sdk.NewAttribute(types.AttributeKeySubspaceName, "Another subspace"), sdk.NewAttribute(types.AttributeKeySubspaceCreator, "cosmos1y4emx0mm4ncva9mnv9yvjrm7nrq3psvmwhk9ll"), @@ -358,7 +358,7 @@ func (suite *KeeperTestSuite) TestMsgServer_EditSubspace() { shouldErr: false, expEvents: sdk.Events{ sdk.NewEvent( - types.EventTypeEditSubspace, + types.EventTypeEditedSubspace, sdk.NewAttribute(types.AttributeKeySubspaceID, "1"), ), }, @@ -481,7 +481,7 @@ func (suite *KeeperTestSuite) TestMsgServer_DeleteSubspace() { shouldErr: false, expEvents: sdk.Events{ sdk.NewEvent( - types.EventTypeDeleteSubspace, + types.EventTypeDeletedSubspace, sdk.NewAttribute(types.AttributeKeySubspaceID, "1"), ), }, @@ -712,7 +712,7 @@ func (suite *KeeperTestSuite) TestMsgServer_CreateSection() { expResponse: &types.MsgCreateSectionResponse{SectionID: 2}, expEvent: sdk.Events{ sdk.NewEvent( - types.EventTypeCreateSection, + types.EventTypeCreatedSection, sdk.NewAttribute(types.AttributeKeySubspaceID, "1"), sdk.NewAttribute(types.AttributeKeySectionID, "2"), ), @@ -912,7 +912,7 @@ func (suite *KeeperTestSuite) TestMsgServer_EditSection() { shouldErr: false, expEvents: sdk.Events{ sdk.NewEvent( - types.EventTypeEditSection, + types.EventTypeEditedSection, sdk.NewAttribute(types.AttributeKeySubspaceID, "1"), sdk.NewAttribute(types.AttributeKeySectionID, "1"), ), @@ -1167,7 +1167,7 @@ func (suite *KeeperTestSuite) TestMsgServer_MoveSection() { shouldErr: false, expEvents: sdk.Events{ sdk.NewEvent( - types.EventTypeMoveSection, + types.EventTypeMovedSection, sdk.NewAttribute(types.AttributeKeySubspaceID, "1"), sdk.NewAttribute(types.AttributeKeySectionID, "2"), ), @@ -1314,7 +1314,7 @@ func (suite *KeeperTestSuite) TestMsgServer_DeleteSection() { shouldErr: false, expEvents: sdk.Events{ sdk.NewEvent( - types.EventTypeDeleteSection, + types.EventTypeDeletedSection, sdk.NewAttribute(types.AttributeKeySubspaceID, "1"), sdk.NewAttribute(types.AttributeKeySectionID, "1"), ), @@ -1540,12 +1540,12 @@ func (suite *KeeperTestSuite) TestMsgServer_CreateUserGroup() { expResponse: &types.MsgCreateUserGroupResponse{GroupID: 2}, expEvents: sdk.Events{ sdk.NewEvent( - types.EventTypeCreateUserGroup, + types.EventTypeCreatedUserGroup, sdk.NewAttribute(types.AttributeKeySubspaceID, "1"), sdk.NewAttribute(types.AttributeKeyUserGroupID, "2"), ), sdk.NewEvent( - types.EventTypeAddUserToGroup, + types.EventTypeAddedUserToGroup, sdk.NewAttribute(types.AttributeKeySubspaceID, "1"), sdk.NewAttribute(types.AttributeKeyUserGroupID, "2"), sdk.NewAttribute(types.AttributeKeyUser, "cosmos16yhs7fgqnf6fjm4tftv66g2smtmee62wyg780l"), @@ -1737,7 +1737,7 @@ func (suite *KeeperTestSuite) TestMsgServer_EditUserGroup() { shouldErr: false, expEvents: sdk.Events{ sdk.NewEvent( - types.EventTypeEditUserGroup, + types.EventTypeEditedUserGroup, sdk.NewAttribute(types.AttributeKeySubspaceID, "1"), sdk.NewAttribute(types.AttributeKeyUserGroupID, "1"), ), @@ -2044,7 +2044,7 @@ func (suite *KeeperTestSuite) TestMsgServer_MoveUserGroup() { shouldErr: false, expEvents: sdk.Events{ sdk.NewEvent( - types.EvenTypeMoveUserGroup, + types.EventTypeMovedUserGroup, sdk.NewAttribute(types.AttributeKeySubspaceID, "1"), sdk.NewAttribute(types.AttributeKeyUserGroupID, "1"), ), @@ -2267,6 +2267,7 @@ func (suite *KeeperTestSuite) TestMsgServer_SetUserGroupPermissions() { types.EventTypeSetUserGroupPermissions, sdk.NewAttribute(types.AttributeKeySubspaceID, "1"), sdk.NewAttribute(types.AttributeKeyUserGroupID, "1"), + sdk.NewAttribute(types.AttributeKeyPermissions, "EVERYTHING"), ), }, check: func(ctx sdk.Context) { @@ -2317,6 +2318,7 @@ func (suite *KeeperTestSuite) TestMsgServer_SetUserGroupPermissions() { types.EventTypeSetUserGroupPermissions, sdk.NewAttribute(types.AttributeKeySubspaceID, "1"), sdk.NewAttribute(types.AttributeKeyUserGroupID, "1"), + sdk.NewAttribute(types.AttributeKeyPermissions, "SET_PERMISSIONS"), ), }, check: func(ctx sdk.Context) { @@ -2459,7 +2461,7 @@ func (suite *KeeperTestSuite) TestMsgServer_DeleteUserGroup() { shouldErr: false, expEvents: sdk.Events{ sdk.NewEvent( - types.EventTypeDeleteUserGroup, + types.EventTypeDeletedUserGroup, sdk.NewAttribute(types.AttributeKeySubspaceID, "1"), sdk.NewAttribute(types.AttributeKeyUserGroupID, "1"), ), @@ -2638,7 +2640,7 @@ func (suite *KeeperTestSuite) TestMsgServer_AddUserToGroup() { shouldErr: false, expEvents: sdk.Events{ sdk.NewEvent( - types.EventTypeAddUserToGroup, + types.EventTypeAddedUserToGroup, sdk.NewAttribute(types.AttributeKeySubspaceID, "1"), sdk.NewAttribute(types.AttributeKeyUserGroupID, "1"), sdk.NewAttribute(types.AttributeKeyUser, "cosmos1a0cj0j6ujn2xap8p40y6648d0w2npytw3xvenm"), @@ -2817,7 +2819,7 @@ func (suite *KeeperTestSuite) TestMsgServer_RemoveUserFromGroup() { shouldErr: false, expEvents: sdk.Events{ sdk.NewEvent( - types.EventTypeRemoveUserFromGroup, + types.EventTypeRemovedUserFromGroup, sdk.NewAttribute(types.AttributeKeySubspaceID, "1"), sdk.NewAttribute(types.AttributeKeyUserGroupID, "1"), sdk.NewAttribute(types.AttributeKeyUser, "cosmos1a0cj0j6ujn2xap8p40y6648d0w2npytw3xvenm"), @@ -2985,6 +2987,8 @@ func (suite *KeeperTestSuite) TestMsgServer_SetUserPermissions() { sdk.NewEvent( types.EventTypeSetUserPermissions, sdk.NewAttribute(types.AttributeKeySubspaceID, "1"), + sdk.NewAttribute(types.AttributeKeySectionID, "0"), + sdk.NewAttribute(types.AttributeKeyPermissions, "EDIT_SUBSPACE"), sdk.NewAttribute(types.AttributeKeyUser, "cosmos1x5pjlvufs4znnhhkwe8v4tw3kz30f3lxgwza53"), ), }, @@ -3112,7 +3116,7 @@ func (suite *KeeperTestSuite) TestMsgServer_UpdateSubspaceFeeTokens() { shouldErr: false, expEvents: sdk.Events{ sdk.NewEvent( - types.EventTypeUpdateSubspaceFeeToken, + types.EventTypeUpdatedSubspaceFeeToken, sdk.NewAttribute(types.AttributeKeySubspaceID, "1"), sdk.NewAttribute(types.AttributeKeyUser, authtypes.NewModuleAddress("gov").String()), ), @@ -3294,7 +3298,7 @@ func (suite *KeeperTestSuite) TestMsgServer_GrantTreasuryAuthorization() { expResponse: &types.MsgGrantTreasuryAuthorizationResponse{}, expEvents: sdk.Events{ sdk.NewEvent( - types.EventTypeGrantTreasuryAuthorization, + types.EventTypeGrantedTreasuryAuthorization, sdk.NewAttribute(types.AttributeKeySubspaceID, "1"), sdk.NewAttribute(types.AttributeKeyGranter, "cosmos1lv3e0l66rr68k5l74mnrv4j9kyny6cz27pvnez"), sdk.NewAttribute(types.AttributeKeyGrantee, "cosmos1qzskhrcjnkdz2ln4yeafzsdwht8ch08j4wed69"), @@ -3518,7 +3522,7 @@ func (suite *KeeperTestSuite) TestMsgServer_RevokeTreasuryAuthorization() { expResponse: &types.MsgRevokeTreasuryAuthorizationResponse{}, expEvents: sdk.Events{ sdk.NewEvent( - types.EventTypeRevokeTreasuryAuthorization, + types.EventTypeRevokedTreasuryAuthorization, sdk.NewAttribute(types.AttributeKeySubspaceID, "1"), sdk.NewAttribute(types.AttributeKeyGranter, "cosmos1lv3e0l66rr68k5l74mnrv4j9kyny6cz27pvnez"), sdk.NewAttribute(types.AttributeKeyGrantee, "cosmos1qzskhrcjnkdz2ln4yeafzsdwht8ch08j4wed69"), @@ -3755,7 +3759,7 @@ func (suite *KeeperTestSuite) TestMsgServer_GrantAllowance() { shouldErr: false, expEvents: sdk.Events{ sdk.NewEvent( - types.EventTypeGrantAllowance, + types.EventTypeGrantedAllowance, sdk.NewAttribute(types.AttributeKeySubspaceID, "1"), sdk.NewAttribute(types.AttributeKeyGranter, "cosmos1x5pjlvufs4znnhhkwe8v4tw3kz30f3lxgwza53"), sdk.NewAttribute(types.AttributeKeyUserGrantee, "cosmos1m0czrla04f7rp3zg7dsgc4kla54q7pc4xt00l5"), @@ -3811,7 +3815,7 @@ func (suite *KeeperTestSuite) TestMsgServer_GrantAllowance() { shouldErr: false, expEvents: sdk.Events{ sdk.NewEvent( - types.EventTypeGrantAllowance, + types.EventTypeGrantedAllowance, sdk.NewAttribute(types.AttributeKeySubspaceID, "1"), sdk.NewAttribute(types.AttributeKeyGranter, "cosmos1x5pjlvufs4znnhhkwe8v4tw3kz30f3lxgwza53"), sdk.NewAttribute(types.AttributeKeyGroupGrantee, "1"), @@ -3977,7 +3981,7 @@ func (suite *KeeperTestSuite) TestMsgServer_RevokeAllowance() { shouldErr: false, expEvents: sdk.Events{ sdk.NewEvent( - types.EventTypeRevokeAllowance, + types.EventTypeRevokedAllowance, sdk.NewAttribute(types.AttributeKeySubspaceID, "1"), sdk.NewAttribute(types.AttributeKeyGranter, "cosmos1x5pjlvufs4znnhhkwe8v4tw3kz30f3lxgwza53"), sdk.NewAttribute(types.AttributeKeyUserGrantee, "cosmos1m0czrla04f7rp3zg7dsgc4kla54q7pc4xt00l5"), @@ -4022,7 +4026,7 @@ func (suite *KeeperTestSuite) TestMsgServer_RevokeAllowance() { shouldErr: false, expEvents: sdk.Events{ sdk.NewEvent( - types.EventTypeRevokeAllowance, + types.EventTypeRevokedAllowance, sdk.NewAttribute(types.AttributeKeySubspaceID, "1"), sdk.NewAttribute(types.AttributeKeyGranter, "cosmos1x5pjlvufs4znnhhkwe8v4tw3kz30f3lxgwza53"), sdk.NewAttribute(types.AttributeKeyGroupGrantee, "1"), diff --git a/x/subspaces/spec/05-events.md b/x/subspaces/spec/05-events.md index 8cd85fe566..b91cc768d9 100644 --- a/x/subspaces/spec/05-events.md +++ b/x/subspaces/spec/05-events.md @@ -13,103 +13,103 @@ The subspaces module emits the following events: ### MsgCreateSubspace -| **Type** | **Attribute Key** | **Attribute Value** | -|:----------------|:------------------|:--------------------------------------| -| create_subspace | subspace_id | {subspaceID} | -| create_subspace | subspace_name | {subspaceName} | -| create_subspace | subspace_creator | {subspaceCreator} | -| create_subspace | creation_date | {subspaceCreationTime} | -| message | module | subspaces | -| message | action | desmos.subspaces.v3.MsgCreateSubspace | -| message | sender | {userAddress} | +| **Type** | **Attribute Key** | **Attribute Value** | +|:-----------------|:------------------|:--------------------------------------| +| created_subspace | subspace_id | {subspaceID} | +| created_subspace | subspace_name | {subspaceName} | +| created_subspace | subspace_creator | {subspaceCreator} | +| created_subspace | creation_date | {subspaceCreationTime} | +| message | module | subspaces | +| message | action | desmos.subspaces.v3.MsgCreateSubspace | +| message | sender | {userAddress} | ### MsgEditSubspace -| **Type** | **Attribute Key** | **Attribute Value** | -|:--------------|:------------------|:------------------------------------| -| edit_subspace | subspace_id | {subspaceID} | -| message | module | subspaces | -| message | action | desmos.subspaces.v3.MsgEditSubspace | -| message | sender | {userAddress} | +| **Type** | **Attribute Key** | **Attribute Value** | +|:----------------|:------------------|:------------------------------------| +| edited_subspace | subspace_id | {subspaceID} | +| message | module | subspaces | +| message | action | desmos.subspaces.v3.MsgEditSubspace | +| message | sender | {userAddress} | ### MsgDeleteSubspace -| **Type** | **Attribute Key** | **Attribute Value** | -|:----------------|:------------------|:--------------------------------------| -| delete_subspace | subspace_id | {subspaceID} | -| message | module | subspaces | -| message | action | desmos.subspaces.v3.MsgDeleteSubspace | -| message | sender | {userAddress} | +| **Type** | **Attribute Key** | **Attribute Value** | +|:-----------------|:------------------|:--------------------------------------| +| deleted_subspace | subspace_id | {subspaceID} | +| message | module | subspaces | +| message | action | desmos.subspaces.v3.MsgDeleteSubspace | +| message | sender | {userAddress} | ### MsgCreateSection -| **Type** | **Attribute Key** | **Attribute Value** | -|:---------------|:------------------|:-------------------------------------| -| create_section | subspace_id | {subspaceID} | -| create_section | section_id | {sectionID} | -| message | module | subspaces | -| message | action | desmos.subspaces.v3.MsgCreateSection | -| message | sender | {userAddress} | +| **Type** | **Attribute Key** | **Attribute Value** | +|:----------------|:------------------|:-------------------------------------| +| created_section | subspace_id | {subspaceID} | +| created_section | section_id | {sectionID} | +| message | module | subspaces | +| message | action | desmos.subspaces.v3.MsgCreateSection | +| message | sender | {userAddress} | ### MsgEditSection -| **Type** | **Attribute Key** | **Attribute Value** | -|:-------------|:------------------|:-----------------------------------| -| edit_section | subspace_id | {subspaceID} | -| edit_section | section_id | {sectionID} | -| message | module | subspaces | -| message | action | desmos.subspaces.v3.MsgEditSection | -| message | sender | {userAddress} | +| **Type** | **Attribute Key** | **Attribute Value** | +|:---------------|:------------------|:-----------------------------------| +| edited_section | subspace_id | {subspaceID} | +| edited_section | section_id | {sectionID} | +| message | module | subspaces | +| message | action | desmos.subspaces.v3.MsgEditSection | +| message | sender | {userAddress} | ### MsgMoveSection -| **Type** | **Attribute Key** | **Attribute Value** | -|:-------------|:------------------|:-----------------------------------| -| move_section | subspace_id | {subspaceID} | -| move_section | section_id | {sectionID} | -| message | module | subspaces | -| message | action | desmos.subspaces.v3.MsgMoveSection | -| message | sender | {userAddress} | +| **Type** | **Attribute Key** | **Attribute Value** | +|:--------------|:------------------|:-----------------------------------| +| moved_section | subspace_id | {subspaceID} | +| moved_section | section_id | {sectionID} | +| message | module | subspaces | +| message | action | desmos.subspaces.v3.MsgMoveSection | +| message | sender | {userAddress} | ### MsgDeleteSection -| **Type** | **Attribute Key** | **Attribute Value** | -|:---------------|:------------------|:-------------------------------------| -| delete_section | subspace_id | {subspaceID} | -| delete_section | section_id | {sectionID} | -| message | module | subspaces | -| message | action | desmos.subspaces.v3.MsgDeleteSection | -| message | sender | {userAddress} | +| **Type** | **Attribute Key** | **Attribute Value** | +|:----------------|:------------------|:-------------------------------------| +| deleted_section | subspace_id | {subspaceID} | +| deleted_section | section_id | {sectionID} | +| message | module | subspaces | +| message | action | desmos.subspaces.v3.MsgDeleteSection | +| message | sender | {userAddress} | ### MsgCreateUserGroup -| **Type** | **Attribute Key** | **Attribute Value** | -|:------------------|:------------------|:---------------------------------------| -| create_user_group | subspace_id | {subspaceID} | -| create_user_group | user_group_id | {userGroupID} | -| message | module | subspaces | -| message | action | desmos.subspaces.v3.MsgCreateUserGroup | -| message | sender | {userAddress} | +| **Type** | **Attribute Key** | **Attribute Value** | +|:-------------------|:------------------|:---------------------------------------| +| created_user_group | subspace_id | {subspaceID} | +| created_user_group | user_group_id | {userGroupID} | +| message | module | subspaces | +| message | action | desmos.subspaces.v3.MsgCreateUserGroup | +| message | sender | {userAddress} | ### MsgEditUserGroup -| **Type** | **Attribute Key** | **Attribute Value** | -|:----------------|:------------------|:-------------------------------------| -| edit_user_group | subspace_id | {subspaceID} | -| edit_user_group | user_group_id | {userGroupID} | -| message | module | subspaces | -| message | action | desmos.subspaces.v3.MsgEditUserGroup | -| message | sender | {userAddress} | +| **Type** | **Attribute Key** | **Attribute Value** | +|:------------------|:------------------|:-------------------------------------| +| edited_user_group | subspace_id | {subspaceID} | +| edited_user_group | user_group_id | {userGroupID} | +| message | module | subspaces | +| message | action | desmos.subspaces.v3.MsgEditUserGroup | +| message | sender | {userAddress} | ### MsgMoveUserGroup -| **Type** | **Attribute Key** | **Attribute Value** | -|:----------------|:------------------|:-------------------------------------| -| move_user_group | subspace_id | {subspaceID} | -| move_user_group | user_group_id | {userGroupID} | -| message | module | subspaces | -| message | action | desmos.subspaces.v3.MsgMoveUserGroup | -| message | sender | {userAddress} | +| **Type** | **Attribute Key** | **Attribute Value** | +|:-----------------|:------------------|:-------------------------------------| +| moved_user_group | subspace_id | {subspaceID} | +| moved_user_group | user_group_id | {userGroupID} | +| message | module | subspaces | +| message | action | desmos.subspaces.v3.MsgMoveUserGroup | +| message | sender | {userAddress} | ### MsgSetUserGroupPermissions @@ -117,47 +117,50 @@ The subspaces module emits the following events: |:---------------------------|:------------------|:-----------------------------------------------| | set_user_group_permissions | subspace_id | {subspaceID} | | set_user_group_permissions | user_group_id | {userGroupID} | +| set_user_group_permissions | permissions | {permissions} | | message | module | subspaces | | message | action | desmos.subspaces.v3.MsgSetUserGroupPermissions | | message | sender | {userAddress} | ### MsgDeleteUserGroup -| **Type** | **Attribute Key** | **Attribute Value** | -|:------------------|:------------------|:---------------------------------------| -| delete_user_group | subspace_id | {subspaceID} | -| delete_user_group | user_group_id | {userGroupID} | -| message | module | subspaces | -| message | action | desmos.subspaces.v3.MsgDeleteUserGroup | -| message | sender | {userAddress} | +| **Type** | **Attribute Key** | **Attribute Value** | +|:-------------------|:------------------|:---------------------------------------| +| deleted_user_group | subspace_id | {subspaceID} | +| deleted_user_group | user_group_id | {userGroupID} | +| message | module | subspaces | +| message | action | desmos.subspaces.v3.MsgDeleteUserGroup | +| message | sender | {userAddress} | ### MsgAddUserToUserGroup -| **Type** | **Attribute Key** | **Attribute Value** | -|:-----------------|:------------------|:------------------------------------------| -| add_group_member | subspace_id | {subspaceID} | -| add_group_member | user_group_id | {userGroupID} | -| add_group_member | user | {userAddress} | -| message | module | subspaces | -| message | action | desmos.subspaces.v3.MsgAddUserToUserGroup | -| message | sender | {userAddress} | +| **Type** | **Attribute Key** | **Attribute Value** | +|:-------------------|:------------------|:------------------------------------------| +| added_group_member | subspace_id | {subspaceID} | +| added_group_member | user_group_id | {userGroupID} | +| added_group_member | user | {userAddress} | +| message | module | subspaces | +| message | action | desmos.subspaces.v3.MsgAddUserToUserGroup | +| message | sender | {userAddress} | ### MsgRemoveUserFromUserGroup -| **Type** | **Attribute Key** | **Attribute Value** | -|:--------------------|:------------------|:-----------------------------------------------| -| remove_group_member | subspace_id | {subspaceID} | -| remove_group_member | user_group_id | {userGroupID} | -| remove_group_member | user | {userAddress} | -| message | module | subspaces | -| message | action | desmos.subspaces.v3.MsgRemoveUserFromUserGroup | -| message | sender | {userAddress} | +| **Type** | **Attribute Key** | **Attribute Value** | +|:---------------------|:------------------|:-----------------------------------------------| +| removed_group_member | subspace_id | {subspaceID} | +| removed_group_member | user_group_id | {userGroupID} | +| removed_group_member | user | {userAddress} | +| message | module | subspaces | +| message | action | desmos.subspaces.v3.MsgRemoveUserFromUserGroup | +| message | sender | {userAddress} | ### MsgSetUserPermissions | **Type** | **Attribute Key** | **Attribute Value** | |:---------------------|:------------------|:------------------------------------| | set_user_permissions | subspace_id | {subspaceID} | +| set_user_permissions | section_id | {sectionID} | +| set_user_permissions | permissions | {permissions} | | set_user_permissions | user | {userAddress} | | message | module | subspaces | | message | action | desmos.subspaces.v3.MsgEditSubspace | @@ -165,56 +168,56 @@ The subspaces module emits the following events: ## MsgGrantTreasuryAuthorization -| **Type** | **Attribute Key** | **Attribute Value** | -|:-----------------------------|:------------------|:--------------------------------------------------| -| grant_treasury_authorization | subspace_id | {subspaceID} | -| grant_treasury_authorization | granter | {userAddress} | -| grant_treasury_authorization | grantee | {userAddress} | -| message | module | subspaces | -| message | action | desmos.subspaces.v3.MsgGrantTreasuryAuthorization | -| message | sender | {userAddress} | +| **Type** | **Attribute Key** | **Attribute Value** | +|:-------------------------------|:------------------|:--------------------------------------------------| +| granted_treasury_authorization | subspace_id | {subspaceID} | +| granted_treasury_authorization | granter | {userAddress} | +| granted_treasury_authorization | grantee | {userAddress} | +| message | module | subspaces | +| message | action | desmos.subspaces.v3.MsgGrantTreasuryAuthorization | +| message | sender | {userAddress} | ## MsgRevokeTreasuryAuthorization -| **Type** | **Attribute Key** | **Attribute Value** | -|:------------------------------|:------------------|:---------------------------------------------------| -| revoke_treasury_authorization | subspace_id | {subspaceID} | -| revoke_treasury_authorization | granter | {userAddress} | -| revoke_treasury_authorization | grantee | {userAddress} | -| message | module | subspaces | -| message | action | desmos.subspaces.v3.MsgRevokeTreasuryAuthorization | -| message | sender | {userAddress} | +| **Type** | **Attribute Key** | **Attribute Value** | +|:-------------------------------|:------------------|:---------------------------------------------------| +| revoked_treasury_authorization | subspace_id | {subspaceID} | +| revoked_treasury_authorization | granter | {userAddress} | +| revoked_treasury_authorization | grantee | {userAddress} | +| message | module | subspaces | +| message | action | desmos.subspaces.v3.MsgRevokeTreasuryAuthorization | +| message | sender | {userAddress} | ## MsgGrantAllowance -| **Type** | **Attribute Key** | **Attribute Value** | -|:----------------|:------------------|:--------------------------------------------------| -| grant_allowance | subspace_id | {subspaceID} | -| grant_allowance | granter | {userAddress} | -| grant_allowance | user_grantee | {userAddress} | -| grant_allowance | group_grantee | {groupID} | -| message | module | subspaces | -| message | action | desmos.subspaces.v3.MsgGrantTreasuryAuthorization | -| message | sender | {userAddress} | +| **Type** | **Attribute Key** | **Attribute Value** | +|:------------------|:------------------|:--------------------------------------------------| +| granted_allowance | subspace_id | {subspaceID} | +| granted_allowance | granter | {userAddress} | +| granted_allowance | user_grantee | {userAddress} | +| granted_allowance | group_grantee | {groupID} | +| message | module | subspaces | +| message | action | desmos.subspaces.v3.MsgGrantTreasuryAuthorization | +| message | sender | {userAddress} | ## MsgRevokeAllowance -| **Type** | **Attribute Key** | **Attribute Value** | -|:-----------------|:------------------|:--------------------------------------------------| -| revoke_allowance | subspace_id | {subspaceID} | -| revoke_allowance | granter | {userAddress} | -| revoke_allowance | user_grantee | {userAddress} | -| revoke_allowance | group_grantee | {groupID} | -| message | module | subspaces | -| message | action | desmos.subspaces.v3.MsgGrantTreasuryAuthorization | -| message | sender | {userAddress} | +| **Type** | **Attribute Key** | **Attribute Value** | +|:------------------|:------------------|:--------------------------------------------------| +| revoked_allowance | subspace_id | {subspaceID} | +| revoked_allowance | granter | {userAddress} | +| revoked_allowance | user_grantee | {userAddress} | +| revoked_allowance | group_grantee | {groupID} | +| message | module | subspaces | +| message | action | desmos.subspaces.v3.MsgGrantTreasuryAuthorization | +| message | sender | {userAddress} | ## MsgUpdateSubspaceFeeTokens -| **Type** | **Attribute Key** | **Attribute Value** | -|:---------------------------|:------------------|:--------------------------------------------------| -| update_subspace_fee_tokens | subspace_id | {subspaceID} | -| update_subspace_fee_tokens | user | {authorityAddress} | -| message | module | subspaces | -| message | action | desmos.subspaces.v3.MsgGrantTreasuryAuthorization | -| message | sender | {userAddress} | \ No newline at end of file +| **Type** | **Attribute Key** | **Attribute Value** | +|:----------------------------|:------------------|:--------------------------------------------------| +| updated_subspace_fee_tokens | subspace_id | {subspaceID} | +| updated_subspace_fee_tokens | user | {authorityAddress} | +| message | module | subspaces | +| message | action | desmos.subspaces.v3.MsgGrantTreasuryAuthorization | +| message | sender | {userAddress} | \ No newline at end of file diff --git a/x/subspaces/types/events.go b/x/subspaces/types/events.go index 52cceb1be1..d0c481c842 100644 --- a/x/subspaces/types/events.go +++ b/x/subspaces/types/events.go @@ -2,26 +2,26 @@ package types // Subspaces module event types const ( - EventTypeCreateSubspace = "create_subspace" - EventTypeEditSubspace = "edit_subspace" - EventTypeDeleteSubspace = "delete_subspace" - EventTypeCreateSection = "create_section" - EventTypeEditSection = "edit_section" - EventTypeMoveSection = "move_section" - EventTypeDeleteSection = "delete_section" - EventTypeCreateUserGroup = "create_user_group" - EventTypeEditUserGroup = "edit_user_group" - EvenTypeMoveUserGroup = "move_user_group" - EventTypeSetUserGroupPermissions = "set_user_group_permissions" - EventTypeDeleteUserGroup = "delete_user_group" - EventTypeAddUserToGroup = "add_group_member" - EventTypeRemoveUserFromGroup = "remove_group_member" - EventTypeSetUserPermissions = "set_user_permissions" - EventTypeGrantTreasuryAuthorization = "grant_treasury_authorization" - EventTypeRevokeTreasuryAuthorization = "revoke_treasury_authorization" - EventTypeGrantAllowance = "grant_allowance" - EventTypeRevokeAllowance = "revoke_allowance" - EventTypeUpdateSubspaceFeeToken = "update_subspace_fee_token" + EventTypeCreatedSubspace = "created_subspace" + EventTypeEditedSubspace = "edited_subspace" + EventTypeDeletedSubspace = "deleted_subspace" + EventTypeCreatedSection = "created_section" + EventTypeEditedSection = "edited_section" + EventTypeMovedSection = "moved_section" + EventTypeDeletedSection = "deleted_section" + EventTypeCreatedUserGroup = "created_user_group" + EventTypeEditedUserGroup = "edited_user_group" + EventTypeMovedUserGroup = "moved_user_group" + EventTypeSetUserGroupPermissions = "set_user_group_permissions" + EventTypeDeletedUserGroup = "deleted_user_group" + EventTypeAddedUserToGroup = "added_group_member" + EventTypeRemovedUserFromGroup = "removed_group_member" + EventTypeSetUserPermissions = "set_user_permissions" + EventTypeGrantedTreasuryAuthorization = "granted_treasury_authorization" + EventTypeRevokedTreasuryAuthorization = "revoked_treasury_authorization" + EventTypeGrantedAllowance = "granted_allowance" + EventTypeRevokedAllowance = "revoked_allowance" + EventTypeUpdatedSubspaceFeeToken = "updated_subspace_fee_token" AttributeKeySubspaceID = "subspace_id" AttributeKeySubspaceName = "subspace_name" @@ -29,6 +29,7 @@ const ( AttributeKeyCreationTime = "creation_date" AttributeKeySectionID = "section_id" AttributeKeyUserGroupID = "user_group_id" + AttributeKeyPermissions = "permissions" AttributeKeyUser = "user" AttributeKeyGranter = "granter" AttributeKeyGrantee = "grantee"