Created
November 20, 2018 22:39
-
-
Save davidabram/c1924f4d9dcf6f730ba98a352f1f0b48 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.4.24; | |
contract HackerNoon { | |
struct Story { | |
string title; | |
string text; | |
address owner; | |
} | |
Story[] public stories; | |
event StoryAdded(uint storyId, address owner, string title, string text); | |
function submitStory(string title, string text) public { | |
Story memory story = Story(title, text, msg.sender); | |
uint storyId = stories.push(story) - 1; | |
emit StoryAdded(storyId, msg.sender, title, text); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment