How albertobas/olive-oil-trust works
Main Components
• Smart Contracts (Backend Blockchain Layer):
– Located in “hardhat-env/contracts” along with deployment scripts, Hardhat tasks, and tests.
– These contracts implement the supply chain roles (olive growers, oil mills, distributors, etc.), escrow mechanisms, certificate management, and token minting/trading.
– They are upgradeable (UUPS compliant) which is an important architectural nuance.
• Front-End Application (User Interface Layer):
– Found under “next-app” with a Next.js framework that handles both exploration (public view) and management (authenticated member actions).
– Uses Redux for global state management (hexagonal architecture pattern with the domain core separate from infrastructure).
• Supporting Services:
Relationships and Interactions
• The blockchain (Hardhat node) hosts the smart contracts, and deployment scripts in “hardhat-env/scripts” deploy these contracts.
Important Architectural Patterns & Design Principles
• Hexagonal Architecture (Ports and Adapters):
• Upgradeable Smart Contracts:
– The contracts use ownership, roles, and UUPS patterns to allow upgrades while preserving state.
• Event-Driven Data Flow:
• Test-Driven Development:
– A rich set of tests (using Mocha, Chai, and Hardhat plugins) ensures the correctness of each component in the blockchain layer.