Files
smom-dbis-138/contracts/mainnet-checkpoint/LegacyCheckpointAdapter.sol
T
defiQUGandCursor 651fb59786 Add mainnet checkpoint stack: ISO attestation, participant Etherscan surface, and services.
Ship AddressActivityRegistry V1/V2, ISO20022IntakeGateway, Chain138ParticipantSurface,
checkpoint hub contracts, checkpoint-core package, aggregator/indexer/sdk services,
relay profile guards, M00 diamond bridge facet, and OMNL compliance contracts.

Co-authored-by: Cursor <[email protected]>
2026-06-24 21:54:05 -07:00

77 lines
2.4 KiB
Solidity

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import {CheckpointStorage} from "./storage/CheckpointStorage.sol";
import {IChain138MainnetCheckpoint} from "./interfaces/IChain138MainnetCheckpoint.sol";
interface ILegacyTransactionMirror {
function getMirroredTransactionCount() external view returns (uint256);
function transactions(bytes32 txHash)
external
view
returns (
bytes32,
address,
address,
uint256,
uint256,
uint256,
uint256,
bool,
bytes memory,
bytes32
);
}
interface ILegacyMainnetTether {
function stateProofs(uint256 blockNumber)
external
view
returns (
uint256,
bytes32,
bytes32,
bytes32,
uint256,
bytes memory,
uint256,
bytes32
);
}
/// @notice Read-only unified view over v1 mirror/tether + v2 checkpoint hub.
contract LegacyCheckpointAdapter {
IChain138MainnetCheckpoint public immutable checkpointV2;
ILegacyTransactionMirror public immutable mirrorV1;
ILegacyMainnetTether public immutable tetherV1;
constructor(address checkpoint, address mirror, address tether) {
checkpointV2 = IChain138MainnetCheckpoint(checkpoint);
mirrorV1 = ILegacyTransactionMirror(mirror);
tetherV1 = ILegacyMainnetTether(tether);
}
function latestAttestationBlock() external view returns (uint256 blockNumber, uint64 batchId, bool fromV2) {
batchId = checkpointV2.getLatestBatchId();
if (batchId > 0) {
CheckpointStorage.CheckpointHeader memory h = checkpointV2.getLatestCheckpoint();
return (h.checkpointBlock, batchId, true);
}
return (0, 0, false);
}
function isTxMirroredV1(bytes32 txHash) external view returns (bool) {
(, , , , uint256 blockNumber, , , , , ) = mirrorV1.transactions(txHash);
return blockNumber > 0;
}
function getTetherStateRoot(uint256 blockNumber) external view returns (bytes32 stateRoot, bool found) {
(, , stateRoot, , , , , ) = tetherV1.stateProofs(blockNumber);
found = stateRoot != bytes32(0);
}
function v1MirrorCount() external view returns (uint256) {
return mirrorV1.getMirroredTransactionCount();
}
}