riftenlabs-indexer/src
Hossein Zoda 0a566e9ee6 ido: native BCH xToken — nullable xTokenCategory + single-UTXO tokenbch pool
Reflect libriften 9e3456d4 (feat(ido): native BCH xToken) in the indexer. An
IDO priced in native BCH sets offer.xTokenCategory = null: proceeds ride as
satoshi value and the permanent pool is a single-UTXO tokenbch-delegation pool
(BCH reserve in value + oToken as the CashToken) instead of a two-leg tokentoken
pool. The sibling tokenbch-delegation AMM (libriften 7b7cd569) is NOT indexed
here — deferred per Hossein.

- xTokenCategory is now Option<Vec<u8>> (serde Option<Hex>): native = None ->
  JSON null, matching libriften indexer-types (Hex | null). Old rows (always a
  hex string) deserialize to Some, so no migration.
- Announcement parse: an all-zero category normalizes to None; dropped the
  now-obsolete "must be non-native" rejection.
- build_offering_bytecode + PartialPostlaunchParameters take Option<&[u8]> and
  bake an empty (0x -> OP_0) push for native, matching encodeIdoXTokenCategory.
- Recompiled IDO_POSTLAUNCH_CONTRACT 1627 -> 2309 bytes (native collect/run
  branches); all three IDO contract hexes now byte-match ido.json.
- ACTIVE buy: native uses the offering's XWNT path — the entry XWNT flag is now
  required-iff-native (was always rejected); supply_amount is the entry output's
  value (no xToken storage output); a freshly minted owner nft shifts #3 -> #2.
- POSTLAUNCH run: native single-UTXO pool leg read from output#0 (xTokenAmount =
  its value in sats, oTokenAmount = its token); collector xToken share read from
  output#3 value. The platform xToken share is BCH folded into output#5's value,
  so it is recovered as earnedAmount - output#0.value - output#3.value (the
  offering layer charges no IDO fee, so earnedAmount is the full xToken proceeds
  entering run); platformBchPayout excludes that share, leaving just the pot.

No cargo this session (project constraint) — verified via rustfmt.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-19 18:29:41 +03:00
..
bcmr Expose authchain head + optional local IPFS gateway for BCMR downloads 2026-06-24 11:07:31 +00:00
cashaddr Upgrade bitcoincash to 0.32 and add TokenToken AMM pool indexing 2026-06-10 16:18:35 +02:00
crc20 Switch to tokio and sqlx 2026-02-18 10:16:51 +01:00
db ido: native BCH xToken — nullable xTokenCategory + single-UTXO tokenbch pool 2026-07-19 18:29:41 +03:00
rpc Merge branch 'authChain' into 'master' 2026-06-24 11:07:31 +00:00
chain.rs format 2026-06-23 02:38:25 +03:00
def.rs Upgrade bitcoincash to 0.32 and add TokenToken AMM pool indexing 2026-06-10 16:18:35 +02:00
electrum.rs bcmr: index new registrations from mempool, no confirmation needed 2026-07-06 08:59:46 +00:00
index.rs bcmr: index new registrations from mempool, no confirmation needed 2026-07-06 08:59:46 +00:00
main.rs bcmr: index new registrations from mempool, no confirmation needed 2026-07-06 08:59:46 +00:00
signal.rs Do not serve requests during IBD 2026-02-02 12:08:04 +01:00
timeutil.rs Update copyright headers 2026-01-21 12:37:13 +01:00
utiltest.rs ido, compiles, with claude generated unittests 2026-06-21 01:44:39 +03:00
utiltoken.rs Upgrade bitcoincash to 0.32 and add TokenToken AMM pool indexing 2026-06-10 16:18:35 +02:00
utiltx.rs Upgrade bitcoincash to 0.32 and add TokenToken AMM pool indexing 2026-06-10 16:18:35 +02:00