diff --git a/src/components/TrustScoreCalculator.tsx b/src/components/TrustScoreCalculator.tsx index 13c3076c..414c2c19 100644 --- a/src/components/TrustScoreCalculator.tsx +++ b/src/components/TrustScoreCalculator.tsx @@ -2,13 +2,21 @@ import React, { useState, useEffect } from 'react'; import { Calculator, TrendingUp, Users, BookOpen, Award } from 'lucide-react'; const TrustScoreCalculator: React.FC = () => { - const [stakingScore, setStakingScore] = useState(50); + const [stakedAmount, setStakedAmount] = useState(100); const [stakingMonths, setStakingMonths] = useState(6); const [referralCount, setReferralCount] = useState(5); const [perwerdeScore, setPerwerdeScore] = useState(30); const [tikiScore, setTikiScore] = useState(40); const [finalScore, setFinalScore] = useState(0); + // Calculate base amount score based on pallet_staking_score logic + const getAmountScore = (amount: number) => { + if (amount <= 100) return 20; + if (amount <= 250) return 30; + if (amount <= 750) return 40; + return 50; // 751+ HEZ + }; + // Calculate staking multiplier based on months const getStakingMultiplier = (months: number) => { if (months < 1) return 1.0; @@ -27,19 +35,20 @@ const TrustScoreCalculator: React.FC = () => { }; useEffect(() => { + const amountScore = getAmountScore(stakedAmount); const multiplier = getStakingMultiplier(stakingMonths); - const adjustedStaking = Math.min(stakingScore * multiplier, 100); + const adjustedStaking = Math.min(amountScore * multiplier, 100); const adjustedReferral = getReferralScore(referralCount); - - const weightedSum = - adjustedStaking * 100 + - adjustedReferral * 300 + - perwerdeScore * 300 + + + const weightedSum = + adjustedStaking * 100 + + adjustedReferral * 300 + + perwerdeScore * 300 + tikiScore * 300; - + const score = (adjustedStaking * weightedSum) / 1000; setFinalScore(Math.round(score)); - }, [stakingScore, stakingMonths, referralCount, perwerdeScore, tikiScore]); + }, [stakedAmount, stakingMonths, referralCount, perwerdeScore, tikiScore]); return (
@@ -60,24 +69,24 @@ const TrustScoreCalculator: React.FC = () => {
-

Staking Score

+

Staking Amount

- +
- + setStakingScore(parseInt(e.target.value))} + max="1000" + step="10" + value={stakedAmount} + onChange={(e) => setStakedAmount(parseInt(e.target.value))} className="w-full mt-2" /> -
- 0 - {stakingScore} - 100 +
+ {stakedAmount} HEZ + Score: {getAmountScore(stakedAmount)}
@@ -200,7 +209,7 @@ const TrustScoreCalculator: React.FC = () => {
Staking Component: - {Math.round(stakingScore * getStakingMultiplier(stakingMonths))} × 100 + {Math.min(Math.round(getAmountScore(stakedAmount) * getStakingMultiplier(stakingMonths)), 100)} × 100
Referral Component: