📜 Added RoadChain symbolic ledger (ledger.sol)

This commit is contained in:
2025-07-24 18:37:05 -05:00
parent 7dd3a08337
commit abe8ca6e20

34
roadchain/ledger.sol Normal file
View File

@@ -0,0 +1,34 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
/// @title Lucidia RoadChain Ledger
/// @author You
/// @notice Symbolic truth ledger for Codex Infinity
contract RoadChain {
struct TruthEntry {
address author;
string statement;
uint256 timestamp;
}
TruthEntry[] public ledger;
event TruthWritten(address indexed author, string statement, uint256 time);
function writeTruth(string calldata statement) external {
ledger.push(TruthEntry(msg.sender, statement, block.timestamp));
emit TruthWritten(msg.sender, statement, block.timestamp);
}
function getTruth(uint index) public view returns (address, string memory, uint256) {
require(index < ledger.length, "Invalid index");
TruthEntry memory entry = ledger[index];
return (entry.author, entry.statement, entry.timestamp);
}
function getTotalTruths() public view returns (uint) {
return ledger.length;
}
}