Spaces:
Running
Running
File size: 1,760 Bytes
88d2f2a | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | // SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
/// @title QuestionRegistry
/// @notice Anchors PolyglotAlpha Polymarket-style questions on Arc testnet.
/// Stores cryptographic commitments (hashes) of the question title and
/// the source Chinese news text plus auxiliary resolution metadata.
contract QuestionRegistry {
struct Question {
bytes32 titleHash;
bytes32 sourceNewsHash;
string resolutionSource;
uint256 cutoffTs;
string category;
string winningTranslator;
address submitter;
uint256 blockTimestamp;
}
mapping(uint256 => Question) public questions;
uint256 public nextId;
event QuestionRegistered(
uint256 indexed id,
bytes32 indexed titleHash,
address indexed submitter,
string category,
uint256 cutoffTs
);
function registerQuestion(
bytes32 _titleHash,
bytes32 _sourceNewsHash,
string calldata _resolutionSource,
uint256 _cutoffTs,
string calldata _category,
string calldata _winningTranslator
) external returns (uint256 id) {
id = nextId++;
questions[id] = Question({
titleHash: _titleHash,
sourceNewsHash: _sourceNewsHash,
resolutionSource: _resolutionSource,
cutoffTs: _cutoffTs,
category: _category,
winningTranslator: _winningTranslator,
submitter: msg.sender,
blockTimestamp: block.timestamp
});
emit QuestionRegistered(id, _titleHash, msg.sender, _category, _cutoffTs);
}
function getQuestion(uint256 _id) external view returns (Question memory) {
return questions[_id];
}
}
|