Read official docs at https://docs.transferagentprotocol.xyz to get started.
This repo is based on the Open Cap Table Coalition standard, with the license included in its entirety.
We welcome all contributions. Please give a quick read to our CONTRIBUTING guidelines to understand the them and the process.
This project is licensed under the MIT License - see the LICENSE file for details.
After the deployment script is completed, start the server with nodemon:
yarn dev
Inspect the database with Mongo Compass. To connect to it, use the same string that we provided in the .env
file:
mongodb://tap:tap@localhost:27017/mongo?authSource=admin&retryWrites=true&w=majority
There are two ways of seeding the cap table:
We provide sample data to test deploying the cap table onchain. You can inspect and change it in /src/db/samples/notPoet, which contains Manifest.ocf.json file with Poet's actual cap table, and some partial data in primary objects (stakeholders, stock classes, vesting terms, valuation, etc).
You can change it to your own startup if you want to test it.
To seed the database, you'll need to
- Run Postman
- Run
yarn export-manifest
which will zip the sample manifest file inside of /samples and save it to your /Downloads directory. - POST that ZIP file to the
http://localhost:8080/mint-cap-table
route in Postman as a form-data request with that file attached.
This operation will perform several checks. If everything is in order, it will deploy the cap table onchain, and seed the database with the sample data.
- Check if the cap table is already deployed onchain. If it is, it will return an error
- Validate schema against OCF. If it isn't, it will return an error
- Check if the cap table is already in the database. If it is, it will return an error
- Mint the cap table onchain if all checks pass, then save it to the Mongo DB instance.
In development and testing, you will need to deseed the database before you can seed it again. To do that, run:
yarn deseed
In another terminal (ensuring you’re in the root directory) run node src/scripts/testMintingCapTable.js.
If you navigate to /scripts
directory, you’ll be able to interact with the sample data.
We're shipping code fast. If you run into an issue, particularly one that results in an onchain error of "could not estimate gas", it's likely that the forge build cache is out of sync.
Inside of /chain
:
- Restart anvil
- Run
forge clean
- Move back to the root directory, then run
yarn deploy-libraries
After, you can seed and deploy the cap table with either of the above options. If the bug persists, please open an issue with an attached screenshot and steps to reproduce.
Run all smart contracts tests
yarn test
Run all javascript unit tests with jest
yarn test-js
Deploy a cap table to local anvil server through a local web2 server. The chain event listener is also run to ensure the events are properly mirrored into the mongo database. NOTE: running this deletes your local mongo collections first
yarn test-js-integration
Integration test setup from no active processes:
- Terminal 1:
docker compose up
- Terminal 2:
anvil
- Terminal 3:
cd chain && forge script script/CapTableFactory.s.sol --fork-url http://localhost:8545 --broadcast
- In MongoDB compass, create/update
implementation_address
andfactory_address
injest-integration.factories
- If the
jest-integration
MongoDB databases dont exist:cd .. && yarn test-js-integration
- If the
- Run
yarn test-js-integration
!
- In MongoDB compass, create/update