-
Notifications
You must be signed in to change notification settings - Fork 8
Description
Organization and UtilityToken contracts are used in more than one repositories.
All repositories have its own implementations, so
- Its code duplication
- It is difficult to maintain code across the repositories.
Following are the items that we are trying to achieve in this epic
1. The code will be moved to a new repository.
openst/organization-contractsalready exists.- A new repository will be created for utility token contracts.
2. These repositories should include the contract interacts
These repositories should auto-generate the contract interact code from the ABI JSON files.
Contract interacts creation in type-script has a lot of boilerplate code and its time consuming to maintain it manually. It will be helpful to consume APIs with proper typed parameters.
So for the creation of contract interacts the proposal will be as follows
- Do research on ABI to typescript generators
- Analyze if we can use any one of the existing generators that best fit our requirements, or we need to manually write the code.
- Analyze if the unit tests are needed.
Few example of generators are given below (You may add more)
- Typechain (this looks interesting)
- Soltsice.
- @0xproject/abi-gen. (this looks interesting)
- Go-ethereum has a CLI tool called abigen -> Go/Java/Objective-C wrapper. (Just for reference)
3. Publish NPM package
While publishing the NPM package
- The contract interacts should be autogenerated before publishing and should be exported.
4. Use git submodule to use the contracts in the dependent repository
- OpenST/openst-contracts
- OpenST/mosaic-contracts
- OpenST/brandedtoken-contracts
5. Update dependent repositories to use published NPM module.