mirror of
https://github.com/blackboxprogramming/blackroad.io.git
synced 2026-03-18 06:34:01 -05:00
35 lines
981 B
Solidity
35 lines
981 B
Solidity
// 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;
|
|
}
|
|
}
|
|
|