// SPDX-License-Identifier: MIT pragma solidity 0.8.37; /// @title ChainpulsEvidenceAnchor /// @notice Anchors public BDAG burn-vault releases on Ethereum Mainnet. /// @dev The publisher is immutable. Existing evidence cannot be edited or deleted. contract ChainpulsEvidenceAnchor { uint256 public constant ETHEREUM_MAINNET_CHAIN_ID = 1; uint256 public constant BDAG_CHAIN_ID = 1404; address public immutable publisher; mapping(bytes32 releaseSha256 => bool anchored) public isAnchored; error WrongChainId(uint256 detectedChainId); error ZeroAddress(); error EmptyHash(); error Unauthorized(); error AlreadyAnchored(); error DirectETHDisabled(); error UnsupportedCall(); event ReleaseAnchored( bytes32 indexed releaseSha256, address indexed bdagVault, bytes32 indexed bdagRuntimeCodeHash, uint256 bdagChainId, uint256 branchReferenceBlock, bytes32 branchReferenceHash, string publicationURI ); constructor(address publisher_) { if (block.chainid != ETHEREUM_MAINNET_CHAIN_ID) { revert WrongChainId(block.chainid); } if (publisher_ == address(0)) revert ZeroAddress(); publisher = publisher_; } /// @notice Records one immutable public release commitment. /// @param releaseSha256 SHA-256 of the exact canonical PUBLICATION.json bytes. /// @param bdagVault Deployed BDAGBurnVault address on the selected Chain 1404 branch. /// @param bdagRuntimeCodeHash keccak256 of the verified deployed vault runtime bytecode. /// @param branchReferenceBlock Historical block number used to identify the branch. /// @param branchReferenceHash Full block hash returned by the approved RPC endpoints. /// @param publicationURI Public HTTPS or content-addressed URI for the evidence bundle. function anchorRelease( bytes32 releaseSha256, address bdagVault, bytes32 bdagRuntimeCodeHash, uint256 branchReferenceBlock, bytes32 branchReferenceHash, string calldata publicationURI ) external { if (msg.sender != publisher) revert Unauthorized(); if (releaseSha256 == bytes32(0)) revert EmptyHash(); if (bdagVault == address(0)) revert ZeroAddress(); if (bdagRuntimeCodeHash == bytes32(0)) revert EmptyHash(); if (branchReferenceHash == bytes32(0)) revert EmptyHash(); if (isAnchored[releaseSha256]) revert AlreadyAnchored(); isAnchored[releaseSha256] = true; emit ReleaseAnchored( releaseSha256, bdagVault, bdagRuntimeCodeHash, BDAG_CHAIN_ID, branchReferenceBlock, branchReferenceHash, publicationURI ); } receive() external payable { revert DirectETHDisabled(); } fallback() external payable { revert UnsupportedCall(); } }