diff --git a/tokenTap/constants.py b/tokenTap/constants.py index 92448c3..58498a7 100644 --- a/tokenTap/constants.py +++ b/tokenTap/constants.py @@ -414,4 +414,3 @@ UNITAP_PASS_CLAIM_PERCENT = 0.3 -UNITAP_PASS_CLAIM_TIME_AVAILABLE = 0.3 diff --git a/tokenTap/models.py b/tokenTap/models.py index 72f8cc2..81be367 100644 --- a/tokenTap/models.py +++ b/tokenTap/models.py @@ -1,3 +1,5 @@ +from datetime import timedelta + from django.core.cache import cache from django.core.validators import MinValueValidator from django.db import models @@ -9,10 +11,7 @@ from core.utils import calculate_percentage_date from faucet.constraints import OptimismHasClaimedGasConstraint from faucet.models import ClaimReceipt -from tokenTap.constants import ( - UNITAP_PASS_CLAIM_PERCENT, - UNITAP_PASS_CLAIM_TIME_AVAILABLE, -) +from tokenTap.constants import UNITAP_PASS_CLAIM_PERCENT from .constraints import ( OnceInALifeTimeVerification, @@ -134,15 +133,15 @@ def max_claim_number_for_unitap_pass_user(self): @property def remaining_claim_for_unitap_pass_user(self): - remainingupclaims = self.max_claim_number_for_unitap_pass_user - if remainingupclaims is None: + total_claim_number_for_ups = self.max_claim_number_for_unitap_pass_user + if total_claim_number_for_ups is None: return None - if remainingupclaims == 0: + if total_claim_number_for_ups == 0: return 0 is_unitap_pass_share_count = self.claims.filter( is_unitap_pass_share=True ).count() - return remainingupclaims - is_unitap_pass_share_count + return total_claim_number_for_ups - is_unitap_pass_share_count @property def remaining_claim_for_normal_user(self): @@ -162,10 +161,15 @@ def remaining_claim_for_normal_user(self): @property def claim_deadline_for_unitap_pass_user(self): - return calculate_percentage_date( - self.start_at, - self.deadline, - UNITAP_PASS_CLAIM_TIME_AVAILABLE, + dist_duration = self.deadline - self.start_at + if dist_duration > timedelta(days=30): + return self.start_at + timedelta(days=3) + elif dist_duration >= timedelta(days=7) and dist_duration <= timedelta(days=30): + return self.start_at + timedelta(days=2) + + return min( + calculate_percentage_date(self.start_at, self.deadline, 0.5), + self.start_at + timedelta(days=1), ) @property