CropXYZ White Paper
  • 🧑‍🌾Welcome to your farm!
  • 🔖Table of Contents
  • đŸ•šī¸Get Started
    • Gameplay in a Nutshell
    • Plant Basics
    • Farmer Starter Packs
    • Roadmap
  • 🌾The Farm
    • đŸĨœBean Garden
      • Black Beans
      • Chickpeas
      • Green Peas
      • Kidney Beans
      • Pinto Beans
    • 🍓Berry Bush
      • Blackberries
      • Blueberries
      • Goji Berries
      • Raspberries
      • Strawberries
    • 🌹Flower Bed
      • Daisies
      • Hops
      • Lilies
      • Roses
      • Sunflowers
    • 🍇Fruit Vine
      • Cantaloupe
      • Grapes
      • Pumpkins
      • Tomatoes
      • Watermelon
    • đŸŒŊGrain Field
      • Corn
      • Oats
      • Wheat
      • Wild Rice
  • đŸ› ī¸The Technology
    • System Overview
    • Blockchain Layer
    • Query Layer
    • Anatomy of a Plot
    • Plot Yield
  • đŸĒ™The Economy
    • Tokenomics
    • Pricing Modeling
    • Transaction Fee
    • Alpha Liquidity Pools
    • zGOLD Distribution
  • 🎊Extras
    • Releases
Powered by GitBook
On this page
  • Indexing Service
  • Sample Requests
  1. The Technology

Query Layer

Behind the scenes, there is an extensive query layer that makes it easier for the front-end to pull the data it needs.

PreviousBlockchain LayerNextAnatomy of a Plot

Last updated 1 year ago

Indexing Service

We leverage Airstack () to create an aggregated look at the underlying Polygon blockchain.

Just so you know: This API is exposed to anyone who wants to build apps or visuals using the CropXYZ data can pull aggregated on-chain data.

Sample Requests

For the initial launch, we used The Graph so here are a set of sample requests that can be made to The Graph query layer. This is more for demonstrative purposes because this entire logic wil be from Airstack in this relaunch.

Overall Game State

All of the smart contracts report their pause status and contract address.

{
  gameStates(first: 20) {
    id
    address
    isPaused
  }
}

Query Link:

Crops Details

This requests pulls the basic details of all crops as well as the time it takes to grow these crops.

{
  crops {
    elementName
    addressMapping {
      tokenAddress
    }
    plotType {
      name
    }
    growthTimeTable {
      deltaNothingToStart
      deltaStartToEarly
      deltaEarlyToMature
      deltaMatureToExpire
    }
  }
}

Query Link:

Plots

This request pulls the base details about the plots, also it pulls the planted crop (if one has been planted).

{
    plots(first: 1000, skip: 0) {
      id
      width
      height
      tileArea
      baseSpeed
      baseYield
      countClears
      countHarvests
      countDeathClears
      baseYield
      yieldConfig {
        minYield
        maxYield
      }
      stakedCrop {
        id
        elementName
        addressMapping {
          addressName
          tokenAddress
        }
      }
      plotType {
        id
        name
      }
      amountStaked
      timeStartStaked
      timeReadyDelta
      timeExpiredDelta
    }
}

Query Link:

Plot Actions

The plot actions are the different plots, harvests and clear actions players take on their plot.

{
  plotActions(first: 1000, skip: 0) {
    id
    timestamp
    blockIndex
    playerAddress
    amount
    actionType
    plot {
      id
    }
    currentCrop {
      elementName
      addressMapping {
        tokenAddress
      }
    }
    newCrop {
      elementName
      addressMapping {
        tokenAddress
      }
    }
  }
}

Query Link:

Transactions

Each transaction is broken up into the seeds or gold flowing "in" to the economic layer and how much gold or seed flows "out" of the economic layer.

{
  transactionFlows(first: 1000, skip: 0) {
    timestamp
    blockIndex
    playerAddress
    isGoldInbound
    flowIn {
      tokenAddress
      tokenAmount
    }
    flowOut {
      tokenAddress
      tokenAmount
    }
  }
}

Query Link:

https://www.airstack.xyz/
https://thegraph.com/hosted-service/subgraph/cropxyz/cropxyz-metaverse?query=Game%20State
https://thegraph.com/hosted-service/subgraph/cropxyz/cropxyz-metaverse?query=Crops
https://thegraph.com/hosted-service/subgraph/cropxyz/cropxyz-metaverse?query=Plots
https://thegraph.com/hosted-service/subgraph/cropxyz/cropxyz-metaverse?query=Plot%20Actions
https://thegraph.com/hosted-service/subgraph/cropxyz/cropxyz-metaverse?query=Game%20State
đŸ› ī¸
Page cover image