This repository contains Acre staking subgraphs. Subgraphs are open APIs to query data from networks like Ethereum and IPFS. The data is indexed by The Graph decentralized protocol.
By the moment, there one subgraph has been developed:
- sepolia: collects the data from contracts in Sepolia Testnet.
-
Install the Graph CLI in your computer:
yarn global add @graphprotocol/graph-cli
-
Once graph-cli is installed in your system, install dependencies, linting and formatting tools:
pnpm install
-
Build the subgraph:
pnpm codegen:sepolia && pnpm build:sepolia
In order to index a network, Graph Node needs access to a network client via an EVM-compatible JSON-RPC API. You can use Thesis private RPC from Alchemy or create a private one here.
-
Install Docker on your local machine:
-
Set the API key in the
docker-compose.yaml
file. Note that the provided RPC URL should support thetrace_filter
method because the Acre subgraph defines the contract's function call handler. Eg. Alchemy does not support it in a free plan - it requires at leastgrowth
paid plan.ethereum: "sepolia:https://eth-sepolia.g.alchemy.com/v2/<API key>"
-
Run a local Graph Node:
docker-compose up
-
Allocate the subgraph name in the local Graph Node:
pnpm create:local
Note: use it only if your subgraph is not created in the local Graph node.
-
Deploy the subgraph to your local Graph Node:
pnpm deploy:local
-
Create Subgraph queries and preview of the entities:
http://localhost:8000/subgraphs/name/acre-subgraph
-
Go to Subgraph Studio. Connect wallet to use the Subgraph Studio using Metamask, WalletConnect, Coinbase Wallet or Safe. Use a dedicated account for the Acre team.
-
Once the account is connected, all subgraphs are available in the My Dashboard tab. Select the correct subgraph.
-
Before being able to deploy subgraph to the Subgraph Studio, you need to login into your account within the CLI.
graph auth --studio <DEPLOY KEY>
The
<DEPLOY_KEY>
can be found on "My Subgraphs" page or subgraph details page. -
Build the subgraph for a given network:
pnpm codegen:mainnet && pnpm build:mainnet
or
pnpm codegen:sepolia && pnpm build:sepolia
-
Deploying a Subgraph to Subgraph Studio
pnpm deploy:mainnet
or
pnpm deploy:sepolia
After running this command, the CLI will ask for a version label, you can name it however you want, you can use labels such as 0.1 and 0.2 or use letters as well such as uniswap-v2-0.1.
If you have any problems, take a look here.
Subgraphs can be published to the decentralized network directly from the Subgraph Studio dashboard.
-
Select the correct subgraph from the Subgraph Studio.
-
Click the "Publish" button
-
While you’re going through your publishing flow, you’ll be able to push to either Arbitrum One or Arbitrum Sepolia.
- Publishing to Arbitrum Sepolia is free. This will allow you to see how the subgraph will work in the Graph Explorer and will allow you to test curation elements. This is recommended for testing purposes only.
-
During the publication flow, it is possible to add signal to your subgraph. This is not a required step and you can add GRT signal to a published subgraph from the Graph Explorer later.
- Adding signal to a subgraph which is not eligible for rewards will not attract additional Indexers. More info here.
-
Click the "Publish new Subgraph" button. Once a subgraph is published, it will be available to view in the Graph Explorer.
If you have any problems, take a look here.