# Castle Crush (Reward Share)

## Query On-chain data

We use The Graph's subgraph to index on-chain events. To obtain the Castle Crush subgraph URL reach out to the reNFT team directly. We shall not explore how to make GraphQL queries to the subgraph here. We will merely point out an important potential "gotcha". By default, the query will return at most `100` items in the return set. The maximum you can get is `1000`. To achieve this, you must add the `first: 1000` query variable and value in your query. For example,

<pre class="language-graphql"><code class="lang-graphql"><strong>query Query {
</strong>  rentings(first: 1000, orderBy: cursor, orderDirection: asc) {
    id
    cursor
    renterAddress
    rentDuration
    rentedAt
  }
}
</code></pre>

This is not all, however. If the full set of rentings exceeds `1000` items, we will miss all the other rentings. To remedy this, we must use `first` in conjunction with a where clause. For example,

```graphql
query Query {
  rentings(first: 1000, orderBy: cursor, orderDirection: asc, where: {cursor_gt: 1000}) {
    id
    renterAddress
    rentDuration
    rentedAt
  }
}
```

The above query will now pull the next `1000` items. Note that if there are more than `2000` items we are still in trouble. To pull the next `1000` you would use `first: 1000, where: {cursor_gt: 2000}.`

**PLEASE USE THIS TECHNIQUE ON EVERY QUERY YOU ARE MAKING TO THE SUBGRAPH (lendings, rentings, users).**


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.renft.io/developers/querying-renfts-on-chain-data/castle-crush-reward-share.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
