PureVersation / src /PureIUUY.sol
github-actions[bot]
Automated deployment to Hugging Face
963d10b
Raw
History Blame Contribute Delete
3.49 kB
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract PureIUUY {
// --- 1. IDENTITY & REPUTATION ---
struct Researcher {
bool isRegistered;
uint256 reputationScore;
string role; // "Admin", "Native_Speaker", "Contributor"
}
mapping(address => Researcher) public researchers;
address public labAdmin;
// --- 2. REGISTRY & LICENSING ---
struct DialectEntry {
uint256 id;
string phrase; // e.g., "How far?"
string dialect; // e.g., "Nigerian Pidgin"
string ipfsCid; // Link to audio/metadata
address contributor;
string licenseType; // e.g., "CC-BY-4.0", "Research-Only"
uint256 verificationCount;
bool isVerified;
}
uint256 public entryCounter;
mapping(uint256 => DialectEntry) public entries;
// --- EVENTS (For your Python Script to listen to) ---
event EntryProposed(uint256 indexed id, string phrase, address indexed proposer);
event EntryVerified(uint256 indexed id, address indexed verifier);
event ReputationMinted(address indexed researcher, uint256 amount);
constructor() {
labAdmin = msg.sender;
researchers[msg.sender] = Researcher(true, 100, "Admin"); // Initial Admin
}
// --- MODIFIERS (Governance Guardrails) ---
modifier onlyAdmin() {
require(msg.sender == labAdmin, "Only Lab Admin can do this");
_;
}
modifier onlyRegistered() {
require(researchers[msg.sender].isRegistered, "Must be registered researcher");
_;
}
// --- FUNCTIONS ---
// Identity Management (Onboarding)
function registerResearcher(address _user, string memory _role) public onlyAdmin {
researchers[_user] = Researcher(true, 10, _role); // Start with 10 Rep
}
// Level 1: The Registry (Logic Layer)
function proposeEntry(string memory _phrase, string memory _dialect, string memory _ipfsCid, string memory _license) public onlyRegistered {
entryCounter++;
entries[entryCounter] = DialectEntry(
entryCounter,
_phrase,
_dialect,
_ipfsCid,
msg.sender,
_license,
0,
false
);
emit EntryProposed(entryCounter, _phrase, msg.sender);
}
// Level 3: Consensus & Governance (Voting)
function verifyEntry(uint256 _id) public onlyRegistered {
require(entries[_id].contributor != msg.sender, "Cannot verify own entry");
require(!entries[_id].isVerified, "Already verified");
entries[_id].verificationCount++;
// Simple Consensus: If 2 peers verify, it becomes "Official"
if (entries[_id].verificationCount >= 2) {
entries[_id].isVerified = true;
_mintReputation(entries[_id].contributor, 50); // Reward the creator
emit EntryVerified(_id, msg.sender);
}
// Reward the verifier slightly for doing the work
_mintReputation(msg.sender, 10);
}
// Level 3: Incentive Mechanism (Reputation)
function _mintReputation(address _user, uint256 _amount) internal {
researchers[_user].reputationScore += _amount;
emit ReputationMinted(_user, _amount);
}
// Level 4: Transparent Usage
function getLicenseInfo(uint256 _id) public view returns (string memory, address) {
return (entries[_id].licenseType, entries[_id].contributor);
}
}