Created
September 24, 2019 01:17
-
-
Save arkhaminferno/2a7238303f232c9d81a2923912f0d1da to your computer and use it in GitHub Desktop.
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.4.24+commit.e67f0147.js&optimize=false&gist=
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 Messenger{ | |
address owner; | |
string[] messages; | |
constructor() public{ | |
owner = msg.sender; | |
} | |
function add(string memory newMessage) public{ | |
require(msg.sender == owner); | |
messages.push(newMessage); | |
} | |
function count() view public returns(uint){ | |
return messages.length; | |
} | |
function getMessages(uint index) view public returns(string){ | |
return messages[index]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment