npm i
npm run start
npm run test
npm run stop
- This test uses a simple DAO protocol, read more here.
- The subgraph is setup to only track the
DAONetwork
contract. - The mapping for
DAONetwork
adds the Avatar as a Datasource Template. - When a new DAO is added to the
DAONetwork
(line #106), the subgraph starts tracking the newAvatar
contract (line #24). - Now that the subgraph is tracking the new
Avatar
contract, events that're emitted from it will be passed through theAvatar
mapping. - We test to verify this works by:
- Deploying a new DAO under the name "foo".
- Adding it to the
DAONetwork
(which creates the datasource template). - Set the
Avatar
's name to "bar". - Verify the subgraph is updated properly.
See test code here.