|
| 1 | + |
| 2 | + |
| 3 | +# Polymath.js |
| 4 | + |
| 5 | +Polymath.js is the main library for interacting with Polymath's smart contracts on the client side. It is written in javascript using flow, babel and eslint. The documentation is automatically generated using documentationjs. Checkout the [docs](https://docs.polymath.network) |
| 6 | + |
| 7 | +## Developement Testing on local machine with truffle and mocha |
| 8 | + |
| 9 | +For testing polymathjs source code, clone this repo, then run the following commands. This will set up the environment to run tests on the polymath.js library functionality. |
| 10 | + |
| 11 | +- `yarn prepack`to compile the javascript down to vanilla javascript |
| 12 | +- `yarn testrpc` (keep this terminal running) |
| 13 | + |
| 14 | +In a new terminal |
| 15 | +- `yarn compile` to compile the contracts and create truffle artifacts |
| 16 | +- `yarn migrate-testrpc` to migrate the contracts onto your testrpc |
| 17 | +- `yarn start `(babel compiling) (keep this terminal running) |
| 18 | + |
| 19 | +In a new terminal |
| 20 | +- `yarn test` to test all files |
| 21 | +- `yarn mocha lib/test/{FILENAME.js}` to test a single file |
| 22 | + |
| 23 | +Note: If make changes to source files being compiled by babel, run `yarn clean` to remove the old compiled babel files, and then run `yarn start` to get an updated version with the new code. |
| 24 | + |
| 25 | +## Updating the polymath core contracts into polymath.js |
| 26 | + |
| 27 | +This should only be done when the npm module is ready to be upgraded to a new version of polymath core on the mainnet. The new contracts should be pulled into polymathjs repo, and then worked on in a branch. Once it is known that polymathjs is correctly working on new core contracts, the npm module can be published to reflect this. |
| 28 | + |
| 29 | +The following occurs: |
| 30 | +- Checks that polymath-core is on the master branch |
| 31 | +- Executes git pull on the polymath-core |
| 32 | +- Copies the polymath-core/contract directory into polymath-js directory |
| 33 | +- Removes the polymath-js/build directory |
| 34 | + |
| 35 | +In polymath-js |
| 36 | +- `yarn contracts` |
| 37 | + |
| 38 | +Note: Ensure you have the following file structure |
| 39 | +``` |
| 40 | +- polymath (root dir name doesn't matter) |
| 41 | +|-- polymath-js |
| 42 | +|-- polymath-core |
| 43 | +``` |
| 44 | + |
| 45 | +## Serving and building documentation |
| 46 | + |
| 47 | +The documentation should be built when the npm module is updated. When you build the docs, the build folder will update, and this repo is connected to netlify which will automatically serve the new documentation to https://docs.polymath.network. So building should only be done when the npm package is ready to upgrade, so that they are in sync. |
| 48 | + |
| 49 | +To serve the docs locally, run: |
| 50 | + |
| 51 | +- `yarn install` |
| 52 | +- `yarn start` to run babel to compile the source code and have it watching for updates (leave this terminal open) |
| 53 | +- `yarn serve-poly-docs` |
| 54 | + |
| 55 | +To build the docs run `yarn build-poly-docs`. Make sure when you make edits, you rebuild the docs so they are added in! |
| 56 | + |
| 57 | +## Contributing |
| 58 | + |
| 59 | +We're always looking for developers to join the polymath network. To do so we |
| 60 | +encourage developers to contribute by creating Security Token Offering contracts |
| 61 | +(STO) which can be used by issuers to raise funds. If your contract is used, you |
| 62 | +can earn POLY fees directly through the contract, and additional bonuses through |
| 63 | +the Polymath reserve fund. |
| 64 | + |
| 65 | +If you would like to apply directly to our STO contract development team, please |
| 66 | +send your resume and/or portfolio to [email protected]. |
| 67 | + |
| 68 | +### Styleguide |
| 69 | + |
| 70 | +The polymath-core repo follows the style guide overviewed here: |
| 71 | +http://solidity.readthedocs.io/en/develop/style-guide.html |
| 72 | + |
| 73 | +[polymath]: https://polymath.network |
| 74 | +[ethereum]: https://www.ethereum.org/ |
| 75 | +[solidity]: https://solidity.readthedocs.io/en/develop/ |
| 76 | +[truffle]: http://truffleframework.com/ |
| 77 | +[testrpc]: https://github.com/ethereumjs/testrpc |
0 commit comments