Skip to content
Verified contractExactMIT

QairosArk

Address0x41d5ff38ca6a8d185d05306d836d5be986ee47d7
Balance

0 ETH

 

Transactions

1

 

Compiler

solc 0.8.28

 

Same code

Only this contract

 

Details

Compiler
solc 0.8.28+commit.7893614a
Language
solidity
Optimization
Yes, 200 runs
EVM version
cancun
Via IR
yes
License
MIT
Match
Exactcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
26,162,611
Creation transaction
0x0b1b1e7027…e616a40fcc

src/QairosArk.sol

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;

import {IQairosOracle} from "./interfaces/IQairosOracle.sol";

/// @title QairosArk
/// @notice Pre-registration of post-quantum ownership. An account stores keccak256(pqPublicKey || salt || account)
///         today. If ECDSA falls, revealing a preimage that was committed before the first armed QairosCanary break
///         proves ownership in a way a quantum attacker cannot forge after the fact.
contract QairosArk {
    struct Entry {
        bytes32 commitment;
        uint64 committedAt;
        uint64 blockNumber;
    }

    IQairosOracle public immutable oracle;
    mapping(address => Entry) public entries;
    uint256 public totalEntries;

    event Committed(address indexed account, bytes32 commitment, uint64 timestamp, bool preQairosMoment);

    error MomentPassed();

    constructor(IQairosOracle oracle_) {
        oracle = oracle_;
    }

    /// @notice Store or rotate a commitment. Rotation is closed once the Qairos Moment is recorded by the oracle,
    ///         so a quantum attacker holding the ECDSA key cannot overwrite a pre-Moment entry.
    function commit(bytes32 commitment) external {
        bool pre = oracle.firstBreakTime() == 0;
        Entry storage e = entries[msg.sender];
        if (!pre && e.commitment != bytes32(0)) revert MomentPassed();
        if (e.commitment == bytes32(0)) totalEntries += 1;
        entries[msg.sender] = Entry(commitment, uint64(block.timestamp), uint64(block.number));
        emit Committed(msg.sender, commitment, uint64(block.timestamp), pre);
    }

    function commitmentFor(bytes calldata pqPublicKey, bytes32 salt, address account) public pure returns (bytes32) {
        return keccak256(abi.encodePacked(pqPublicKey, salt, account));
    }

    /// @notice True when the preimage matches the stored commitment for `account`.
    function verify(address account, bytes calldata pqPublicKey, bytes32 salt) public view returns (bool) {
        bytes32 c = entries[account].commitment;
        return c != bytes32(0) && c == commitmentFor(pqPublicKey, salt, account);
    }

    /// @notice True when the account's entry predates the first armed canary break (or no break has happened).
    function isPreMoment(address account) public view returns (bool) {
        Entry memory e = entries[account];
        if (e.commitment == bytes32(0)) return false;
        uint64 q = oracle.firstBreakTime();
        return q == 0 || e.committedAt < q;
    }
}

src/interfaces/IQairosOracle.sol

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;

interface IQairosOracle {
    event ThreatRaised(uint8 level, uint16 bits, address solver);

    /// @notice Called by QairosCanary when a rung is broken.
    function report(uint16 bits, bool armed, address solver) external;

    /// @notice 0 = nominal. +1 per broken armed rung (128-bit and up). Max 5.
    function threatLevel() external view returns (uint8);

    function rungBroken(uint16 bits) external view returns (bool);

    function lastBreak() external view returns (uint16 bits, uint64 ts);

    /// @notice Timestamp of the first armed break, or 0 if none. Ark commitments before this time are pre-Moment.
    function firstBreakTime() external view returns (uint64);
}
Compiler settingsShow
{
  "viaIR": true,
  "metadata": {
    "bytecodeHash": "ipfs"
  },
  "libraries": {},
  "optimizer": {
    "runs": 200,
    "enabled": true
  },
  "evmVersion": "cancun",
  "remappings": [
    "forge-std/=lib/forge-std/src/"
  ]
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.