My hack uses The Graph protocol to create a subgraph of the MLB Champions ERC Token, MLBCB. MLB CHAMPIONS is a game that allows users to create collectable, non-fungible items based on their favorite MLB baseball players. Being a baseball fan, I was interested in questions like Which player has the most Collectables associated with them? Which collectable has been traded the most? Which player had the most ether spent for his collectables?
How It's Made
This project uses the graph protocol to index ethereum blockchain events associated with the non-fungible, ERC 721 token, MLBCB. First, I used the graph cli tool to generate a project based on the ethereum contract 0x8c9b261faef3b3c2e64ab5e58e04615f8c788099. Next, I created a graphql schema based on the data associated with the tokens, and to track various events like the creation of a token or a transfer of a token from one address to another. I also created some entities to track frequency of trades of a token and tokens associated with each player. Then created a mappings file which hooked into the events and populated the entities in the schema. Finally I wrote graphql queries to answer basic questions about the data.