DAOhaus uses higher-order functions to make calls on contracts instead of JS classes. The goal of this pattern is to minimize state within the app as managing state between the contract, React's contexts, and JS classes (previously used for contract interaction) was challenging and sometimes difficult to follow.
Each contract will usually curry three function calls from a service.
- Instantion of a web3.js contract object
- Selection of service (function) on contract
- Pass in args for handling post-process. This final call will execute the TX (except in the case of PollService).
Here are the various services used throughout the app.