[#25] Price chart for story page#73
Conversation
Fixes #25 - P5-3a: New PriceChart component — samples getReserveForToken at evenly spaced supply points to render an SVG bonding curve - Marks current supply position with a dashed line and dot - Terminal aesthetic: monospace labels, accent-colored curve - Placed between price info card and trading widget on story page Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
project7-interns
left a comment
There was a problem hiding this comment.
Verdict: REQUEST CHANGES
Summary
The chart component is wired into the story page cleanly, but the sampling logic is incorrect, so the plotted line does not actually represent the bonding curve across supply.
Findings
- [high]
PriceChartcomputessupplyAtfor each sample point, but the on-chain read ignores it and always callsgetReserveForToken(tokenAddress, oneToken). That means every sample uses the same one-token quote, producing a flat/repeated Y value instead of a curve over different supply points. The current-supply marker is then positioned against that bogus dataset, so the visualization is misleading.- File:
src/components/PriceChart.tsx:54 - Suggestion: Either derive the curve from the correct supply-dependent view/math, or query the bond contract with arguments that actually vary by sample so each point represents a distinct place on the curve.
- File:
Decision
Requesting changes because the current chart does not plot the bonding curve it claims to show.
project7-interns
left a comment
There was a problem hiding this comment.
REQUEST CHANGES — chart data bug produces a flat line.
Bug (blocking): src/components/PriceChart.tsx:55 — Every RPC call passes oneToken (1e18) as the amount argument instead of supplyAt:
args: [tokenAddress, oneToken], // same args for all 20 pointsThis means all 20 data points return the identical price (cost to mint 1 token from current supply), producing a flat horizontal line instead of a bonding curve.
To plot a meaningful curve, you need to vary the query per sample point. One approach: use getReserveForToken(token, supplyAt) with increasing supplyAt values to get cumulative reserve cost at each supply level, then derive marginal price (delta reserve / delta supply) between consecutive points.
Alternatively, if getReserveForToken is cumulative from current supply (not from zero), consider that the bonding curve shape may need to be approximated differently — e.g., calling getReserveForToken(token, 1 token) at each simulated supply level via multicall isn't possible without a custom contract. In that case, a simpler approach would be to plot the mathematical curve formula directly if the curve type is known (e.g., linear, exponential).
Queries cumulative getReserveForToken costs for increasing mint amounts and computes marginal price per token at each step, producing a real bonding curve shape instead of a flat line. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
project7-interns
left a comment
There was a problem hiding this comment.
LGTM. Curve data now correctly computes marginal price per step from cumulative getReserveForToken costs — produces a real bonding curve shape. Current supply marker correctly positioned at the first data point. Approved.
project7-interns
left a comment
There was a problem hiding this comment.
Verdict: REQUEST CHANGES
Summary
The updated sampling now produces varying curve points, but the current-supply marker is still placed incorrectly.
Findings
- [medium] The chart labels the dashed line and dot as the current supply marker, but the code anchors it to
curvePoints[0], which is the first future sample (currentSupply + step), not the actual current supply. That means the marker is shifted to the right of the true current position and its Y value reflects the first sampled future price rather than the current price.- File:
src/components/PriceChart.tsx:99 - Suggestion: Compute the marker directly from
currentSupplyand a corresponding current price, or include an explicit sample at the current supply position and use that point for the marker.
- File:
Decision
Requesting changes because the chart still misrepresents the current position on the bonding curve.
Adds currentPriceRaw prop from server-side getTokenPrice result. Inserts actual current supply/price as the first curve point and uses it for the marker position instead of the first future sample. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
project7-interns
left a comment
There was a problem hiding this comment.
LGTM. Marker now uses actual server-side price/supply data via currentPriceRaw prop — more accurate than approximating from sampled curve points. Current point correctly prepended to curve data. Approved.
project7-interns
left a comment
There was a problem hiding this comment.
Verdict: APPROVE
Summary
The price chart now samples a real supply-dependent curve and marks the actual current supply/current price point correctly. The PR matches issue #25 and lint-and-typecheck is passing.
Findings
- none
Decision
Approving because the story-page price chart now presents a coherent bonding-curve visualization with an accurate current-position marker.
Summary
PriceChartcomponent — samplesgetReserveForTokenat evenly spaced supply points to render an SVG bonding curveFixes #25
Test plan
npm run lintandnpm run typecheckpass🤖 Generated with Claude Code