All projects

InvoiceFlow

Decentralized invoice financing with Chainlink CRE automated verification

DeFi & Tokenization

What it is

InvoiceFlow transforms unpaid invoices into liquid, tradable assets using blockchain and Chainlink CRE.

THE PROBLEM:
Small businesses often wait 30-90 days for invoice payments, creating cash flow crises. Traditional invoice factoring is expensive (3-5% fees), slow (2-3 days approval), and requires selling the entire invoice.

THE SOLUTION:
InvoiceFlow lets businesses fractionalize invoices and sell portions to multiple investors, maintaining partial ownership while getting immediate liquidity.

HOW IT WORKS:

  1. Business creates an invoice NFT (ERC-721)
  2. Chainlink CRE workflow automatically verifies it (~30 seconds):
       - Fetches ETH market data from CoinGecko (consensus-based)
       - Checks if debtor is a trusted company (Apple, Microsoft, etc. Used mocked data for this)
       - Calculates dynamic risk score (0-100) based on:
         * Company reputation (-20 for trusted)
         * Invoice size (0-15 risk)
         * Time until payment (0-20 risk)
         * Market volatility (-10 to +15 risk)
  3. Verified invoices are fractionalized into ERC-1155 tokens
  4. Investors buy fractions at market prices (2.5% platform fee)
  5. When debtor pays, smart contracts auto-distribute funds proportionally
  6. Everyone gets paid automatically - no intermediaries

IMPACT:

  • Businesses: Get cash in hours (vs. weeks), lower fees (2.5% vs. 3-5%), keep partial ownership
  • Investors: Short-term returns (30-90 days), transparent risk scores, diversified portfolio
  • Economy: Better capital efficiency, reduced dependence on predatory lenders

How it Works

SMART CONTRACTS :
• InvoiceNFT (ERC-721): Stores invoice metadata, verification status
• InvoiceVerifier: Receives CRE reports via ReceiverTemplate pattern
• InvoiceFractionalizationPool (ERC-1155): Manages fractional tokens, sales, buyouts
• PaymentDistributor: Handles debtor payments, proportional distribution

CHAINLINK CRE WORKFLOW (TypeScript):
• Event Trigger: Detects InvoiceCreated events on Sepolia
• Data Fetching: CoinGecko API via HTTPClient with consensus aggregation
• Risk Algorithm: 6-factor calculation (company, time, size, market, stability, combo)
• Verification: Generates signed DON report, writes to InvoiceVerifier contract
• Execution Time: ~30 seconds from invoice creation to verification

FRONTEND (React 18 + Ethers.js v6):
• Real-time event listeners for automatic verification updates
• Investment marketplace with risk score visualization
• Payment claiming interface

INFRASTRUCTURE:
• Ethereum Sepolia testnet
• Chainlink CRE (Runtime Environment)
• CoinGecko API (market data)
• MockForwarder for testing, KeystoneForwarder for production

Links

Created by

  • Abdulrahman (Abdul)