Skip to content

Commit

Permalink
taking commits from dev to main (#684)
Browse files Browse the repository at this point in the history
* Merge main into dev (#665)

* Core Devs Call Notes April 18, 2024 (#660)

* Add files via upload

* new bridges draft - 1

* change bridge architecture

* bridges section update

* updated legacy links for bridges

* dev links updated

* links for bridges

* screenshots

* bridges ss

* fix(bridges): typo

* Core Devs Call April 3, 2024 (#654)

* fix: using datadir instead of validator-dir (#647)

* node structure and updates (#648)

* metadata test

* thumbnail

* thumbnail

* thumbnail fix

* thumbnail fix

* added image for metadata

* added image for metadata

* added image for metadata

* added image for metadata

* added image for metadata

* added image for metadata

* minor fixes

* Solve conflicts

* Add files via upload

* Update README.md

updated and edited some part

* Update depositWithdrawalReward.md

* Update generalQuestions.md

* hard-fork info

* governance summary added

* fixing validator section

* config for redirects

* fixed node structure

* Update _category_.json

---------

Co-authored-by: Giacomo Licari <[email protected]>
Co-authored-by: Armagan Ercan <[email protected]>

* Add files via upload (#650)

* Bridge UI related changes for docs (#652)

* Add files via upload

* new bridges draft - 1

* change bridge architecture

* bridges section update

* updated legacy links for bridges

* dev links updated

* links for bridges

* screenshots

* bridges ss

---------

Co-authored-by: Vanshika

---------

Co-authored-by: cgi-bin/ <[email protected]>
Co-authored-by: Vanshika Srivastava <[email protected]>
Co-authored-by: Giacomo Licari <[email protected]>
Co-authored-by: zengzengzenghuy <[email protected]>

* Add files via upload

* added new provider for data indexing, some minor link changes

* fixed redirect for media kit

* added zerodev segment

* resolve configuration error

* Add CI for manual deployments to production, rename deploy.yml to dev_deploy.yml which handles deploys to dev/staging only (#658)

Co-authored-by: Giacomo Licari <[email protected]>

* Add slack_release_notifications.yml (#659)

Co-authored-by: Giacomo Licari <[email protected]>

* Add files via upload

* Update authors.yml

* fix: build error

* bridge: add governance proposal (unlocked EURe due to bridge UI issue)

* Added RPC nodes to moralis section (#662)

---------

Co-authored-by: Vanshika <[email protected]>
Co-authored-by: zengzengzenghuy <[email protected]>
Co-authored-by: cgi-bin/ <[email protected]>
Co-authored-by: Giacomo Licari <[email protected]>
Co-authored-by: giacomognosis <[email protected]>
Co-authored-by: Giacomo Licari <[email protected]>
Co-authored-by: Filip Martinsson <[email protected]>

* Added RPC nodes to moralis section (#662) (#664)

* Add files via upload

* new bridges draft - 1

* change bridge architecture

* bridges section update

* updated legacy links for bridges

* dev links updated

* links for bridges

* screenshots

* bridges ss

* fix(bridges): typo

* Core Devs Call April 3, 2024 (#654)

* fix: using datadir instead of validator-dir (#647)

* node structure and updates (#648)

* metadata test

* thumbnail

* thumbnail

* thumbnail fix

* thumbnail fix

* added image for metadata

* added image for metadata

* added image for metadata

* added image for metadata

* added image for metadata

* added image for metadata

* minor fixes

* Solve conflicts

* Add files via upload

* Update README.md

updated and edited some part

* Update depositWithdrawalReward.md

* Update generalQuestions.md

* hard-fork info

* governance summary added

* fixing validator section

* config for redirects

* fixed node structure

* Update _category_.json

---------

Co-authored-by: Giacomo Licari <[email protected]>
Co-authored-by: Armagan Ercan <[email protected]>

* Add files via upload (#650)

* Bridge UI related changes for docs (#652)

* Add files via upload

* new bridges draft - 1

* change bridge architecture

* bridges section update

* updated legacy links for bridges

* dev links updated

* links for bridges

* screenshots

* bridges ss

---------

Co-authored-by: Vanshika

---------

Co-authored-by: cgi-bin/ <[email protected]>
Co-authored-by: Vanshika Srivastava <[email protected]>
Co-authored-by: Giacomo Licari <[email protected]>
Co-authored-by: zengzengzenghuy <[email protected]>

* Add files via upload

* added new provider for data indexing, some minor link changes

* fixed redirect for media kit

* added zerodev segment

* resolve configuration error

* Add CI for manual deployments to production, rename deploy.yml to dev_deploy.yml which handles deploys to dev/staging only (#658)

Co-authored-by: Giacomo Licari <[email protected]>

* Add slack_release_notifications.yml (#659)

Co-authored-by: Giacomo Licari <[email protected]>

* Add files via upload

* Update authors.yml

* fix: build error

* bridge: add governance proposal (unlocked EURe due to bridge UI issue)

* Added RPC nodes to moralis section (#662)

---------

Co-authored-by: Armagan Ercan <[email protected]>
Co-authored-by: zengzengzenghuy <[email protected]>
Co-authored-by: cgi-bin/ <[email protected]>
Co-authored-by: Giacomo Licari <[email protected]>
Co-authored-by: giacomognosis <[email protected]>
Co-authored-by: Giacomo Licari <[email protected]>
Co-authored-by: Filip Martinsson <[email protected]>

* CI: fix tag regex

* CI: fix tag name in tag release

* CI: fix missing permissions

---------

Co-authored-by: Armagan Ercan <[email protected]>
Co-authored-by: Vanshika <[email protected]>
Co-authored-by: zengzengzenghuy <[email protected]>
Co-authored-by: cgi-bin/ <[email protected]>
Co-authored-by: Giacomo Licari <[email protected]>
Co-authored-by: Filip Martinsson <[email protected]>

* Update README, add instructions on deployments to production (#667)

* Core Devs Call April 24, 2024

* chore: update hardforks info (#668)

* chore: update clients versions

* chore: add dancun hardfork hashes

* chore: add shapella schedule table

* small fix

* grammar fixes

* Add files via upload

* Update README.md

updated cover image

* fix for developer broken page link

* chore: update bridges addresses info

* Feature/improve ci (#675)

* CI: update actions, improve tag fetching

* CI: add cache invalidation

* chore: update bridges FAQ

* chore: update Sepolia-Chiado testnet bridges addresses

* Add files via upload

* fix broken mdx files

* broken links, package updates

* remove mGNO related content

* Add files via upload

* refactor(bridges): remove outdated content and consolidate bridge validator & bridge governance into bridge management (#680)

* refactor(bridge): refactor 'Understanding Token Bridgess'

* chore(bridge): update Hashi-related info

* chore(bridges): move all bridge governance and validators contents under 'bridge management'

* chore(bridges): remove outdated content and update info

* Added Option 3: "Running Your Own Deposit UI Instance Locally" (#672)

* added links to third party bridges and update legacy UI section

* bridges update

* reconfigure bridge segment

* new segment form

* fix a broken link

* faq: update bridge FAQs

* Add files via upload

* Update 06-19-core-devs-call.md

* updated docs on The Graph (#683)

---------

Co-authored-by: giacomognosis <[email protected]>
Co-authored-by: Armagan Ercan <[email protected]>
Co-authored-by: zengzengzenghuy <[email protected]>
Co-authored-by: cgi-bin/ <[email protected]>
Co-authored-by: Giacomo Licari <[email protected]>
Co-authored-by: Filip Martinsson <[email protected]>
Co-authored-by: 4rgon4ut <[email protected]>
Co-authored-by: zengzengzenghuy <[email protected]>
Co-authored-by: Felix <[email protected]>
Co-authored-by: AK <[email protected]>
  • Loading branch information
11 people authored Jun 24, 2024
1 parent b030686 commit 9e6b0fa
Show file tree
Hide file tree
Showing 3 changed files with 374 additions and 39 deletions.
88 changes: 87 additions & 1 deletion docs/faq/bridges.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,93 @@

To bridge AgEUR : https://app.angle.money/bridges-agEUR
To bridge EURe: You will need have an account in [Monerium app](https://monerium.app/), click **Send Money**, select **Cross-Chain** and enter the amount you want to send, then click **Send**.. Double check the message is correct and sign the message.

```mdx-code-block
<details>
<summary>Step by Step</summary>
<div>
```
![Step1](../../static/img/faq/bridge/EURe-step1.png)
![Step2](../../static/img/faq/bridge/EURe-step2.png)
![Step3](../../static/img/faq/bridge/EURe-step3.png)
![Step4](../../static/img/faq/bridge/EURe-step4.png)
![Step4](../../static/img/faq/bridge/EURe-step4.png)

```mdx-code-block
</div>
</details>
```

13. How do I check if my message from AMB(or Omnibridge) has been executed?

For Omnibridge, you can visit https://bridge.gnosischain.com/bridge-explorer and enter the transaction hash or address you want to search for.
For AMB, you can check it by messageId.
1. Find the message Id from the transaction log: In the block explorer, check the `Logs` tab of your transaction receipt, and find `messageId` in event `UserRequestForAffirmation`(bridging from ETH) or `UserRequestForSignature`(bridging from Gnosis Chain). The data type of `messageId` is `bytes32`.
2. On the destination chain's AMB, query the `messageCallStatus(bytes32 messageId)` by pasting the `messageId`. If it returns true, it means the message has been executed. If false, it means the message has not been executed.
Foreign AMB (Ethereum): https://etherscan.io/address/0x4C36d2919e407f0Cc2Ee3c993ccF8ac26d9CE64e#readProxyContract#F18
Home AMB (Gnosis Chain): https://gnosisscan.io/address/0x75Df5AF045d91108662D8080fD1FEFAd6aA0bb59#readProxyContract#F23
3. To find out the transaction of the message being executed, you can find the log which emit the event `AffirmationCompleted` (bridging from ETH), or `RelayedMessage` (bridging from GC).
Here is an example script using viem.

```mdx-code-block
<details>
<summary>Sample script</summary>
<div>
```

```
import { createPublicClient, http, parseAbiItem } from "viem";
import { gnosis, mainnet} from "viem/chains";
const main = async() => {
const gnoClient = createPublicClient({
chain: gnosis,
transport: http()
})
const ethClient = createPublicClient({
chain: mainnet,
transport: http()
})
const homeAMB = "0x75Df5AF045d91108662D8080fD1FEFAd6aA0bb59"
const foreignAMB = "0x4C36d2919e407f0Cc2Ee3c993ccF8ac26d9CE64e"
// Choose either home or foreign
// Foreign
const foreignLogs = await ethClient.getContractEvents({
address: foreignAMB,
abi: [parseAbiItem("event RelayedMessage(address indexed sender,address indexed executor,bytes32 indexed messageId,bool status)")],
eventName: 'RelayedMessage',
args: {
messageId: // replace the messageId
},
fromBlock: // replace from Block to recent block
toBlock: 'latest'
})
console.log(foreignLogs[0].transactionHash)
// Home
const homeLogs = await gnoClient.getContractEvents({
address: homeAMB,
abi: [parseAbiItem("event AffirmationCompleted(address indexed sender,address indexed executor,bytes32 indexed messageId,bool status)")],
eventName: 'AffirmationCompleted',
args: {
messageId: // replace the messageId
},
fromBlock: // replace from Block to recent block
toBlock: 'latest'
})
console.log(homeLogs[0].transactionHash)
};
main();
```

```mdx-code-block
</div>
</details>
```
199 changes: 161 additions & 38 deletions docs/tools/Data Indexing/the-graph.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,70 +4,193 @@ description: The Graph is a decentralized protocol for indexing and querying cha
keywords: [the graph, data indexing, query data, chain data, subgraphs]
---

# The Graph Data Indexing
# The Graph

[The Graph](https://thegraph.com/) is a decentralized protocol for indexing and querying chain data, supports Gnosis. Data defined through subgraphs is easy to query and explore. Subgraphs can be created locally, or use a free hosted explorer for indexing and data display.
Getting historical data on a smart contract can be frustrating when you’re building a dapp. [The Graph](https://thegraph.com/) provides a decentralized option to query smart contract data through APIs known as subgraphs, which utilize GraphQL.  The Graph’s infrastructure relies on a decentralized network of indexers, enabling your dapp to become truly decentralized.

## Setting up a hosted project with TheGraph & Gnosis
## Quick Start

:::info
See [The Graph Documentation](https://thegraph.com/docs/en/) for more details, local installation and more.
:::
These subgraphs only take a few minutes to set up and get running. To get started, follow these three steps:

## Steps:
1. Initialize your subgraph project
2. Deploy & Publish
3. Query from your dapp

1) Go to [Graph Explorer](https://thegraph.com/explorer/) and setup an account. You will need a GitHub account for authentication.
Pricing: **All developers receive 100K free queries per month on the decentralized network**. After these free queries, you only pay based on usage at $4 for every 100K queries.

2) Go to your dashboard and click **Add Subgraph**. Define the subgraph Name, Account, and Subtitle and update the image and other info (you can update later) if desired.
Here’s a step by step walk through:

## 1. Initialize your subgraph project

![Basic info is required to create a subgraph. You can modify later if needed.](/img/tools/xdai-graph.png)
### Create a subgraph on Subgraph Studio⁠

3) Install Graph CLI on your machine (using either npm or yarn)
Go to the [Subgraph Studio](https://thegraph.com/studio/) and connect your wallet. Once your wallet is connected, you can begin by clicking “Create a Subgraph”. Please choose a good name for the subgraph because this name can’t be edited later. It is recommended to use Title Case: “Subgraph Name Chain Name.”

```bash
$ npm install -g @graphprotocol/graph-cli
$ yarn global add @graphprotocol/graph-cli
![Create a Subgraph](https://lh7-us.googleusercontent.com/docsz/AD_4nXf8OTdwMxlKQGKzIF_kYR7NPKeh9TmWnZBYxb7ft_YbdOdx_VVtbp6PslN7N1KGUzNpIDCmaXppdrllM1cw_J4L8Na03BXOWzJTK1POCve0nkRjQYgWJ60QHAdtQ4Niy83SMM8m0F0f-N-AJj4PDqDPlA5M?key=fnI6SyFgXU9SZRNX5C5vPQ)


You will then land on your subgraph’s page. All the CLI commands you need will be visible on the right side of the page:

![CLI commands](https://lh7-us.googleusercontent.com/docsz/AD_4nXe3YvCxiOH_LupSWe8zh9AmP-VrV4PlOq3f7Ix6hNlBUYcANUFuLuVIWR74OGiBs0nrugTyT0v3o6RPmTsgHONdv_ZJNWtcDWEkRntXPHlQGFcqmEBa-D6j4aoIPzUKYdOJMVUPu8O3fwjdZ4IaXXZoTzY?key=fnI6SyFgXU9SZRNX5C5vPQ)


### Install the Graph CLI⁠

On your local machine run the following:
```
npm install -g @graphprotocol/graph-cli
```
### Initialize your Subgraph⁠

You can copy this directly from your subgraph page to include your specific subgraph slug:
```
graph init --studio <SUBGRAPH_SLUG>
```
You’ll be prompted to provide some info on your subgraph like this:

![cli sample](https://lh7-us.googleusercontent.com/docsz/AD_4nXdTAUsUb5vbs3GtCrhKhuXM1xYoqqooYTxw6lfJfYtLJNP8GKVOhTPmjxlM1b6Qpx-pXNVOzRuc8BL12wZXqy4MIj8ja0tp15znfuJD_Mg84SSNj3JpQ4d31lNTxPYnpba4UOzZx8pmgOIsbI7vCz70v9gC?key=fnI6SyFgXU9SZRNX5C5vPQ)

4) The following command creates a subgraph that indexes all events of an existing contract. It attempts to fetch the contract ABI from BlockScout and falls back to requesting a local file path. If any of the optional arguments are missing, it takes you through an interactive form.

_*Note: The interactive form does not currently include Gnosis in the dropdown of networks, so using the following flags is useful for a Gnosis deployment._
Simply have your contract verified on the block explorer and the CLI will automatically obtain the ABI and set up your subgraph. The default settings will generate an entity for each event.

## 2. Deploy & Publish

### Deploy to Subgraph Studio⁠

First run these commands:

```bash
graph init
--from-contract <CONTRACT_ADDRESS>
[--network xdai ]
[--abi <FILE>]
<GITHUB_USER>/<SUBGRAPH_NAME> [<DIRECTORY>]
$ graph codegen
$ graph build
```

--from-contract `<CONTRACT_ADDRESS>` is the address of your existing contract.
Then run these to authenticate and deploy your subgraph. You can copy these commands directly from your subgraph’s page in Studio to include your specific deploy key and subgraph slug:

--abi `<FILE>` is a local path to a contract ABI file (optional, If [verified in BlockScout](https://docs.blockscout.com/for-users/smart-contract-interaction/verifying-a-smart-contract), the graph will grab the ABI, otherwise you will need manually add the ABI. _You can save the abi from BlockScout or by running `truffle compile` or `solc` on a public project._ [_More info available here_](https://thegraph.com/docs/en/developing/creating-a-subgraph/)_.)_
```bash
$ graph auth --studio <DEPLOY_KEY>
$ graph deploy --studio <SUBGRAPH_SLUG>
```

The `<GITHUB_USER>` is your github user or organization name, `<SUBGRAPH_NAME>` is the name for your subgraph, and `<DIRECTORY>` is the optional name of the directory where `graph init` will put the example subgraph manifest.
You will be asked for a version label. You can enter something like v0.0.1, but you’re free to choose the format.

* _Choose the subgraph name created in step 2 as lowercase-hyphenated_
### Test your subgraph

:::info
More details are here: [https://thegraph.com/docs/en/developer/create-subgraph-hosted/](https://thegraph.com/docs/en/developer/create-subgraph-hosted/)
:::
You can test your subgraph by making a sample query in the playground section. The Details tab will show you an API endpoint. You can use that endpoint to test from your dapp.

5) Authenticate with the hosted service
![Playground](https://lh7-us.googleusercontent.com/docsz/AD_4nXf3afwSins8_eO7BceGPN79VvwolDxmFNUnkPk0zAJCaUA-3-UAAjVvrMzwr7q9vNYWdrEUNgm2De2VfQpWauiT87RkFc-cVfoPSsQbYSgsmwhyY1-tpPdv2J1H4JAMq70nfWBhb8PszZBFjsbDAaJ5eto?key=fnI6SyFgXU9SZRNX5C5vPQ)


### Publish Your Subgraph to The Graph’s Decentralized Network

Once your subgraph is ready to be put into production, you can publish it to the decentralized network. On your subgraph’s page in Subgraph Studio, click on the Publish button:

![publish button](https://edgeandnode.notion.site/image/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2Fa7d6afae-8784-4b15-a90e-ee8f6ee007ba%2F2f9c4526-123d-4164-8ea8-39959c8babbf%2FUntitled.png?table=block&id=37005371-76b4-4780-b044-040a570e3af6&spaceId=a7d6afae-8784-4b15-a90e-ee8f6ee007ba&width=1420&userId=&cache=v2)


Before you can query your subgraph, Indexers need to begin serving queries on it. In order to streamline this process, you can curate your own subgraph using GRT.

When publishing, you’ll see the option to curate your subgraph. As of May 2024, it is recommended that you curate your own subgraph with at least 3,000 GRT to ensure that it is indexed and available for querying as soon as possible.

![Publish screen](https://lh7-us.googleusercontent.com/docsz/AD_4nXerUr-IgWjwBZvp9Idvz5hTq8AFB0n_VlXCzyDtUxKaCTANT4gkk-2O77oW-a0ZWOh3hnqQsY7zcSaLeCQin9XU1NTX1RVYOLFX9MuVxBEqcMryqgnGQKx-MbDnOWKuMoLBhgyVWQereg3cdWtCPcTQKFU?key=fnI6SyFgXU9SZRNX5C5vPQ)

## 3. Query your Subgraph

Congratulations! You can now query your subgraph on the decentralized network!

For any subgraph on the decentralized network, you can start querying it by passing a GraphQL query into the subgraph’s query URL which can be found at the top of its Explorer page.

Here’s an example from the [CryptoPunks Ethereum subgraph](https://thegraph.com/explorer/subgraphs/HdVdERFUe8h61vm2fDyycHgxjsde5PbB832NHgJfZNqK) by Messari:

![Query URL](https://lh7-us.googleusercontent.com/docsz/AD_4nXebivsPOUjPHAa3UVtvxoYTFXaGBao9pQOAJvFK0S7Uv0scfL6TcTVjmNCzT4DgsIloAQyrPTCqHjFPtmjyrzoKkfSeV28FjS32F9-aJJm0ILAHey2gqMr7Seu4IqPz2d__QotsWG3OKv2dEghiD74eypzs?key=fnI6SyFgXU9SZRNX5C5vPQ)


The query URL for this subgraph is:

https://gateway-arbitrum.network.thegraph.com/api/**[api-key]**/subgraphs/id/HdVdERFUe8h61vm2fDyycHgxjsde5PbB832NHgJfZNqK

Now, you simply need to  fill in your own API Key to start sending GraphQL queries to this endpoint.

### Getting your own API Key

![API keys](https://lh7-us.googleusercontent.com/docsz/AD_4nXdz7H8hSRf2XqrU0jN3p3KbmuptHvQJbhRHOJh67nBfwh8RVnhTsCFDGA_JQUFizyMn7psQO0Vgk6Vy7cKYH47OyTq5PqycB0xxLyF4kSPsT7hYdMv2MEzAo433sJT6VlQbUAzgPnSxKI9a5Tn3ShSzaxI?key=fnI6SyFgXU9SZRNX5C5vPQ)


In Subgraph Studio, you’ll see the “API Keys” menu at the top of the page. Here you can create API Keys.

## Appendix

### Sample Query

This query shows the most expensive CryptoPunks sold.

```graphql
{
trades(orderBy: priceETH, orderDirection: desc) {
priceETH
tokenId
}
}

```bash
graph auth https://api.thegraph.com/deploy/ <your-access-token>
```

6) cd to the directory you created and start defining the subgraph. Information on creating a subgraph is available in [The Graph Docs](https://thegraph.com/docs/en/developing/creating-a-subgraph/)
Passing this into the query URL returns this result:

7) When you are ready, deploy your subgraph. You can always test and redeploy as needed.
```
{
"data": {
"trades": [
{
"priceETH": "124457.067524886018255505",
"tokenId": "9998"
},
{
"priceETH": "8000",
"tokenId": "5822"
},
// ...
```

```bash
yarn deploy
<aside>
💡 Trivia: Looking at the top sales on [CryptoPunks website](https://cryptopunks.app/cryptopunks/topsales) it looks like the top sale is Punk #5822, not #9998. Why? Because they censor the flash-loan sale that happened.

</aside>

### Sample code

```jsx
const axios = require('axios');

const graphqlQuery = `{
trades(orderBy: priceETH, orderDirection: desc) {
priceETH
tokenId
}
}`;
const queryUrl = 'https://gateway-arbitrum.network.thegraph.com/api/[api-key]/subgraphs/id/HdVdERFUe8h61vm2fDyycHgxjsde5PbB832NHgJfZNqK'

const graphQLRequest = {
method: 'post',
url: queryUrl,
data: {
query: graphqlQuery,
},
};

// Send the GraphQL query
axios(graphQLRequest)
.then((response) => {
// Handle the response here
const data = response.data.data
console.log(data)

})
.catch((error) => {
// Handle any errors
console.error(error);
});
```

:::success
Your subgraph will be deployed, and you can try sample queries. If you are ready to make it public, select the subgraph and turn off the Hide slider.
:::
### Additional resources:

- To explore all the ways you can optimize & customize your subgraph for a better performance, read more about [creating a subgraph here](https://thegraph.com/docs/en/developing/creating-a-subgraph/).
- For more information about querying data from your subgraph, read more [here](https://thegraph.com/docs/en/querying/querying-the-graph/).
Loading

0 comments on commit 9e6b0fa

Please sign in to comment.