Structs Library
chain/src/lib/Structs.sol defines the structs that CapTable, StockLib, TxHelper, and Adjustment share. The tables group them by role.
Core records
| Struct | Fields |
|---|---|
Issuer | id, legal_name, shares_issued, shares_authorized |
StockClass | id, class_type, price_per_share, shares_issued, shares_authorized |
Stakeholder | id, stakeholder_type, current_relationship |
StockLegendTemplate | id |
class_type, stakeholder_type, and current_relationship are OCF strings that the contract doesn’t validate.
Positions
| Struct | Fields |
|---|---|
ActivePosition | stock_class_id, quantity, share_price, timestamp |
ActivePositions | activePositions[stakeholder_id][security_id] |
SecIdsStockClass | activeSecurityIdsByStockClass[stakeholder_id][stock_class_id] |
Seeding
| Struct | Fields |
|---|---|
IssuerInitialShares | shares_authorized, shares_issued |
StockClassInitialShares | id, shares_authorized, shares_issued |
InitialShares | issuerInitialShares, stockClassesInitialShares |
Function inputs
| Struct | Used by | Fields |
|---|---|---|
StockIssuanceParams | issueStock | stock_class_id, stock_plan_id, share_numbers_issued, share_price, quantity, vesting_terms_id, cost_basis, stock_legend_ids, issuance_type, comments, custom_id, stakeholder_id, approval dates, consideration_text, security_law_exemptions |
ShareNumbersIssued | StockIssuanceParams | starting_share_number, ending_share_number |
StockTransferParams | transferStock | transferor_stakeholder_id, transferee_stakeholder_id, stock_class_id, is_buyer_verified, quantity, share_price, nonce, custom_id |
StockParams | Cancel, retract, reissue, repurchase | stakeholder_id, stock_class_id, security_id, comments, reason_text |
StockParamsQuantity | Cancel and repurchase, internally | nonce, quantity, stakeholder_id, stock_class_id, security_id, comments, reason_text |
StockParams carries stakeholder_id and stock_class_id, which aren’t OCF fields, because the contract needs them to find the security.
Transaction payloads
Each payload is ABI-encoded into the TxCreated event, which the poller decodes into a history row.
| Struct | object_type | Fields |
|---|---|---|
StockIssuance | TX_STOCK_ISSUANCE | id, security_id, params (a StockIssuanceParams) |
StockTransfer | TX_STOCK_TRANSFER | id, quantity, security_id, balance_security_id, resulting_security_ids |
StockCancellation | TX_STOCK_CANCELLATION | id, quantity, security_id, reason_text, balance_security_id |
StockRetraction | TX_STOCK_RETRACTION | id, security_id, reason_text |
StockReissuance | TX_STOCK_REISSUANCE | id, security_id, resulting_security_ids, reason_text; split_transaction_id is always zero |
StockRepurchase | TX_STOCK_REPURCHASE | id, security_id, quantity, price, balance_security_id, and consideration_text, which the contract fills from the call’s reason_text |
StockAcceptance | TX_STOCK_ACCEPTANCE | id, security_id |
IssuerAuthorizedSharesAdjustment | TX_ISSUER_AUTHORIZED_SHARES_ADJUSTMENT | id, new_shares_authorized, approval dates |
StockClassAuthorizedSharesAdjustment | TX_STOCK_CLASS_AUTHORIZED_SHARES_ADJUSTMENT | id, new_shares_authorized, approval dates |
Every payload also has object_type and comments. For StockIssuance, comments is inside params.
Scaled values
Share counts and money are stored ×1e10; see Scaling. These uint256 fields are scaled:
shares_issuedandshares_authorized, inIssuer,StockClass, and the seeding structsprice_per_shareinStockClassquantityandshare_priceinActivePosition,StockIssuanceParams, andStockTransferParamsquantityinStockParamsQuantity,StockTransfer,StockCancellation, andStockRepurchase, andpriceinStockRepurchasenew_shares_authorizedin both adjustmentscost_basis,starting_share_number, andending_share_numberin issuances
nonce, timestamp (Unix seconds), and the TxCreated index aren’t scaled.
Ids
| Value | Solidity type | Offchain form |
|---|---|---|
| Issuer, stakeholder, stock class, security, and transaction ids | bytes16 | Dashed UUID strings. @tap/units converts them with uuidToBytes16 and bytes16ToUuid. |
| Wallets | address | Hex addresses |
Related: Stock Library and API Reference.