Skip to Content
Protocol SpecificationSolidity Cap Table

Solidity Cap Table

Each issuer gets its own CapTable contract, created through a CapTableFactory. The contract stores the issuer, stakeholders, stock classes, positions, and every stock transaction. The issuer’s wallet writes to it from the app, the server key can write to it through the API, and the event poller copies its events into MongoDB.

Roles

RoleHeld byCan
ADMIN_ROLEThe wallet that called createCapTable, usually the issuerGrant and revoke roles, adjust authorized shares, and do everything OPERATOR can
OPERATOR_ROLEOptional, such as a transfer agent’s server keyCreate stakeholders and stock classes, issue and change stock, and link wallets
Factory ownerThe wallet that deployed the factoryUpgrade the implementation for every cap table on that factory, with no rights inside any cap table

createCapTable is permissionless. It makes the caller ADMIN, grants OPERATOR to its operator argument unless that’s the zero address, and doesn’t make the caller the factory owner. Admins manage roles with addAdmin, removeAdmin, addOperator, and removeOperator. For how the roles map to local keys, see Three wallets and keys.

To check a role, pass the role’s hash and the wallet:

cast call <CAP_TABLE_ADDRESS> "hasRole(bytes32,address)(bool)" $(cast keccak ADMIN) <WALLET_ADDRESS> --rpc-url https://rpc.plume.org

Use $(cast keccak OPERATOR) for the operator role. The roles are keccak256("ADMIN") and keccak256("OPERATOR"), not OpenZeppelin’s default admin role.

Upgrades

ContractPattern
CapTableFactoryOwns one UpgradeableBeacon and creates the proxies.
CapTableThe implementation behind the beacon.
Each cap tableA BeaconProxy that reads the implementation from the beacon.

updateCapTableImplementation, which only the factory owner can call, moves every cap table on the factory to a new implementation in one transaction. To check a factory’s owner and implementation, see Verify the deployment.

Source files

Contract or libraryFilePurpose
CapTablechain/src/CapTable.solIssuer state, roles, and every write.
CapTableFactorychain/src/CapTableFactory.solCreates proxies and upgrades the beacon.
ICapTable, ICapTableFactorychain/src/interfaces/Interfaces, with the NatSpec docs.
Structschain/src/lib/Structs.solShared structs.
StockLibchain/src/lib/Stock.solStock issuance, transfer, and change logic.
TxHelperchain/src/lib/TxHelper.solTransaction payloads and the TxCreated event.
DeleteContextchain/src/lib/DeleteContext.solRemoves closed positions.
Adjustmentchain/src/lib/transactions/Adjustment.solAuthorized-share changes.
Last updated on