Human-AI Collaboration Contract

What it does:
Facilitates collaborative creation between humans and AI agents, tracking contributions, managing rights, and automatically distributing revenues.

Why it matters:
Ensures fair compensation for human contributors, verifies AI-generated outputs, prevents disputes, and enables transparent collaboration ecosystems.

How it works:

  • Humans and AI agents register for a collaboration project

  • Contributions (human or AI) are logged on-chain with proof or metadata

  • Smart contract tracks ownership shares and royalties for all participants

  • Revenue from sales or licensing is automatically split based on predefined percentages

  • Integrates with AI Training Data Licensing, AI Agent Payment Contract, Play-to-Earn Reward Engine, or Life Achievement NFT

  • Dashboards show contributions, ownership shares, revenue distribution, and project history

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

import "@openzeppelin/contracts/access/Ownable.sol";

/**
 * @title HumanAICollaboration
 * @author Nam
 * @notice Manages co-creation projects between humans and AI with revenue sharing
 */
contract HumanAICollaboration is Ownable {

    struct Contributor {
        address payable contributorAddress;
        uint256 share; // 0-100 percentage
        bool isAI;
    }

    struct Project {
        string metadataURI; // description, IPFS, etc.
        uint256 totalRevenue; // total ETH received
        bool active;
        Contributor[] contributors;
    }

    mapping(uint256 => Project) public projects;
    uint256 public projectCount;

    // -------------------- EVENTS --------------------

    event ProjectCreated(uint256 indexed projectId, string metadataURI);
    event ContributionRegistered(uint256 indexed projectId, address contributor, uint256 share, bool isAI);
    event RevenueDistributed(uint256 indexed projectId, uint256 totalRevenue);

    // -------------------- PROJECT MANAGEMENT --------------------

    function createProject(string calldata _metadataURI) external {
        projectCount += 1;
        Project storage p = projects[projectCount];
        p.metadataURI = _metadataURI;
        p.active = true;

        emit ProjectCreated(projectCount, _metadataURI);
    }

    function addContributor(uint256 _projectId, address payable _contributor, uint256 _share, bool _isAI) external onlyOwner {
        Project storage p = projects[_projectId];
        require(p.active, "Project inactive");

        p.contributors.push(Contributor({
            contributorAddress: _contributor,
            share: _share,
            isAI: _isAI
        }));

        emit ContributionRegistered(_projectId, _contributor, _share, _isAI);
    }

    // -------------------- REVENUE MANAGEMENT --------------------

    function distributeRevenue(uint256 _projectId) external payable {
        Project storage p = projects[_projectId];
        require(p.active, "Project inactive");
        require(msg.value > 0, "No revenue sent");

        p.totalRevenue += msg.value;

        for (uint256 i = 0; i < p.contributors.length; i++) {
            Contributor storage c = p.contributors[i];
            uint256 amount = (msg.value * c.share) / 100;
            c.contributorAddress.transfer(amount);
        }

        emit RevenueDistributed(_projectId, msg.value);
    }

    // -------------------- VIEW FUNCTIONS --------------------

    function getProject(uint256 _projectId) external view returns (Project memory) {
        return projects[_projectId];
    }

    function getContributors(uint256 _projectId) external view returns (Contributor[] memory) {
        return projects[_projectId].contributors;
    }
}