Update sushiswap-subgraph stack to point to filecoin endpoint

This commit is contained in:
Prathamesh Musale 2023-08-18 11:34:49 +05:30
parent f411590452
commit 8c67429861
6 changed files with 79 additions and 39 deletions

View File

@ -6,8 +6,8 @@ services:
condition: service_healthy
ipfs:
condition: service_healthy
lotus-node-1:
condition: service_healthy
# lotus-node-1:
# condition: service_healthy
extra_hosts:
- host.docker.internal:host-gateway
environment:
@ -18,7 +18,8 @@ services:
postgres_pass: password
postgres_db: graph-node
# TODO: Get endpoint from env
ethereum: 'lotus-fixturenet:http://lotus-node-1:1234/rpc/v1'
# ethereum: 'lotus-fixturenet:http://lotus-node-1:1234/rpc/v1'
ethereum: 'filecoin:https://archive.lotus.vdb.to/rpc/v1'
GRAPH_LOG: info
ports:
- "8000"

View File

@ -10,17 +10,19 @@ services:
condition: service_healthy
environment:
- APP=v3
- NETWORK=lotus-fixturenet
# - NETWORK=lotus-fixturenet
- NETWORK=filecoin
command: ["bash", "-c", "./run-v3.sh"]
working_dir: /app/subgraphs/v3
volumes:
- ../config/sushiswap-subgraph-v3/lotus-fixturenet.js.template:/app/config/lotus-fixturenet.js.template
- ../config/sushiswap-subgraph-v3/filecoin.js:/app/config/filecoin.js
# - ../config/sushiswap-subgraph-v3/lotus-fixturenet.js.template:/app/config/lotus-fixturenet.js.template
- ../config/sushiswap-subgraph-v3/run-v3.sh:/app/subgraphs/v3/run-v3.sh
- sushiswap_core_deployment:/app/subgraphs/v3/core-deployments/docker
- sushiswap_periphery_deployment:/app/subgraphs/v3/deployments/docker
# - sushiswap_core_deployment:/app/subgraphs/v3/core-deployments/docker
# - sushiswap_periphery_deployment:/app/subgraphs/v3/deployments/docker
extra_hosts:
- "host.docker.internal:host-gateway"
volumes:
sushiswap_core_deployment:
sushiswap_periphery_deployment:
# volumes:
# sushiswap_core_deployment:
# sushiswap_periphery_deployment:

View File

@ -0,0 +1,24 @@
module.exports = {
network: 'filecoin',
v3: {
factory: {
// https://filfox.info/en/address/0xc35DADB65012eC5796536bD9864eD8773aBc74C4
address: '0xc35DADB65012eC5796536bD9864eD8773aBc74C4',
startBlock: 2867560,
},
positionManager: {
// https://filfox.info/en/address/0xF4d73326C13a4Fc5FD7A064217e12780e9Bd62c3
address: '0xF4d73326C13a4Fc5FD7A064217e12780e9Bd62c3',
startBlock: 2868037
},
// https://filfox.info/en/address/0x60E1773636CF5E4A227d9AC24F20fEca034ee25A
native: { address: '0x60E1773636CF5E4A227d9AC24F20fEca034ee25A' },
whitelistedTokenAddresses: [
'0x60E1773636CF5E4A227d9AC24F20fEca034ee25A',
],
stableTokenAddresses: [
],
// TODO: Check value
minimumEthLocked: 1.5
}
}

View File

@ -3,37 +3,39 @@
set -e
# Loop until the NFPM deployment is detected
echo "Waiting for sushiswap-periphery deployments to occur"
while [ ! -f ./deployments/docker/NonfungiblePositionManager.json ]; do
sleep 5
done
# echo "Waiting for sushiswap-periphery deployments to occur"
# while [ ! -f ./deployments/docker/NonfungiblePositionManager.json ]; do
# sleep 5
# done
echo "Reading contract addresses and block numbers from deployments"
FACTORY_ADDRESS=$(jq -r '.address' ./core-deployments/docker/UniswapV3Factory.json)
FACTORY_BLOCK=$(jq -r '.receipt.blockNumber' ./core-deployments/docker/UniswapV3Factory.json)
NATIVE_ADDRESS=$(jq -r '.address' ./deployments/docker/WFIL.json)
NFPM_ADDRESS=$(jq -r '.address' ./deployments/docker/NonfungiblePositionManager.json)
NFPM_BLOCK=$(jq -r '.receipt.blockNumber' ./deployments/docker/NonfungiblePositionManager.json)
# echo "Reading contract addresses and block numbers from deployments"
# FACTORY_ADDRESS=$(jq -r '.address' ./core-deployments/docker/UniswapV3Factory.json)
# FACTORY_BLOCK=$(jq -r '.receipt.blockNumber' ./core-deployments/docker/UniswapV3Factory.json)
# NATIVE_ADDRESS=$(jq -r '.address' ./deployments/docker/WFIL.json)
# NFPM_ADDRESS=$(jq -r '.address' ./deployments/docker/NonfungiblePositionManager.json)
# NFPM_BLOCK=$(jq -r '.receipt.blockNumber' ./deployments/docker/NonfungiblePositionManager.json)
# Read the JavaScript file content
file_content=$(</app/config/lotus-fixturenet.js.template)
# file_content=$(</app/config/lotus-fixturenet.js.template)
# Replace uppercase words with environment variables
echo "Reading values in lotus-fixturenet config"
replaced_content=$(echo "$file_content" | sed -e "s/FACTORY_ADDRESS/$FACTORY_ADDRESS/g" \
-e "s/FACTORY_BLOCK/$FACTORY_BLOCK/g" \
-e "s/NFPM_ADDRESS/$NFPM_ADDRESS/g" \
-e "s/NFPM_BLOCK/$NFPM_BLOCK/g" \
-e "s/NATIVE_ADDRESS/$NATIVE_ADDRESS/g")
# echo "Reading values in lotus-fixturenet config"
# replaced_content=$(echo "$file_content" | sed -e "s/FACTORY_ADDRESS/$FACTORY_ADDRESS/g" \
# -e "s/FACTORY_BLOCK/$FACTORY_BLOCK/g" \
# -e "s/NFPM_ADDRESS/$NFPM_ADDRESS/g" \
# -e "s/NFPM_BLOCK/$NFPM_BLOCK/g" \
# -e "s/NATIVE_ADDRESS/$NATIVE_ADDRESS/g")
# Write the replaced content back to the JavaScript file
echo "$replaced_content" > /app/config/lotus-fixturenet.js
# echo "$replaced_content" > /app/config/lotus-fixturenet.js
echo "Building subgraph and deploying to graph-node..."
pnpm run generate
pnpm run build
pnpm exec graph create --node http://graph-node:8020/ sushiswap/v3-lotus
pnpm exec graph deploy --node http://graph-node:8020/ --ipfs http://ipfs:5001 --version-label 0.1.0 sushiswap/v3-lotus
# pnpm exec graph create --node http://graph-node:8020/ sushiswap/v3-lotus
# pnpm exec graph deploy --node http://graph-node:8020/ --ipfs http://ipfs:5001 --version-label 0.1.0 sushiswap/v3-lotus
pnpm exec graph create --node http://graph-node:8020/ sushiswap/v3-filecoin
pnpm exec graph deploy --node http://graph-node:8020/ --ipfs http://ipfs:5001 --version-label 0.1.0 sushiswap/v3-filecoin
echo "Done"

View File

@ -8,6 +8,17 @@ Clone required repositories:
laconic-so --stack sushiswap-subgraph setup-repositories
```
Checkout to a non-default branch in the cloned repos if required:
```bash
# Default repo base dir
cd ~/cerc
# Example
cd graph-node
git checkout <your-branch>
```
Build the container images:
```bash

View File

@ -3,26 +3,26 @@ name: sushiswap-subgraph
description: "An end-to-end SushiSwap Subgraph stack"
repos:
## fixturenet-lotus repo
- github.com/filecoin-project/lotus
# - github.com/filecoin-project/lotus
## graph-node repo
- github.com/graphprotocol/graph-node
## sushiswap repos
- github.com/cerc-io/sushiswap-v3-core@watcher-ts
- github.com/cerc-io/sushiswap-v3-periphery@watcher-ts
# - github.com/cerc-io/sushiswap-v3-core@watcher-ts
# - github.com/cerc-io/sushiswap-v3-periphery@watcher-ts
## subgraph repo
- github.com/sushiswap/subgraphs
containers:
## fixturenet-lotus image
- cerc/lotus
# - cerc/lotus
## fixturenet-graph-node image
- cerc/graph-node
## sushiswap contract deployment images
- cerc/sushiswap-v3-core
- cerc/sushiswap-v3-periphery
# - cerc/sushiswap-v3-core
# - cerc/sushiswap-v3-periphery
## sushiswap subgraphs image
- cerc/sushiswap-subgraphs
pods:
- fixturenet-lotus
# - fixturenet-lotus
- fixturenet-graph-node
- contract-sushiswap
# - contract-sushiswap
- sushiswap-subgraph-v3