Skip to content

Instantly share code, notes, and snippets.

@montyanderson
Created June 21, 2017 10:24
Show Gist options
  • Save montyanderson/c2cc7e8e8055e17f94c31b703a52b7ee to your computer and use it in GitHub Desktop.
Save montyanderson/c2cc7e8e8055e17f94c31b703a52b7ee to your computer and use it in GitHub Desktop.
pragma solidity ^0.4.10;
contract Account {
string public name;
string public bio;
string[] public posts;
address public owner;
address[] public following;
modifier isOwner() {
require(owner == msg.sender);
_;
}
function Account() {
owner = msg.sender;
}
function setName(string _name) isOwner {
name = _name;
}
function setBio(string _bio) isOwner {
bio = _bio;
}
function post(string _post) isOwner {
posts.push(_post);
}
function follow(address account) isOwner {
for(var i = 0; i < following.length; i++) {
if(following[i] == address(0)) {
following[i] = account;
return;
}
}
following.push(account);
}
function unfollow(address account) isOwner {
for(var i = 0; i < following.length; i++) {
if(following[i] == account) {
following[i] = address(0);
return;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment