Skip to Content
Protocol SpecificationStructs Library

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

StructFields
Issuerid, legal_name, shares_issued, shares_authorized
StockClassid, class_type, price_per_share, shares_issued, shares_authorized
Stakeholderid, stakeholder_type, current_relationship
StockLegendTemplateid

class_type, stakeholder_type, and current_relationship are OCF strings that the contract doesn’t validate.

Positions

StructFields
ActivePositionstock_class_id, quantity, share_price, timestamp
ActivePositionsactivePositions[stakeholder_id][security_id]
SecIdsStockClassactiveSecurityIdsByStockClass[stakeholder_id][stock_class_id]

Seeding

StructFields
IssuerInitialSharesshares_authorized, shares_issued
StockClassInitialSharesid, shares_authorized, shares_issued
InitialSharesissuerInitialShares, stockClassesInitialShares

Function inputs

StructUsed byFields
StockIssuanceParamsissueStockstock_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
ShareNumbersIssuedStockIssuanceParamsstarting_share_number, ending_share_number
StockTransferParamstransferStocktransferor_stakeholder_id, transferee_stakeholder_id, stock_class_id, is_buyer_verified, quantity, share_price, nonce, custom_id
StockParamsCancel, retract, reissue, repurchasestakeholder_id, stock_class_id, security_id, comments, reason_text
StockParamsQuantityCancel and repurchase, internallynonce, 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.

Structobject_typeFields
StockIssuanceTX_STOCK_ISSUANCEid, security_id, params (a StockIssuanceParams)
StockTransferTX_STOCK_TRANSFERid, quantity, security_id, balance_security_id, resulting_security_ids
StockCancellationTX_STOCK_CANCELLATIONid, quantity, security_id, reason_text, balance_security_id
StockRetractionTX_STOCK_RETRACTIONid, security_id, reason_text
StockReissuanceTX_STOCK_REISSUANCEid, security_id, resulting_security_ids, reason_text; split_transaction_id is always zero
StockRepurchaseTX_STOCK_REPURCHASEid, security_id, quantity, price, balance_security_id, and consideration_text, which the contract fills from the call’s reason_text
StockAcceptanceTX_STOCK_ACCEPTANCEid, security_id
IssuerAuthorizedSharesAdjustmentTX_ISSUER_AUTHORIZED_SHARES_ADJUSTMENTid, new_shares_authorized, approval dates
StockClassAuthorizedSharesAdjustmentTX_STOCK_CLASS_AUTHORIZED_SHARES_ADJUSTMENTid, 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_issued and shares_authorized, in Issuer, StockClass, and the seeding structs
  • price_per_share in StockClass
  • quantity and share_price in ActivePosition, StockIssuanceParams, and StockTransferParams
  • quantity in StockParamsQuantity, StockTransfer, StockCancellation, and StockRepurchase, and price in StockRepurchase
  • new_shares_authorized in both adjustments
  • cost_basis, starting_share_number, and ending_share_number in issuances

nonce, timestamp (Unix seconds), and the TxCreated index aren’t scaled.

Ids

ValueSolidity typeOffchain form
Issuer, stakeholder, stock class, security, and transaction idsbytes16Dashed UUID strings. @tap/units converts them with uuidToBytes16 and bytes16ToUuid.
WalletsaddressHex addresses

Related: Stock Library and API Reference.

Last updated on