Created
June 20, 2018 11:58
-
-
Save 6pm/aaf4c9f06b14bfdc6816eb8ce0d6e284 to your computer and use it in GitHub Desktop.
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.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