Skip to content

Instantly share code, notes, and snippets.

@davidabram
Created November 20, 2018 22:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davidabram/c1924f4d9dcf6f730ba98a352f1f0b48 to your computer and use it in GitHub Desktop.
Save davidabram/c1924f4d9dcf6f730ba98a352f1f0b48 to your computer and use it in GitHub Desktop.
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