Contract 0xaDdBEC01921ff2B46992F2a40fc322F7B08a86F9 1

 
Txn Hash
Method
Block
From
To
Value
0x4d207c980b6b6add367079897cac249f085f0f6a96b4e836063d28efaaa1e4f6Document It69167772018-12-19 20:09:521386 days 23 hrs ago0xe8cad220316476ca7dda39432e0a79b22ff7751c IN  0xaddbec01921ff2b46992f2a40fc322f7b08a86f90 Ether0.000714246
0x5c0aefed4c1b8d04c62b082f3622e12b36b55e16873b7c0a82807e5b46f52872Document It64849572018-10-09 21:23:271457 days 22 hrs ago0x69ca8084a276a693c78c2eb576859e215d79b3ed IN  0xaddbec01921ff2b46992f2a40fc322f7b08a86f90 Ether0.000318333
0xdb73fee4ba85f72aa14258ab5e3399014d23dd481eb547aae7abec93cf8bf70dDocument It59463242018-07-11 18:50:181548 days 33 mins agoENS Name valkenburgh.eth IN  0xaddbec01921ff2b46992f2a40fc322f7b08a86f90 Ether0.0022446921
0x7b0229ca188c1e15a0f4f5432fd1adca8766a3d47107202613bbcdd7a91d3872Document It58742212018-06-29 9:57:571560 days 9 hrs ago0x78e1a222dac0c1b1e48e0bc061c3295d6b8649fd IN  0xaddbec01921ff2b46992f2a40fc322f7b08a86f90 Ether0.000518022
0xfdc2104601fe561c0b54b5706c6f5042a9947e69ee80dcf5e88ca666722688b5Document It56258802018-05-16 22:24:251603 days 20 hrs ago0x78e1a222dac0c1b1e48e0bc061c3295d6b8649fd IN  0xaddbec01921ff2b46992f2a40fc322f7b08a86f90 Ether0.000818417
0x038448ebb4ef5e3f84e0dcea9757b70f7af0fc5ee369165a7b31e44cbea33f7eDocument It56257862018-05-16 21:58:491603 days 21 hrs ago0x78e1a222dac0c1b1e48e0bc061c3295d6b8649fd IN  0xaddbec01921ff2b46992f2a40fc322f7b08a86f90 Ether0.002491319
0xa95fe7af4b144b49400f1187abeab6ab41c4c245b62abc911d74169a3964eda3Document It56199952018-05-15 21:35:011604 days 21 hrs ago0x78e1a222dac0c1b1e48e0bc061c3295d6b8649fd IN  0xaddbec01921ff2b46992f2a40fc322f7b08a86f90 Ether0.001710818
0x3e6c4e7fe60e5135c00a169dd4b6841dc897b7e56213e1164c43e9080814413eDocument It56198352018-05-15 20:54:221604 days 22 hrs ago0x78e1a222dac0c1b1e48e0bc061c3295d6b8649fd IN  0xaddbec01921ff2b46992f2a40fc322f7b08a86f90 Ether0.002038628
0xeff0d11d5cfd4d8dd1106902cda457e1eb2dba548eb92fdeca6690232b3293a8Document It56141612018-05-14 20:53:511605 days 22 hrs ago0x78e1a222dac0c1b1e48e0bc061c3295d6b8649fd IN  0xaddbec01921ff2b46992f2a40fc322f7b08a86f90 Ether0.001592476
0xfd69a62ae8e179ed082151c943c0cd8e57f1f8d727501184543d69f8a4e3eb190x6060604055606792018-05-05 13:22:191615 days 6 hrs ago0x52e18a7cd9eb50505a8682c63a3e35413a2573ff IN  Create: DocumentaryContract0 Ether0.003923863
[ Download CSV Export 
Parent Txn Hash Block From To Value
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
DocumentaryContract

Compiler Version
v0.4.20+commit.3155dd80

Optimization Enabled:
No with 200 runs

Other Settings:
default evmVersion
/**
 *Submitted for verification at Etherscan.io on 2018-05-05
*/

pragma solidity 0.4.20;

/**
* @title DocumentaryContract
*/
contract DocumentaryContract {

    // Owner of the contract    
    address owner;
    
    // Get the editor rights of an address
    mapping (address => bool) isEditor;

    // Total number of documents, starts with 1    
    uint128 doccnt;
    
    // Get the author of a document with a given docid
    mapping (uint128 => address) docauthor;		                    // docid => author
    
    // Get visibility of a document with a given docid
    mapping (uint128 => bool) isInvisible;		                    // docid => invisibility
    
    // Get the number of documents authored by an address
    mapping (address => uint32) userdoccnt;		                    // author => number docs of user
    
    // Get the document id that relates to the document number of a given address
    mapping (address => mapping (uint32 => uint128)) userdocid;		// author => (userdocid => docid)


    // Documents a new or modified document    
    event DocumentEvent (
        uint128 indexed docid,
        uint128 indexed refid,
        uint16 state,   // 0: original. Bit 1: edited
        uint doctime,
        address indexed author,
        string tags,
        string title,
        string text
    );

    // Documents a registration of a tag
    event TagEvent (
        uint128 docid,
        address indexed author,
        bytes32 indexed taghash,
        uint64 indexed channelid
    );

    // Documents the change of the visibility of a document 
    event InvisibleDocumentEvent (
        uint128 indexed docid,
        uint16 state    // 0: inactive. Bit 1: active
    );
    
    modifier onlyOwner {
        require(msg.sender == owner);
        _;
    }

    modifier onlyEditor {
        require(isEditor[msg.sender] == true);
        _;
    }

    modifier onlyAuthor(uint128 docid) {
        require(docauthor[docid] == msg.sender);
        _;
    }

    modifier onlyVisible(uint128 docid) {
        require(isInvisible[docid] == false);
        _;
    }

    modifier onlyInvisible(uint128 docid) {
        require(isInvisible[docid] == true);
        _;
    }

    function DocumentaryContract() public {
        owner = msg.sender;
        grantEditorRights(owner);
        doccnt = 1;
    }
    
    /**
    * @dev Grants editor rights to the passed address
    * @param user Address to obtain editor rights
    */
    function grantEditorRights(address user) public onlyOwner {
        isEditor[user] = true;
    }

    /**
    * @dev Revokes editor rights of the passed address
    * @param editor Address to revoke editor rights from
    */
    function revokeEditorRights(address editor) public onlyOwner {
        isEditor[editor] = false;
    }

    /**
    * @dev Adds a document to the blockchain
    * @param refid The document id to that the new document refers
    * @param doctime Timestamp of the creation of the document
    * @param taghashes Array containing the hashes of up to 5 tags
    * @param tags String containing the tags of the document
    * @param title String containing the title of the document
    * @param text String containing the text of the document
    */
    function documentIt(uint128 refid, uint64 doctime, bytes32[] taghashes, string tags, string title, string text) public {
        writeDocument(refid, 0, doctime, taghashes, tags, title, text);
    }
    
    /**
    * @dev Edits a document that is already present of the blockchain. The document is edited by writing a modified version to the blockchain
    * @param docid The document id of the document that is edited
    * @param doctime Timestamp of the edit of the document
    * @param taghashes Array containing the hashes of up to 5 tags
    * @param tags String containing the modified tags of the document
    * @param title String containing the modified title of the document
    * @param text String containing the modified text of the document
    */
    function editIt(uint128 docid, uint64 doctime, bytes32[] taghashes, string tags, string title, string text) public onlyAuthor(docid) onlyVisible(docid) {
        writeDocument(docid, 1, doctime, taghashes, tags, title, text);
    }

    /**
    * @dev Generic function that adds a document to the blockchain or modifies a document that already exists on the blockchain
    * @param refid The document id to that the new document refers
    * @param state The state of the document, if 0 a new document is written, if 1 an existing document is edited
    * @param doctime Timestamp of the creation of the document
    * @param taghashes Array containing the hashes of up to 5 tags
    * @param tags String containing the tags of the document
    * @param title String containing the title of the document
    * @param text String containing the text of the document
    */
    function writeDocument(uint128 refid, uint16 state, uint doctime, bytes32[] taghashes, string tags, string title, string text) internal {

        docauthor[doccnt] = msg.sender;
        userdocid[msg.sender][userdoccnt[msg.sender]] = doccnt;
        userdoccnt[msg.sender]++;
        
        DocumentEvent(doccnt, refid, state, doctime, msg.sender, tags, title, text);
        for (uint8 i=0; i<taghashes.length; i++) {
            if (i>=5) break;
            if (taghashes[i] != 0) TagEvent(doccnt, msg.sender, taghashes[i], 0);
        }
        doccnt++;
    }
    
    /**
    * @dev Markes the document with the passed id as invisible
    * @param docid Id of the document to be marked invisible
    */
    function makeInvisible(uint128 docid) public onlyEditor onlyVisible(docid) {
        isInvisible[docid] = true;
        InvisibleDocumentEvent(docid, 1);
    }

    /**
    * @dev Markes the document with the passed id as visible
    * @param docid Id of the document to be marked visible
    */
    function makeVisible(uint128 docid) public onlyEditor onlyInvisible(docid) {
        isInvisible[docid] = false;
        InvisibleDocumentEvent(docid, 0);
    }
    
    /**
    * @dev Returns the total number of documents on the blockchain
    * @return The total number of documents on the blockchain as uint128
    */
    function getDocCount() public view returns (uint128) {
        return doccnt;
    }

    /**
    * @dev Returns the total number of documents on the blockchain written by the passed user 
    * @param user Address of the user 
    * @return The total number of documents written by the passe user as uint32
    */
    function getUserDocCount(address user) public view returns (uint32) {
        return userdoccnt[user];
    }

    /**
    * @dev Returns the document id of the x-th document written by the passed user
    * @param user Address of the user
    * @param docnum Order number of the document 
    * @return The document id as uint128
    */
    function getUserDocId(address user, uint32 docnum) public view returns (uint128) {
        return userdocid[user][docnum];
    }
}

Contract Security Audit

Contract ABI

[{"constant":true,"inputs":[{"name":"user","type":"address"},{"name":"docnum","type":"uint32"}],"name":"getUserDocId","outputs":[{"name":"","type":"uint128"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"docid","type":"uint128"}],"name":"makeVisible","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"refid","type":"uint128"},{"name":"doctime","type":"uint64"},{"name":"taghashes","type":"bytes32[]"},{"name":"tags","type":"string"},{"name":"title","type":"string"},{"name":"text","type":"string"}],"name":"documentIt","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"user","type":"address"}],"name":"getUserDocCount","outputs":[{"name":"","type":"uint32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"user","type":"address"}],"name":"grantEditorRights","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"getDocCount","outputs":[{"name":"","type":"uint128"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"docid","type":"uint128"},{"name":"doctime","type":"uint64"},{"name":"taghashes","type":"bytes32[]"},{"name":"tags","type":"string"},{"name":"title","type":"string"},{"name":"text","type":"string"}],"name":"editIt","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"docid","type":"uint128"}],"name":"makeInvisible","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"editor","type":"address"}],"name":"revokeEditorRights","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"docid","type":"uint128"},{"indexed":true,"name":"refid","type":"uint128"},{"indexed":false,"name":"state","type":"uint16"},{"indexed":false,"name":"doctime","type":"uint256"},{"indexed":true,"name":"author","type":"address"},{"indexed":false,"name":"tags","type":"string"},{"indexed":false,"name":"title","type":"string"},{"indexed":false,"name":"text","type":"string"}],"name":"DocumentEvent","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"docid","type":"uint128"},{"indexed":true,"name":"author","type":"address"},{"indexed":true,"name":"taghash","type":"bytes32"},{"indexed":true,"name":"channelid","type":"uint64"}],"name":"TagEvent","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"docid","type":"uint128"},{"indexed":false,"name":"state","type":"uint16"}],"name":"InvisibleDocumentEvent","type":"event"}]

6060604052341561000f57600080fd5b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061008c6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff166100cb64010000000002610799176401000000009004565b6001600260006101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff160217905550610180565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561012657600080fd5b60018060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b61112b8061018f6000396000f300606060405260043610610098576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168062dfd21a1461009d57806307de67dc1461011d57806309ee75a21461015257806311ffe7c9146102a35780631cb3d9be146102fc57806363704e93146103355780637542890d14610382578063b7b2e501146104d3578063d748d1f614610508575b600080fd5b34156100a857600080fd5b6100e3600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803563ffffffff16906020019091905050610541565b60405180826fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561012857600080fd5b61015060048080356fffffffffffffffffffffffffffffffff169060200190919050506105c4565b005b341561015d57600080fd5b6102a160048080356fffffffffffffffffffffffffffffffff1690602001909190803567ffffffffffffffff169060200190919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509190505061071e565b005b34156102ae57600080fd5b6102da600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610740565b604051808263ffffffff1663ffffffff16815260200191505060405180910390f35b341561030757600080fd5b610333600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610799565b005b341561034057600080fd5b61034861084e565b60405180826fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561038d57600080fd5b6104d160048080356fffffffffffffffffffffffffffffffff1690602001909190803567ffffffffffffffff169060200190919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091905050610874565b005b34156104de57600080fd5b61050660048080356fffffffffffffffffffffffffffffffff16906020019091905050610982565b005b341561051357600080fd5b61053f600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610adc565b005b6000600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008363ffffffff1663ffffffff16815260200190815260200160002060009054906101000a90046fffffffffffffffffffffffffffffffff16905092915050565b60011515600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514151561062357600080fd5b806001151560046000836fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514151561067b57600080fd5b600060046000846fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550816fffffffffffffffffffffffffffffffff167f84bc7b300fdda25b3671d7d79b252101d5b44e3a1d7fd78d4a70d963695ea39e6000604051808261ffff16815260200191505060405180910390a25050565b6107388660008767ffffffffffffffff1687878787610b92565b505050505050565b6000600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900463ffffffff169050919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156107f457600080fd5b60018060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b6000600260009054906101000a90046fffffffffffffffffffffffffffffffff16905090565b853373ffffffffffffffffffffffffffffffffffffffff1660036000836fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151561090657600080fd5b866000151560046000836fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514151561095e57600080fd5b6109788860018967ffffffffffffffff1689898989610b92565b5050505050505050565b60011515600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151415156109e157600080fd5b806000151560046000836fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515141515610a3957600080fd5b600160046000846fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550816fffffffffffffffffffffffffffffffff167f84bc7b300fdda25b3671d7d79b252101d5b44e3a1d7fd78d4a70d963695ea39e6001604051808261ffff16815260200191505060405180910390a25050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610b3757600080fd5b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60003360036000600260009054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600260009054906101000a90046fffffffffffffffffffffffffffffffff16600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900463ffffffff1663ffffffff1663ffffffff16815260200190815260200160002060006101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff160217905550600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600081819054906101000a900463ffffffff168092919060010191906101000a81548163ffffffff021916908363ffffffff160217905550503373ffffffffffffffffffffffffffffffffffffffff16886fffffffffffffffffffffffffffffffff16600260009054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff167fa6735b0b508af0f8443deef550249136473268fe763f2467a16e50ebfa4821f28a8a898989604051808661ffff1661ffff168152602001858152602001806020018060200180602001848103845287818151815260200191508051906020019080838360005b83811015610e7d578082015181840152602081019050610e62565b50505050905090810190601f168015610eaa5780820380516001836020036101000a031916815260200191505b50848103835286818151815260200191508051906020019080838360005b83811015610ee3578082015181840152602081019050610ec8565b50505050905090810190601f168015610f105780820380516001836020036101000a031916815260200191505b50848103825285818151815260200191508051906020019080838360005b83811015610f49578082015181840152602081019050610f2e565b50505050905090810190601f168015610f765780820380516001836020036101000a031916815260200191505b509850505050505050505060405180910390a4600090505b84518160ff1610156110965760058160ff16101515610fac57611096565b6000600102858260ff16815181101515610fc257fe5b9060200190602002015160001916141515611089576000858260ff16815181101515610fea57fe5b90602001906020020151600019163373ffffffffffffffffffffffffffffffffffffffff167fb469d0b8d18ad7c9ddf234af13075dd2a5793e15ed2770dcbf08c1a54642345d600260009054906101000a90046fffffffffffffffffffffffffffffffff1660405180826fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff16815260200191505060405180910390a45b8080600101915050610f8e565b6002600081819054906101000a90046fffffffffffffffffffffffffffffffff168092919060010191906101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff1602179055505050505050505050505600a165627a7a72305820bf20077419f3549791f647da43a4a4eb42d3a10bc6bb1338b292a7c02eb117570029

Swarm Source

bzzr://bf20077419f3549791f647da43a4a4eb42d3a10bc6bb1338b292a7c02eb11757
Block Transaction Difficulty Gas Used Reward
Block Uncle Number Difficulty Gas Used Reward
Loading
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.