Skip to content

dadadave80/chronicle

Repository files navigation

Chronify: Modular Supply Chain on Hedera

Chronify is a composable, upgradeable supply chain platform leveraging the Diamond Standard (EIP‑2535) and Hedera Token Service for end‑to‑end traceability. It provides a transparent and immutable way to track products from origin to destination, ensuring accountability and reducing fraud.


Overview

Chronify is a modular smart contract system for supply chain management, built on the Hedera network. It employs the Diamond Standard (EIP‑2535) for upgradeable, facet‑based architecture, allowing seamless extension and maintenance. Core supply chain entities—parties, products, and supply chain events—are managed as distinct facets. The system integrates Hedera Token Service (HTS) to mint and transfer NFTs representing unique products, enabling secure, verifiable, and transparent asset tracking across the supply chain.

By combining modularity, upgradeability, and HTS NFT integration, Chronify delivers a robust foundation for traceable, compliant, and future‑proof supply chain solutions.


Features

  • Modular Facet Architecture: Parties, Products, and Supply Chain logic separated into upgradable facets.
  • Diamond Standard (EIP‑2535): Dynamic addition, replacement, and removal of contract functionality.
  • HTS NFT Integration: Mint, transfer, and manage NFTs for unique product tracking on Hedera.
  • Access Control: Role‑based permissions for parties (e.g., Supplier, Transporter, Retailer).
  • Traceability: End‑to‑end product journey tracking and event logging.
  • Upgradeable & Extensible: Use DiamondCut to safely upgrade or extend contract logic.
  • Event Logging: On‑chain logs for party/product registration, transfer, and status changes.

Getting Started

Prerequisites

  • Foundry (optional, for advanced EVM tooling)

Installation

  1. Clone the repository:
    git clone https://github.com/dadadave80/chronicle.git
    cd chronicle
  2. Install dependencies:
    forge install
  3. Configure network:
    • Update foundry.toml or .env with your Hedera RPC and credentials.

Project Structure

src/
├── Chronicle.sol                # Diamond proxy root contract
├── facets/
│   ├── PartiesFacet.sol         # Party registration, roles, access control
│   ├── ProductsFacet.sol        # Product/NFT management, minting, transfer
│   └── SupplyChainFacet.sol     # Supply chain event logging
├── initializers/
│   └── InitHTCKeyTypes.sol      # Key type initialization for HTS
├── libraries/
│   ├── LibParty.sol             # Party logic, storage, helpers
│   ├── LibProduct.sol           # Product logic, HTS/NFT integration
│   ├── LibSupplyChain.sol       # Supply chain logic, HTS/NFT integration
│   ├── hts/
│   │   ├── LibHederaTokenService.sol # HTS interface, NFT mint/transfer
│   │   └── LibKeyHelper.sol     # Key generation for HTS tokens
│   ├── logs/
│   │   ├── PartyLogs.sol        # Events for party actions
│   │   ├── ProductLogs.sol      # Events for product actions
│   │   └── SupplyChainLogs.sol  # Events for supply chain actions
│   └── types/                   # Storage structs/enums for parties/products/keys

Usage / Workflow

1. Register Parties

// Register a new party (Supplier, Transporter, Retailer)
PartiesFacet.registerParty("Acme Logistics", Role.Transporter);

2. Mint Product NFTs

// Mint a new product as an NFT
ProductsFacet.addProduct("Widget A", "Batch 001", 100, 10);

3. Transfer Products

// Transfer NFT from supplier to transporter
ProductsFacet.transferProduct(tokenAddress, transporterAddress, serialNumber);

4. Track Product Status

// Update or query product status
ProductsFacet.getProductByTokenAddress(tokenAddress);
ProductsFacet.updateProduct(tokenAddress, "Widget A+", "Batch 001A", 120);

Development & Testing

  1. Compile contracts:
    forge build
  2. Run tests:
    forge test
  3. Upgrade contracts (DiamondCut):

Deployed Contracts

Roadmap

  • Owner lookup and management
  • Compliance and audit workflows
  • UI front-end for supply chain visualization
  • Testnet deployment scripts
  • Advanced analytics and reporting

Contributing

We welcome contributions!


License

This project is licensed under the MIT License.


Acknowledgements & References

About

Supply Chain Management System.

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •