Giter VIP home page Giter VIP logo

open-captable-protocol's Introduction

Documentation

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.

Contributing

We welcome all contributions. Please give a quick read to our CONTRIBUTING guidelines to understand the them and the process.

License

This project is licensed under the MIT License - see the LICENSE file for details.

OUTDATED README BELOW


Running the cap table server

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

Seeding and deploying the cap table with sample data

There are two ways of seeding the cap table:

Using the manifest file

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

  1. Run Postman
  2. Run yarn export-manifest which will zip the sample manifest file inside of /samples and save it to your /Downloads directory.
  3. 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.

  1. Check if the cap table is already deployed onchain. If it is, it will return an error
  2. Validate schema against OCF. If it isn't, it will return an error
  3. Check if the cap table is already in the database. If it is, it will return an error
  4. 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

Using sample scripts that call our APIs

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.

Debugging Steps

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.

Testing Web3

Run all smart contracts tests

yarn test

Testing Web2

Unit tests

Run all javascript unit tests with jest

yarn test-js

Integration tests

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 and factory_address in jest-integration.factories
      • If the jest-integration MongoDB databases dont exist: cd .. && yarn test-js-integration
    • Run yarn test-js-integration!

open-captable-protocol's People

Contributors

victormimo avatar thatalexpalmer avatar adammomen avatar kentkolze avatar apfong avatar thibauld avatar kentplural avatar

Watchers

 avatar

Forkers

fairmint

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.