Verified contractPartial
DocumentRegistry
Address0x5548e21695f8f5e4edbcd8abc2de0924c718daca
- Balance
0 ETH
- Transactions
12
- Compiler
solc 0.1.3
- Same code
Only this contract
Details
- Compiler
- solc 0.1.3+commit.028f561d
- Language
- solidity
- Optimization
- Yes, 200 runs
- License
- Not stated
- Match
- Partialcreation code: no, runtime code: yes
- Verified on Sourcify
- Created in block
- 74,814
- Creation transaction
- 0x6baf024207…fe1179ff55
DocumentRegistry.sol
// Recovered by EthereumHistory (ethereumhistory.com) -sw
contract DocumentRegistry {
struct Document {
uint blockNumber;
bytes32 hash;
address from;
address to;
}
address owner;
uint latest;
mapping (uint => Document) public history;
mapping (bytes32 => bool) public usedHashes;
mapping (bytes32 => address) public documentHashMap;
event DocumentEvent(uint blockNumber, bytes32 indexed hash, address indexed from, address indexed to);
function DocumentRegistry() {
owner = msg.sender;
}
function newDocument(bytes32 hash) returns (bool success) {
if (documentExists(hash)) {
success = false;
} else {
createHistory(hash, msg.sender, msg.sender);
usedHashes[hash] = true;
success = true;
}
success = true;
}
function createHistory(bytes32 hash, address from, address to) internal {
++latest;
documentHashMap[hash] = to;
usedHashes[hash] = true;
history[latest] = Document(block.number, hash, from, to);
DocumentEvent(block.number, hash, from, to);
}
function transferDocument(bytes32 hash, address to) returns (bool success) {
if (documentExists(hash)) {
if (documentHashMap[hash] == msg.sender) {
createHistory(hash, msg.sender, to);
success = true;
}
}
}
function documentExists(bytes32 hash) returns (bool exists) {
if (usedHashes[hash]) {
exists = true;
} else {
exists = false;
}
return exists;
}
function getDocument(uint id) returns (uint blockNumber, bytes32 hash, address from, address to) {
Document d = history[id];
blockNumber = d.blockNumber;
hash = d.hash;
from = d.from;
to = d.to;
}
function getLatest() returns (uint) {
return latest;
}
function empty() {
uint b = this.balance;
owner.send(b);
}
}
Compiler settingsShow
{
"optimizer": {
"runs": 200,
"enabled": true
}
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.