From 9b35de669f87824bfc2ddc1f470cee1390e5e0fc Mon Sep 17 00:00:00 2001 From: cyrbuzz Date: Tue, 2 Jul 2024 17:13:48 +0800 Subject: [PATCH] chore: delegation limit --- .../DelegationCampaign/DelegationCampaign.tsx | 28 +++++++++++++++---- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/src/components/DelegationCampaign/DelegationCampaign.tsx b/src/components/DelegationCampaign/DelegationCampaign.tsx index 1e7582a..d20ca1b 100644 --- a/src/components/DelegationCampaign/DelegationCampaign.tsx +++ b/src/components/DelegationCampaign/DelegationCampaign.tsx @@ -40,7 +40,9 @@ const useAccount = () => { }; }; -const rankPointRule = (rank: number) => { +const minDelegationAmount = 3000; +const rankPointRule = (rank: number, delegation: string) => { + if (BigNumber(delegation).lt(minDelegationAmount)) return 0; if (rank === 1) return 15_000; if (rank === 2) return 10_000; if (rank === 3) return 5_000; @@ -50,8 +52,14 @@ const rankPointRule = (rank: number) => { return 0; }; -const delegationAmountPoint = (amount: string) => BigNumber(amount).decimalPlaces(0).div(10).toFixed(0); -const rewardsAmountPoint = (amount: string) => BigNumber(amount).decimalPlaces(0).multipliedBy(70).toFixed(0); +const delegationAmountPoint = (amount: string) => { + if (BigNumber(amount).lt(minDelegationAmount)) return '0'; + return BigNumber(amount).decimalPlaces(0).div(10).toFixed(0); +}; +const rewardsAmountPoint = (amount: string, delegation: string) => { + if (BigNumber(delegation).lt(minDelegationAmount)) return '0'; + return BigNumber(amount).decimalPlaces(0).multipliedBy(70).toFixed(0); +}; const FirstStep = (props: { userInfo?: IDelegationUserInfo['data']; refresh: () => void }) => { const { userInfo, refresh } = props; @@ -622,7 +630,12 @@ const SecondStep = (props: { userInfo?: IDelegationUserInfo['data'] }) => { Points for SQT Rewards
@@ -639,7 +652,12 @@ const SecondStep = (props: { userInfo?: IDelegationUserInfo['data'] }) => { Best Performing Delegators