Backend indexer for Riften Labs BCH DeFi contracts (Cauldron, Moria). Mirror of gitlab.com/riftenlabs/riftenlabs-indexer (AGPL-3.0). Author: Riften Labs.
Find a file
Hossein Zoda f3818fd7a2 ido: resync to the PoolParams-free spec; native BCH xToken; conf NFT run()-only
Port libriften feb2167 + 05d3454 + a582108 (through HEAD a582108):

- The ORB PoolParams NFT is gone from the spec. The IdoParams commitment
  field orbPoolParamsCategory (32, VM-order category) is replaced by
  permanentPoolPlatformNfth (32, verbatim hash) — the delegation-pool
  platform nfth the postlaunch bakes; run() reconstructs the permanent
  pool's thin main from it on-chain, so the indexer's only duties are to
  source it from the params NFT commitment and prove the output #7
  postlaunch rebuild was baked with it (unchanged mechanism). Stored on
  the PreInit/Active parameters as permanentPoolPlatformNfth.
- postlaunch io realignment: run() drops the PoolParams io#4 — the
  offering confirmation NFT is consumed exactly ONCE, at run() input#4,
  and is forbidden in init()/collect() (a582108). Collects no longer
  copy the NFT through io#4, so they are invisible to the tracked chain
  (they only move proceeds into the covenant storages); the POSTLAUNCH
  status now advances solely on the final run tx. The platform payout
  moved to output#4 and the altPPOut pool-deploy-failure fallback is
  gone (altPPOutPayout dropped from the Distributed state, matching
  libriften indexer-types).
- Native BCH xToken: offer.xTokenCategory is now nullable (all-zero
  on-chain = native sentinel -> JSON null). Native IDOs take payment via
  the offering's XWNT path (entry flag required-iff-native, payment in
  the entry's value, fresh owner nft at #2) and their permanent pool is
  a single-UTXO tokenbch-delegation pool at run() output#0 (BCH reserve
  in the value; sibling slot -> OP_RETURN). The offering/postlaunch
  builders bake an empty push for a native category.
- IDO_POSTLAUNCH_CONTRACT re-synced (1627 -> 2193 bytes, byte-matching
  ido.json; embeds the new delegation contracts + both native branches);
  initiator/preinit/offering-layer contracts verified byte-identical.
- Per-network ORB constants centralized in src/db/orbconstants.rs: the
  IdoParams NFT category moved there next to the delegation-pool
  platform nfth (chipnet pins the deployed ORB v0 records, mainnet stays
  all-zero fail-closed).
- ido.db schema version 4: no backward compatibility, delete ido.db and
  re-index.

Verified: cargo build, test (233 passing), clippy (no new warnings)
and fmt all clean.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-12 10:06:16 +03:00
.vscode Convert hash columns from TEXT to BLOB storage 2026-01-22 08:30:17 +01:00
contrib Delphi v2 support 2026-05-04 15:03:40 +02:00
internal Expose authchain head + optional local IPFS gateway for BCMR downloads 2026-06-24 11:07:31 +00:00
linters Fix potential API hangs from write lock contention 2026-02-02 21:01:50 +01:00
src ido: resync to the PoolParams-free spec; native BCH xToken; conf NFT run()-only 2026-08-12 10:06:16 +03:00
.gitignore Add Chipnet support 2026-01-09 13:46:58 +01:00
.gitlab-ci.yml ci: Use lockfile as cache key 2026-02-02 11:52:09 +01:00
build.rs missing build file 2024-10-25 15:28:40 +02:00
Cargo.lock tokentoken/tokenbch: index delegation pools, replace the pre-delegation AMM 2026-08-12 10:06:13 +03:00
Cargo.toml tokentoken/tokenbch: index delegation pools, replace the pre-delegation AMM 2026-08-12 10:06:13 +03:00
LICENSE use AGPL 2024-02-05 16:32:27 +01:00
README.md README: contributors license 2024-03-14 10:54:44 +01:00

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