Gotchiverse Subgraph

The subgraph for the Gotchiverse

Introduction

This subgraph provides all the information you need for the gotchiverse: Events, Parcels, Gotchis, Installations, Tiles and more.

Watch out! The subgraph is a WIP and things might change over time. Please follow the #subgraphs channel at the Aavegotchi Discord!

The endpoint is: https://api.thegraph.com/subgraphs/name/aavegotchi/gotchiverse-matic

The Playground can be found HERE.

Schema

The schema consists out of basically three different kinds of entities: Events, State and Stats. We have for each event emitted on chain a Event entitiy on the subgraph whichs logs all the data. Such as Transfer events, Mint Parcel events or EquipTile events. The State holds the latest state of the Parcels, Gotchis, Installations and Tiles. Finally the Stats hold information about the Gotchiverse, the user, the parcels and gotchis.

You can find at the Playground or in the github repo the entire Schema: https://github.com/aavegotchi/gotchiverse-subgraph/blob/main/schema.graphql

Examples

In this section we provide some example queries which should help you to get first ideas of what to fetch from the graph and how to do it. You can insert all events on the Playground and get the results. If you need help on how to integrate those queries in your app please take a look into the General Section.

Events

You can query the subgraph for almost every event happened on chain. From transfers, to equip / unequip of installations and tiles also to parcel access rights and more.

{
  transferFromUser: transferEvents(where: {from:"0xa97946357a1f6c251b9d257833ab0233ed863527"}) {
    from
    to
    tokenId
  }
  
  transferToUser: transferEvents(where: {to:"0xa97946357a1f6c251b9d257833ab0233ed863527"}) {
    from
    to
    tokenId
  }
  
  upgradeFinalizedEvents(where: {parcel: "23596"}) {
    installation {
      name
    }
  }
}

Gotchis and Parcels

We store a lot of information about the Parcles, but very less for Gotchis, because the core matic subgraph already maintains the gotchi information. We store for both entity types the last channeled alchemica attribute. For the parcels we also store the size, the coordinates, the alchemica boost and the equipped tiles and installations.

{
  gotchis(where: {id_in: ["4430", "20695"]}) {
    id
    lastChanneledAlchemica
  }
  parcels(where: {owner: "0x1AD3d72e54Fb0eB46e87F82f77B284FC8a66b16C"}) {
    equippedInstallations {
      name
      level
    }
    equippedTiles {
      name
      uri
    }
    lastChanneledAlchemica
    fudBoost
    fomoBoost
    alphaBoost
    kekBoost
    size
    coordinateX
    coordinateY
  }
}

Installation Types and Tile Types

You can query all the possible Installation and Tiles types with their pre requisites and alchemica costs.

{
  tileTypes {
    width
    height
    deprecated
    craftTime
    alchemicaCost
    name
    amount
    uri
  }
  
  installationTypes {
    width
    height
    level
    alchemicaType
    spillRadius
    spillRate
    prerequisites
    amountPrerequisites
    name
    amount
    uri
    harvestRate
    alchemicaCost
    deprecated
    craftTime
    upgradeQueueBoost
  }
}

Stats

We store some stats for the entire gotchisverse, but also for users, parcel and gotchis.

{
  overallStats: stat(id:"overall") {
    alchemicaSpendOnTiles
    alchemicaSpendOnUpgrades
    alchemicaSpendTotal
    alchemicaClaimedTotal
    tilesEquippedCurrent
    installationsEquippedCurrent
    alchemicaSpendOnInstallations
    alchemicaSpendOnUpgrades
    alchemicaSpendOnTiles
    alchemicaSpendTotal
    tilesMinted
  }
  
  userStats:stat(id:"user-0x1ad3d72e54fb0eb46e87f82f77b284fc8a66b16c") {
    alchemicaSpendTotal
    tilesMinted
    installationsMintedTotal
    installationsUpgradedTotal
    alchemicaSpendTotal
    alchemicaSpendOnUpgrades
    alchemicaSpendOnInstallations
  }
  
  parcelStats:stat(id:"parcel-23596") {
    installationsEquippedTotal
    installationsEquippedCurrent
    alchemicaChanneledTotal
  }
}

Last updated