Verified contractPartial
DocumentStore
Address0x509cbddc27fc5e33bd039276479f707079d032fa
- Balance
0 ETH
- Transactions
1,176
- Compiler
solc 0.4.25
- Same code
70 more contracts
Details
- Compiler
- solc 0.4.25+commit.59dbf8f1
- Language
- solidity
- Optimization
- No
- EVM version
- byzantium
- License
- Not stated
- Match
- Partialcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 13,171,978
- Creation transaction
- 0x7fc03759e0…45c1fb2cbd
- Main copy (most transactions)
- 0x8482e4d4…93a4f3d8
DocumentStore.sol
pragma solidity ^0.4.24;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to relinquish control of the contract.
* @notice Renouncing to ownership will leave the contract without an owner.
* It will not be possible to call the functions with the `onlyOwner`
* modifier anymore.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipRenounced(owner);
owner = address(0);
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function transferOwnership(address _newOwner) public onlyOwner {
_transferOwnership(_newOwner);
}
/**
* @dev Transfers control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function _transferOwnership(address _newOwner) internal {
require(_newOwner != address(0));
emit OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
}
}
contract DocumentStore is Ownable {
string public name;
string public version = "2.2.0";
/// A mapping of the document hash to the block number that was issued
mapping(bytes32 => uint) documentIssued;
/// A mapping of the hash of the claim being revoked to the revocation block number
mapping(bytes32 => uint) documentRevoked;
event DocumentIssued(bytes32 indexed document);
event DocumentRevoked(
bytes32 indexed document
);
constructor(
string _name
) public
{
name = _name;
}
function issue(
bytes32 document
) public onlyOwner onlyNotIssued(document)
{
documentIssued[document] = block.number;
emit DocumentIssued(document);
}
function getIssuedBlock(
bytes32 document
) public onlyIssued(document) view returns (uint)
{
return documentIssued[document];
}
function isIssued(
bytes32 document
) public view returns (bool)
{
return (documentIssued[document] != 0);
}
function isIssuedBefore(
bytes32 document,
uint blockNumber
) public view returns (bool)
{
return documentIssued[document] != 0 && documentIssued[document] <= blockNumber;
}
function revoke(
bytes32 document
) public onlyOwner onlyNotRevoked(document) returns (bool)
{
documentRevoked[document] = block.number;
emit DocumentRevoked(document);
}
function isRevoked(
bytes32 document
) public view returns (bool)
{
return documentRevoked[document] != 0;
}
function isRevokedBefore(
bytes32 document,
uint blockNumber
) public view returns (bool)
{
return documentRevoked[document] <= blockNumber && documentRevoked[document] != 0;
}
modifier onlyIssued(bytes32 document) {
require(isIssued(document), "Error: Only issued document hashes can be revoked");
_;
}
modifier onlyNotIssued(bytes32 document) {
require(!isIssued(document), "Error: Only hashes that have not been issued can be issued");
_;
}
modifier onlyNotRevoked(bytes32 claim) {
require(!isRevoked(claim), "Error: Hash has been revoked previously");
_;
}
}Compiler settingsShow
{
"libraries": {},
"optimizer": {
"runs": 200,
"enabled": false
},
"evmVersion": "byzantium",
"remappings": []
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.