Skip to content

Commit ca115d1

Browse files
committed
feat: added fdv to the calculator
1 parent f00b685 commit ca115d1

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

src/components/infoTooltips/PointsBasedCampaignTooltip.tsx

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ export const PointsBasedCampaignTooltip = ({
2727
const [inkPriceInput, setInkPriceInput] = useState('');
2828
const [estimatedPointsValue, setEstimatedPointsValue] = useState<number | null>(null);
2929
const [estimatedAPY, setEstimatedAPY] = useState<number | null>(null);
30+
const [estimatedFDV, setEstimatedFDV] = useState<number | null>(null);
31+
const TOTAL_INK_SUPPLY = 1_000_000_000;
3032

3133
useEffect(() => {
3234
const timeoutId = window.setTimeout(() => {
@@ -35,6 +37,7 @@ export const PointsBasedCampaignTooltip = ({
3537
if (!trimmedValue) {
3638
setEstimatedPointsValue(null);
3739
setEstimatedAPY(null);
40+
setEstimatedFDV(null);
3841
return;
3942
}
4043

@@ -44,10 +47,12 @@ export const PointsBasedCampaignTooltip = ({
4447
if (!Number.isFinite(numericPrice) || numericPrice < 0) {
4548
setEstimatedPointsValue(null);
4649
setEstimatedAPY(null);
50+
setEstimatedFDV(null);
4751
return;
4852
}
4953
const dailyUsdValue = pointsPerThousandUsd * numericPrice;
5054
setEstimatedPointsValue(dailyUsdValue);
55+
setEstimatedFDV(numericPrice * TOTAL_INK_SUPPLY);
5156

5257
const aprDecimal = (dailyUsdValue / 1000) * 365;
5358
const apyDecimal = convertAprToApy(aprDecimal);
@@ -232,6 +237,29 @@ export const PointsBasedCampaignTooltip = ({
232237
%
233238
</Typography>
234239
</Box>
240+
<Box
241+
sx={{
242+
display: 'flex',
243+
alignItems: 'center',
244+
justifyContent: 'space-between',
245+
px: 1,
246+
py: 1,
247+
borderRadius: 1,
248+
backgroundColor: theme.palette.action.hover,
249+
}}
250+
>
251+
<Typography variant={typographyVariant} color={theme.palette.text.secondary}>
252+
FDV
253+
</Typography>
254+
<Typography variant={typographyVariant} sx={{ fontWeight: 500 }}>
255+
$
256+
<FormattedNumber
257+
value={estimatedFDV || 0}
258+
visibleDecimals={2}
259+
variant={typographyVariant}
260+
/>
261+
</Typography>
262+
</Box>
235263
</>
236264
)}
237265
</Box>

0 commit comments

Comments
 (0)