Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

🇬 The Hop Protocol v1 Subgraphs for The Graph

License

NotificationsYou must be signed in to change notification settings

hop-protocol/subgraph

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

The Hop Protocol Subgraph forThe Graph.

Subgraphs

Mainnet

Goerli

Development

Authenticate

npx graph auth https://api.thegraph.com/deploy/<access-token>

The access token is found on the hosted-servicedashboard.

Instructions to Add new chain config or new addresses

  1. Updatescripts/mapping_config.json with the new chain network and subgraph name mapping.

  2. Update the@hop-protocol/sdk package version inpackage.json.

  3. Add thebuild-deploy npm script inpackage.json.

  4. Update.gitignore andclean.sh (this step can probably be automated).

  5. Runnpm i to install the latest@hop-protocol/sdk package

  6. Runnpm run generate-config-json to create the updated config files

The config generation script is run automatically when building the subgraph with npmbuild-deploy command and can also be ran withnpm run generate-config-json.

The generation scriptscripts/generate_config_json.js will read the chain/token config from@hop-protocol/sdk and output/override the config JSON files toconfig/.

  1. Install Docker

  2. After bumping the version of@hop-protocol/sdk inpackage.json and pushing to github and github action finishes building thedocker image, run the following commands to build and deploy the subgraph locally or on a server using docker compose:

# change this values to deploy a different subgraph. Refer to `scripts/mapping_config.json` for the subgraph nameexport NETWORK=base-goerliexport RPC=https://goerli.base.org# download docker-compose filewget https://raw.githubusercontent.com/hop-protocol/subgraph/master/docker-compose.yml# start services# the `-d` is used to run in background# the `--pull=always` is used to update the image when there is one available# NOTE: The NETWORK and RPC are redundant, but sometimes cause issues if they do not existsudo RPC=https://rpc.linea.build NETWORK=linea docker compose up --pull=always

After a minute or so the graph should be available athttp://localhost:8000/subgraphs/name/hop-protocol/hop-base-goerli/graphql

  1. Troubleshooting
  • If your server is unreachable from outside, ensure you enabled port8000 with UFW
    • Disable and enable UFW after this

Pre-setup notes

These are deprecated in favor of the local Docker instructions. Only reference these if Docker is not used.

# Required for AbortControllernvm install 16.6.1nvm use 16.6.1# Various requirementssudo apt install npmsudo apt install -y jqnpm i @graphprotocol/graph-cli@0.53.0

Troubleshooting

# ErrorFailed to deploy to Graph node https://api.thegraph.com/deploy/: subgraph failure::Subgraph [hop-protocol/hop-base-mainnet] not found# Lines to commentnpx graph auth https://api.thegraph.com/deploy/ $ACCESS_TOKENnpx graph deploy --product hosted-service --ipfs https://api.thegraph.com/ipfs/ --node https://api.thegraph.com/deploy/ "$GITHUB_ORG/{{subgraphName}}"

Build and deploy

npm run build-deploy:mainnetnpm run build-deploy:mainnet-subgraph-studionpm run build-deploy:polygonnpm run build-deploy:xdainpm run build-deploy:optimismnpm run build-deploy:arbitrum# testnetnpm run build-deploy:goerlinpm run build-deploy:mumbainpm run build-deploy:optimism-goerli# localnpm run build-deploy:arbitrum-goerlinpm run build-deploy:novanpm run build-deploy:zksyncnpm run build-deploy:base-goerlinpm run build-deploy:base-mainnetnpm run build-deploy:lineanpm run build-deploy:polygonzk

By default, it will deploy underhop-protocol github org.

SetGITHUB_ORG to deploy another a different account.

Example:

GITHUB_ORG=<github-username> npm run build-deploy:mainnet

The following subgraphs will need to be created on the dashboard:

  • hop-mainnet
  • hop-polygon
  • hop-xdai
  • hop-optimism
  • hop-arbitrum
  • hop-goerli
  • hop-mumbai
  • hop-optimism-goerli

Clean build files:

npm run clean

Deploying locally:

Update networks indocker-compose.yml:

For Optimism Regenesis:

ethereum:'optimism:https://mainnet-replica-4.optimism.io'

For Arbitrum Nova:

ethereum:'nova:https://nova.arbitrum.io/rpc'

For zkSync:

ethereum:'zksync:https://zksync2-testnet.zksync.dev'

For Base:

ethereum:'base-mainnet:https://developer-access-mainnet.base.org'

For Linea:

ethereum:'linea:https://rpc.linea.build'

For Polygonzk:

ethereum:'polygonzk:https://zkevm-rpc.com'

For Linea (Goerli):

ethereum:'linea-goerli:https://consensys-zkevm-goerli-prealpha.infura.io/v3/YOUR_PROJECT_ID'

For Base (Goerli):

ethereum:'base-goerli:https://goerli.base.org'

For Arbitrum (Goerli):

ethereum:'arbitrum-goerli:https://goerli-rollup.arbitrum.io/rpc'

Start containers:

docker-compose up

Create local subgraph (in another terminal):

For Optimism Regenesis:

npx graph create hop-protocol/hop-optimism --node http://127.0.0.1:8020

For Arbitrum Nova:

npx graph create hop-protocol/hop-nova --node http://127.0.0.1:8020

For zkSync:

npx graph create hop-protocol/hop-zksync --node http://127.0.0.1:8020

For Base:

npx graph create hop-protocol/hop-base-mainnet --node http://127.0.0.1:8020

For Base:

npx graph create hop-protocol/hop-linea --node http://127.0.0.1:8020

For Polygonzk:

npx graph create hop-protocol/hop-polygonzk --node http://127.0.0.1:8020

For Linea (Goerli):

npx graph create hop-protocol/hop-linea-goerli --node http://127.0.0.1:8020

For Base (Goerli):

npx graph create hop-protocol/hop-base-goerli --node http://127.0.0.1:8020

For Arbitrum (Goerli):

npx graph create hop-protocol/hop-arbitrum-goerli --node http://127.0.0.1:8020

Deploy subgraph after building (add this line at the bottom ofbuildfiles.template.sh and comment out existingnpx graph deploy line):

For Optimism Regenesis:

npx graph deploy --ipfs http://localhost:5001 --node http://localhost:8020 hop-protocol/hop-optimism

For Arbitrum Nova:

npx graph deploy --ipfs http://localhost:5001 --node http://localhost:8020 hop-protocol/hop-nova

For zkSync:

npx graph deploy --ipfs http://localhost:5001 --node http://localhost:8020 hop-protocol/hop-zksync

For Base:

npx graph deploy --ipfs http://localhost:5001 --node http://localhost:8020 hop-protocol/hop-base-mainnet

For Linea:

npx graph deploy --ipfs http://localhost:5001 --node http://localhost:8020 hop-protocol/hop-linea

For Polygonzk:

npx graph deploy --ipfs http://localhost:5001 --node http://localhost:8020 hop-protocol/hop-polygonzk

For Linea (Goerli):

npx graph deploy --ipfs http://localhost:5001 --node http://localhost:8020 hop-protocol/hop-linea-goerli

For Base (Goerli):

npx graph deploy --ipfs http://localhost:5001 --node http://localhost:8020 hop-protocol/hop-base-goerli

For Arbitrum (Goerli):

npx graph deploy --debug --ipfs http://localhost:5001 --node http://localhost:8020 hop-protocol/hop-arbitrum-goerli

Build and deploy:

For Optimism Regenesis:

npm run build-deploy:optimism

For Arbitrum Nova:

npm run build-deploy:nova

For zkSync:

npm run build-deploy:zksync

For Base:

npm run build-deploy:base-mainnet

For Linea:

npm run build-deploy:linea

For Polygonzk:

npm run build-deploy:polygonzk

For Linea (Goerli):

npm run build-deploy:linea-goerli

For Base (Goerli):

npm run build-deploy:base-goerli

For Arbitrum (Goerli):

npm run build-deploy:arbitrum-goerli

Query subgraphs

For Optimism Regenesis:

http://localhost:8000/subgraphs/name/hop-protocol/hop-optimism

For Arbitrum Nova:

http://localhost:8000/subgraphs/name/hop-protocol/hop-nova

For zkSync:

http://localhost:8000/subgraphs/name/hop-protocol/hop-zksync

For Base:

http://localhost:8000/subgraphs/name/hop-protocol/hop-base-mainnet

For Linea:

http://localhost:8000/subgraphs/name/hop-protocol/hop-linea

For Polygonzk:

http://localhost:8000/subgraphs/name/hop-protocol/hop-polygonzk

For Linea (Goerli):

http://localhost:8000/subgraphs/name/hop-protocol/hop-linea-goerli

For Base (Goerli):

http://localhost:8000/subgraphs/name/hop-protocol/hop-base-goerli

For Arbitrum (Goerli):

http://localhost:8000/subgraphs/name/hop-protocol/hop-arbitrum-goerli

Github Actions

Run github action build locally withact:

act --workflows .github/workflows/build.yml

License

MIT


[8]ページ先頭

©2009-2025 Movatter.jp