Skip to content

LucasR29/IPRegistry-DOCS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

1 Commit
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿงฉ IP Registry

Modular Architecture & Controlled Transfer System

Solidity License Status Smart%20Contracts


๐Ÿ“š Table of Contents


๐Ÿ—๏ธ Overview

The IP Registry is a modular, enterprise-grade smart contract system for managing intellectual property (IP) on-chain โ€” including registration, licensing, transfer, validation, and legal compliance.

It is built with a modular architecture, ensuring scalability, maintainability, and auditability.
Includes a controlled transfer system and author consensus mechanism for legal compliance and democratic management of rights.

Version: 2.0.0 - Modular Architecture


๐Ÿงฑ Architecture Structure

contracts/Registry/
โ”œโ”€โ”€ types/
โ”‚   โ””โ”€โ”€ IPTypes.sol              # Data structures and enums
โ”œโ”€โ”€ base/
โ”‚   โ””โ”€โ”€ IPRegistryBase.sol       # Core ERC721 + AccessControl
โ”œโ”€โ”€ modules/
โ”‚   โ”œโ”€โ”€ LicensingModule.sol      # Licensing and royalty management
โ”‚   โ”œโ”€โ”€ ValidationModule.sol     # Legal validation and compliance
โ”‚   โ””โ”€โ”€ TransferModule/          # Advanced transfer system
โ”‚       โ”œโ”€โ”€ TransferModule.sol   # Main orchestrator
โ”‚       โ”œโ”€โ”€ core/
โ”‚       โ”‚   โ””โ”€โ”€ TransferCore.sol # Core validation & entrypoint
โ”‚       โ”œโ”€โ”€ consensus/
โ”‚       โ”‚   โ””โ”€โ”€ AuthorConsensus.sol # Author preference system
โ”‚       โ”œโ”€โ”€ approval/
โ”‚       โ”‚   โ””โ”€โ”€ TransferApproval.sol # Multi-author approvals
โ”‚       โ””โ”€โ”€ history/
โ”‚           โ””โ”€โ”€ TransferHistory.sol # Transfer records & analytics
โ”œโ”€โ”€ libraries/                   # Supporting logic libraries
โ””โ”€โ”€ Registry.sol                 # Main contract combining all modules

๐Ÿ“ฆ Module Descriptions

IPTypes.sol

Defines all core enums and structs:

  • Enums: EntityType, IntellectualPropertyType, TransferType, RegistrationStatus
  • Structs: Author, LegalData, Registration, Licensing, TransferRecord, TransferApproval
  • Purpose: Centralized type definitions for maintainability

IPRegistryBase.sol

Abstract base contract providing:

  • ERC721 functionality with custom _update() override
  • AccessControl with MINTER_ROLE and DEFAULT_ADMIN_ROLE
  • Core storage mappings for tokens, authors, licenses, ownership
  • Registration system with registerIntellectualProperty()
  • Rights management with getRightsStatus()

LicensingModule.sol

Handles licensing and royalties:

  • License lifecycle: grantLicense(), revokeLicense(), renewRegistration()
  • Royalty management: payRoyalty() with automatic distribution
  • Status management: updateRegistrationStatus(), isExpired()
  • Analytics: getLicenseStats(), getActiveLicenses()

ValidationModule.sol

Ensures legal compliance:

  • Entity verification: registerEntityLegalData(), verifyLegalCapacity()
  • Document validation: validateTransfer(), setRequiredDocuments()
  • Due diligence: generateDueDiligenceReport(), isTokenFullyValidated()
  • Compliance scoring: getComplianceScore() (0-100 scale)

โš™๏ธ Transfer System โ€” Controlled and Auditable

Problem Solved

Every transfer must pass through the registry's controlled validation flow. No bypassing allowed.

Architecture

ERC721._update()
โ†“
IPRegistryBase._update()
โ†“
TransferCore._validateTransferInUpdate()
โ†“ (checks _directTransferApprovals[tokenId][to])
โ†“ (records history and consumes approval)
โ†“
super._update()

Each transfer requires a direct approval, either:

  • Manual: approveDirectTransfer(tokenId, to) for simple transfers
  • Automatic: created after requestTransfer() is fully approved by authors

๐Ÿš€ Transfer Flow

Simple Transfer (Fast)

// 1. Owner approves direct transfer
registry.approveDirectTransfer(tokenId, recipient);

// 2. Anyone can execute the transfer
registry.transferFrom(owner, recipient, tokenId);
// OR
registry.safeTransferFrom(owner, recipient, tokenId);

Author-Approved Transfer (Complex)

// 1. Owner requests transfer with author approval
uint256 transferId = registry.requestTransfer(
    tokenId, 
    newOwner, 
    TransferType.SALE, 
    false, // maintainAuthorRights
    7      // deadlineInDays
);

// 2. Each author approves individually
registry.connect(author1).approveTransfer(transferId);
registry.connect(author2).approveTransfer(transferId);
// ... all authors must approve

// 3. After all approvals, transfer is executed
registry.transferFrom(owner, newOwner, tokenId);

Any unauthorized transfer attempt reverts automatically.


๐Ÿ“œ Main Transfer Functions

Function Description
approveDirectTransfer(tokenId, to) Approve direct transfer
revokeDirectTransferApproval(tokenId, to) Revoke direct approval
isDirectTransferApproved(tokenId, to) Verify approval status
requestTransfer(...) Start a complex transfer
approveTransfer(transferId) Author approves transfer
getTransferHistory(tokenId) Retrieve all transfer history
getPendingTransfer(transferId) Get pending transfer details
hasAuthorApproved(transferId, author) Check individual author approval

๐Ÿ“ Transfer Module Architecture

The TransferModule.sol was refactored into 4 specialized submodules for single-responsibility clarity:

TransferCore (core/TransferCore.sol)

  • Responsibility: Core validation & entrypoint for _update()
  • Features: Direct transfer approvals, validation logic
  • Key Functions: _validateTransferInUpdate(), approveDirectTransfer()

AuthorConsensus (consensus/AuthorConsensus.sol)

  • Responsibility: Author preference and voting system
  • Features: Individual author preferences, automatic consensus resolution
  • Key Functions: setAuthorApprovalPreference(), getConsensusStats()

TransferApproval (approval/TransferApproval.sol)

  • Responsibility: Multi-author approval logic
  • Features: Complex transfer requests, approval workflows
  • Key Functions: requestTransfer(), approveTransfer(), cancelPendingTransfer()

TransferHistory (history/TransferHistory.sol)

  • Responsibility: Records & analytics for all transfers
  • Features: Complete transfer history, statistics, ownership tracking
  • Key Functions: getTransferHistory(), getTransferStats(), hasBeenOwner()

โš–๏ธ Author Consensus System

Allows authors to vote on whether transfers require approval, enabling democratic management of IP ownership.

Features

  • Each author sets individual true/false preference
  • Automatic consensus resolution based on voting rules
  • Dynamic update of requiresAuthorApproval state
  • Protection: only authors can enable approval requirements

Consensus Rules

Scenario Result
All authors enable Approval required
All authors disable Approval removed
Conflicting opinions Keeps current state
Owner not author Cannot enable

Core Functions

setAuthorApprovalPreference(tokenId, bool preference);
getAuthorApprovalPreference(tokenId, author);
getAllAuthorPreferences(tokenId);
getConsensusStats(tokenId);

Integration Example

// โŒ This will revert if authors require approval
registry.approveDirectTransfer(tokenId, buyer);

// โœ… This works - uses author approval system
registry.requestTransfer(tokenId, buyer, SALE, false, 7);

๐Ÿงฎ Final Inheritance Flow

IPRegistry (Main Contract)
โ”œโ”€โ”€ LicensingModule
โ”‚   โ””โ”€โ”€ IPRegistryBase
โ”œโ”€โ”€ TransferModule
โ”‚   โ””โ”€โ”€ TransferHistory
โ”‚       โ””โ”€โ”€ TransferApproval
โ”‚           โ””โ”€โ”€ AuthorConsensus
โ”‚               โ””โ”€โ”€ TransferCore
โ”‚                   โ””โ”€โ”€ IPRegistryBase
โ””โ”€โ”€ ValidationModule
    โ””โ”€โ”€ IPRegistryBase

๐Ÿ“Š Data Flow Diagram

graph TD
    A[IPTypes] --> B[IPRegistryBase]
    B --> C[LicensingModule]
    B --> D[TransferModule]
    B --> E[ValidationModule]
    C --> F[Registry]
    D --> F
    E --> F
    
    D --> G[TransferCore]
    D --> H[AuthorConsensus]
    D --> I[TransferApproval]
    D --> J[TransferHistory]
    
    G --> K[Direct Transfers]
    H --> L[Author Preferences]
    I --> M[Complex Transfers]
    J --> N[Transfer Records]
Loading

๐ŸŽฏ Simplified Fluxogram

graph TD
    A[User calls transferFrom] --> B[_validateTransferInUpdate]
    B --> C{Has Direct Approval?}
    C -->|Yes| D[Consume approval & record]
    C -->|No| E[โŒ REVERT: Use approval system]
    D --> F[Notify licenses]
    F --> G[โœ… Execute ERC721 transfer]
    
    H[approveDirectTransfer] --> I[Grant Direct Approval]
    J[requestTransfer + all approvals] --> I
    I --> K[Ready for transfer]
Loading

๐Ÿ”’ Security & Compliance

Access Control

  • Role-based permissions on sensitive functions
  • MINTER_ROLE for registration
  • DEFAULT_ADMIN_ROLE for system management

Transfer Security

  • Double-layer validation for author approvals
  • No bypass possible - all transfers go through validation
  • Single-use approvals - consumed after transfer

Legal Compliance

  • On-chain history for full auditability
  • Legal entity verification with LegalData structs
  • Due diligence reports with compliance scoring
  • Document validation system

ERC721 Compatibility

  • Standard interface preserved - works with existing wallets/exchanges
  • Custom _update() override for controlled transfers
  • Gas-efficient validation with minimal overhead

๐Ÿ“ˆ Benefits

๐Ÿงฉ Maintainability

  • Modular structure - each module has single responsibility
  • Clear separation of concerns - easy to locate and fix issues
  • ~5x smaller modules compared to monolithic approach

โš™๏ธ Scalability

  • Easily extendable (e.g., Dispute, Auction, Insurance modules)
  • Upgradeable via proxy patterns
  • Independent module updates possible

๐Ÿ” Auditability

  • Every action logged on-chain with events
  • Full ownership and approval history tracked
  • Compliance scoring for legal validation

๐Ÿ’ป Developer Experience

  • Clean APIs with intuitive function names
  • Easy-to-read modular design
  • Comprehensive view functions for data access

๐Ÿ Deployment

# Deploy the complete registry system
npx hardhat run scripts/deploy-registry.js

# The Registry contract includes all functionality
# No need to deploy individual modules

Contract Information

// Get system information
(string memory architecture, string[] memory modules, string memory transferSystem) = 
    registry.getSystemInfo();

// Get global statistics
(uint256 totalTokens, uint256 totalAuthors, uint256 totalLicenses, string memory version) = 
    registry.getGlobalStats();

๐Ÿ† Outcome

After full modular refactor and consensus integration:

  • โœ… ~5x smaller modules, easier to audit and maintain
  • โœ… 100% backward compatibility with existing interfaces
  • โœ… Secure, transparent multi-author approval system
  • โœ… Legally compliant and production-ready
  • โœ… Modular architecture ready for future extensions

๐Ÿ’ก Summary

The IP Registry delivers a professional-grade modular system, combining:

  • Licensing - Complete royalty and license management
  • Ownership - Secure transfer system with author consensus
  • Author Rights - Democratic management of IP rights
  • Legal Compliance - Full validation and due diligence

All within a scalable, maintainable, and auditable blockchain architecture.


ยฉ 2025 โ€” All Rights Reserved.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors