Skip to content

TrustifyProject/subgraph

Repository files navigation

Trustify Logo

📡 Trustify - Subgraph

The counterfeit "Made in Italy" market is a growing issue, causing significant economic and reputational damage to authentic Italian brands. The lack of reliable and decentralized supply chain traceability solutions has allowed counterfeit goods to proliferate. NapulETH, in partnership with the University of Federico II and Confindustria, is developing a blockchain-based digital twin solution leveraging Ethereum, Zero-Knowledge Proofs (ZK), and IoT integrations to ensure full transparency and authenticity in the agrifood sector. This initiative aims to create an immutable, verifiable, and privacy-preserving system to certify product origin and quality.

Introduction

This subgraph indexes the Trustify Supply Chain contracts deployed on the Sepolia testnet. Subgraph is consumed by the Trustify DApp through the Apollo Supergraph.

Subgraph URLs:

Overview

This subgraph extracts and structures event data from the following contracts:

  • SupplyChain: Manages batches as dynamic NFTs (dNFTs) and tracks their state transitions.
  • ActorsManager: Registers actors involved in the supply chain, assigning them soul-bound NFTs.

Entities

Actor:

Stores data about supply chain actors such as farmers, processors, distributors, and retailers.

type Actor @entity(immutable: false) {
  id: ID!
  actorType: String!
  address: Bytes!
  hash: String!
  issuedAt: BigInt!
  batches: [Batch!]!
}

Batch:

Represents a batch of goods in the supply chain, tracking its state and associated actors.

type Batch @entity(immutable: false) {
  id: ID!
  state: String!
  hash: String!
  farmer: Actor
  processor: Actor
  packager: Actor
  distributors: [Actor!]!
  retailers: [Actor!]!
  createdAt: BigInt!
}

SupplyChain

Stores aggregated statistics about the entire supply chain.

type SupplyChain @entity(immutable: false) {
  id: ID! @default(value: "supply-chain")
  batches: [Batch!]!
  actors: [Actor!]!
  totalBatches: BigInt!
  totalActors: BigInt!
  activeBatches: BigInt!
  inTransit: BigInt!
  retailedBatches: BigInt!
  transactions: BigInt!
}

Setup & Running Locally

  1. Install dependencies:
yarn install
  1. Generate types:
yarn codegen
  1. Deploy subgraph:
yarn deploy

About

A Subgraph for Trustify Supply Chain contracts.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published