beefy-databarn

Indexer for beefy data

Dev

Setup

python3 -m venv .venv
source .venv/bin/activate
pip install . .[test] .[dev]
cp .env.example .env
cp .env-grafana.example .env-grafana
meltano install

Run

Infra

./scripts/infra.sh start

start

# get vault and boost data updated
meltano run tap-beefy-api target-postgres
meltano run tap-github-files target-postgres

# run taps once to initialize the schemas
# this should fail on first run because their input tables do not exist yet
meltano run tap-block-explorer-contract-creation-infos target-postgres

# run dbt to create input tables
meltano invoke dbt-postgres:run
meltano invoke dbt-postgres:test

# actually fetch the data
meltano run tap-block-explorer-contract-creation-infos target-postgres
meltano run tap-squid-contract-events contract-event-split target-postgres

Test

Unit

PYTHONPATH=".:src/" pytest

Lint

ruff check . --fix

Types

mypy .

All checks

pre-commit run --all-files

Debug commands

cd extract/tap-beefy-databarn
source .venv/bin/activate

Show a contract creation date and block

poetry run show-contract-creation --chain=avax --contract_address=0x22eafb9c7e2858cfda712940896464ddaa83d053

Other

Format SQL files

# just tell you about the issues
meltano invoke sqlfluff:lint

# fix the issues with your confirmation
meltano invoke sqlfluff:fix

# do not ask for confirmation
meltano invoke sqlfluff:fix-force

Reset venv

rm -Rf .venv && python3 -m venv .venv && source .venv/bin/activate && pip install . .[test] .[dev]

Links for later