Skip to content

Commit

Permalink
Merge pull request #90 from bobanetwork/wsdt/subgraph
Browse files Browse the repository at this point in the history
feat: Adding Light-Bridge GoldSky subgraphs
  • Loading branch information
wsdt committed Feb 16, 2024
2 parents 77d4417 + 21bf7e7 commit 9ab9e40
Show file tree
Hide file tree
Showing 12 changed files with 4,230 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,6 @@ crytic-export

# ignore yarn.lock
boba-community/*/yarn.lock

# local data
packages/boba/subgraphs/local/data
58 changes: 58 additions & 0 deletions packages/boba/subgraphs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Goldsky subgraphs
Subgraphs have been migrated to Goldsky, more contracts may follow (we may need to evaluate which subgraphs are still needed).
For old subgraphs please refer to the [legacy repository](https://github.com/bobanetwork/boba/tree/develop/packages/boba/subgraph).

## Install GoldSky
`curl https://goldsky.com | sh`

or refer to the official documentation: https://docs.goldsky.com/introduction

Hint: You can also directly migrate your already deployed subgraphs from The Graph to GoldSky.

## Configuration
With GoldSky you only need to add your ABI into the `./abi` folder and create a configuration file (refer to `lightbridge.json`).

Here is also some official [GoldSky documentation](https://docs.goldsky.com/subgraphs/introduction).

To deploy your subgraphs execute:
`goldsky subgraph deploy {NAME_OF_SUBGRAPH}/v{VERSION} --from-abi ./{YOUR_CONFIG_JSON}.json`

Here is an example:
`goldsky subgraph deploy light-bridge/v1 --from-abi ./lightbridge.json`

## API / Account
We already have a GoldSky account. As of 18. Dec 23 following people have already access that you can reach out to for access:
- Boyuan
- Souradeep
- Kevin

## Online dashboard
You can view your subgraphs [here](https://app.goldsky.com/dashboard/subgraphs).
This dashboard also gives you access to your subgraphs directly, so that you can test out queries.

## Queries
GoldSky already generates GraphQL types for, that you can use in your queries (which make your querying much more powerful and easier).

An example:

```graphql
query Teleportation($wallet: String!, $sourceChainId: BigInt!) {
assetReceiveds(
where: {and: [{emitter_contains_nocase: $wallet}, { sourceChainId: $sourceChainId }]}
) {
token
sourceChainId
toChainId
depositId
emitter
amount
block_number
timestamp_
transactionHash_
}
}
```

- `emitter_contains_nocase` is a non-standard operation, most GraphQL providers don't support case insensitive querying.
- `block_number`, `timestamp_`, `transactionHash_` and many others are indexed/queryable as well, despite not being part of the on-chain event.

Loading

0 comments on commit 9ab9e40

Please sign in to comment.