diff --git a/src/publication/publication.cairo b/src/publication/publication.cairo index 6461e08..b89f295 100644 --- a/src/publication/publication.cairo +++ b/src/publication/publication.cairo @@ -39,8 +39,8 @@ pub mod PublicationComponent { Post: Post, CommentCreated: CommentCreated, RepostCreated: RepostCreated, - UpvoteCreated: UpvoteCreated, - DownvoteCreated: DownvoteCreated + Upvoted: Upvoted, + Downvoted: Downvoted } #[derive(Drop, starknet::Event)] @@ -68,14 +68,14 @@ pub mod PublicationComponent { } #[derive(Drop, starknet::Event)] - pub struct UpvoteCreated { + pub struct Upvoted { publication_id: u256, transaction_executor: ContractAddress, block_timestamp: u64, } #[derive(Drop, starknet::Event)] - pub struct DownvoteCreated { + pub struct Downvoted { publication_id: u256, transaction_executor: ContractAddress, block_timestamp: u64, @@ -233,7 +233,7 @@ pub mod PublicationComponent { self .emit( - UpvoteCreated { + Upvoted { publication_id: pub_id, transaction_executor: caller, block_timestamp: get_block_timestamp() @@ -267,7 +267,7 @@ pub mod PublicationComponent { self.vote_status.write((caller, pub_id), true); self .emit( - DownvoteCreated { + Downvoted { publication_id: pub_id, transaction_executor: caller, block_timestamp: get_block_timestamp() diff --git a/tests/test_publication.cairo b/tests/test_publication.cairo index 642480f..2a43e25 100644 --- a/tests/test_publication.cairo +++ b/tests/test_publication.cairo @@ -11,7 +11,7 @@ use snforge_std::{ EventAssertions }; use karst::publication::publication::PublicationComponent::{ - Event as PublicationEvent, Post, CommentCreated, RepostCreated, UpvoteCreated, DownvoteCreated + Event as PublicationEvent, Post, CommentCreated, RepostCreated, Upvoted, Downvoted }; @@ -327,8 +327,8 @@ fn test_upvote_event_emission() { let dispatcher = IComposableDispatcher { contract_address: publication_contract_address }; start_prank(CheatTarget::One(publication_contract_address), USER_ONE.try_into().unwrap()); dispatcher.upvote(user_one_profile_address, user_one_first_post_pointed_pub_id); - let expected_event = PublicationEvent::UpvoteCreated( - UpvoteCreated { + let expected_event = PublicationEvent::Upvoted( + Upvoted { publication_id: user_one_first_post_pointed_pub_id, transaction_executor: USER_ONE.try_into().unwrap(), block_timestamp: get_block_timestamp() @@ -359,8 +359,8 @@ fn test_downvote_event_emission() { start_prank(CheatTarget::One(publication_contract_address), USER_SIX.try_into().unwrap()); let dispatcher = IComposableDispatcher { contract_address: publication_contract_address }; dispatcher.downvote(user_one_profile_address, user_one_first_post_pointed_pub_id); - let expected_event = PublicationEvent::DownvoteCreated( - DownvoteCreated { + let expected_event = PublicationEvent::Downvoted( + Downvoted { publication_id: user_one_first_post_pointed_pub_id, transaction_executor: USER_SIX.try_into().unwrap(), block_timestamp: get_block_timestamp()