Skip to content

feat(currency-info): add How Market Cap Works explainer - #946

Merged
bmc08gt merged 5 commits into
mainfrom
feat/market-cap-explainer
Oct 2, 2026
Merged

bmc08gt merged 5 commits into
mainfrom
feat/market-cap-explainer

Conversation

@bmc08gt

@bmc08gt bmc08gt commented Oct 2, 2026 •

Copy link
Copy Markdown
Collaborator

Adds a "How Market Cap Works" screen to currency info, built from the v0.1 spec (section 10776:1757, screens 10761:2077 and 10761:1773). It shows what the holder's balance would be worth if the coin's reserve grew to a chosen size.

The math lives in FlipcashCore/Models/MarketCapExplainer.swift. The slider axis is reserve in USD, positioned by log(reserve). Supply at a stop comes from the curve's supply-from-value, and "would be worth" is the fee-free sell value of the held quarks at that supply. Display goes through the preferred currency rate; the math stays in USD. The acceptance vectors (1.25M supply, 12,400 held) match Android:

Stop Price Worth
Today ($22.7K reserve) $0.02994 $369.18
$5K $0.0144 $177
$100K $0.0977 $1,205
$1M $0.887 $10,941
$10M $8.78 $108,304

Stops are $5K, $100K, $1M and $10M. While the top stop is at most twice today's reserve, a stop 10× higher is added, capped at the reserve where all 21M tokens are sold, so Today always has room to slide up.

The screen

  • Continuous slider that springs back to Today on release.
  • The thumb is a white capsule that turns to Liquid Glass while pressed on iOS 26, and a 28pt white disc on iOS 18–25.
  • Readouts roll with .numericText().
  • Colors come from the theme: Color.Sentiment.positive for the curve, slider fill, row icon and a gain; Color.textError (#FF8383, the same red Android uses) for a loss; backgroundRow and rowSeparator for the row card, icon disc and inactive track. Color.Sentiment.negative is untouched.
  • The chart draws solid up to the selection and dashed beyond, with a dashed line at today's price. It redraws from the slider position on every frame of the spring back, with Charts' own animation off. Animating between curve data sets of different sizes made part of the curve fade out on release.
  • Axis labels are measured; Today always draws, and any label within 6pt of a drawn one is dropped. The layout is in MarketCapAxisLabels in FlipcashCore so it can be tested.

The new row 12pt below the range chips (node 10761:1879) opens the screen.

StockChart gains headerTitle, which draws the "Market Cap" label above the value.

Tests cover the curve math and stops, the axis-label layout, the view model (currency conversion, reset to Today, appreciation sign, the "<0.01%" share) and the chart's per-frame values.

Android counterpart: code-payments/code-android-app#1649.

MarketCapExplainer maps a reserve in USD to supply, price and the fee-free
sell value of a held balance at that supply. Slider stops are $5K, $100K,
$1M and $10M, with a 10x stop appended while the top stop is at most twice
today's reserve, capped at the reserve where all 21M tokens are sold.
Opens from the Market Cap header on the currency info chart and from a new
row under the range chips (spec section 10776:1757). A slider over reserve
shows what the balance would be worth, springing back to Today on release,
with the curve redrawn from the slider position on every frame.
@bmc08gt
bmc08gt force-pushed the feat/market-cap-explainer branch from 30959ef to 160eda0 Compare October 2, 2026 00:25
Replace the explainer's local palette and hex constants with existing
tokens: Sentiment.positive, textError, backgroundRow and rowSeparator.
@bmc08gt
bmc08gt merged commit a5062a4 into main Oct 2, 2026
3 checks passed
@bmc08gt
bmc08gt deleted the feat/market-cap-explainer branch October 5, 2026 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant