Repository navigation
feat(currency-info): add How Market Cap Works explainer - #946
Merged
Merged
Conversation
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
force-pushed
the
feat/market-cap-explainer
branch
from
October 2, 2026 00:25
30959ef to
160eda0
Compare
…s and chart frame
Replace the explainer's local palette and hex constants with existing tokens: Sentiment.positive, textError, backgroundRow and rowSeparator.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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: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
.numericText().Color.Sentiment.positivefor the curve, slider fill, row icon and a gain;Color.textError(#FF8383, the same red Android uses) for a loss;backgroundRowandrowSeparatorfor the row card, icon disc and inactive track.Color.Sentiment.negativeis untouched.MarketCapAxisLabelsin FlipcashCore so it can be tested.The new row 12pt below the range chips (node 10761:1879) opens the screen.
StockChartgainsheaderTitle, 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.