Skip to content

Commit

Permalink
Merge pull request #625 from UnitapApp/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
PooyaFekri authored Sep 16, 2024
2 parents 097ce49 + ef9080e commit efd06a0
Show file tree
Hide file tree
Showing 14 changed files with 42 additions and 105 deletions.
2 changes: 1 addition & 1 deletion core/constraints/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
HasTwitter,
HasVoteOnATweet,
IsFollowingTwitterBatch,
IsFollowinTwitterUser,
IsFollowingTwitterUser,
)
from core.constraints.zora import DidMintZoraNFT

Expand Down
9 changes: 0 additions & 9 deletions core/constraints/arbitrum.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -146,6 +140,3 @@ class DidDelegateArbToAddress(DelegateArb):
ConstraintParam.ADDRESS,
ConstraintParam.MINIMUM,
)

def __init__(self, user_profile) -> None:
super().__init__(user_profile)
3 changes: 0 additions & 3 deletions core/constraints/ens.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
21 changes: 0 additions & 21 deletions core/constraints/farcaster.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand Down Expand Up @@ -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

Expand All @@ -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

Expand All @@ -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

Expand All @@ -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

Expand All @@ -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

Expand Down
12 changes: 0 additions & 12 deletions core/constraints/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand All @@ -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 = []
Expand Down
9 changes: 0 additions & 9 deletions core/constraints/gitcoin_passport.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand Down Expand Up @@ -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(
Expand Down
21 changes: 0 additions & 21 deletions core/constraints/lens.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand All @@ -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

Expand All @@ -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

Expand All @@ -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

Expand All @@ -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

Expand All @@ -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

Expand Down
4 changes: 2 additions & 2 deletions core/constraints/muon_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 0 additions & 3 deletions core/constraints/octant.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 0 additions & 6 deletions core/constraints/optimism.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -74,6 +71,3 @@ class DidDelegateOPToAddress(ConstraintVerification):
ConstraintParam.MINIMUM,
ConstraintParam.ADDRESS,
)

def __init__(self, user_profile) -> None:
super().__init__(user_profile)
17 changes: 1 addition & 16 deletions core/constraints/twitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand All @@ -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

Expand All @@ -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

Expand All @@ -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

Expand Down
4 changes: 2 additions & 2 deletions core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
IsFollowingFarcasterUser,
IsFollowingLensUser,
IsFollowingTwitterBatch,
IsFollowinTwitterUser,
IsFollowingTwitterUser,
)
from .utils import SolanaWeb3Utils, Web3Utils

Expand Down Expand Up @@ -146,7 +146,7 @@ class Type(models.TextChoices):
HasGitcoinPassportProfile,
IsFollowingFarcasterChannel,
BridgeEthToArb,
IsFollowinTwitterUser,
IsFollowingTwitterUser,
BeFollowedByTwitterUser,
DidRetweetTweet,
DidQuoteTweet,
Expand Down
18 changes: 18 additions & 0 deletions prizetap/migrations/0080_alter_constraint_name.py
Original file line number Diff line number Diff line change
@@ -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),
),
]
Loading

0 comments on commit efd06a0

Please sign in to comment.