CropXYZ White Paper
Search…
⌃K

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.

Hosted Graph Service

We leverage The Graph (https://thegraph.com/) to create an aggregated look at the underlying Polygon blockchain.

Live API

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

Here are a set of sample requests that can be made to The Graph query layer. The majority of data
All of the smart contracts report their pause status and contract address.
{
gameStates(first: 20) {
id
address
isPaused
}
}
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
}
}
}
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
}
}
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
}
}
}
}
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
}
}
}