Files
captable/README.md
Lux Dev 6df2b904f0 feat(edgar,bluesky): add Form D + Blue-Sky state filing adapters
G-03 — SEC EDGAR Form D adapter (pkg/edgar):
- FormDFiling typed model covering primary issuer, related persons,
  industry, federal exemptions, sales/offering amounts, investor count,
  sales commissions, use of proceeds, and signature blocks
- marshalFormD emits the SEC Form D XML primaryDocument shape;
  buildSGMLSubmission wraps it in the EDGARLink Online SUBMISSION SGML
  envelope (TYPE / CIK / CCC / CONTACT / DOCUMENT)
- Filer with FileFormD / AmendFormD / GetFilingStatus, CIK normalization,
  exponential-backoff + jitter retry with Retry-After honoring,
  REJECTED-status → ErrSubmissionRejected, 4xx → *APIError
- 32 conformance tests against httptest.Server fixtures

G-04 — Blue-Sky state notice adapter (pkg/bluesky):
- Registrar dispatches to per-state StateAdapter implementations
- EFDAdapter (NASAA Electronic Filing Depository) covers 49 states + DC
  with bearer-token auth, ACH-payment metadata, and renewal support
- Real state-portal adapters for FL, TX, NY, CA, MA — five highest-
  volume non-EFD / hybrid-portal states
- Per-state fee calculator with flat + scaled fee schedules
  (CA / NY / WA scale with offering size); EFD system fee layered on
- 30 conformance tests against httptest.Server fixtures

compliance bridge (pkg/compliance/filings.go):
- FormDFiler / BlueSkyFiler interfaces let the compliance Service
  delegate filings without importing the wire packages directly
- compliance.FileFormD / AmendFormD / FileBlueSkyNotice update the
  in-domain record with the regulator-assigned identifier, status,
  filing date, and fee
- 6 bridge tests with in-memory fakes

Coverage: go build / vet / -race clean across the full repo. 62 tests
in the two new packages + 6 in the compliance bridge, all passing.

Source-of-design: Public-Spec
Source-ref: https://www.sec.gov/info/edgar/specifications/formdxml.pdf
Source-ref: https://www.sec.gov/edgar/filer-information/current-edgar-technical-specifications
Source-ref: http://nasaaefd.org
Source-ref: http://nasaaefd.org/About/FormDStates
Clean-Team-Member: dev-agent (P0 G-03 / G-04 implementation)
Signed-off-by: dev <[email protected]>
2026-05-26 18:14:15 -07:00

5.8 KiB

Lux Cap Table

Domain library for cap table management, securities lifecycle, and compliance -- 26 packages, zero database opinion.

go get github.com/luxfi/captable

Architecture

luxfi/captable models the complete private securities lifecycle as interface-driven Go packages. No ORM, no database driver, no framework. Consumers implement repository interfaces and compose services.

Packages

Package Purpose
captable Companies, share classes, entries, ownership summaries, fully-diluted calculations
securities Security instruments (equity, debt, convertible, warrant), CUSIP/ISIN, issuance/transfer/cancellation/conversion with immutable ledger
stakeholder Investors, employees, advisors -- type tracking, accreditation, relationship history
safe SAFE agreements (YC post-money templates: cap, discount, MFN, pro rata variants), conversion math
note Convertible notes (CCD, OCD, simple), interest accrual (simple/compound, daily through continuous), maturity triggers
warrant Common/preferred/broker/penny warrants, cash and cashless exercise
vesting Time-based and milestone vesting, cliff, immediate vesting, custom tranches, performance conditions
compliance Form D (506b/506c/504), blue sky filings per state, Reg D/Reg S/Rule 144 compliance checks
kyc KYC/KYB submissions, AML screening, accreditation verification, pluggable provider interface
omnisub Omnibus/sub-account structure (Alpaca OmniSub), positions, orders, corporate actions, tax lots, 1099/K-1 generation
transfer Transfer restrictions -- Rule 144, lockup, ROFR, board approval
corporate Corporate actions -- stock splits, reverse splits, mergers, spinoffs, reclassification
dividend Dividend declaration, record-date processing, distribution calculation
document Data rooms, document management, access control, audit trails
disclosure PPM/subscription delivery and acknowledgment tracking
comms Shareholder notices -- proxy, dividend, regulatory, K-1
exercise Option and warrant exercise processing
conversion SAFE and convertible note conversion to equity
settlement Trade settlement tracking and reconciliation
scenario Waterfall modeling, what-if analysis
valuation 409A valuation support, FMV tracking
tax 1099-DIV, 1099-B, Schedule K-1 generation
voting Shareholder proposals, quorum, vote tallying
waterfall Liquidation waterfall -- seniority, participation, caps
edgar SEC EDGAR Form D adapter — XML schema marshal, SGML envelope, CIK/CCC auth, EDGARLink Online submission, amendment, status query
bluesky State blue-sky notice adapter — NASAA EFD (49 states + DC) + real state-portal adapters (FL, TX, NY, CA, MA), per-state fee calculator

Securities Lifecycle

The library models the full lifecycle of private securities:

Authorization → Issuance → Vesting → Exercise/Conversion → Transfer → Cancellation
                  │                       │                    │
                  ├── SAFE ──────────────►├── Restriction ─────┤
                  ├── Convertible Note ──►│   Check            │
                  ├── Warrant ───────────►│   (Rule 144,       │
                  └── Option Grant ──────►│    Lockup, ROFR)   │
                                          │                    │
                                          └── On-chain ledger ─┘

Compliance Engine

pkg/compliance enforces securities exemption requirements:

Regulation D:

  • 506(b): max 35 non-accredited investors, no general solicitation, pre-existing relationship required
  • 506(c): all investors must be verified accredited (third-party verification), general solicitation permitted

Regulation S: Offshore sale verification, directed selling restrictions, compliance period tracking (40 or 365 days by category)

Rule 144: Holding period (6 months reporting, 12 months non-reporting), volume limits for affiliates, manner of sale requirements, Form 144 filing tracking

Blue Sky: Per-state filing tracking with status, fees, and expiration

OmniSub (Omnibus/Sub-Account)

pkg/omnisub implements the Alpaca OmniSub model for broker-dealer integration:

  • Omnibus accounts with per-stakeholder sub-accounts
  • Position tracking with cost basis
  • Order lifecycle (pending, filled, partial, cancelled, rejected)
  • Corporate actions applied to positions
  • Tax lot tracking (FIFO, specific identification)
  • Annual tax statement generation (1099-B, 1099-DIV, K-1)

Usage

import (
    "github.com/luxfi/captable/pkg/captable"
    "github.com/luxfi/captable/pkg/securities"
    "github.com/luxfi/captable/pkg/safe"
    "github.com/luxfi/captable/pkg/compliance"
)

// Implement repository interfaces with your database.
repo := myPostgresRepo{}

// Create and manage a company.
company := &captable.Company{
    Name:         "Acme Corp",
    EntityType:   "corporation",
    Jurisdiction: "DE",
}

// Issue a SAFE.
s := &safe.Safe{
    Type:         safe.PostMoney,
    Template:     safe.TemplatePostMoneyCap,
    Capital:      500000,
    ValuationCap: ptr(10000000.0),
    ProRata:      true,
}

// Run a Reg D compliance check.
check := &compliance.RegDCheck{
    Exemption:           "506c",
    AllVerifiedAccredited: true,
    TotalInvestors:       42,
    AccreditedInvestors:  42,
}

Testing

go test ./...

Papers

License

Lux Ecosystem License v1.2.