Git Product home page Git Product logo

erc1155-subgraph's Introduction

Example Subgraph for erc1155

Run the example

  1. Start graph node

    • Change working directory to docker
    • Run the graph node docker-compose up
  2. Deploy smart contract

    truffle build
    truffle tests tests/mint-card-for-parser-test.js 
    
  3. Deploy subgraph

    Change the contract address in the file subgraph.yaml by the contract address from the preceded step.

    yarn codegen
    yarn create-local
    yarn deploy-local
    

Docker

The docker-compose includes many serivces for testing purpose:

  • The graph node: thegraph, ipfs, postgres, thegraph-graphql
  • ganache-cli run at port 8545
  • pgadmin run at port 5050

SQL

--- sgd3 is the schema name that could be changed automatically by thegraph

-- Transfer history of a address
select * 
from sgd3.transfer
where "to"='0xd4039eb67cbb36429ad9dd30187b94f6a5122215'
OR "from"='0xd4039eb67cbb36429ad9dd30187b94f6a5122215'

-- Owner count of cards
select card_id, count(*)
from sgd3.card_owner
group by card_id

-- Balance of an address
select * 
from sgd3.card_owner
where "owner" = '0xd5cc383881d6d9a7dc1891a0235e11d03cb992d3'
order by card_id

erc1155-subgraph's People

Contributors

quocphu avatar

Watchers

James Cloos avatar  avatar  avatar

Forkers

murall-art

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.