From 0233bc815d1adda63a893a61b8125d224d42d7b0 Mon Sep 17 00:00:00 2001 From: jeffyanta Date: Fri, 23 Jan 2026 15:57:12 -0500 Subject: [PATCH] Add 0 market cap values at range start times if the currency is created after it --- ocp/rpc/currency/server.go | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/ocp/rpc/currency/server.go b/ocp/rpc/currency/server.go index 9996106..67933f8 100644 --- a/ocp/rpc/currency/server.go +++ b/ocp/rpc/currency/server.go @@ -330,13 +330,25 @@ func (s *currencyServer) GetHistoricalMintData(ctx context.Context, req *currenc // Build historical data points with market cap var data []*currencypb.HistoricalMintData - // Add a 0 market cap value at time of currency creation if it falls within - // the start time if startTime.Before(metadataRecord.CreatedAt) { - data = append(data, ¤cypb.HistoricalMintData{ - Timestamp: timestamppb.New(metadataRecord.CreatedAt), - MarketCap: 0, - }) + if req.GetPredefinedRange() != currencypb.GetHistoricalMintDataRequest_ALL_TIME { + data = append( + data, + // 0 market cap value at the range start time + ¤cypb.HistoricalMintData{ + Timestamp: timestamppb.New(startTime), + MarketCap: 0, + }, + ) + } + data = append( + data, + // 0 market cap value at time of currency creation + ¤cypb.HistoricalMintData{ + Timestamp: timestamppb.New(metadataRecord.CreatedAt), + MarketCap: 0, + }, + ) } for _, reserve := range reserveHistory {