Inspiration

The Colony dApp has turned into a pretty big project, with many different moving parts. One of the ways we get data from the chain is via emitted contract events. We filter for the events we're interested in and then reduce them into some state that we can use. This works, but it's quite slow, especially for when a colony goes back many blocks.

Instead, we'd like to have some kind of caching layer which does this for us. That's where TheGraph can help - it provides exactly that, and in a decentralised way (eventually).

What it does

Events get mapped into a subgraph state. Then we can query with GraphQL.

How we built it

TheGraph

Challenges we ran into

Our contracts are upgradable, which means function signatures can change over time. We think one of our functions changing has caused a call listener to break, and we're not sure of a solution.

Accomplishments that we're proud of

It works!

What we learned

AssemblyScript (or the TS -> AS transpiler) is quite restrictive!

What's next for colonySubgraph

Support all the data that we would possibly want to derive from contract events. Then once that's done, combine it with OrbitDB data on the client side. At that point, we'd probably seek to switch out all our data stuff for a GQL client that can interact with this combined schema locally in the browser.

Built With

Share this project:

Updates