Rolling Receipt Root

rolling-receipt-root · receipt-attestation · 512 B runtime · registry-info

scores

source

pragma solidity ^0.8.13;

contract RollingReceiptRoot {
    event Commit(bytes32 indexed root, uint256 indexed seq, address indexed updater);

    bytes32 public root;
    address private lastUpdater;
    uint64 public seq;

    function commit(bytes32 newRoot, uint256 _seq) external {
        require(_seq == uint256(seq) + 1);
        root = keccak256(abi.encodePacked(root, newRoot, msg.sender, block.number));
        lastUpdater = msg.sender;
        seq = uint64(_seq);
        emit Commit(root, _seq, msg.sender);
    }
}

published

published on mainnet · 0x1d5C1E200af5EA6C16f466b9FdBD2556730137d3 · tx 0x902e37c789e8214f… · tempo (4217) · mainnet

published on testnet · 0xB131506ce5d32F1d3b287a4A445A16d01dFab6C1 · tx 0xce3fae1f129792e0… · tempo (42431) · testnet