Skip to content

Commit

Permalink
Merge pull request #5 from Snowfork/more-chains
Browse files Browse the repository at this point in the history
More chains
  • Loading branch information
yrong authored Feb 3, 2025
2 parents bcac3cd + 67852c7 commit 6f97207
Show file tree
Hide file tree
Showing 83 changed files with 28,110 additions and 19 deletions.
4 changes: 3 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ RPC_BRIDGEHUB_POLKADOT=wss://bridgehub-polkadot.api.onfinality.io/public-ws
RPC_ASSETHUB_POLKADOT=wss://statemint.api.onfinality.io/public-ws
RPC_MOONBEAM=wss://moonbeam.ibp.network
RPC_HYDRATION=wss://hydration.dotters.network

RPC_BIFROST=wss://bifrost-polkadot-rpc.dwellir.com
RPC_ACALA=wss://acala-rpc-3.aca-api.network/ws
RPC_MYTHOS=wss://polkadot-mythos-rpc.polkadot.io
# Ankr endpoint is only for test, for production to decrease the latency
# better to use rpc endpoint more robust/realtime like Alchemy
RPC_ETH_HTTP=https://www.ankr.com/rpc/eth/
Expand Down
27 changes: 27 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,33 @@
"args": ["src/parachains/hydration/main.ts"],
"env": { "SQD_DEBUG": "*" }
},
{
"type": "node",
"request": "launch",
"name": "Launch process bifrost",
"runtimeArgs": ["-r", "ts-node/register", "-r", "dotenv/config"],
"cwd": "${workspaceRoot}",
"args": ["src/parachains/bifrost/main.ts"],
"env": { "SQD_DEBUG": "*" }
},
{
"type": "node",
"request": "launch",
"name": "Launch process acala",
"runtimeArgs": ["-r", "ts-node/register", "-r", "dotenv/config"],
"cwd": "${workspaceRoot}",
"args": ["src/parachains/acala/main.ts"],
"env": { "SQD_DEBUG": "*" }
},
{
"type": "node",
"request": "launch",
"name": "Launch process mythos",
"runtimeArgs": ["-r", "ts-node/register", "-r", "dotenv/config"],
"cwd": "${workspaceRoot}",
"args": ["src/parachains/mythos/main.ts"],
"env": { "SQD_DEBUG": "*" }
},
{
"type": "node",
"request": "launch",
Expand Down
40 changes: 40 additions & 0 deletions acala-versions.jsonl

Large diffs are not rendered by default.

43 changes: 43 additions & 0 deletions bifrost-versions.jsonl

Large diffs are not rendered by default.

70 changes: 66 additions & 4 deletions commands.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,18 +105,80 @@
]
},
"typegen:parachain:moonbeam": {
"description": "Generate data access classes for an moombeam metadata",
"description": "Generate data access classes from metadata",
"cmd": ["squid-substrate-typegen", "./typegen-moonbeam.json"]
},
"process:parachain:moonbeam": {
"description": "Load .env and start the squid processor",
"description": "Start the squid processor",
"deps": ["build"],
"cmd": [
"node",
"--require=dotenv/config",
"lib/parachains/moonbeam/main.js"
]
},
"generateMeta:parachain:bifrost": {
"description": "Generate metadata for bifrost",
"cmd": [
"npx",
"squid-substrate-metadata-explorer",
"--rpc=wss://bifrost-polkadot-rpc.dwellir.com",
"--out=bifrost-versions.jsonl"
]
},
"typegen:parachain:bifrost": {
"description": "Generate data access classes from metadata",
"cmd": ["squid-substrate-typegen", "./typegen-bifrost.json"]
},
"process:parachain:bifrost": {
"description": "Start the squid processor",
"deps": ["build"],
"cmd": [
"node",
"--require=dotenv/config",
"lib/parachains/bifrost/main.js"
]
},
"generateMeta:parachain:acala": {
"description": "Generate metadata for acala",
"cmd": [
"npx",
"squid-substrate-metadata-explorer",
"--rpc=wss://acala-rpc-3.aca-api.network/ws",
"--out=acala-versions.jsonl"
]
},
"typegen:parachain:acala": {
"description": "Generate data access classes from metadata",
"cmd": ["squid-substrate-typegen", "./typegen-acala.json"]
},
"process:parachain:acala": {
"description": "Start the squid processor",
"deps": ["build"],
"cmd": ["node", "--require=dotenv/config", "lib/parachains/acala/main.js"]
},
"generateMeta:parachain:mythos": {
"description": "Generate metadata for mythos",
"cmd": [
"npx",
"squid-substrate-metadata-explorer",
"--rpc=wss://polkadot-mythos-rpc.polkadot.io",
"--out=mythos-versions.jsonl"
]
},
"typegen:parachain:mythos": {
"description": "Generate data access classes from metadata",
"cmd": ["squid-substrate-typegen", "./typegen-mythos.json"]
},
"process:parachain:mythos": {
"description": "Start the squid processor",
"deps": ["build"],
"cmd": [
"node",
"--require=dotenv/config",
"lib/parachains/mythos/main.js"
]
},
"generateMeta:parachain:hydration": {
"description": "Generate metadata for hydration",
"cmd": [
Expand All @@ -127,11 +189,11 @@
]
},
"typegen:parachain:hydration": {
"description": "Generate data access classes for hydration metadata",
"description": "Generate data access classes from metadata",
"cmd": ["squid-substrate-typegen", "./typegen-hydration.json"]
},
"process:parachain:hydration": {
"description": "Load .env and start the squid processor",
"description": "Start the squid processor",
"deps": ["build"],
"cmd": [
"node",
Expand Down
20 changes: 20 additions & 0 deletions ecosystem.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,26 @@ module.exports = {
node_args: "--require=dotenv/config",
script: "./lib/parachains/hydration/main.js",
},
{
name: "moonbeam",
node_args: "--require=dotenv/config",
script: "./lib/parachains/moonbeam/main.js",
},
{
name: "bifrost",
node_args: "--require=dotenv/config",
script: "./lib/parachains/bifrost/main.js",
},
{
name: "acala",
node_args: "--require=dotenv/config",
script: "./lib/parachains/acala/main.js",
},
{
name: "mythos",
node_args: "--require=dotenv/config",
script: "./lib/parachains/mythos/main.js",
},
{
name: "graphql",
script: "./node_modules/.bin/squid-graphql-server",
Expand Down
10 changes: 10 additions & 0 deletions mythos-versions.jsonl

Large diffs are not rendered by default.

7 changes: 5 additions & 2 deletions scripts/re-index-all.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
set -e
#!/usr/bin/env bash
set -eu

source ./scripts/set-env.sh

pm2 stop ecosystem.config.js

docker exec snowbridge-subsquid-db-1 /bin/sh -c 'psql -h localhost -U postgres -c "drop database squid_v2 WITH (FORCE);" -c "create database squid_v2;"'
docker exec snowbridge-subsquid-db-1 /bin/sh -c 'psql -h localhost -U postgres -c "drop database '$database' WITH (FORCE);" -c "create database '$database';"'

sqd clean && sqd codegen && sqd build && sqd migration:apply

Expand Down
7 changes: 5 additions & 2 deletions scripts/re-index-assethub.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
set -e
#!/usr/bin/env bash
set -eu

source ./scripts/set-env.sh

pm2 stop assethub

docker exec snowbridge-subsquid-db-1 /bin/sh -c 'psql -h localhost -U postgres -d squid_v2 -c "drop schema assethub_processor cascade;"'
docker exec snowbridge-subsquid-db-1 /bin/sh -c 'psql -h localhost -U postgres -d '$database' -c "drop schema assethub_processor cascade;"'

pm2 start assethub

Expand Down
7 changes: 5 additions & 2 deletions scripts/re-index-bridgehub.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
set -e
#!/usr/bin/env bash
set -eu

source ./scripts/set-env.sh

pm2 stop bridgehub

docker exec snowbridge-subsquid-db-1 /bin/sh -c 'psql -h localhost -U postgres -d squid_v2 -c "drop schema bridgehub_processor cascade;"'
docker exec snowbridge-subsquid-db-1 /bin/sh -c 'psql -h localhost -U postgres -d '$database' -c "drop schema bridgehub_processor cascade;"'

pm2 start bridgehub

Expand Down
7 changes: 5 additions & 2 deletions scripts/re-index-ethereum.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
set -e
#!/usr/bin/env bash
set -eu

source ./scripts/set-env.sh

pm2 stop ethereum

docker exec snowbridge-subsquid-db-1 /bin/sh -c 'psql -h localhost -U postgres -d squid_v2 -c "drop schema eth_processor cascade;"'
docker exec snowbridge-subsquid-db-1 /bin/sh -c 'psql -h localhost -U postgres -d '$database' -c "drop schema eth_processor cascade;"'

pm2 start ethereum

Expand Down
7 changes: 5 additions & 2 deletions scripts/re-index-hydration.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
set -e
#!/usr/bin/env bash
set -eu

source ./scripts/set-env.sh

pm2 stop hydration

docker exec snowbridge-subsquid-db-1 /bin/sh -c 'psql -h localhost -U postgres -d squid_v2 -c "drop schema hydration_processor cascade;"'
docker exec snowbridge-subsquid-db-1 /bin/sh -c 'psql -h localhost -U postgres -d '$database' -c "drop schema hydration_processor cascade;"'

pm2 start hydration

Expand Down
7 changes: 5 additions & 2 deletions scripts/re-index-moonbeam.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
set -e
#!/usr/bin/env bash
set -eu

source ./scripts/set-env.sh

pm2 stop moonbeam

docker exec snowbridge-subsquid-db-1 /bin/sh -c 'psql -h localhost -U postgres -d squid_v2 -c "drop schema moonbeam_processor cascade;"'
docker exec snowbridge-subsquid-db-1 /bin/sh -c 'psql -h localhost -U postgres -d '$database' -c "drop schema moonbeam_processor cascade;"'

pm2 start moonbeam

Expand Down
5 changes: 4 additions & 1 deletion scripts/re-index-staging.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
set -e
#!/usr/bin/env bash
set -eu

source ./scripts/set-env.sh

pm2 stop staging.ecosystem.config.js

Expand Down
1 change: 1 addition & 0 deletions scripts/set-env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
database=squid_test
1 change: 1 addition & 0 deletions src/assethub/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ async function processInboundEvents(ctx: ProcessorContext<Store>) {
transfer.status = TransferStatusEnum.Complete;
if (transfer.destinationParaId == AssetHubParaId) {
// Terminated on AH
transfer.toAssetHubMessageQueue = processedMessage;
transfer.toDestination = processedMessage;
} else {
// Forward to 3rd Parachain
Expand Down
6 changes: 6 additions & 0 deletions src/common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ export const MoonBeamParaId = 2004;

export const HydrationParaId = 2034;

export const BifrostParaId = 2030;

export const MythosParaId = 3369;

export const AcalaParaId = 2000;

export interface ToEthereumAsset {
location: string;
address: string;
Expand Down
Loading

0 comments on commit 6f97207

Please sign in to comment.