Skip to content

feat: swap recent-activity state + MarketCapMetrics (v2 leaderboard) + swap fee_destination wiring - #1251

Merged
bmc08gt merged 4 commits into
code/cashfrom
feat/swap-recent-activity
Aug 19, 2026
Merged

feat: swap recent-activity state + MarketCapMetrics (v2 leaderboard) + swap fee_destination wiring#1251
bmc08gt merged 4 commits into
code/cashfrom
feat/swap-recent-activity

Conversation

@bmc08gt

@bmc08gt bmc08gt commented Aug 19, 2026

Copy link
Copy Markdown
Collaborator

Summary

Refreshes the vendored protobuf definitions and wires the three new contract changes end-to-end, then puts the swap recent-activity + market-cap data to work in the UI.

1. chore(protos) — refresh definitions

  • activity/v1: swapped-crypto notification metadata + swap state
  • currency/v1: MarketCapMetrics on mint metadata
  • transaction/v1: fee_destination on stateful swap server params

2. feat(activity) — swap recent-activity notification state

  • Service NotificationMetadata: SwappedCrypto + WithdrewCrypto carrying SwappedCryptoMetadata (from/to mint, amounts, fee, SwapState)
  • Persisted MessageMetadata mirror + MetadataMapper translation at the persistence boundary
  • transaction-history direction handling (outgoing, no counterparty)
  • Supersedes the standalone bought/sold crypto states

3. feat(oc) — MarketCapMetrics + swap fee_destination wiring

  • MarketCapMetrics domain model (currentMarketCap + windowed marketCapDeltas) + mapper, threaded through MintMapper (incl. the two hand-constructed sites)
  • Persisted as a tokens.market_cap_metrics JSON column, mirroring the existing holder_metrics pattern; nullable-column auto-migration v27 → v28 (schema 28.json exported)
  • fee_destination threaded server params → ExistingCurrency buy instructions. Inert unless feeAmount > 0 && feeDestination != null, so the on-chain transaction bytes are unchanged until deliberately activated.

    ⚠️ Activating the fee path still needs iOS parity + on-chain verification — it's a flagged shared-logic hotspot.

4. feat(discovery) — rank v2 leaderboard rows by market cap

  • Implements the previously-stubbed RankingSystem.MarketCap branch off marketCapMetrics: headline = current market cap, change = windowed market-cap delta (signed, correct colour)
  • v2 (FeatureFlag.NewUi) leaderboard rows now rank by market cap; legacy rows stay on Holders
  • Falls back to the bonding-curve estimate when a token has no metrics yet

Persistence

  • Room @Database version bumped 27 → 28 via a nullable-column AutoMigration (no spec class needed); schema JSON exported.

Testing

  • Unit tests pass across services:flipcash, services:opencode, apps:flipcash:core, transaction-history, and persistence:{db,sources}.
  • Verified live on a debug build: Discover Currencies → Leaderboard renders rows ranked by market cap with signed windowed deltas (green +$1.43K this week, red -$210.18K this week) off real backend marketCapMetrics.

…ion definitions

- activity/v1: swapped-crypto notification metadata + swap state
- currency/v1: MarketCapMetrics on mint metadata
- transaction/v1: fee_destination on stateful swap server params
Add SwappedCryptoMetadata + SwapState to the activity feed:
- service NotificationMetadata: SwappedCrypto + WithdrewCrypto carrying swap metadata
- persisted MessageMetadata mirror + MetadataMapper translation
- transaction-history direction handling (outgoing, no counterparty)
- supersedes standalone bought/sold crypto states
…ring

- MarketCapMetrics domain model + mapper, threaded through MintMapper
- persist as tokens.market_cap_metrics JSON column (auto-migration v27->v28)
- fee_destination threaded server params -> ExistingCurrency buy instructions;
  inert unless feeAmount > 0 && feeDestination != null (preserves tx bytes)
Implement the RankingSystem.MarketCap branch off the new marketCapMetrics:
- headline shows current market cap, change shows the windowed market-cap delta
- falls back to the bonding-curve estimate when metrics aren't populated yet
Drive v2 (NewUi) leaderboard rows to MarketCap ranking; legacy rows stay on Holders.
@github-actions github-actions Bot added type: feature New functionality area: crypto Solana, keys, encryption, signing area: network gRPC, connectivity, API, exchange rates and removed type: feature New functionality labels Aug 19, 2026
@bmc08gt
bmc08gt merged commit a5212ae into code/cash Aug 19, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: crypto Solana, keys, encryption, signing area: network gRPC, connectivity, API, exchange rates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant