Skip to content

ecosystem: Invoice Factoring / PO Financing — reference pattern for receivables financing on Arc #196

Description

@osr21

Summary

Searched the circlefin org for any existing sample, reference pattern, or advisory covering invoice factoring / purchase-order financing on Arc (keywords: invoice, factoring, purchase order, accounts receivable, debtor, financier, working capital, trade finance — checked arc-node, arc-fintech, perimeter-protocol, arc-escrow, and org-wide). There isn't one. Given Arc's stablecoin-as-gas + CCTP + Gateway building blocks are a natural fit for receivables financing (a very common real-world commerce primitive), this seems like a documentation/reference-app gap worth flagging — similar in spirit to the PaymentEscrow advisory in #86.

We built an InvoiceFactoring contract as part of a stablecoin dApp on Arc Testnet and are sharing the design here as a possible starting point for an official reference pattern or sample app.

Design

Lifecycle:

Created → Funded → Delivered → Repaid
                             \→ Defaulted (permissionless, after dueDate)
Created → Cancelled (by sme, before funding)

Three roles per invoice: sme (raises it), financier (advances capital at a discount), debtor (owes the full face value).

Functions:

  • createInvoice(debtor, token, faceValue, advanceBps, feeBps, dueDate, description) — moves no funds; snapshots feeBps into the invoice struct at creation time (see note below).
  • fundInvoice(id) — financier's discounted advance is pulled and forwarded directly to the SME.
  • submitProofOfDelivery(id, proofHash) — SME posts a delivery proof hash once goods/services are delivered.
  • repayInvoice(id) — debtor repays the full face value; the contract atomically splits it into a financier payout (advance + fee) and an SME remainder.
  • markDefaulted(id) — permissionless after dueDate if unpaid.
  • cancelInvoice(id) — SME can cancel before funding.

Notable design decisions (informed by #86):

Suggested action

  1. Consider an official InvoiceFactoring/receivables-financing reference pattern or sample app, alongside the existing PaymentEscrow-style advisories and sample apps (arc-escrow, arc-nanopayments, arc-p2p-payments).
  2. If useful, happy to have this design reviewed/critiqued the way the PaymentEscrow pattern was in security: developer advisory — 4 vulnerabilities found in common PaymentEscrow patterns when building on Arc Network #86.

Reference implementation

InvoiceFactoring.sol: https://github.com/osr21/arc-stablecoin-dapp/blob/main/contracts/src/InvoiceFactoring.sol
Docs: https://github.com/osr21/arc-stablecoin-dapp/blob/main/docs/contracts.md#invoicefactoring

Environment: Arc Testnet (chainId 5042002), Solidity 0.8.20

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions