How manukj/guardfi works
Main Components
• Frontend (Next.js): The packages/nextjs directory contains a full Next.js application with a lot of UI elements (e.g., block explorer, debug screens, dashboard, login components, etc.), integration with scaffold-eth, and additional UI components. This is the user-facing application that displays risk metrics, insurance details, and interfaces for contract analysis.
• Smart Contracts & Blockchain Layer (Foundry): The packages/foundry directory is dedicated to Solidity contracts, deployments, scripts, and tests. This includes contracts for various insurance-related functionalities and protocols. It reflects the core on-chain logic and integration with tools like Mythril and Slither.
• AI & Risk Assessment Component (Flock): The packages/flock folder (notably with a “testnet-training-node-quickstart”) suggests an AI-powered component used for risk evaluation of smart contracts based on training data.
• Cross-Chain Verification & External Data (Flare & External Services): The README mentions using Flare’s Data Connector and external blockchain data services along with integrated static analysis tools.
• Infrastructure & CI/CD: The presence of GitHub workflows, Docker Compose configuration (docker-compose.yml), and yarn configuration files indicate an integrated development and deployment pipeline.
Relationships and Interaction Flows
• Frontend ⇄ Smart Contract Layer: Show how the Next.js application interacts with deployed contracts (via web3 services in packages/nextjs/services/web3). This communication involves user-triggered transactions and queries.
• Frontend ⇄ AI Risk Assessment: Illustrate how the UI sends contract code or transaction details for risk analysis. This could be an API endpoint (see packages/nextjs/app/api/analyze) that interfaces with the Flock training/test component.
• CI/CD and Infrastructure: Indicate components that handle code quality checks (e.g., GitHub workflows, husky, and lint-staged configurations) and containerized deployments (Docker Compose).
Architectural Patterns and Technologies
• Modularized Multi-Package Structure: Emphasize the separation into packages (nextjs, foundry, flock) which reflects clear domain boundaries – UI, smart contract backend, and AI risk assessment.
• Full-Stack Separation: The clear division into frontend (user interface, API endpoints) and backend (smart contracts and data services) should be highlighted.
• Security and Static Analysis: Note that the system integrates static analysis tools (e.g., Mythril, Slither) and risk analysis models as core design elements.
• Integration with External Libraries and Tools: Mention technologies like Tailwind CSS, Node.js, Foundry, and Solidity, as well as integrations with scaffold-eth for blockchain interactions.