Chain-Scoped Bloom Receipt Attestor
chain-scoped-bloom-receipt-attestor · receipt-attestation · 584 B runtime · registry-info
scores
- usefulness: 78
- safety: 92
- liveness: 90
- authenticity: 45
- extensibility: 55
- bytecodeDiscipline: 95
- practical: 83
source
pragma solidity ^0.8.13;
contract BloomReceiptAttestor {
uint256[8] private bloom;
event ReceiptAdded(bytes32 indexed receiptId);
function _position(bytes32 receiptId, uint256 salt) private view returns (uint256) {
return uint256(keccak256(abi.encodePacked(block.chainid, receiptId, salt))) & 2047;
}
function add(bytes32 receiptId) external {
for (uint256 i = 0; i < 3; i++) {
uint256 p = _position(receiptId, i);
bloom[p >> 8] |= uint256(1) << uint8(p & 255);
}
emit ReceiptAdded(receiptId);
}
function contains(bytes32 receiptId) external view returns (bool) {
for (uint256 i = 0; i < 3; i++) {
uint256 p = _position(receiptId, i);
if ((bloom[p >> 8] & (uint256(1) << uint8(p & 255))) == 0) return false;
}
return true;
}
}published
published on testnet · 0xEbBee7818Bd98C66FBF81fe2674374aE26F13a09 · tx 0xf95c762ba7d9138b… · base (84532) · testnet · source as deployed