Skip to content

Commit

Permalink
Merge branch 'feat/clickhouse-raw-models' into feat/indexer-scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
marcus-snx committed Dec 18, 2024
2 parents e720426 + 9a536c8 commit 9c225ef
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 20 deletions.
3 changes: 2 additions & 1 deletion indexers/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ WORKDIR /app
COPY package*.json ./
COPY patches/ ./patches/

RUN apt-get update && apt-get install -y build-essential && npm ci && apt-get remove -y build-essential
RUN apt-get update && apt-get install -y build-essential clang
RUN npm ci

COPY pyproject.toml uv.lock ./
RUN uv sync --frozen --no-dev
Expand Down
34 changes: 16 additions & 18 deletions indexers/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,19 +121,6 @@ def load_network_config(path):
# Load custom config
custom_config = config_file["configs"][protocol_name]

# Initialize Synthetix SDK (with optional Cannon config)
if "cannon_config" in custom_config:
snx = Synthetix(
provider_rpc=rpc_endpoint,
network_id=network_id,
cannon_config=custom_config["cannon_config"],
)
else:
snx = Synthetix(
provider_rpc=rpc_endpoint,
network_id=network_id,
)

# Set block range based on config.
block_range = {}
if args.block_from is not None:
Expand All @@ -157,7 +144,20 @@ def load_network_config(path):
# Get contracts from SDK or ABI files
contracts = []
schemas_path = f"{SCHEMAS_BASE_PATH}/{network_name}/{protocol_name}"

if "contracts_from_sdk" in custom_config:
# Initialize Synthetix SDK (with optional Cannon config)
if "cannon_config" in custom_config:
snx = Synthetix(
provider_rpc=rpc_endpoint,
network_id=network_id,
cannon_config=custom_config["cannon_config"],
)
else:
snx = Synthetix(
provider_rpc=rpc_endpoint,
network_id=network_id,
)
contracts_from_sdk = custom_config["contracts_from_sdk"]
for contract in contracts_from_sdk:
name = contract["name"]
Expand Down Expand Up @@ -192,8 +192,8 @@ def load_network_config(path):
client=client,
)
contracts.append({"name": name, "address": contract["address"]})
else:
message = "No contracts found in network config"
if not contracts:
message = "No contracts found"
raise Exception(message)

# Create squidgen generator config
Expand All @@ -209,6 +209,4 @@ def load_network_config(path):
)
write_yaml(squidgen_config, "squidgen.yaml")

snx.logger.info(
f"squidgen.yaml and ABI files have been generated for {args.network_name}"
)
print(f"squidgen.yaml and ABI files have been generated for {args.network_name}")
6 changes: 5 additions & 1 deletion indexers/networks/arbitrum_mainnet/network_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,15 @@ configs:
package: perpsFactory
- name: PerpsAccountProxy
package: perpsFactory
cannon_config:
package: "synthetix-omnibus"
version: "latest"
preset: "main"

curve:
range:
from: 236000000
contracts_from_abi:
- name: CurveUsdx
address: '0x096A8865367686290639bc50bF8D85C0110d9Fea'
address: "0x096A8865367686290639bc50bF8D85C0110d9Fea"
abi: ./abi/CurvePool.json

0 comments on commit 9c225ef

Please sign in to comment.