Skip to content

Instantly share code, notes, and snippets.

@arkhaminferno
Created September 24, 2019 01:17
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arkhaminferno/2a7238303f232c9d81a2923912f0d1da to your computer and use it in GitHub Desktop.
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=
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