+ {/* Header */}
+
+
+
+
Yield Accrual Calculator
+
+
+ See how your assets grow over time with compound interest using our yield-optimized settings.
+
+
+
+ {/* Input Controls */}
+
+ {/* Principal Amount Input */}
+
+
+ Principal Amount
+
+
+
+ {currency}
+ handleAmountChange(e.target.value)}
+ className="w-full rounded-lg border border-white/10 bg-[#0A0F11] px-3 py-2 text-sm text-slate-100 outline-none transition-colors placeholder:text-slate-600 focus:border-primary"
+ />
+
+
+
+ {/* Holding Period Input */}
+
+
+ Holding Period
+
+
+
+ handleYearsChange(e.target.value)}
+ className="w-full rounded-lg border border-white/10 bg-[#0A0F11] px-3 py-2 text-sm text-slate-100 outline-none transition-colors placeholder:text-slate-600 focus:border-primary"
+ />
+ years
+
+
+
+
+ {/* Token Selection */}
+ {showComparison && tokenRates.length > 1 && (
+
+
Token Selection
+
+ {tokenRates.map((token, index) => (
+
setSelectedTokenIndex(index)}
+ className={`rounded-lg border px-3 py-3 text-left transition-colors ${
+ selectedTokenIndex === index
+ ? 'border-primary bg-primary/10'
+ : 'border-white/10 bg-white/[0.02] hover:border-white/20'
+ }`}
+ >
+ {token.displayName}
+
+ {(token.rateBps / 100).toFixed(2)}% APY
+
+
+ ))}
+
+
+ )}
+
+ {/* Yield Chart */}
+
+
+ {/* Summary Cards */}
+
+ {/* Principal Card */}
+
+
+
+ {currency}
+ {principal.toLocaleString('en-US', {
+ minimumFractionDigits: 2,
+ maximumFractionDigits: 2,
+ })}
+
+
+
+ {/* Accrued Yield Card */}
+
+
+
+ {currency}
+ {selectedCalculation.finalAccruedYield.toLocaleString('en-US', {
+ minimumFractionDigits: 2,
+ maximumFractionDigits: 2,
+ })}
+
+
+ {(selectedCalculation.ratePercentage / 100).toFixed(2)}% annual rate
+
+
+
+ {/* Total Value Card */}
+
+
+
+ {currency}
+ {selectedCalculation.finalTotal.toLocaleString('en-US', {
+ minimumFractionDigits: 2,
+ maximumFractionDigits: 2,
+ })}
+
+
+ +{((selectedCalculation.finalAccruedYield / principal) * 100).toFixed(1)}% return
+
+
+
+
+ {/* Information Box */}
+
+
+ Note: This calculator uses a simple interest formula that mirrors our backend
+ yield calculations. Actual yields may vary based on market conditions and protocol changes.
+
+
+
+ );
+}
+
+/**
+ * Simple check circle icon component
+ */
+function CheckCircleIcon() {
+ return (
+
+
+ Year {data.year}, Month {data.month % 12}
+
+
+
+ Principal:
+
+ {currency}
+ {data.principal.toLocaleString('en-US', {
+ minimumFractionDigits: 2,
+ maximumFractionDigits: 2,
+ })}
+
+
+
+ Accrued Yield:
+
+ {currency}
+ {data.accruedYield.toLocaleString('en-US', {
+ minimumFractionDigits: 2,
+ maximumFractionDigits: 2,
+ })}
+
+
+
+ Total:
+
+ {currency}
+ {data.total.toLocaleString('en-US', {
+ minimumFractionDigits: 2,
+ maximumFractionDigits: 2,
+ })}
+
+
+
+ Yield Rate: {(data.yieldRate * 100).toFixed(2)}% APY
+
+
+
+ );
+}
+
+export function YieldChart({
+ data,
+ title = 'Projected Yield Over Time',
+ height = 300,
+ currency = '$',
+}: YieldChartProps) {
+ if (data.length === 0) {
+ return (
+