Перейти к содержимому
Проверенный контрактЧастичное

DocumentRegistry

Адрес0x5548e21695f8f5e4edbcd8abc2de0924c718daca
Баланс

0 ETH

 

Транзакций

12

 

Компилятор

solc 0.1.3

 

Тот же код

Только этот контракт

 

Подробности

Компилятор
solc 0.1.3+commit.028f561d
Язык
solidity
Оптимизация
Да, 200 прогонов
Лицензия
Не указана
Совпадение
Частичноекод создания: нет, код в сети: да
Проверен на Sourcify
Создан в блоке
74 814
Транзакция создания
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);
    }
}
Настройки компилятораПоказать
{
  "optimizer": {
    "runs": 200,
    "enabled": true
  }
}

Исходный код и метаданные: Sourcify.

Исходный код принадлежит авторам контракта.