/sablier-subgraph

GraphQL server built with The Graph

Primary LanguageTypeScriptGNU General Public License v3.0GPL-3.0

Sablier Subgraph

The Graph is a tool that helps dapps index their blockchain data so that users don't have to wait hours or more for the website to load.

This is our subgraph, a collection of schemas and event handlers that parse the data broadcast on the Ethereum blockchain to GraphQL form.

Our smart contracts can be found in the Sablier monorepo.

Contributing

Before you can build, create and deploy this subgraph, you have to execute the following commands in the terminal:

$ yarn
$ yarn prepare:mainnet

The first command installs all external dependencies, while the latter generates the subgraph.yaml file, which is required by The Graph.

We use Handlebars to compile a template subgraph and add the parameters specific to each network (Mainnet, Goerli, Kovan, Rinkeby, Ropsten). The network can be changed via the NETWORK_NAME environment variable or directly by choosing a different "prepare" script. See package.json for all options.

Queries

Querying All Streams

{
  streams {
    id
    cancellation {
      recipientBalance
      recipientInterest
      timestamp
      txhash
    }
    deposit
    exchangeRateInitial
    ratePerSecond
    recipient
    recipientSharePercentage
    sender
    senderSharePercentage
    startTime
    stopTime
    timestamp
    token {
      id
      decimals
      name
      symbol
    }
    txs {
      id
      block
      event
      from
      timestamp
      to
    }
    withdrawals {
      id
      amount
    }
  }
}

Querying All Transactions

{
  transactions {
    id
    block
    event
    from
    stream {
      id
    }
    timestamp
    to
  }
}