Protocol Specification
How OCF records, the API, contracts, and poller fit.
System model
| Layer | Source | Responsibility |
|---|---|---|
| OCF records | ocf/schema and MongoDB | Offchain issuer, stakeholder, stock class, transaction, and support-record shapes. |
| API server | server/routes | Validates OCF-shaped input, writes MongoDB records, and calls contracts. |
| Contracts | chain/src | Stores issuer, stock class, stakeholder, active position, and transaction state onchain. |
| Event poller | server/chain-operations/transactionPoller.ts | Syncs contract events back into MongoDB history records. |
Contract structs live in Structs Library; stock lifecycle behavior lives in Stock Functions.