diff --git a/core/constraints/__init__.py b/core/constraints/__init__.py index 74decfe..4c6b0f8 100644 --- a/core/constraints/__init__.py +++ b/core/constraints/__init__.py @@ -62,7 +62,7 @@ HasTwitter, HasVoteOnATweet, IsFollowingTwitterBatch, - IsFollowinTwitterUser, + IsFollowingTwitterUser, ) from core.constraints.zora import DidMintZoraNFT diff --git a/core/constraints/arbitrum.py b/core/constraints/arbitrum.py index bc80222..c9c1714 100644 --- a/core/constraints/arbitrum.py +++ b/core/constraints/arbitrum.py @@ -14,9 +14,6 @@ class BridgeEthToArb(ConstraintVerification): app_name = ConstraintApp.ARBITRUM.value - def __init__(self, user_profile) -> None: - super().__init__(user_profile) - def is_observed(self, *args, **kwargs) -> bool: try: return self.has_bridged( @@ -107,9 +104,6 @@ class DelegateArb(ConstraintVerification): ] ARB_TOKEN_CONTRACT = "0x912CE59144191C1204E64559FE8253a0e49E6548" - def __init__(self, user_profile) -> None: - super().__init__(user_profile) - def is_observed(self, *args, **kwargs) -> bool: from core.models import Chain @@ -146,6 +140,3 @@ class DidDelegateArbToAddress(DelegateArb): ConstraintParam.ADDRESS, ConstraintParam.MINIMUM, ) - - def __init__(self, user_profile) -> None: - super().__init__(user_profile) diff --git a/core/constraints/ens.py b/core/constraints/ens.py index cd16092..bb26c57 100644 --- a/core/constraints/ens.py +++ b/core/constraints/ens.py @@ -5,9 +5,6 @@ class HasENSVerification(ConstraintVerification): _param_keys = [] app_name = ConstraintApp.ENS.value - def __init__(self, user_profile) -> None: - super().__init__(user_profile) - def is_observed(self, *args, **kwargs) -> bool: from authentication.models import ENSConnection diff --git a/core/constraints/farcaster.py b/core/constraints/farcaster.py index 0dd88eb..fe811fd 100644 --- a/core/constraints/farcaster.py +++ b/core/constraints/farcaster.py @@ -12,9 +12,6 @@ class HasFarcasterProfile(ConstraintVerification): _param_keys = [] app_name = ConstraintApp.FARCASTER.value - def __init__(self, user_profile) -> None: - super().__init__(user_profile) - def is_observed(self, *args, **kwargs) -> bool: from authentication.models import FarcasterConnection @@ -30,9 +27,6 @@ class IsFollowingFarcasterUser(ConstraintVerification): _param_keys = [ConstraintParam.FARCASTER_FID] app_name = ConstraintApp.FARCASTER.value - def __init__(self, user_profile) -> None: - super().__init__(user_profile) - def is_observed(self, *args, **kwargs) -> bool: from authentication.models import FarcasterConnection @@ -74,9 +68,6 @@ class DidLikedFarcasterCast(ConstraintVerification): _param_keys = [ConstraintParam.FARCASTER_CAST_HASH] app_name = ConstraintApp.FARCASTER.value - def __init__(self, user_profile) -> None: - super().__init__(user_profile) - def is_observed(self, *args, **kwargs) -> bool: from authentication.models import FarcasterConnection @@ -98,9 +89,6 @@ class DidRecastFarcasterCast(ConstraintVerification): _param_keys = [ConstraintParam.FARCASTER_CAST_HASH] app_name = ConstraintApp.FARCASTER.value - def __init__(self, user_profile) -> None: - super().__init__(user_profile) - def is_observed(self, *args, **kwargs) -> bool: from authentication.models import FarcasterConnection @@ -122,9 +110,6 @@ class HasMinimumFarcasterFollower(ConstraintVerification): _param_keys = [ConstraintParam.MINIMUM] app_name = ConstraintApp.FARCASTER.value - def __init__(self, user_profile) -> None: - super().__init__(user_profile) - def is_observed(self, *args, **kwargs) -> bool: from authentication.models import FarcasterConnection @@ -148,9 +133,6 @@ class IsFollowingFarcasterChannel(ConstraintVerification): _param_keys = [ConstraintParam.FARCASTER_CHANNEL_ID] app_name = ConstraintApp.FARCASTER.value - def __init__(self, user_profile) -> None: - super().__init__(user_profile) - def is_observed(self, *args, **kwargs) -> bool: from authentication.models import FarcasterConnection @@ -173,9 +155,6 @@ class IsFollowingFarcasterBatch(ConstraintVerification): _param_keys = [ConstraintParam.FARCASTER_FIDS] app_name = ConstraintApp.FARCASTER.value - def __init__(self, user_profile) -> None: - super().__init__(user_profile) - def get_info(self, *args, **kwargs) -> dict: from authentication.models import FarcasterConnection diff --git a/core/constraints/general.py b/core/constraints/general.py index 959c22f..249c07f 100644 --- a/core/constraints/general.py +++ b/core/constraints/general.py @@ -15,9 +15,6 @@ class HasNFTVerification(ConstraintVerification): ConstraintParam.MINIMUM, ] - def __init__(self, user_profile) -> None: - super().__init__(user_profile) - def is_observed(self, *args, **kwargs): from core.models import Chain @@ -49,9 +46,6 @@ class ABCTokenVerification(ConstraintVerification, ABC): ConstraintParam.MINIMUM, ] - def __init__(self, user_profile) -> None: - super().__init__(user_profile) - @abstractmethod def get_amount( self, user_address: str, token_address: str, token_client: TokenClient @@ -88,9 +82,6 @@ def is_observed(self, *args, **kwargs): class HasTokenVerification(ABCTokenVerification): - def __init__(self, user_profile) -> None: - super().__init__(user_profile) - def get_amount( self, user_address: str, token_address: None | str, token_client: TokenClient ) -> int: @@ -117,9 +108,6 @@ def get_amount( class AllowListVerification(ConstraintVerification): _param_keys = [ConstraintParam.CSV_FILE] - def __init__(self, user_profile) -> None: - super().__init__(user_profile) - def is_observed(self, *args, **kwargs): file_path = self.param_values[ConstraintParam.CSV_FILE.name] self.allow_list = [] diff --git a/core/constraints/gitcoin_passport.py b/core/constraints/gitcoin_passport.py index 0c45246..89d72b6 100644 --- a/core/constraints/gitcoin_passport.py +++ b/core/constraints/gitcoin_passport.py @@ -15,9 +15,6 @@ class HasGitcoinPassportProfile(ConstraintVerification): _param_keys = [] app_name = ConstraintApp.GITCOIN_PASSPORT.value - def __init__(self, user_profile) -> None: - super().__init__(user_profile) - def is_observed(self, *args, **kwargs) -> bool: from authentication.models import GitcoinPassportConnection @@ -37,9 +34,6 @@ class HasMinimumHumanityScore(ConstraintVerification): _param_keys = [ConstraintParam.MINIMUM] app_name = ConstraintApp.GITCOIN_PASSPORT.value - def __init__(self, user_profile) -> None: - super().__init__(user_profile) - def is_observed(self, *args, **kwargs) -> bool: from authentication.models import GitcoinPassportConnection @@ -72,9 +66,6 @@ class HasDonatedOnGitcoin(ConstraintVerification): app_name = ConstraintApp.GITCOIN_PASSPORT.value _graph_url = "https://grants-stack-indexer-v2.gitcoin.co" - def __init__(self, user_profile) -> None: - super().__init__(user_profile) - def is_observed(self, *args, **kwargs) -> bool: try: return self.has_donated( diff --git a/core/constraints/lens.py b/core/constraints/lens.py index 28a2e6e..4c017c1 100644 --- a/core/constraints/lens.py +++ b/core/constraints/lens.py @@ -12,9 +12,6 @@ class HasLensProfile(ConstraintVerification): _param_keys = [] app_name = ConstraintApp.LENS.value - def __init__(self, user_profile) -> None: - super().__init__(user_profile) - def is_observed(self, *args, **kwargs) -> bool: from authentication.models import LensConnection @@ -31,9 +28,6 @@ class IsFollowingLensUser(ConstraintVerification): _param_keys = [ConstraintParam.LENS_PROFILE_ID] app_name = ConstraintApp.LENS.value - def __init__(self, user_profile) -> None: - super().__init__(user_profile) - def is_observed(self, *args, **kwargs) -> bool: from authentication.models import LensConnection @@ -51,9 +45,6 @@ class BeFollowedByLensUser(ConstraintVerification): _param_keys = [ConstraintParam.LENS_PROFILE_ID] app_name = ConstraintApp.LENS.value - def __init__(self, user_profile) -> None: - super().__init__(user_profile) - def is_observed(self, *args, **kwargs) -> bool: from authentication.models import LensConnection @@ -73,9 +64,6 @@ class DidMirrorOnLensPublication(ConstraintVerification): _param_keys = [ConstraintParam.LENS_PUBLICATION_ID] app_name = ConstraintApp.LENS.value - def __init__(self, user_profile) -> None: - super().__init__(user_profile) - def is_observed(self, *args, **kwargs) -> bool: from authentication.models import LensConnection @@ -97,9 +85,6 @@ class DidCollectLensPublication(ConstraintVerification): _param_keys = [ConstraintParam.LENS_PUBLICATION_ID] app_name = ConstraintApp.LENS.value - def __init__(self, user_profile) -> None: - super().__init__(user_profile) - def is_observed(self, *args, **kwargs) -> bool: from authentication.models import LensConnection @@ -122,9 +107,6 @@ class HasMinimumLensFollower(ConstraintVerification): _param_keys = [ConstraintParam.MINIMUM] app_name = ConstraintApp.LENS.value - def __init__(self, user_profile) -> None: - super().__init__(user_profile) - def is_observed(self, *args, **kwargs) -> bool: from authentication.models import LensConnection @@ -148,9 +130,6 @@ class HasMinimumLensPost(ConstraintVerification): _param_keys = [ConstraintParam.MINIMUM] app_name = ConstraintApp.LENS.value - def __init__(self, user_profile) -> None: - super().__init__(user_profile) - def is_observed(self, *args, **kwargs) -> bool: from authentication.models import LensConnection diff --git a/core/constraints/muon_node.py b/core/constraints/muon_node.py index 4ac8d0d..ccea9d5 100644 --- a/core/constraints/muon_node.py +++ b/core/constraints/muon_node.py @@ -51,10 +51,10 @@ class HasMuonNode(ConstraintVerification): CHAIN_ID = 56 CONTRACT_ADDR = "0x6eA3096eB0fAf5c1DEb970DCd29A6b10a48DaD83" - def __init__(self, user_profile) -> None: + def __init__(self, user_profile, *, obj=None) -> None: from core.models import Chain - super().__init__(user_profile) + super().__init__(user_profile, obj=obj) self.chain = Chain.objects.get(chain_id=HasMuonNode.CHAIN_ID) self.web3_utils = Web3Utils(self.chain.rpc_url_private, self.chain.poa) self.web3_utils.set_contract(HasMuonNode.CONTRACT_ADDR, MUON_NODE_MANAGER_ABI) diff --git a/core/constraints/octant.py b/core/constraints/octant.py index 15b1af7..00599dc 100644 --- a/core/constraints/octant.py +++ b/core/constraints/octant.py @@ -17,9 +17,6 @@ class GLMStakingVerification(ConstraintVerification): ] GLM_CONTRACT_ADDRESS = "0x879133Fd79b7F48CE1c368b0fCA9ea168eaF117c" - def __init__(self, user_profile) -> None: - super().__init__(user_profile) - def is_observed(self, *args, **kwargs): from core.models import Chain diff --git a/core/constraints/optimism.py b/core/constraints/optimism.py index fe4a1c1..be182a0 100644 --- a/core/constraints/optimism.py +++ b/core/constraints/optimism.py @@ -35,9 +35,6 @@ class DelegateOP(ConstraintVerification): ] OP_TOKEN_CONTRACT = "0x4200000000000000000000000000000000000042" - def __init__(self, user_profile) -> None: - super().__init__(user_profile) - def is_observed(self, *args, **kwargs) -> bool: from core.models import Chain @@ -74,6 +71,3 @@ class DidDelegateOPToAddress(ConstraintVerification): ConstraintParam.MINIMUM, ConstraintParam.ADDRESS, ) - - def __init__(self, user_profile) -> None: - super().__init__(user_profile) diff --git a/core/constraints/twitter.py b/core/constraints/twitter.py index 6211800..28cd3dd 100644 --- a/core/constraints/twitter.py +++ b/core/constraints/twitter.py @@ -116,13 +116,10 @@ def is_observed(self, *args, **kwargs) -> bool: return False -class IsFollowinTwitterUser(ConstraintVerification): +class IsFollowingTwitterUser(ConstraintVerification): _param_keys = [ConstraintParam.TWITTER_USERNAME] app_name = ConstraintApp.TWITTER.value - def __init__(self, user_profile) -> None: - super().__init__(user_profile) - def is_observed(self, *args, **kwargs) -> bool: from authentication.models import TwitterConnection @@ -146,9 +143,6 @@ class BeFollowedByTwitterUser(ConstraintVerification): _param_keys = [ConstraintParam.TWITTER_USERNAME] app_name = ConstraintApp.TWITTER.value - def __init__(self, user_profile) -> None: - super().__init__(user_profile) - def is_observed(self, *args, **kwargs) -> bool: from authentication.models import TwitterConnection @@ -174,9 +168,6 @@ class DidRetweetTweet(ConstraintVerification): _param_keys = [ConstraintParam.TWEET_ID] app_name = ConstraintApp.TWITTER.value - def __init__(self, user_profile) -> None: - super().__init__(user_profile) - def is_observed(self, *args, **kwargs) -> bool: from authentication.models import TwitterConnection @@ -196,9 +187,6 @@ class DidQuoteTweet(ConstraintVerification): _param_keys = [ConstraintParam.TWEET_ID] app_name = ConstraintApp.TWITTER.value - def __init__(self, user_profile) -> None: - super().__init__(user_profile) - def is_observed(self, *args, **kwargs) -> bool: from authentication.models import TwitterConnection @@ -218,9 +206,6 @@ class IsFollowingTwitterBatch(ConstraintVerification): app_name = ConstraintApp.TWITTER.value _param_keys = [ConstraintParam.TWITTER_IDS] - def __init__(self, user_profile) -> None: - super().__init__(user_profile) - def get_info(self, *args, **kwargs) -> None | dict: from authentication.models import TwitterConnection diff --git a/core/models.py b/core/models.py index dea31cb..744534f 100644 --- a/core/models.py +++ b/core/models.py @@ -53,7 +53,7 @@ IsFollowingFarcasterUser, IsFollowingLensUser, IsFollowingTwitterBatch, - IsFollowinTwitterUser, + IsFollowingTwitterUser, ) from .utils import SolanaWeb3Utils, Web3Utils @@ -146,7 +146,7 @@ class Type(models.TextChoices): HasGitcoinPassportProfile, IsFollowingFarcasterChannel, BridgeEthToArb, - IsFollowinTwitterUser, + IsFollowingTwitterUser, BeFollowedByTwitterUser, DidRetweetTweet, DidQuoteTweet, diff --git a/prizetap/migrations/0080_alter_constraint_name.py b/prizetap/migrations/0080_alter_constraint_name.py new file mode 100644 index 0000000..9b210dc --- /dev/null +++ b/prizetap/migrations/0080_alter_constraint_name.py @@ -0,0 +1,18 @@ +# Generated by Django 5.0 on 2024-09-16 17:49 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('prizetap', '0079_fix_raffle_image_urls'), + ] + + operations = [ + migrations.AlterField( + model_name='constraint', + name='name', + field=models.CharField(choices=[('core.BrightIDMeetVerification', 'BrightIDMeetVerification'), ('core.BrightIDAuraVerification', 'BrightIDAuraVerification'), ('core.HasNFTVerification', 'HasNFTVerification'), ('core.HasTokenVerification', 'HasTokenVerification'), ('core.HasTokenTransferVerification', 'HasTokenTransferVerification'), ('core.AllowListVerification', 'AllowListVerification'), ('core.HasENSVerification', 'HasENSVerification'), ('core.HasLensProfile', 'HasLensProfile'), ('core.IsFollowingLensUser', 'IsFollowingLensUser'), ('core.BeFollowedByLensUser', 'BeFollowedByLensUser'), ('core.DidMirrorOnLensPublication', 'DidMirrorOnLensPublication'), ('core.DidCollectLensPublication', 'DidCollectLensPublication'), ('core.HasMinimumLensPost', 'HasMinimumLensPost'), ('core.HasMinimumLensFollower', 'HasMinimumLensFollower'), ('core.BeFollowedByFarcasterUser', 'BeFollowedByFarcasterUser'), ('core.HasMinimumFarcasterFollower', 'HasMinimumFarcasterFollower'), ('core.DidLikedFarcasterCast', 'DidLikedFarcasterCast'), ('core.DidRecastFarcasterCast', 'DidRecastFarcasterCast'), ('core.IsFollowingFarcasterUser', 'IsFollowingFarcasterUser'), ('core.HasFarcasterProfile', 'HasFarcasterProfile'), ('core.BeAttestedBy', 'BeAttestedBy'), ('core.Attest', 'Attest'), ('core.HasDonatedOnGitcoin', 'HasDonatedOnGitcoin'), ('core.HasMinimumHumanityScore', 'HasMinimumHumanityScore'), ('core.HasGitcoinPassportProfile', 'HasGitcoinPassportProfile'), ('core.IsFollowingFarcasterChannel', 'IsFollowingFarcasterChannel'), ('core.BridgeEthToArb', 'BridgeEthToArb'), ('core.IsFollowingTwitterUser', 'IsFollowingTwitterUser'), ('core.BeFollowedByTwitterUser', 'BeFollowedByTwitterUser'), ('core.DidRetweetTweet', 'DidRetweetTweet'), ('core.DidQuoteTweet', 'DidQuoteTweet'), ('core.HasMuonNode', 'HasMuonNode'), ('core.DelegateArb', 'DelegateArb'), ('core.DelegateOP', 'DelegateOP'), ('core.DidDelegateArbToAddress', 'DidDelegateArbToAddress'), ('core.DidDelegateOPToAddress', 'DidDelegateOPToAddress'), ('core.GLMStakingVerification', 'GLMStakingVerification'), ('core.IsFollowingTwitterBatch', 'IsFollowingTwitterBatch'), ('core.IsFollowingFarcasterBatch', 'IsFollowingFarcasterBatch'), ('core.HasVerifiedCloudflareCaptcha', 'HasVerifiedCloudflareCaptcha'), ('core.DidMintZoraNFT', 'DidMintZoraNFT'), ('core.HasVerifiedHCaptcha', 'HasVerifiedHCaptcha'), ('prizetap.HaveUnitapPass', 'HaveUnitapPass'), ('prizetap.NotHaveUnitapPass', 'NotHaveUnitapPass'), ('faucet.OptimismDonationConstraint', 'OptimismDonationConstraint'), ('faucet.OptimismClaimingGasConstraint', 'OptimismClaimingGasConstraint')], max_length=255, unique=True), + ), + ] diff --git a/tokenTap/migrations/0066_alter_constraint_name.py b/tokenTap/migrations/0066_alter_constraint_name.py new file mode 100644 index 0000000..5631d1e --- /dev/null +++ b/tokenTap/migrations/0066_alter_constraint_name.py @@ -0,0 +1,18 @@ +# Generated by Django 5.0 on 2024-09-16 17:49 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('tokenTap', '0065_fix_token_image_prefix'), + ] + + operations = [ + migrations.AlterField( + model_name='constraint', + name='name', + field=models.CharField(choices=[('core.BrightIDMeetVerification', 'BrightIDMeetVerification'), ('core.BrightIDAuraVerification', 'BrightIDAuraVerification'), ('core.HasNFTVerification', 'HasNFTVerification'), ('core.HasTokenVerification', 'HasTokenVerification'), ('core.HasTokenTransferVerification', 'HasTokenTransferVerification'), ('core.AllowListVerification', 'AllowListVerification'), ('core.HasENSVerification', 'HasENSVerification'), ('core.HasLensProfile', 'HasLensProfile'), ('core.IsFollowingLensUser', 'IsFollowingLensUser'), ('core.BeFollowedByLensUser', 'BeFollowedByLensUser'), ('core.DidMirrorOnLensPublication', 'DidMirrorOnLensPublication'), ('core.DidCollectLensPublication', 'DidCollectLensPublication'), ('core.HasMinimumLensPost', 'HasMinimumLensPost'), ('core.HasMinimumLensFollower', 'HasMinimumLensFollower'), ('core.BeFollowedByFarcasterUser', 'BeFollowedByFarcasterUser'), ('core.HasMinimumFarcasterFollower', 'HasMinimumFarcasterFollower'), ('core.DidLikedFarcasterCast', 'DidLikedFarcasterCast'), ('core.DidRecastFarcasterCast', 'DidRecastFarcasterCast'), ('core.IsFollowingFarcasterUser', 'IsFollowingFarcasterUser'), ('core.HasFarcasterProfile', 'HasFarcasterProfile'), ('core.BeAttestedBy', 'BeAttestedBy'), ('core.Attest', 'Attest'), ('core.HasDonatedOnGitcoin', 'HasDonatedOnGitcoin'), ('core.HasMinimumHumanityScore', 'HasMinimumHumanityScore'), ('core.HasGitcoinPassportProfile', 'HasGitcoinPassportProfile'), ('core.IsFollowingFarcasterChannel', 'IsFollowingFarcasterChannel'), ('core.BridgeEthToArb', 'BridgeEthToArb'), ('core.IsFollowingTwitterUser', 'IsFollowingTwitterUser'), ('core.BeFollowedByTwitterUser', 'BeFollowedByTwitterUser'), ('core.DidRetweetTweet', 'DidRetweetTweet'), ('core.DidQuoteTweet', 'DidQuoteTweet'), ('core.HasMuonNode', 'HasMuonNode'), ('core.DelegateArb', 'DelegateArb'), ('core.DelegateOP', 'DelegateOP'), ('core.DidDelegateArbToAddress', 'DidDelegateArbToAddress'), ('core.DidDelegateOPToAddress', 'DidDelegateOPToAddress'), ('core.GLMStakingVerification', 'GLMStakingVerification'), ('core.IsFollowingTwitterBatch', 'IsFollowingTwitterBatch'), ('core.IsFollowingFarcasterBatch', 'IsFollowingFarcasterBatch'), ('core.HasVerifiedCloudflareCaptcha', 'HasVerifiedCloudflareCaptcha'), ('core.DidMintZoraNFT', 'DidMintZoraNFT'), ('core.HasVerifiedHCaptcha', 'HasVerifiedHCaptcha'), ('tokenTap.OncePerMonthVerification', 'OncePerMonthVerification'), ('tokenTap.OnceInALifeTimeVerification', 'OnceInALifeTimeVerification'), ('faucet.OptimismHasClaimedGasConstraint', 'OptimismHasClaimedGasConstraint')], max_length=255, unique=True), + ), + ]