pragma solidity ^0.4.13;
// File: contracts/Owned.sol
contract Owned {
address owner;
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
function Owned() public {
owner = msg.sender;
}
function transferOwnership(address newOwner) public onlyOwner() {
require(newOwner != 0x0);
owner = newOwner;
}
}
// File: contracts/Notarize.sol
contract Notarize is Owned {
mapping(bytes32 => uint) public notaryBook;
uint public notaryBookSize;
event RecordAdded(bytes32 hash, uint timestamp);
function notarize(bytes32 _hash, uint _timestamp) public onlyOwner {
require(!isNotarized(_hash));
notaryBook[_hash] = _timestamp;
notaryBookSize++;
RecordAdded(_hash, _timestamp);
}
function isNotarized(bytes32 _hash) public view returns(bool) {
return (notaryBook[_hash] > 0);
}
function getTimestamp(bytes32 _hash) public view returns(uint) {
return notaryBook[_hash];
}
}
{
"compilationTarget": {
"Notarize.sol": "Notarize"
},
"evmVersion": "byzantium",
"libraries": {},
"optimizer": {
"enabled": false,
"runs": 200
},
"remappings": []
}
[{"constant":true,"inputs":[{"name":"","type":"bytes32"}],"name":"notaryBook","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_hash","type":"bytes32"}],"name":"getTimestamp","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"notaryBookSize","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_hash","type":"bytes32"},{"name":"_timestamp","type":"uint256"}],"name":"notarize","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_hash","type":"bytes32"}],"name":"isNotarized","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"anonymous":false,"inputs":[{"indexed":false,"name":"hash","type":"bytes32"},{"indexed":false,"name":"timestamp","type":"uint256"}],"name":"RecordAdded","type":"event"}]