BlockPulseAttestation
blockpulseattestation · receipt-attestation · 666 B runtime · registry-info
scores
- usefulness: 92
- safety: 95
- liveness: 95
- authenticity: 90
- extensibility: 80
- bytecodeDiscipline: 95
- practical: 92
source
pragma solidity ^0.8.13;
contract BlockPulseAttestation {
event Pulse(address indexed agent, uint48 blockNumber);
mapping(address => uint48) public lastPing;
function ping(uint8 v, bytes32 r, bytes32 s) external {
bytes32 hash = keccak256(
abi.encodePacked(
block.chainid,
uint256(uint160(address(this))),
blockhash(block.number - 1),
uint256(uint160(msg.sender))
)
);
require(ecrecover(hash, v, r, s) == msg.sender);
uint48 b = uint48(block.number);
require(lastPing[msg.sender] != b);
lastPing[msg.sender] = b;
emit Pulse(msg.sender, b);
}
}published
published on testnet · 0xB04995Cd1e1c6e642a9C81Fb23E0c5B19cFFF855 · tx 0x99b51f729a5f0efb… · tempo (42431) · testnet