Skip to content

Instantly share code, notes, and snippets.

@6pm
Created June 20, 2018 11:58
Show Gist options
  • Save 6pm/aaf4c9f06b14bfdc6816eb8ce0d6e284 to your computer and use it in GitHub Desktop.
Save 6pm/aaf4c9f06b14bfdc6816eb8ce0d6e284 to your computer and use it in GitHub Desktop.
pragma solidity ^0.4.0;
contract Ownable {
address owner;
function Ownable() public {
owner = msg.sender;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
function transferOwnership(address newOwner) public onlyOwner {
owner = newOwner;
}
}
contract BusinessCard is Ownable {
mapping (bytes32 => string) data;
function setData(string key, string value) public onlyOwner {
data[keccak256(key)] = value;
}
function getData(string key) public constant returns(string) {
return data[keccak256(key)];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment