diff --git a/contracts/DReddit.sol b/contracts/DReddit.sol index 0da55e4..5e252d1 100644 --- a/contracts/DReddit.sol +++ b/contracts/DReddit.sol @@ -10,13 +10,22 @@ contract DReddit { Post [] public posts; + event NewPost( + uint indexed postId, + address owner, + bytes description + ); + function createPost(bytes memory _description) public { uint postId = posts.length++; + posts[postId] = Post({ creationDate: block.timestamp, description: _description, owner: msg.sender }); + + emit NewPost(postId, msg.sender, _description); } }