A transaction that trades against several pools of the same token had its price computed as |SUM(sats_delta) / SUM(token_delta)|. Arbitrage routers buy from one pool and sell into the others, so the token deltas very nearly cancel, and the division turned real satoshis into a price no leg ever traded at. Mainnet token NWB printed 30,792,599.5 sats/unit from a 27-pool sweep whose legs all executed between 0.288 and 0.335 — a hundred-million-fold error, and the visible spike on its chart. 820 such transactions exist across 91 tokens. Price is now SUM(ABS(sats_delta)) / SUM(ABS(token_delta)): the volume-weighted average of the prices the transaction's legs actually executed at, which is always bounded by its cheapest and dearest leg. For single-direction transactions — 99.76% of all prints, including the OLA supply-shock crash — this is arithmetically identical to the old formula, so honest history is untouched. Transactions whose legs cancel exactly used to print nothing and let the candle carry the previous close; they now price from their legs like any other trade. ohlcv_1h is materialised with INSERT OR IGNORE and the materialiser only ever moves forward, so contaminated buckets could never be corrected in place. An ohlcv_version config key clears the table once when the pricing rule changes. The synchronous post-IBD backfill is skipped on that pass: it runs before rocket::build() returns, so rebuilding all of history there would refuse connections for the duration instead of falling back to the raw query path. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> |
||
|---|---|---|
| .vscode | ||
| contrib | ||
| internal | ||
| linters | ||
| src | ||
| .gitignore | ||
| .gitlab-ci.yml | ||
| build.rs | ||
| Cargo.lock | ||
| Cargo.toml | ||
| LICENSE | ||
| README.md | ||
Riftenlabs Indexer
RiftenLabs indexer is for indexing DeFi contracts by Riften Labs. It allows for querying historical on-chain data on Bitcoin Cash.
Contributing
All contributors are required to sign a Contributor License Agreement (CLA) before their contributions can be merged into the project.
Contributions are generally welcome. If you intend to make larger changes please discuss them in an issue before MRing them to avoid duplicate work and architectural mismatches.
Installing Rust
Rust can be installed using your package manager of choice or rustup.rs. The former way is considered more secure since it typically doesn't involve trust in the CA system. But you should be aware that the version of Rust shipped by your distribution might be out of date.
Building
The library can be built and tested using cargo:
git clone https://gitlab.com/riftenlabs/riftenlabs-indexer.git
cd riftenlabs-indexer
cargo build
You can run tests with:
cargo test