You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add Stellar Expert enrichment for indexed contracts #1
We index every contract deploy in the hack window from testnet. Stellar Expert computes its own numbers for the same contracts. Showing both, and flagging where they disagree, makes our data checkable.
In this repo today
The indexer stores deploys in the contracts table (contract_id, deployer, wasm_hash, tx_hash, ledger, deployed_at) but does not count invocations yet, so the first version compares the fields we do have. An invocation comparison can follow once the indexer records invokes (see the resource fee metrics and function name issues).
What to build
apps/api/src/hackproof/enrichment/stellar_expert.py: an httpx client over a new stellar_expert_api setting in config.py (default https://api.stellar.expert/explorer/testnet). get_contract(contract_id) -> StellarExpertContract | None returns a Pydantic model with at least contract_id, invocations, users, verified, created_at and wasm_hash. Upstream extras are preserved (extra="allow").
A contract_stats table in db.py: contract_id primary key, the fields above, fetched_at. A 404 is stored as "not found" so it is not refetched every run.
A run_enrich_stellar_expert job and an enrich-stellar-expert subcommand in cli.py. It walks the window's contracts, fetches at most 2 requests per second, and retries with backoff on 429 and 5xx.
Mismatch flags: wasm_hash differs, or created_at differs from our deployed_at by more than a minute.
Expose the stats on the contracts list (schemas.py, queries.py) and add Stellar Expert invocations and callers to the Contracts table in apps/web/src/components/explorer/columns.tsx, with a link out (see lib/links.ts).
Acceptance criteria
Fixtures in apps/api/tests/fixtures/stellar_expert/ cover a verified contract, an unverified one and a 404. Tests use a mock transport and never touch the network.
uv run hackproof enrich-stellar-expert against the fixtures fills contract_stats.
A test covers each mismatch flag.
The Contracts table shows the numbers with a link to Stellar Expert.
Activity
Jalst commentedon Oct 31, 2026