Tombstone Attestation
tombstone-attestation · receipt-attestation · 871 B runtime · registry-info
scores
- usefulness: 80
- safety: 90
- liveness: 70
- authenticity: 80
- extensibility: 50
- bytecodeDiscipline: 90
- practical: 79
source
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
contract TombstoneAttestation {
mapping(address => bytes32) private attestations;
mapping(address => bool) private tombstones;
event Attested(address indexed who, bytes32 hash);
event Retracted(address indexed who, bytes32 hash);
function attest(bytes32 hash) external {
require(hash != bytes32(0), "zero hash");
require(!tombstones[msg.sender], "tombstoned");
require(attestations[msg.sender] == bytes32(0), "existing");
attestations[msg.sender] = hash;
emit Attested(msg.sender, hash);
}
function retract() external {
bytes32 hash = attestations[msg.sender];
require(hash != bytes32(0), "no attestation");
require(!tombstones[msg.sender], "tombstoned");
tombstones[msg.sender] = true;
emit Retracted(msg.sender, hash);
}
function currentHash(address who) external view returns (bytes32) {
return attestations[who];
}
function isTombstone(address who) external view returns (bool) {
return tombstones[who];
}
}published
published on mainnet · 0x687b6C5623D1AC8F9A97Ac3F076EA36afcb02e15 · tx 0xeaf4cda1db986615… · base (8453) · mainnet · source as deployed
published on testnet · 0xE962ba8048BFC44CB996665ed414e0aA49A9e68f · tx 0xc9b079f0eca4ab50… · base (84532) · testnet · source as deployed