Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion website/src/pages/en/subgraphs/_meta.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ export default {
querying: titles.querying,
developing: titles.developing,
billing: '',
cookbook: titles.cookbook,
guides: 'How-to Guides',
'best-practices': titles['best-practices'],
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably add a redirect to /subgraphs/developing/creating/install-the-cli/#safe-subgraph-code-generator

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes! @benface Did we add an explanation of redirects in the contribution notes?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a mention of it here, but I don't know if I would call it an "explanation" haha. I didn't want to go too much in the technical weeds in the CONTRIBUTING guide since writing Nginx rewrite rules is a whole topic, but maybe we could link to these docs? It's also very much possible to create a redirect without understanding any of it by just copying & pasting another one and modifying it slightly, potentially with the help of AI.

This file was deleted.

3 changes: 2 additions & 1 deletion website/src/pages/en/subgraphs/developing/_meta-titles.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"creating": "Creating",
"deploying": "Deploying",
"publishing": "Publishing",
"managing": "Managing"
"managing": "Managing",
"guides": "How-to Guides"
}
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,31 @@ The ABI file(s) must match your contract(s). There are a few ways to obtain ABI
- If you are building your own project, you will likely have access to your most current ABIs.
- If you are building a Subgraph for a public project, you can download that project to your computer and get the ABI by using [`npx hardhat compile`](https://hardhat.org/hardhat-runner/docs/guides/compile-contracts#compiling-your-contracts) or using `solc` to compile.
- You can also find the ABI on [Etherscan](https://etherscan.io/), but this isn't always reliable, as the ABI that is uploaded there may be out of date. Make sure you have the right ABI, otherwise running your Subgraph will fail.

## Safe Subgraph Code Generator

[Subgraph Uncrashable](https://float-capital.github.io/float-subgraph-uncrashable/) is a code generation tool that generates a set of helper functions from the graphql schema of a project. It ensures that all interactions with entities in your Subgraph are completely safe and consistent.

### Why integrate with Subgraph Uncrashable?

- **Continuous Uptime**. Mishandled entities may cause Subgraphs to crash, which can be disruptive for projects that are dependent on The Graph. Set up helper functions to make your Subgraphs “uncrashable” and ensure business continuity.

- **Completely Safe**. Common problems seen in Subgraph development are issues of loading undefined entities, not setting or initializing all values of entities, and race conditions on loading and saving entities. Ensure all interactions with entities are completely atomic.

- **User Configurable** Set default values and configure the level of security checks that suits your individual project's needs. Warning logs are recorded indicating where there is a breach of Subgraph logic to help patch the issue to ensure data accuracy.

**Key Features**

- The code generation tool accommodates **all** Subgraph types and is configurable for users to set sane defaults on values. The code generation will use this config to generate helper functions that are to the users specification.

- The framework also includes a way (via the config file) to create custom, but safe, setter functions for groups of entity variables. This way it is impossible for the user to load/use a stale graph entity and it is also impossible to forget to save or set a variable that is required by the function.

- Warning logs are recorded as logs indicating where there is a breach of Subgraph logic to help patch the issue to ensure data accuracy.

Subgraph Uncrashable can be run as an optional flag using the Graph CLI codegen command.

```sh
graph codegen -u [options] [<subgraph-manifest>]
```

Visit the [Subgraph uncrashable documentation](https://float-capital.github.io/float-subgraph-uncrashable/docs/) or watch this [video tutorial](https://float-capital.github.io/float-subgraph-uncrashable/docs/tutorial) to learn more and to get started with developing safer Subgraphs.
Loading