├── .DS_Store ├── .dockerignore ├── .env.test.example ├── .flake8 ├── .github └── workflows │ ├── dev-deploy.yml │ └── django.yml ├── .gitignore ├── .pre-commit-config.yaml ├── Dockerfile ├── LICENSE ├── Makefile ├── Procfile ├── README.md ├── analytics ├── __init__.py ├── apps.py ├── tests.py ├── urls.py └── views.py ├── authentication ├── __init__.py ├── admin.py ├── apps.py ├── helpers.py ├── migrations │ ├── 0001_initial.py │ ├── 0002_profile_initial_context_id.py │ ├── 0003_profile_user_solanawallet_evmwallet_and_more.py │ ├── 0004_alter_profile_initial_context_id.py │ ├── 0005_wallet_remove_evmwallet_profile_and_more.py │ ├── 0006_wallet_address.py │ ├── 0007_rename_profile_userprofile_and_more.py │ ├── 0008_alter_userprofile_user_alter_wallet_user_profile.py │ ├── 0009_temporarywalletaddress.py │ ├── 0010_userprofile_created_at_alter_wallet_wallet_type.py │ ├── 0011_alter_userprofile_created_at.py │ ├── 0012_alter_wallet_wallet_type_and_more.py │ ├── 0013_alter_wallet_wallet_type.py │ ├── 0014_alter_wallet_wallet_type.py │ ├── 0015_alter_wallet_wallet_type.py │ ├── 0016_userprofile_username_alter_wallet_wallet_type.py │ ├── 0017_alter_userprofile_username.py │ ├── 0018_alter_wallet_unique_together_wallet_primary.py │ ├── 0018_userprofile_is_temporary.py │ ├── 0019_alter_wallet_unique_together.py │ ├── 0019_rename_is_temporary_userprofile_is_new_by_wallet.py │ ├── 0020_remove_userprofile_is_new_by_wallet.py │ ├── 0021_merge_20231126_1858.py │ ├── 0022_remove_wallet_primary.py │ ├── 0023_wallet_created_at.py │ ├── 0024_alter_userprofile_initial_context_id.py │ ├── 0025_brightidconnection.py │ ├── 0026_wallet_deleted_wallet_deleted_by_cascade.py │ ├── 0027_alter_wallet_address_wallet_unique_wallet_address_and_more.py │ ├── 0028_remove_wallet_unique_wallet_address_and_more.py │ ├── 0029_remove_wallet_unique_wallet_address_and_more.py │ ├── 0030_auto_20240125_1045.py │ ├── 0031_userprofile_is_verified.py │ ├── 0032_gitcoinpassportconnection.py │ ├── 0033_twitterconnection.py │ ├── 0034_alter_twitterconnection_access_token_and_more.py │ ├── 0035_ensconnection.py │ ├── 0036_alter_wallet_wallet_type.py │ ├── 0037_alter_wallet_wallet_type.py │ ├── 0038_userprofile_prizetap_winning_chance_number_and_more.py │ ├── 0039_lensconnection_farcasterconnection.py │ ├── 0040_alter_brightidconnection_user_profile_and_more.py │ ├── 0041_alter_brightidconnection_user_profile_and_more.py │ ├── 0042_twitterconnection_twitter_id.py │ └── __init__.py ├── models.py ├── permissions.py ├── serializers.py ├── tests.py ├── thirdpartydrivers │ ├── __init__.py │ ├── abstract.py │ ├── bright_id.py │ ├── ens.py │ ├── farcaster.py │ ├── gitcoin_passport.py │ ├── lens.py │ └── twitter.py ├── urls.py └── views.py ├── brightIDfaucet ├── __init__.py ├── asgi.py ├── celery.py ├── settings.py ├── urls.py └── wsgi.py ├── core ├── __init__.py ├── admin.py ├── apps.py ├── constants.py ├── constraints │ ├── EAS.py │ ├── __init__.py │ ├── abstract.py │ ├── arbitrum.py │ ├── bright_id.py │ ├── captcha.py │ ├── ens.py │ ├── farcaster.py │ ├── general.py │ ├── gitcoin_passport.py │ ├── lens.py │ ├── muon_node.py │ ├── octant.py │ ├── optimism.py │ ├── telegram.py │ ├── twitter.py │ └── zora.py ├── fields.py ├── filters.py ├── helpers.py ├── messages.py ├── migrations │ ├── 0001_initial.py │ ├── 0002_alter_tokenprice_price_url.py │ ├── 0003_alter_tokenprice_price_url.py │ ├── 0004_walletaccount_chain.py │ ├── 0005_auto_20231203_0832.py │ ├── 0006_sponsor.py │ ├── 0007_alter_chain_chain_type_and_more.py │ ├── 0008_alter_chain_chain_type_and_more.py │ └── __init__.py ├── models.py ├── paginations.py ├── request_helper.py ├── serializers.py ├── swagger.py ├── tests.py ├── thirdpartyapp │ ├── EAS.py │ ├── __init__.py │ ├── cloudflare.py │ ├── config.py │ ├── ens.py │ ├── farcaster.py │ ├── gitcoin_graph.py │ ├── gitcoin_passport.py │ ├── hcaptcha.py │ ├── lens.py │ ├── subgraph.py │ ├── telegram.py │ ├── twitter.py │ └── zora.py ├── utils.py ├── validators.py └── views.py ├── docker-compose.yml ├── faucet ├── __init__.py ├── admin.py ├── apps.py ├── artwork.mp4 ├── celery_tasks.py ├── constants.py ├── constraints.py ├── faucet_manager │ ├── __init__.py │ ├── anchor_client │ │ ├── __init__.py │ │ ├── accounts │ │ │ ├── __init__.py │ │ │ └── lock_account.py │ │ ├── errors │ │ │ ├── __init__.py │ │ │ ├── anchor.py │ │ │ └── custom.py │ │ ├── instructions │ │ │ ├── __init__.py │ │ │ ├── change_operator.py │ │ │ ├── change_owner.py │ │ │ ├── emergency_withdraw.py │ │ │ ├── initialize.py │ │ │ ├── set_max_round_amount.py │ │ │ ├── set_period.py │ │ │ └── withdraw.py │ │ └── program_id.py │ ├── bright_id_interface.py │ ├── brightid_user_registry.py │ ├── brightid_user_registry_abi.py │ ├── claim_manager.py │ ├── credit_strategy.py │ ├── fund_manager.py │ ├── fund_manager_abi.py │ └── solana_client.py ├── filters.py ├── helpers.py ├── migrations │ ├── 0001_initial.py │ ├── 0002_brightuser__verification_status.py │ ├── 0003_brightuser_address.py │ ├── 0004_alter_brightuser_address.py │ ├── 0005_remove_brightuser_user.py │ ├── 0006_chain.py │ ├── 0007_claimreceipt.py │ ├── 0008_chain_max_claim_amount.py │ ├── 0009_chain_wallet_key.py │ ├── 0010_claimreceipt__status.py │ ├── 0011_rename_name_chain_chain_name_chain_decimals_and_more.py │ ├── 0012_chain_poa.py │ ├── 0013_chain_rpc_url_private.py │ ├── 0014_walletaccount_remove_chain_wallet_key_chain_wallet.py │ ├── 0015_chain_fund_manager_address.py │ ├── 0016_brightuser__sponsored.py │ ├── 0017_alter_chain_fund_manager_address_and_more.py │ ├── 0018_chain_order.py │ ├── 0019_brightuser__last_verified_datetime.py │ ├── 0019_globalsettings.py │ ├── 0020_merge_20220824_0830.py │ ├── 0021_chain_modal_url_alter_claimreceipt__status.py │ ├── 0022_chain_max_gas_price.py │ ├── 0023_transaction_batch.py │ ├── 0024_copy_tx_hash.py │ ├── 0025_remove_claimreceipt_tx_hash_and_more.py │ ├── 0026_transactionbatch_updating.py │ ├── 0027_chain_gas_multiplier.py │ ├── 0028_chain_needs_funding.py │ ├── 0029_chain_chain_type_chain_is_testnet.py │ ├── 0030_chain_gas_image_url.py │ ├── 0031_chain_is_active.py │ ├── 0032_remove_claimreceipt_bright_user_and_more.py │ ├── 0033_claimreceipt_bright_user_and_more.py │ ├── 0034_alter_claimreceipt_user_profile.py │ ├── 0035_claimreceipt_passive_address.py │ ├── 0036_alter_chain_chain_type.py │ ├── 0037_alter_chain_chain_type.py │ ├── 0038_alter_claimreceipt__status_and_more.py │ ├── 0039_alter_chain_chain_type.py │ ├── 0040_claimreceipt_last_updated.py │ ├── 0041_chain_enough_fee_multiplier.py │ ├── 0042_lightningconfig.py │ ├── 0042_walletaccount_network_type.py │ ├── 0043_alter_chain_chain_type_and_more.py │ ├── 0044_merge_20230507_1530.py │ ├── 0045_chain_tokentap_contract_address.py │ ├── 0046_globalsettings_tokentap_weekly_claim_limit.py │ ├── 0047_globalsettings_is_gas_tap_available.py │ ├── 0048_globalsettings_prizetap_weekly_claim_limit_and_more.py │ ├── 0049_remove_claimreceipt_already_processed_and_more.py │ ├── 0050_alter_chain_max_claim_amount.py │ ├── 0051_chain_show_in_gastap.py │ ├── 0052_alter_claimreceipt__status_and_more.py │ ├── 0053_tokenprice.py │ ├── 0054_donationreceipt_delete_tokenprice.py │ ├── 0055_donationreceipt_status_and_more.py │ ├── 0056_alter_claimreceipt_amount.py │ ├── 0057_alter_claimreceipt_amount.py │ ├── 0058_alter_claimreceipt_amount.py │ ├── 0059_chain_explorer_api_key_chain_explorer_api_url.py │ ├── 0060_alter_donationreceipt_status.py │ ├── 0060_rename_weekly_chain_claim_limit_globalsettings_gastap_claim_limit.py │ ├── 0061_rename_gastap_claim_limit_globalsettings_gastap_round_claim_limit.py │ ├── 0062_rename_tokentap_weekly_claim_limit_globalsettings_tokentap_round_claim_limit.py │ ├── 0063_rename_prizetap_weekly_claim_limit_globalsettings_prizetap_round_claim_limit.py │ ├── 0064_merge_20231108_1331.py │ ├── 0065_chain_is_one_time.py │ ├── 0065_rename_passive_address_claimreceipt_to_address.py │ ├── 0066_rename_is_one_time_chain_is_one_time_claim.py │ ├── 0067_auto_20231219_1401.py │ ├── 0067_merge_20231216_1727.py │ ├── 0067_merge_20231226_1046.py │ ├── 0068_merge_20240105_1916.py │ ├── 0069_merge_20240105_1932.py │ ├── 0070_delete_walletaccount.py │ ├── 0071_donationcontract_and_more.py │ ├── 0072_remove_globalsettings_gastap_round_claim_limit_and_more.py │ ├── 0073_faucet_fuel_level.py │ ├── 0074_faucet_is_deprecated.py │ ├── 0075_delete_lightningconfig.py │ ├── 0076_faucet_total_claims_since_last_round_and_more.py │ ├── 0077_faucet_used_unitap_pass_list.py │ ├── 0078_alter_faucet_used_unitap_pass_list.py │ └── __init__.py ├── models.py ├── serializers.py ├── tasks.py ├── tests.py ├── urls.py └── views.py ├── load_test.py ├── manage.py ├── prizetap ├── __init__.py ├── admin.py ├── apps.py ├── constants.py ├── constraints.py ├── migrations │ ├── 0001_initial.py │ ├── 0002_raffle_is_prize_nft.py │ ├── 0003_raffle_permissions.py │ ├── 0004_raffle_contract_raffle_raffleid_raffle_signer.py │ ├── 0005_alter_raffleentry_options.py │ ├── 0006_remove_raffle_winner_raffleentry_is_winner.py │ ├── 0007_remove_raffleentry_nonce.py │ ├── 0008_raffleentry_tx_hash.py │ ├── 0009_constraint_remove_raffle_permissions_and_more.py │ ├── 0010_raffleentry_claiming_prize_tx.py │ ├── 0011_rename_prize_raffle_prize_name_raffle_decimals_and_more.py │ ├── 0012_raffleentry_multiplier.py │ ├── 0013_constraint_type.py │ ├── 0014_constraint_description_constraint_title.py │ ├── 0015_raffle_constraint_params.py │ ├── 0016_remove_raffle_signer.py │ ├── 0017_remove_raffleentry_signature.py │ ├── 0018_raffle_max_multiplier_raffle_start_at.py │ ├── 0019_alter_raffle_chain.py │ ├── 0020_alter_raffle_deadline_and_more.py │ ├── 0021_alter_raffle_deadline_and_more.py │ ├── 0022_alter_constraint_name.py │ ├── 0023_alter_constraint_name.py │ ├── 0024_alter_raffle_prize_amount.py │ ├── 0025_alter_raffle_nft_id.py │ ├── 0026_alter_raffle_nft_id.py │ ├── 0027_raffle_status.py │ ├── 0028_remove_raffle_creator_raffle_creator_address_and_more.py │ ├── 0029_constraint_icon_url.py │ ├── 0030_alter_constraint_name.py │ ├── 0031_alter_constraint_name.py │ ├── 0032_linearaffleentries.py │ ├── 0033_alter_linearaffleentries_raffle.py │ ├── 0034_raffle_vrf_tx_hash_alter_raffle_status.py │ ├── 0035_alter_raffle_status.py │ ├── 0036_raffle_winners_count.py │ ├── 0037_alter_raffle_status.py │ ├── 0038_alter_constraint_name.py │ ├── 0039_rename_nft_id_raffle_nft_ids.py │ ├── 0040_alter_raffle_nft_ids.py │ ├── 0041_raffle_email_url_raffle_necessary_information_and_more.py │ ├── 0042_alter_raffle_max_multiplier_and_more.py │ ├── 0043_constraint_explanation.py │ ├── 0044_raffle_reversed_constraints.py │ ├── 0045_alter_raffle_chain.py │ ├── 0045_raffleentry_user_wallet_alter_raffleentry_raffle_and_more.py │ ├── 0046_alter_raffle_creator_name_alter_raffle_description.py │ ├── 0046_remove_raffleentry_user_wallet_and_more.py │ ├── 0047_alter_raffleentry_user_wallet_address.py │ ├── 0047_constraint_negative_description.py │ ├── 0048_merge_20231216_1727.py │ ├── 0048_merge_20231226_1046.py │ ├── 0049_merge_20240105_1905.py │ ├── 0050_merge_20240105_1916.py │ ├── 0051_alter_raffle_twitter_url.py │ ├── 0052_alter_constraint_name.py │ ├── 0053_alter_constraint_name.py │ ├── 0054_alter_constraint_name.py │ ├── 0055_alter_constraint_name.py │ ├── 0056_constraint_is_active.py │ ├── 0057_alter_constraint_name.py │ ├── 0058_alter_constraint_name.py │ ├── 0059_alter_constraint_name.py │ ├── 0060_alter_constraint_name.py │ ├── 0061_alter_constraint_name.py │ ├── 0062_raffle_is_processed_raffle_pre_enrollment_file_and_more.py │ ├── 0063_alter_raffleentry_user_profile.py │ ├── 0064_raffle_pre_enrollment_wallets.py │ ├── 0065_alter_constraint_name.py │ ├── 0066_alter_constraint_name.py │ ├── 0067_alter_constraint_name.py │ ├── 0068_alter_constraint_name.py │ ├── 0069_alter_constraint_name.py │ ├── 0070_alter_constraint_name.py │ ├── 0071_alter_constraint_name.py │ ├── 0072_alter_constraint_name.py │ ├── 0073_alter_constraint_name.py │ ├── 0074_alter_constraint_name.py │ ├── 0075_alter_constraint_name.py │ ├── 0076_alter_constraint_name.py │ ├── 0077_alter_constraint_name.py │ ├── 0077_remove_raffle_image_url_raffle_image.py │ ├── 0078_alter_constraint_name.py │ ├── 0079_fix_raffle_image_urls.py │ ├── 0080_alter_constraint_name.py │ ├── 0081_alter_constraint_name.py │ └── __init__.py ├── models.py ├── serializers.py ├── tasks.py ├── tests.py ├── urls.py ├── utils.py ├── validators.py └── views.py ├── pyproject.toml ├── quiztap ├── __init__.py ├── admin.py ├── apps.py ├── constants.py ├── filters.py ├── migrations │ ├── 0001_initial.py │ ├── 0002_remove_competition_rest_time_seconds_and_more.py │ ├── 0003_alter_useranswer_question_and_more.py │ ├── 0004_alter_competition_status.py │ ├── 0005_alter_useranswer_unique_together_and_more.py │ ├── 0006_question_answer_can_be_shown_question_can_be_shown.py │ ├── 0007_competition_title.py │ ├── 0008_alter_usercompetition_amount_won.py │ ├── 0009_competition_amount_won_competition_winner_count.py │ ├── 0010_alter_competition_sponsor.py │ ├── 0011_alter_competition_sponsor.py │ └── __init__.py ├── models.py ├── permissions.py ├── serializers.py ├── tasks.py ├── tests.py ├── urls.py ├── utils.py └── views.py ├── requirements.txt ├── requirements └── local.txt ├── sample.env ├── start.sh ├── start_dev.sh ├── telegram ├── __init__.py ├── admin.py ├── apps.py ├── bot.py ├── forms.py ├── messages │ ├── __init__.py │ ├── about.py │ ├── bug_reporter.py │ ├── easter_egg.py │ ├── gastap_stats.py │ ├── menu.py │ └── start.py ├── migrations │ ├── 0001_initial.py │ ├── 0002_alter_telegramconnection_options.py │ └── __init__.py ├── models.py ├── serializers.py ├── templates │ └── admin │ │ └── broadcast.html ├── tests.py ├── urls.py └── views.py ├── tmp.py └── tokenTap ├── __init__.py ├── admin.py ├── apps.py ├── constants.py ├── constraints.py ├── helpers.py ├── migrations ├── 0001_initial.py ├── 0002_tokendistribution_permissions.py ├── 0003_tokendistribution_max_number_of_claims.py ├── 0004_tokendistribution_notes.py ├── 0005_remove_tokendistributionclaim_signed_typed_data_and_more.py ├── 0006_remove_tokendistributionclaim_nonce_and_more.py ├── 0007_tokendistributionclaim_nonce_and_more.py ├── 0008_alter_tokendistributionclaim_signature.py ├── 0009_alter_tokendistributionclaim_signature.py ├── 0010_rename_distributer_tokendistribution_distributor_and_more.py ├── 0011_tokendistribution_is_active_and_more.py ├── 0012_tokendistributionclaim_status_and_more.py ├── 0013_alter_tokendistributionclaim_status.py ├── 0014_alter_tokendistributionclaim_status.py ├── 0015_constraint_alter_tokendistribution_permissions.py ├── 0016_alter_constraint_name.py ├── 0017_tokendistribution_token_image_url.py ├── 0018_constraint_icon_url.py ├── 0019_alter_constraint_name.py ├── 0020_alter_constraint_name.py ├── 0021_alter_constraint_name.py ├── 0022_constraint_explanation.py ├── 0023_alter_tokendistribution_chain.py ├── 0023_tokendistributionclaim_user_wallet_address.py ├── 0024_tokendistribution_contract.py ├── 0025_constraint_negative_description.py ├── 0025_merge_20231216_1727.py ├── 0025_merge_20231226_1046.py ├── 0026_merge_20240105_1905.py ├── 0027_merge_20240105_1916.py ├── 0028_rename_permissions_tokendistribution_constraints.py ├── 0029_tokendistribution_email_url_and_more.py ├── 0030_tokendistribution_distributor_address_and_more.py ├── 0031_tokendistribution_constraint_params_and_more.py ├── 0032_alter_constraint_name.py ├── 0033_globalsettings_alter_constraint_name.py ├── 0034_tokendistribution_distribution_id.py ├── 0035_tokendistribution_tx_hash.py ├── 0036_tokendistribution_decimals.py ├── 0037_alter_constraint_name.py ├── 0038_alter_constraint_name.py ├── 0039_tokendistribution_is_one_time_claim.py ├── 0040_alter_constraint_name.py ├── 0041_constraint_is_active.py ├── 0042_alter_constraint_name.py ├── 0043_alter_constraint_name.py ├── 0044_alter_constraint_name.py ├── 0045_alter_constraint_name.py ├── 0046_tokendistribution_check_for_extension.py ├── 0047_alter_constraint_name.py ├── 0048_alter_constraint_name.py ├── 0049_tokendistribution_used_unitap_pass_list_and_more.py ├── 0050_alter_tokendistribution_used_unitap_pass_list.py ├── 0051_alter_constraint_name.py ├── 0052_alter_constraint_name.py ├── 0053_alter_constraint_name.py ├── 0054_alter_constraint_name.py ├── 0055_alter_constraint_name.py ├── 0056_alter_constraint_name.py ├── 0057_alter_constraint_name.py ├── 0058_alter_constraint_name.py ├── 0059_alter_constraint_name.py ├── 0060_alter_constraint_name.py ├── 0061_alter_constraint_name.py ├── 0062_alter_constraint_name.py ├── 0063_alter_constraint_name.py ├── 0063_remove_tokendistribution_token_image_url_and_more.py ├── 0064_alter_constraint_name.py ├── 0065_fix_token_image_prefix.py ├── 0066_alter_constraint_name.py ├── 0067_alter_constraint_name.py └── __init__.py ├── models.py ├── serializers.py ├── tasks.py ├── tests.py ├── urls.py ├── utils.py ├── validators.py └── views.py /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UnitapApp/unitap-backend/95fe09d8f8519d6719a11716550b81f2e85531a2/.DS_Store -------------------------------------------------------------------------------- /.env.test.example: -------------------------------------------------------------------------------- 1 | LIGHTNING_INVOICE= 2 | LIGHTNING_RPC_URL= 3 | LIGHTNING_WALLET= 4 | LIGHTNING_FUND_MANAGER= 5 | CONSUMER_KEY= 6 | CONSUMER_SECRET= 7 | -------------------------------------------------------------------------------- /.flake8: -------------------------------------------------------------------------------- 1 | [flake8] 2 | max-line-length=88 3 | extend-ignore = E203 4 | per-file-ignores = __init__.py:F401 5 | -------------------------------------------------------------------------------- /.github/workflows/dev-deploy.yml: -------------------------------------------------------------------------------- 1 | name: Deploy to Server 2 | 3 | on: 4 | push: 5 | branches: 6 | - develop 7 | 8 | jobs: 9 | deploy: 10 | runs-on: ubuntu-latest 11 | 12 | steps: 13 | - name: Checkout code 14 | uses: actions/checkout@v2 15 | 16 | - name: Set up SSH 17 | uses: webfactory/ssh-agent@v0.5.3 18 | with: 19 | ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} 20 | 21 | - name: Disable Host Key Checking 22 | run: | 23 | mkdir -p ~/.ssh 24 | echo "StrictHostKeyChecking no" >> ~/.ssh/config 25 | 26 | - name: Push to Server 27 | run: | 28 | git remote add dokku dokku@70.34.210.129:unitap-dev 29 | git fetch --unshallow origin 30 | git push dokku develop -f -------------------------------------------------------------------------------- /.pre-commit-config.yaml: -------------------------------------------------------------------------------- 1 | exclude: .*migrations\/.* 2 | repos: 3 | - repo: https://github.com/pre-commit/pre-commit-hooks 4 | rev: v4.5.0 5 | hooks: 6 | - id: check-added-large-files 7 | args: ['--maxkb=100'] 8 | - id: check-yaml 9 | - id: end-of-file-fixer 10 | - id: trailing-whitespace 11 | - id: check-executables-have-shebangs 12 | - id: check-merge-conflict 13 | - id: check-shebang-scripts-are-executable 14 | - id: no-commit-to-branch 15 | args: ['--branch', main, '--branch', develop ] 16 | 17 | - repo: https://github.com/pycqa/isort 18 | rev: 5.12.0 19 | hooks: 20 | - id: isort 21 | name: isort (python) 22 | 23 | - repo: https://github.com/psf/black 24 | rev: 23.10.0 25 | hooks: 26 | - id: black 27 | language_version: python3.10 28 | 29 | - repo: https://github.com/pycqa/flake8 30 | rev: 6.0.0 31 | hooks: 32 | - id: flake8 33 | language_version: python3.10 34 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | # syntax=docker/dockerfile:1 2 | FROM --platform=linux/amd64 python:3.10.11 3 | WORKDIR /code 4 | RUN apt update && apt install gcc 5 | COPY ./requirements.txt /code/requirements.txt 6 | RUN pip install pip --upgrade 7 | RUN pip install -r requirements.txt 8 | COPY . . 9 | RUN mkdir db 10 | RUN mkdir -p static 11 | RUN mkdir media -p 12 | RUN chmod +x start_dev.sh 13 | 14 | EXPOSE 5678 15 | CMD ./start_dev.sh 16 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2025 Unitap 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: local-setup install-pre-commit install-local-reqs docker-build-dev docker-up-dev 2 | 3 | 4 | install-local-reqs: 5 | pip install -r requirements/local.txt 6 | 7 | install-pre-commit: 8 | pre-commit uninstall; pre-commit install 9 | 10 | setup-pre-commit: 11 | $(MAKE) install-local-reqs 12 | $(MAKE) install-pre-commit; 13 | 14 | docker-build-dev: 15 | docker-compose -f docker-compose.yml build 16 | 17 | docker-up-dev: 18 | docker-compose up -d --force-recreate --build 19 | 20 | docker-up-dev-log: 21 | docker-compose up --force-recreate --build 22 | 23 | docker-down-dev: 24 | docker-compose down 25 | 26 | docker-coverage-report: 27 | docker-compose exec -i backend bash -c "coverage run manage.py test; coverage report" 28 | 29 | docker-run-tests: 30 | docker-compose exec -i backend bash -c "python manage.py test" 31 | 32 | docker-run-tests-no-i: 33 | docker-compose exec backend bash -c "python manage.py test" 34 | docker-coverage-report-no-i: 35 | docker-compose exec backend bash -c "coverage run manage.py test; coverage report" 36 | -------------------------------------------------------------------------------- /Procfile: -------------------------------------------------------------------------------- 1 | worker: celery -A brightIDfaucet worker -B 2 | release: python manage.py migrate 3 | web: gunicorn brightIDfaucet.wsgi --workers 4 --threads 2 4 | -------------------------------------------------------------------------------- /analytics/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UnitapApp/unitap-backend/95fe09d8f8519d6719a11716550b81f2e85531a2/analytics/__init__.py -------------------------------------------------------------------------------- /analytics/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class AnalyticsConfig(AppConfig): 5 | default_auto_field = 'django.db.models.BigAutoField' 6 | name = 'analytics' 7 | -------------------------------------------------------------------------------- /analytics/urls.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | from django.urls import path 3 | 4 | from analytics.views import GetUserAnalytics 5 | 6 | admin.site.site_header = "Unitap Administration" 7 | admin.site.index_title = "Unitap Administration" 8 | admin.site.site_title = "Unitap Administration" 9 | 10 | app_name = "ANALYTICS" 11 | 12 | urlpatterns = [ 13 | path("user-analytics/", GetUserAnalytics.as_view(), name="get-user-analytics"), 14 | ] 15 | -------------------------------------------------------------------------------- /authentication/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UnitapApp/unitap-backend/95fe09d8f8519d6719a11716550b81f2e85531a2/authentication/__init__.py -------------------------------------------------------------------------------- /authentication/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class AuthenticationConfig(AppConfig): 5 | default_auto_field = 'django.db.models.BigAutoField' 6 | name = 'authentication' 7 | -------------------------------------------------------------------------------- /authentication/migrations/0001_initial.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-02-26 09:42 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | initial = True 9 | 10 | dependencies = [ 11 | ] 12 | 13 | operations = [ 14 | migrations.CreateModel( 15 | name='Profile', 16 | fields=[ 17 | ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 18 | ], 19 | ), 20 | ] 21 | -------------------------------------------------------------------------------- /authentication/migrations/0002_profile_initial_context_id.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-02-26 18:00 2 | 3 | from django.db import migrations, models 4 | import uuid 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('authentication', '0001_initial'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AddField( 15 | model_name='profile', 16 | name='initial_context_id', 17 | field=models.UUIDField(default=uuid.uuid4, unique=True), 18 | ), 19 | ] 20 | -------------------------------------------------------------------------------- /authentication/migrations/0004_alter_profile_initial_context_id.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-02-27 20:06 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('authentication', '0003_profile_user_solanawallet_evmwallet_and_more'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='profile', 15 | name='initial_context_id', 16 | field=models.CharField(max_length=512, unique=True), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /authentication/migrations/0006_wallet_address.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-02-28 12:23 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('authentication', '0005_wallet_remove_evmwallet_profile_and_more'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='wallet', 15 | name='address', 16 | field=models.CharField(default=0, max_length=512, unique=True), 17 | preserve_default=False, 18 | ), 19 | ] 20 | -------------------------------------------------------------------------------- /authentication/migrations/0007_rename_profile_userprofile_and_more.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-02-28 13:00 2 | 3 | from django.conf import settings 4 | from django.db import migrations 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | migrations.swappable_dependency(settings.AUTH_USER_MODEL), 11 | ('authentication', '0006_wallet_address'), 12 | ] 13 | 14 | operations = [ 15 | migrations.RenameModel( 16 | old_name='Profile', 17 | new_name='UserProfile', 18 | ), 19 | migrations.RenameField( 20 | model_name='wallet', 21 | old_name='profile', 22 | new_name='user_profile', 23 | ), 24 | migrations.AlterUniqueTogether( 25 | name='wallet', 26 | unique_together={('wallet_type', 'user_profile')}, 27 | ), 28 | ] 29 | -------------------------------------------------------------------------------- /authentication/migrations/0008_alter_userprofile_user_alter_wallet_user_profile.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-03-08 10:19 2 | 3 | from django.conf import settings 4 | from django.db import migrations, models 5 | import django.db.models.deletion 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | migrations.swappable_dependency(settings.AUTH_USER_MODEL), 12 | ('authentication', '0007_rename_profile_userprofile_and_more'), 13 | ] 14 | 15 | operations = [ 16 | migrations.AlterField( 17 | model_name='userprofile', 18 | name='user', 19 | field=models.OneToOneField(on_delete=django.db.models.deletion.PROTECT, related_name='profile', to=settings.AUTH_USER_MODEL), 20 | ), 21 | migrations.AlterField( 22 | model_name='wallet', 23 | name='user_profile', 24 | field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='wallets', to='authentication.userprofile'), 25 | ), 26 | ] 27 | -------------------------------------------------------------------------------- /authentication/migrations/0009_temporarywalletaddress.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-03-08 11:28 2 | 3 | from django.db import migrations, models 4 | import django.db.models.deletion 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('authentication', '0008_alter_userprofile_user_alter_wallet_user_profile'), 11 | ] 12 | 13 | operations = [ 14 | migrations.CreateModel( 15 | name='TemporaryWalletAddress', 16 | fields=[ 17 | ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 18 | ('address', models.CharField(max_length=512, unique=True)), 19 | ('created_at', models.DateTimeField(auto_now_add=True)), 20 | ('user_profile', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='temporary_wallet', to='authentication.userprofile')), 21 | ], 22 | ), 23 | ] 24 | -------------------------------------------------------------------------------- /authentication/migrations/0010_userprofile_created_at_alter_wallet_wallet_type.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-03-23 09:37 2 | 3 | import datetime 4 | from django.db import migrations, models 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('authentication', '0009_temporarywalletaddress'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AddField( 15 | model_name='userprofile', 16 | name='created_at', 17 | field=models.DateTimeField(auto_now_add=True, default=datetime.datetime(2023, 3, 23, 13, 7, 20, 593792)), 18 | preserve_default=False, 19 | ), 20 | migrations.AlterField( 21 | model_name='wallet', 22 | name='wallet_type', 23 | field=models.CharField(choices=[('EVM', 'EVM Wallet'), ('Solana', 'Solana Wallet'), ('Lightning', 'Lightning Wallet'), ('Non-EVM', 'Non-EVM Wallet')], max_length=10), 24 | ), 25 | ] 26 | -------------------------------------------------------------------------------- /authentication/migrations/0011_alter_userprofile_created_at.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-03-23 09:48 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('authentication', '0010_userprofile_created_at_alter_wallet_wallet_type'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='userprofile', 15 | name='created_at', 16 | field=models.DateTimeField(auto_now_add=True, null=True), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /authentication/migrations/0012_alter_wallet_wallet_type_and_more.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-03-23 10:43 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('authentication', '0011_alter_userprofile_created_at'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='wallet', 15 | name='wallet_type', 16 | field=models.CharField(choices=[('EVM', 'EVM Wallet'), ('Solana', 'Solana Wallet'), ('Lightning', 'Lightning Wallet'), ('NONEVM', 'Non-EVM Wallet')], max_length=10), 17 | ), 18 | migrations.DeleteModel( 19 | name='TemporaryWalletAddress', 20 | ), 21 | ] 22 | -------------------------------------------------------------------------------- /authentication/migrations/0013_alter_wallet_wallet_type.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-04-03 10:02 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('authentication', '0012_alter_wallet_wallet_type_and_more'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='wallet', 15 | name='wallet_type', 16 | field=models.CharField(choices=[('EVM', 'EVM'), ('Solana', 'Solana'), ('Lightning', 'Lightning'), ('NONEVM', 'Non-EVM')], max_length=10), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /authentication/migrations/0014_alter_wallet_wallet_type.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-04-03 14:11 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('authentication', '0013_alter_wallet_wallet_type'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='wallet', 15 | name='wallet_type', 16 | field=models.CharField(choices=[('EVM', 'EVM'), ('Solana', 'Solana'), ('Lightning', 'Lightning'), ('Non-EVM', 'Non-EVM')], max_length=10), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /authentication/migrations/0015_alter_wallet_wallet_type.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-04-03 18:18 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('authentication', '0014_alter_wallet_wallet_type'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='wallet', 15 | name='wallet_type', 16 | field=models.CharField(choices=[('EVM', 'EVM'), ('Solana', 'Solana'), ('Lightning', 'Lightning'), ('NONEVM', 'NONEVM')], max_length=10), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /authentication/migrations/0016_userprofile_username_alter_wallet_wallet_type.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-04-29 06:23 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('authentication', '0015_alter_wallet_wallet_type'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='userprofile', 15 | name='username', 16 | field=models.CharField(blank=True, max_length=24, null=True, unique=True), 17 | ), 18 | migrations.AlterField( 19 | model_name='wallet', 20 | name='wallet_type', 21 | field=models.CharField(choices=[('EVM', 'EVM'), ('Solana', 'Solana'), ('Lightning', 'Lightning'), ('NONEVM', 'NONEVM'), ('NONEVMXDC', 'NONEVMXDC')], max_length=10), 22 | ), 23 | ] 24 | -------------------------------------------------------------------------------- /authentication/migrations/0017_alter_userprofile_username.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-05-10 09:45 2 | 3 | import django.core.validators 4 | from django.db import migrations, models 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('authentication', '0016_userprofile_username_alter_wallet_wallet_type'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AlterField( 15 | model_name='userprofile', 16 | name='username', 17 | field=models.CharField(blank=True, max_length=150, null=True, unique=True, validators=[django.core.validators.RegexValidator(message='Username can only contain letters, digits and @/./+/-/_.', regex='^[\\w.@+-]+$')]), 18 | ), 19 | ] 20 | -------------------------------------------------------------------------------- /authentication/migrations/0018_alter_wallet_unique_together_wallet_primary.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-09-27 11:03 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('authentication', '0017_alter_userprofile_username'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterUniqueTogether( 14 | name='wallet', 15 | unique_together={('wallet_type', 'address')}, 16 | ), 17 | migrations.AddField( 18 | model_name='wallet', 19 | name='primary', 20 | field=models.BooleanField(default=False), 21 | ), 22 | ] 23 | -------------------------------------------------------------------------------- /authentication/migrations/0018_userprofile_is_temporary.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-10-10 11:59 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('authentication', '0017_alter_userprofile_username'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='userprofile', 15 | name='is_temporary', 16 | field=models.BooleanField(default=False), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /authentication/migrations/0019_alter_wallet_unique_together.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-09-28 03:27 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('authentication', '0018_alter_wallet_unique_together_wallet_primary'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterUniqueTogether( 14 | name='wallet', 15 | unique_together=set(), 16 | ), 17 | ] 18 | -------------------------------------------------------------------------------- /authentication/migrations/0019_rename_is_temporary_userprofile_is_new_by_wallet.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-10-10 17:38 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('authentication', '0018_userprofile_is_temporary'), 10 | ] 11 | 12 | operations = [ 13 | migrations.RenameField( 14 | model_name='userprofile', 15 | old_name='is_temporary', 16 | new_name='is_new_by_wallet', 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /authentication/migrations/0020_remove_userprofile_is_new_by_wallet.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-10-10 23:03 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('authentication', '0019_rename_is_temporary_userprofile_is_new_by_wallet'), 10 | ] 11 | 12 | operations = [ 13 | migrations.RemoveField( 14 | model_name='userprofile', 15 | name='is_new_by_wallet', 16 | ), 17 | ] 18 | -------------------------------------------------------------------------------- /authentication/migrations/0021_merge_20231126_1858.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-11-26 18:58 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('authentication', '0019_alter_wallet_unique_together'), 10 | ('authentication', '0020_remove_userprofile_is_new_by_wallet'), 11 | ] 12 | 13 | operations = [ 14 | ] 15 | -------------------------------------------------------------------------------- /authentication/migrations/0022_remove_wallet_primary.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-11-30 12:02 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('authentication', '0021_merge_20231126_1858'), 10 | ] 11 | 12 | operations = [ 13 | migrations.RemoveField( 14 | model_name='wallet', 15 | name='primary', 16 | ), 17 | ] 18 | -------------------------------------------------------------------------------- /authentication/migrations/0023_wallet_created_at.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-11-30 15:49 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('authentication', '0022_remove_wallet_primary'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='wallet', 15 | name='created_at', 16 | field=models.DateTimeField(auto_now_add=True, null=True), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /authentication/migrations/0024_alter_userprofile_initial_context_id.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-12-20 19:39 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('authentication', '0023_wallet_created_at'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='userprofile', 15 | name='initial_context_id', 16 | field=models.CharField(blank=True, max_length=512, null=True, unique=True), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /authentication/migrations/0025_brightidconnection.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-12-20 23:49 2 | 3 | from django.db import migrations, models 4 | import django.db.models.deletion 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('authentication', '0024_alter_userprofile_initial_context_id'), 11 | ] 12 | 13 | operations = [ 14 | migrations.CreateModel( 15 | name='BrightIDConnection', 16 | fields=[ 17 | ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 18 | ('created_at', models.DateTimeField(auto_now_add=True, null=True)), 19 | ('context_id', models.CharField(max_length=512, unique=True)), 20 | ('user_profile', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='%(class)s', to='authentication.userprofile')), 21 | ], 22 | options={ 23 | 'abstract': False, 24 | }, 25 | ), 26 | ] 27 | -------------------------------------------------------------------------------- /authentication/migrations/0026_wallet_deleted_wallet_deleted_by_cascade.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2024-01-08 13:48 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('authentication', '0025_brightidconnection'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='wallet', 15 | name='deleted', 16 | field=models.DateTimeField(db_index=True, editable=False, null=True), 17 | ), 18 | migrations.AddField( 19 | model_name='wallet', 20 | name='deleted_by_cascade', 21 | field=models.BooleanField(default=False, editable=False), 22 | ), 23 | ] 24 | -------------------------------------------------------------------------------- /authentication/migrations/0029_remove_wallet_unique_wallet_address_and_more.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2024-01-12 12:54 2 | 3 | from django.db import migrations, models 4 | import django.db.models.expressions 5 | import django.db.models.functions.text 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('authentication', '0028_remove_wallet_unique_wallet_address_and_more'), 12 | ] 13 | 14 | operations = [ 15 | migrations.RemoveConstraint( 16 | model_name='wallet', 17 | name='unique_wallet_address', 18 | ), 19 | migrations.RemoveConstraint( 20 | model_name='wallet', 21 | name='unique_wallet_user_profile_address', 22 | ), 23 | migrations.AddConstraint( 24 | model_name='wallet', 25 | constraint=models.UniqueConstraint(django.db.models.functions.text.Lower('address'), django.db.models.expressions.F('wallet_type'), name='unique_wallet_address'), 26 | ), 27 | ] 28 | -------------------------------------------------------------------------------- /authentication/migrations/0031_userprofile_is_verified.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2024-03-14 05:12 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('authentication', '0030_auto_20240125_1045'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='userprofile', 15 | name='is_verified', 16 | field=models.BooleanField(default=False), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /authentication/migrations/0032_gitcoinpassportconnection.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2024-03-31 13:25 2 | 3 | from django.db import migrations, models 4 | import django.db.models.deletion 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('authentication', '0031_userprofile_is_verified'), 11 | ] 12 | 13 | operations = [ 14 | migrations.CreateModel( 15 | name='GitcoinPassportConnection', 16 | fields=[ 17 | ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 18 | ('created_at', models.DateTimeField(auto_now_add=True, null=True)), 19 | ('user_wallet_address', models.CharField(max_length=255)), 20 | ('user_profile', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='%(class)s', to='authentication.userprofile')), 21 | ], 22 | options={ 23 | 'abstract': False, 24 | }, 25 | ), 26 | ] 27 | -------------------------------------------------------------------------------- /authentication/migrations/0034_alter_twitterconnection_access_token_and_more.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2024-04-29 19:13 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('authentication', '0033_twitterconnection'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='twitterconnection', 15 | name='access_token', 16 | field=models.CharField(blank=True, max_length=255, null=True, unique=True), 17 | ), 18 | migrations.AlterField( 19 | model_name='twitterconnection', 20 | name='access_token_secret', 21 | field=models.CharField(blank=True, max_length=255, null=True, unique=True), 22 | ), 23 | ] 24 | -------------------------------------------------------------------------------- /authentication/migrations/0035_ensconnection.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2024-05-22 14:07 2 | 3 | from django.db import migrations, models 4 | import django.db.models.deletion 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('authentication', '0034_alter_twitterconnection_access_token_and_more'), 11 | ] 12 | 13 | operations = [ 14 | migrations.CreateModel( 15 | name='ENSConnection', 16 | fields=[ 17 | ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 18 | ('created_at', models.DateTimeField(auto_now_add=True, null=True)), 19 | ('user_wallet_address', models.CharField(max_length=255)), 20 | ('user_profile', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='%(class)s', to='authentication.userprofile')), 21 | ], 22 | options={ 23 | 'abstract': False, 24 | }, 25 | ), 26 | ] 27 | -------------------------------------------------------------------------------- /authentication/migrations/0036_alter_wallet_wallet_type.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2024-05-31 10:53 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('authentication', '0035_ensconnection'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='wallet', 15 | name='wallet_type', 16 | field=models.CharField(choices=[('EVM', 'EVM'), ('Solana', 'Solana'), ('NONEVM', 'NONEVM'), ('NONEVMXDC', 'NONEVMXDC')], max_length=10), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /authentication/migrations/0037_alter_wallet_wallet_type.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2024-05-31 11:28 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('authentication', '0036_alter_wallet_wallet_type'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='wallet', 15 | name='wallet_type', 16 | field=models.CharField(choices=[('EVM', 'EVM'), ('Solana', 'Solana'), ('Lightning', 'Lightning'), ('NONEVM', 'NONEVM'), ('NONEVMXDC', 'NONEVMXDC')], max_length=10), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /authentication/migrations/0038_userprofile_prizetap_winning_chance_number_and_more.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2024-06-28 15:51 2 | 3 | import django.core.validators 4 | from django.db import migrations, models 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('authentication', '0037_alter_wallet_wallet_type'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AddField( 15 | model_name='userprofile', 16 | name='prizetap_winning_chance_number', 17 | field=models.IntegerField(default=0, validators=[django.core.validators.MinValueValidator(0)]), 18 | ), 19 | migrations.AlterField( 20 | model_name='wallet', 21 | name='address', 22 | field=models.CharField(db_index=True, max_length=512), 23 | ), 24 | ] 25 | -------------------------------------------------------------------------------- /authentication/migrations/0042_twitterconnection_twitter_id.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2024-08-30 15:47 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('authentication', '0041_alter_brightidconnection_user_profile_and_more'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='twitterconnection', 15 | name='twitter_id', 16 | field=models.CharField(max_length=255, null=True, unique=True), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /authentication/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UnitapApp/unitap-backend/95fe09d8f8519d6719a11716550b81f2e85531a2/authentication/migrations/__init__.py -------------------------------------------------------------------------------- /authentication/permissions.py: -------------------------------------------------------------------------------- 1 | from rest_framework.permissions import BasePermission 2 | 3 | 4 | class IsMeetVerified(BasePermission): 5 | """ 6 | Allows access only to Meet verified users. 7 | """ 8 | 9 | def has_permission(self, request, view): 10 | return bool(request.user.profile.is_meet_verified) 11 | 12 | 13 | class IsAuraVerified(BasePermission): 14 | """ 15 | Allows access only to Aura verified users. 16 | """ 17 | 18 | def has_permission(self, request, view): 19 | return bool(request.user.profile.is_aura_verified) 20 | 21 | 22 | class IsOwner(BasePermission): 23 | """ 24 | Just owner can access 25 | """ 26 | 27 | def has_object_permission(self, request, view, obj): 28 | return obj.user_profile == request.user.profile 29 | -------------------------------------------------------------------------------- /authentication/thirdpartydrivers/__init__.py: -------------------------------------------------------------------------------- 1 | from .abstract import BaseThirdPartyDriver 2 | from .bright_id import BrightIDConnectionDriver 3 | from .ens import ENSDriver 4 | from .farcaster import FarcasterDriver 5 | from .gitcoin_passport import GitcoinPassportDriver 6 | from .lens import LensDriver 7 | from .twitter import TwitterDriver 8 | -------------------------------------------------------------------------------- /authentication/thirdpartydrivers/abstract.py: -------------------------------------------------------------------------------- 1 | from abc import ABC 2 | 3 | 4 | class BaseThirdPartyDriver(ABC): 5 | pass 6 | -------------------------------------------------------------------------------- /authentication/thirdpartydrivers/ens.py: -------------------------------------------------------------------------------- 1 | from authentication.thirdpartydrivers.abstract import BaseThirdPartyDriver 2 | from core.thirdpartyapp import ENSUtil 3 | 4 | 5 | class ENSDriver(BaseThirdPartyDriver): 6 | def get_name(self, address: str) -> None | str: 7 | ens = ENSUtil() 8 | return ens.get_name(address) 9 | 10 | def get_address(self, name: str) -> str: 11 | ens = ENSUtil() 12 | return ens.get_address(name) 13 | -------------------------------------------------------------------------------- /authentication/thirdpartydrivers/farcaster.py: -------------------------------------------------------------------------------- 1 | from authentication.thirdpartydrivers.abstract import BaseThirdPartyDriver 2 | from core.thirdpartyapp import FarcasterUtil 3 | 4 | 5 | class FarcasterDriver(BaseThirdPartyDriver): 6 | def get_fid(self, address): 7 | fa = FarcasterUtil() 8 | return fa.get_address_fid(address) 9 | -------------------------------------------------------------------------------- /authentication/thirdpartydrivers/gitcoin_passport.py: -------------------------------------------------------------------------------- 1 | from authentication.thirdpartydrivers.abstract import BaseThirdPartyDriver 2 | from core.thirdpartyapp import GitcoinPassport 3 | 4 | 5 | class GitcoinPassportDriver(BaseThirdPartyDriver): 6 | def submit_passport(self, address: str) -> None | str: 7 | gp = GitcoinPassport() 8 | return gp.submit_passport(address) 9 | 10 | def get_score(self, address: str) -> None | tuple: 11 | gp = GitcoinPassport() 12 | return gp.get_score(address) 13 | -------------------------------------------------------------------------------- /authentication/thirdpartydrivers/lens.py: -------------------------------------------------------------------------------- 1 | from authentication.thirdpartydrivers.abstract import BaseThirdPartyDriver 2 | from core.thirdpartyapp import LensUtil 3 | 4 | 5 | class LensDriver(BaseThirdPartyDriver): 6 | def get_profile_id(self, address): 7 | lens = LensUtil() 8 | return lens.get_profile_id(address) 9 | -------------------------------------------------------------------------------- /brightIDfaucet/__init__.py: -------------------------------------------------------------------------------- 1 | # This will make sure the app is always imported when 2 | # Django starts so that shared_task will use this app. 3 | from .celery import app as celery_app 4 | 5 | __all__ = ('celery_app',) 6 | -------------------------------------------------------------------------------- /brightIDfaucet/asgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | ASGI config for brightIDfaucet project. 3 | 4 | It exposes the ASGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/4.0/howto/deployment/asgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.asgi import get_asgi_application 13 | 14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'brightIDfaucet.settings') 15 | 16 | application = get_asgi_application() 17 | -------------------------------------------------------------------------------- /brightIDfaucet/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for brightIDfaucet project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/4.0/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.wsgi import get_wsgi_application 13 | 14 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "brightIDfaucet.settings") 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /core/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UnitapApp/unitap-backend/95fe09d8f8519d6719a11716550b81f2e85531a2/core/__init__.py -------------------------------------------------------------------------------- /core/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class CoreConfig(AppConfig): 5 | default_auto_field = 'django.db.models.BigAutoField' 6 | name = 'core' 7 | -------------------------------------------------------------------------------- /core/constraints/bright_id.py: -------------------------------------------------------------------------------- 1 | from core.constraints.abstract import ConstraintApp, ConstraintVerification 2 | 3 | 4 | class BrightIDMeetVerification(ConstraintVerification): 5 | app_name = ConstraintApp.BRIGHT_ID.value 6 | 7 | def is_observed(self, *args, **kwargs): 8 | return self.user_profile.is_meet_verified 9 | 10 | 11 | class BrightIDAuraVerification(ConstraintVerification): 12 | app_name = ConstraintApp.BRIGHT_ID.value 13 | 14 | def is_observed(self, *args, **kwargs): 15 | return self.user_profile.is_aura_verified 16 | -------------------------------------------------------------------------------- /core/constraints/ens.py: -------------------------------------------------------------------------------- 1 | from core.constraints.abstract import ConstraintApp, ConstraintVerification 2 | 3 | 4 | class HasENSVerification(ConstraintVerification): 5 | _param_keys = [] 6 | app_name = ConstraintApp.ENS.value 7 | 8 | def is_observed(self, *args, **kwargs) -> bool: 9 | from authentication.models import ENSConnection 10 | 11 | try: 12 | ens = ENSConnection.get_connection(self.user_profile) 13 | except ENSConnection.DoesNotExist: 14 | return False 15 | return ens.is_connected() 16 | -------------------------------------------------------------------------------- /core/constraints/telegram.py: -------------------------------------------------------------------------------- 1 | import logging 2 | 3 | from core.constraints.abstract import ( 4 | ConstraintApp, 5 | ConstraintVerification, 6 | ) 7 | 8 | 9 | logger = logging.getLogger(__name__) 10 | 11 | 12 | class HasTelegramConnection(ConstraintVerification): 13 | _param_keys = [] 14 | app_name = ConstraintApp.GENERAL.value 15 | 16 | def is_observed(self, *args, **kwargs) -> bool: 17 | from telegram.models import TelegramConnection 18 | 19 | try: 20 | twitter = TelegramConnection.get_connection(self.user_profile) 21 | except TelegramConnection.DoesNotExist: 22 | return False 23 | return twitter.is_connected() 24 | -------------------------------------------------------------------------------- /core/fields.py: -------------------------------------------------------------------------------- 1 | """ 2 | Contains all the fields related classes to support custom features 3 | such as variants in Cloudflare Images 4 | """ 5 | 6 | from django.db import models 7 | 8 | 9 | class BigNumField(models.Field): 10 | empty_strings_allowed = False 11 | 12 | def __init__(self, *args, **kwargs): 13 | kwargs["max_length"] = 200 # or some other number 14 | super().__init__(*args, **kwargs) 15 | 16 | def db_type(self, connection): 17 | return "numeric" 18 | 19 | def get_internal_type(self): 20 | return "BigNumField" 21 | 22 | def to_python(self, value): 23 | if isinstance(value, str): 24 | return int(value) 25 | 26 | return value 27 | 28 | def get_prep_value(self, value): 29 | return str(value) 30 | 31 | -------------------------------------------------------------------------------- /core/helpers.py: -------------------------------------------------------------------------------- 1 | import time 2 | from contextlib import contextmanager 3 | from django.core.cache import cache 4 | 5 | @contextmanager 6 | def memcache_lock(lock_id, oid, lock_expire=60): 7 | timeout_at = time.monotonic() + lock_expire 8 | # cache.add fails if the key already exists 9 | status = cache.add(lock_id, oid, lock_expire) 10 | try: 11 | yield status 12 | finally: 13 | # memcache delete is very slow, but we have to use it to take 14 | # advantage of using add() for atomic locking 15 | if time.monotonic() < timeout_at and status: 16 | # don't release the lock if we exceeded the timeout 17 | # to lessen the chance of releasing an expired lock 18 | # owned by someone else 19 | # also don't release the lock if we didn't acquire it 20 | cache.delete(lock_id) -------------------------------------------------------------------------------- /core/messages.py: -------------------------------------------------------------------------------- 1 | messages = {"": ""} 2 | -------------------------------------------------------------------------------- /core/migrations/0001_initial.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-08-27 22:26 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | initial = True 9 | 10 | dependencies = [ 11 | ] 12 | 13 | operations = [ 14 | migrations.CreateModel( 15 | name='TokenPrice', 16 | fields=[ 17 | ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 18 | ('usd_price', models.CharField(max_length=255)), 19 | ('datetime', models.DateTimeField(auto_now_add=True)), 20 | ('last_updated', models.DateTimeField(auto_now=True, null=True)), 21 | ('price_url', models.URLField(blank=True, max_length=255)), 22 | ('symbol', models.CharField(db_index=True, max_length=255, unique=True)), 23 | ], 24 | ), 25 | ] 26 | -------------------------------------------------------------------------------- /core/migrations/0002_alter_tokenprice_price_url.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-09-15 10:34 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('core', '0001_initial'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='tokenprice', 15 | name='price_url', 16 | field=models.URLField(max_length=255, null=True), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /core/migrations/0003_alter_tokenprice_price_url.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-10-27 08:04 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('core', '0002_alter_tokenprice_price_url'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='tokenprice', 15 | name='price_url', 16 | field=models.URLField(blank=True, max_length=255, null=True), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /core/migrations/0006_sponsor.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2024-04-15 18:02 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('core', '0005_auto_20231203_0832'), 10 | ] 11 | 12 | operations = [ 13 | migrations.CreateModel( 14 | name='Sponsor', 15 | fields=[ 16 | ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 17 | ('name', models.CharField(max_length=255, unique=True)), 18 | ('link', models.URLField(max_length=255)), 19 | ('description', models.TextField(blank=True, null=True)), 20 | ], 21 | ), 22 | ] 23 | -------------------------------------------------------------------------------- /core/migrations/0007_alter_chain_chain_type_and_more.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2024-05-31 10:53 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('core', '0006_sponsor'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='chain', 15 | name='chain_type', 16 | field=models.CharField(choices=[('EVM', 'EVM'), ('Solana', 'Solana'), ('NONEVM', 'NONEVM'), ('NONEVMXDC', 'NONEVMXDC')], default='EVM', max_length=10), 17 | ), 18 | migrations.AlterField( 19 | model_name='walletaccount', 20 | name='network_type', 21 | field=models.CharField(choices=[('EVM', 'EVM'), ('Solana', 'Solana'), ('NONEVM', 'NONEVM'), ('NONEVMXDC', 'NONEVMXDC')], default='EVM', max_length=10), 22 | ), 23 | ] 24 | -------------------------------------------------------------------------------- /core/migrations/0008_alter_chain_chain_type_and_more.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2024-05-31 11:28 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('core', '0007_alter_chain_chain_type_and_more'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='chain', 15 | name='chain_type', 16 | field=models.CharField(choices=[('EVM', 'EVM'), ('Solana', 'Solana'), ('Lightning', 'Lightning'), ('NONEVM', 'NONEVM'), ('NONEVMXDC', 'NONEVMXDC')], default='EVM', max_length=10), 17 | ), 18 | migrations.AlterField( 19 | model_name='walletaccount', 20 | name='network_type', 21 | field=models.CharField(choices=[('EVM', 'EVM'), ('Solana', 'Solana'), ('Lightning', 'Lightning'), ('NONEVM', 'NONEVM'), ('NONEVMXDC', 'NONEVMXDC')], default='EVM', max_length=10), 22 | ), 23 | ] 24 | -------------------------------------------------------------------------------- /core/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UnitapApp/unitap-backend/95fe09d8f8519d6719a11716550b81f2e85531a2/core/migrations/__init__.py -------------------------------------------------------------------------------- /core/paginations.py: -------------------------------------------------------------------------------- 1 | from rest_framework.pagination import PageNumberPagination 2 | 3 | 4 | class StandardResultsSetPagination(PageNumberPagination): 5 | page_size = 100 6 | page_size_query_param = 'page_size' 7 | max_page_size = 1000 8 | -------------------------------------------------------------------------------- /core/thirdpartyapp/__init__.py: -------------------------------------------------------------------------------- 1 | from .EAS import EASUtils 2 | from .ens import ENSUtil # noqa: F401 3 | from .farcaster import FarcasterUtil # noqa: F401 4 | from .gitcoin_passport import GitcoinPassport, GitcoinPassportRequestError # noqa: F401 5 | from .lens import LensUtil # noqa: F401 6 | from .subgraph import Subgraph 7 | from .twitter import RapidTwitter, TwitterUtils 8 | from .zora import ZoraUtil 9 | -------------------------------------------------------------------------------- /core/thirdpartyapp/cloudflare.py: -------------------------------------------------------------------------------- 1 | import logging 2 | from django.conf import settings 3 | import requests 4 | 5 | 6 | logger = logging.getLogger(__name__) 7 | 8 | 9 | class CloudflareUtil: 10 | secret_key = settings.CLOUDFLARE_TURNSTILE_SECRET_KEY 11 | api_url = "https://challenges.cloudflare.com/turnstile/v0" 12 | 13 | def is_verified(self, token: str, ip: str) -> bool: 14 | try: 15 | res = requests.post( 16 | f"{self.api_url}/siteverify", 17 | data={"secret": self.secret_key, "response": token, "remoteip": ip}, 18 | ) 19 | 20 | return res.ok and res.json()["success"] 21 | except Exception as e: 22 | logger.info(f"Error occurred during cloudflare verification {str(e)}") 23 | 24 | return False 25 | -------------------------------------------------------------------------------- /core/thirdpartyapp/ens.py: -------------------------------------------------------------------------------- 1 | from ens import ENS 2 | 3 | from core.utils import Web3Utils 4 | 5 | 6 | class ENSUtil: 7 | def __init__(self): 8 | from core.models import Chain 9 | 10 | self.eth_rpc = Chain.objects.get(chain_id="1").rpc_url_private 11 | self.w3_utils = Web3Utils(rpc_url=self.eth_rpc) 12 | 13 | @property 14 | def w3(self): 15 | return self.w3_utils.w3 16 | 17 | @property 18 | def ns(self) -> ENS: 19 | return ENS.from_web3(self.w3) 20 | 21 | def get_address(self, name: str) -> str: 22 | """return address of ENS 23 | :param name: 24 | :return: address 25 | """ 26 | return self.ns.address(name) 27 | 28 | def get_name(self, address: str) -> None | str: 29 | """return name on address 30 | :param address: 31 | """ 32 | _address = self.w3_utils.to_checksum_address(address) 33 | return self.ns.name(_address) 34 | -------------------------------------------------------------------------------- /core/thirdpartyapp/gitcoin_graph.py: -------------------------------------------------------------------------------- 1 | import json 2 | import logging 3 | 4 | import requests 5 | import zstandard as zstd 6 | 7 | 8 | class GitcoinGraph: 9 | URL = "https://grants-stack-indexer-v2.gitcoin.co/graphql" 10 | 11 | def send_post_request(self, json_data): 12 | try: 13 | res = requests.post( 14 | self.URL, headers={"Content-Type": "application/json"}, json=json_data 15 | ) 16 | return json.loads(zstd.decompress(res.content, 1073741824).decode()) 17 | except Exception as e: 18 | print(e) 19 | logging.error("Could not connect to gitcoin graph API") 20 | -------------------------------------------------------------------------------- /core/thirdpartyapp/hcaptcha.py: -------------------------------------------------------------------------------- 1 | import logging 2 | from django.conf import settings 3 | import requests 4 | 5 | 6 | logger = logging.getLogger(__name__) 7 | 8 | 9 | class HCaptchaUtil: 10 | secret_key = settings.H_CAPTCHA_SECRET 11 | api_url = "https://api.hcaptcha.com" 12 | 13 | def is_verified(self, token: str, ip: str) -> bool: 14 | try: 15 | res = requests.post( 16 | f"{self.api_url}/siteverify", 17 | data={"secret": self.secret_key, "response": token, "remoteip": ip}, 18 | ) 19 | 20 | return res.ok and res.json()["success"] 21 | except Exception as e: 22 | logger.info(f"Error occurred during hcaptcha verification {str(e)}") 23 | 24 | return False 25 | -------------------------------------------------------------------------------- /core/validators.py: -------------------------------------------------------------------------------- 1 | from rest_framework.exceptions import ValidationError 2 | from solders.pubkey import Pubkey 3 | 4 | from core.utils import Web3Utils 5 | 6 | from .models import Chain, NetworkTypes 7 | 8 | 9 | def address_validator(address, chain: Chain): 10 | is_address_valid = False 11 | if chain.chain_type == NetworkTypes.EVM: 12 | try: 13 | Web3Utils.to_checksum_address(address) 14 | return 15 | except ValueError: 16 | is_address_valid = False 17 | elif chain.chain_type == NetworkTypes.SOLANA: 18 | try: 19 | pub_key = Pubkey.from_string(address) 20 | is_address_valid = pub_key.is_on_curve() 21 | except ValueError: 22 | is_address_valid = False 23 | 24 | if not is_address_valid: 25 | raise ValidationError({"address": f"{address} is not valid"}) 26 | -------------------------------------------------------------------------------- /core/views.py: -------------------------------------------------------------------------------- 1 | from collections import defaultdict 2 | 3 | from rest_framework.generics import ListAPIView 4 | from rest_framework.response import Response 5 | 6 | from core.constraints import get_constraint 7 | 8 | 9 | class AbstractConstraintsListView(ListAPIView): 10 | def list(self, request, *args, **kwargs): 11 | queryset = self.filter_queryset(self.get_queryset()) 12 | constraints = queryset.all() 13 | response = defaultdict(list) 14 | for constraint in constraints: 15 | constraint_obj = get_constraint(constraint.name) 16 | response[constraint_obj.app_name].append( 17 | self.get_serializer(constraint).data 18 | ) 19 | 20 | return Response(response) 21 | -------------------------------------------------------------------------------- /faucet/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UnitapApp/unitap-backend/95fe09d8f8519d6719a11716550b81f2e85531a2/faucet/__init__.py -------------------------------------------------------------------------------- /faucet/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class FaucetConfig(AppConfig): 5 | default_auto_field = "django.db.models.BigAutoField" 6 | name = "faucet" 7 | -------------------------------------------------------------------------------- /faucet/artwork.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UnitapApp/unitap-backend/95fe09d8f8519d6719a11716550b81f2e85531a2/faucet/artwork.mp4 -------------------------------------------------------------------------------- /faucet/constants.py: -------------------------------------------------------------------------------- 1 | FUEL_LEVEL_STATUS_NUMBER = 10 2 | -------------------------------------------------------------------------------- /faucet/faucet_manager/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UnitapApp/unitap-backend/95fe09d8f8519d6719a11716550b81f2e85531a2/faucet/faucet_manager/__init__.py -------------------------------------------------------------------------------- /faucet/faucet_manager/anchor_client/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UnitapApp/unitap-backend/95fe09d8f8519d6719a11716550b81f2e85531a2/faucet/faucet_manager/anchor_client/__init__.py -------------------------------------------------------------------------------- /faucet/faucet_manager/anchor_client/accounts/__init__.py: -------------------------------------------------------------------------------- 1 | from .lock_account import LockAccount, LockAccountJSON 2 | -------------------------------------------------------------------------------- /faucet/faucet_manager/anchor_client/errors/__init__.py: -------------------------------------------------------------------------------- 1 | import typing 2 | import re 3 | from solders.transaction_status import ( 4 | InstructionErrorCustom, 5 | TransactionErrorInstructionError, 6 | ) 7 | from solana.rpc.core import RPCException 8 | from solders.rpc.errors import SendTransactionPreflightFailureMessage 9 | from anchorpy.error import extract_code_and_logs 10 | from ..program_id import PROGRAM_ID 11 | from . import anchor 12 | from . import custom 13 | 14 | 15 | def from_code(code: int) -> typing.Union[custom.CustomError, anchor.AnchorError, None]: 16 | return custom.from_code(code) if code >= 6000 else anchor.from_code(code) 17 | 18 | 19 | error_re = re.compile(r"Program (\w+) failed: custom program error: (\w+)") 20 | 21 | 22 | def from_tx_error( 23 | error: RPCException, 24 | ) -> typing.Union[anchor.AnchorError, custom.CustomError, None]: 25 | err_info = error.args[0] 26 | extracted = extract_code_and_logs(err_info, PROGRAM_ID) 27 | if extracted is None: 28 | return None 29 | return from_code(extracted[0]) 30 | -------------------------------------------------------------------------------- /faucet/faucet_manager/anchor_client/errors/custom.py: -------------------------------------------------------------------------------- 1 | import typing 2 | from anchorpy.error import ProgramError 3 | 4 | 5 | class MaxCapExceed(ProgramError): 6 | def __init__(self) -> None: 7 | super().__init__(6000, "PERIODIC_MAX_CAP_EXCEEDED") 8 | 9 | code = 6000 10 | name = "MaxCapExceed" 11 | msg = "PERIODIC_MAX_CAP_EXCEEDED" 12 | 13 | 14 | class InvalidValue(ProgramError): 15 | def __init__(self) -> None: 16 | super().__init__(6001, "INVALID_VALUE") 17 | 18 | code = 6001 19 | name = "InvalidValue" 20 | msg = "INVALID_VALUE" 21 | 22 | 23 | CustomError = typing.Union[MaxCapExceed, InvalidValue] 24 | CUSTOM_ERROR_MAP: dict[int, CustomError] = { 25 | 6000: MaxCapExceed(), 26 | 6001: InvalidValue(), 27 | } 28 | 29 | 30 | def from_code(code: int) -> typing.Optional[CustomError]: 31 | maybe_err = CUSTOM_ERROR_MAP.get(code) 32 | if maybe_err is None: 33 | return None 34 | return maybe_err 35 | -------------------------------------------------------------------------------- /faucet/faucet_manager/anchor_client/instructions/__init__.py: -------------------------------------------------------------------------------- 1 | from .initialize import initialize, InitializeArgs, InitializeAccounts 2 | from .withdraw import withdraw, WithdrawArgs, WithdrawAccounts 3 | from .emergency_withdraw import ( 4 | emergency_withdraw, 5 | EmergencyWithdrawArgs, 6 | EmergencyWithdrawAccounts, 7 | ) 8 | from .set_period import set_period, SetPeriodArgs, SetPeriodAccounts 9 | from .set_max_round_amount import ( 10 | set_max_round_amount, 11 | SetMaxRoundAmountArgs, 12 | SetMaxRoundAmountAccounts, 13 | ) 14 | from .change_owner import change_owner, ChangeOwnerArgs, ChangeOwnerAccounts 15 | from .change_operator import change_operator, ChangeOperatorArgs, ChangeOperatorAccounts 16 | -------------------------------------------------------------------------------- /faucet/faucet_manager/anchor_client/program_id.py: -------------------------------------------------------------------------------- 1 | from solders.pubkey import Pubkey 2 | 3 | PROGRAM_ID = Pubkey.from_string("DqAXwQiPwq149QgCcmhGYkXg47HeKW8P4BA3xZmzaLrK") 4 | -------------------------------------------------------------------------------- /faucet/filters.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import get_object_or_404 2 | from rest_framework import filters 3 | 4 | from .models import Faucet 5 | 6 | 7 | class FaucetFilterBackend(filters.BaseFilterBackend): 8 | """ 9 | Filter that filter nested faucet 10 | """ 11 | 12 | def filter_queryset(self, request, queryset, view): 13 | faucet_pk = request.query_params.get("faucet_pk") 14 | if faucet_pk is None: 15 | return queryset 16 | return queryset.filter(faucet=get_object_or_404(Faucet, pk=faucet_pk)) 17 | -------------------------------------------------------------------------------- /faucet/helpers.py: -------------------------------------------------------------------------------- 1 | import time 2 | from contextlib import contextmanager 3 | from django.core.cache import cache 4 | 5 | @contextmanager 6 | def memcache_lock(lock_id, oid, lock_expire=60): 7 | timeout_at = time.monotonic() + lock_expire 8 | # cache.add fails if the key already exists 9 | status = cache.add(lock_id, oid, lock_expire) 10 | try: 11 | yield status 12 | finally: 13 | # memcache delete is very slow, but we have to use it to take 14 | # advantage of using add() for atomic locking 15 | if time.monotonic() < timeout_at and status: 16 | # don't release the lock if we exceeded the timeout 17 | # to lessen the chance of releasing an expired lock 18 | # owned by someone else 19 | # also don't release the lock if we didn't acquire it 20 | cache.delete(lock_id) -------------------------------------------------------------------------------- /faucet/migrations/0001_initial.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2022-04-15 12:19 2 | 3 | from django.conf import settings 4 | from django.db import migrations, models 5 | import django.db.models.deletion 6 | import uuid 7 | 8 | 9 | class Migration(migrations.Migration): 10 | 11 | initial = True 12 | 13 | dependencies = [ 14 | migrations.swappable_dependency(settings.AUTH_USER_MODEL), 15 | ] 16 | 17 | operations = [ 18 | migrations.CreateModel( 19 | name='BrightUser', 20 | fields=[ 21 | ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 22 | ('context_id', models.UUIDField(default=uuid.uuid4, unique=True)), 23 | ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='bright_user', to=settings.AUTH_USER_MODEL)), 24 | ], 25 | ), 26 | ] 27 | -------------------------------------------------------------------------------- /faucet/migrations/0002_brightuser__verification_status.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2022-04-15 12:50 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('faucet', '0001_initial'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='brightuser', 15 | name='_verification_status', 16 | field=models.CharField(choices=[('0', 'Pending'), ('1', 'Verified')], default='0', max_length=1), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /faucet/migrations/0003_brightuser_address.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2022-04-15 14:04 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('faucet', '0002_brightuser__verification_status'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='brightuser', 15 | name='address', 16 | field=models.CharField(default='', max_length=45), 17 | preserve_default=False, 18 | ), 19 | ] 20 | -------------------------------------------------------------------------------- /faucet/migrations/0004_alter_brightuser_address.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2022-04-15 14:28 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('faucet', '0003_brightuser_address'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='brightuser', 15 | name='address', 16 | field=models.CharField(max_length=45, unique=True), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /faucet/migrations/0005_remove_brightuser_user.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2022-04-15 14:35 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('faucet', '0004_alter_brightuser_address'), 10 | ] 11 | 12 | operations = [ 13 | migrations.RemoveField( 14 | model_name='brightuser', 15 | name='user', 16 | ), 17 | ] 18 | -------------------------------------------------------------------------------- /faucet/migrations/0006_chain.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2022-04-15 15:15 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('faucet', '0005_remove_brightuser_user'), 10 | ] 11 | 12 | operations = [ 13 | migrations.CreateModel( 14 | name='Chain', 15 | fields=[ 16 | ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 17 | ('name', models.CharField(max_length=255)), 18 | ('symbol', models.CharField(max_length=255)), 19 | ('chain_id', models.CharField(max_length=255, unique=True)), 20 | ('rpc_url', models.URLField(blank=True, max_length=255, null=True)), 21 | ], 22 | ), 23 | ] 24 | -------------------------------------------------------------------------------- /faucet/migrations/0007_claimreceipt.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2022-04-15 15:42 2 | 3 | from django.db import migrations, models 4 | import django.db.models.deletion 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('faucet', '0006_chain'), 11 | ] 12 | 13 | operations = [ 14 | migrations.CreateModel( 15 | name='ClaimReceipt', 16 | fields=[ 17 | ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 18 | ('amount', models.BigIntegerField()), 19 | ('datetime', models.DateTimeField()), 20 | ('tx_hash', models.CharField(blank=True, max_length=100, null=True)), 21 | ('bright_user', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='claims', to='faucet.brightuser')), 22 | ('chain', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='claims', to='faucet.chain')), 23 | ], 24 | ), 25 | ] 26 | -------------------------------------------------------------------------------- /faucet/migrations/0008_chain_max_claim_amount.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2022-04-15 16:36 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('faucet', '0007_claimreceipt'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='chain', 15 | name='max_claim_amount', 16 | field=models.BigIntegerField(default=0), 17 | preserve_default=False, 18 | ), 19 | ] 20 | -------------------------------------------------------------------------------- /faucet/migrations/0009_chain_wallet_key.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2022-04-16 11:57 2 | 3 | from django.db import migrations 4 | import encrypted_model_fields.fields 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('faucet', '0008_chain_max_claim_amount'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AddField( 15 | model_name='chain', 16 | name='wallet_key', 17 | field=encrypted_model_fields.fields.EncryptedCharField(default=''), 18 | preserve_default=False, 19 | ), 20 | ] 21 | -------------------------------------------------------------------------------- /faucet/migrations/0010_claimreceipt__status.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2022-04-17 06:54 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('faucet', '0009_chain_wallet_key'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='claimreceipt', 15 | name='_status', 16 | field=models.CharField(choices=[('0', 'Pending'), ('1', 'Verified'), ('2', 'Rejected')], default='0', max_length=1), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /faucet/migrations/0012_chain_poa.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2022-05-21 10:41 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('faucet', '0011_rename_name_chain_chain_name_chain_decimals_and_more'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='chain', 15 | name='poa', 16 | field=models.BooleanField(default=False), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /faucet/migrations/0013_chain_rpc_url_private.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2022-06-07 05:28 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('faucet', '0012_chain_poa'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='chain', 15 | name='rpc_url_private', 16 | field=models.URLField(blank=True, max_length=255, null=True), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /faucet/migrations/0015_chain_fund_manager_address.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2022-06-07 08:04 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('faucet', '0014_walletaccount_remove_chain_wallet_key_chain_wallet'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='chain', 15 | name='fund_manager_address', 16 | field=models.CharField(blank=True, max_length=255, null=True), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /faucet/migrations/0016_brightuser__sponsored.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2022-06-09 09:17 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('faucet', '0015_chain_fund_manager_address'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='brightuser', 15 | name='_sponsored', 16 | field=models.BooleanField(default=False), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /faucet/migrations/0017_alter_chain_fund_manager_address_and_more.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2022-06-13 12:34 2 | 3 | from django.db import migrations, models 4 | import django.db.models.deletion 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('faucet', '0016_brightuser__sponsored'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AlterField( 15 | model_name='chain', 16 | name='fund_manager_address', 17 | field=models.CharField(max_length=255), 18 | ), 19 | migrations.AlterField( 20 | model_name='chain', 21 | name='rpc_url_private', 22 | field=models.URLField(max_length=255), 23 | ), 24 | migrations.AlterField( 25 | model_name='chain', 26 | name='wallet', 27 | field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='chains', to='faucet.walletaccount'), 28 | ), 29 | ] 30 | -------------------------------------------------------------------------------- /faucet/migrations/0018_chain_order.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2022-08-11 08:39 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('faucet', '0017_alter_chain_fund_manager_address_and_more'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='chain', 15 | name='order', 16 | field=models.IntegerField(default=0), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /faucet/migrations/0019_brightuser__last_verified_datetime.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2022-08-22 02:29 2 | 3 | import datetime 4 | from django.db import migrations, models 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('faucet', '0018_chain_order'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AddField( 15 | model_name='brightuser', 16 | name='_last_verified_datetime', 17 | field=models.DateTimeField(default=datetime.datetime(1970, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)), 18 | ), 19 | ] 20 | -------------------------------------------------------------------------------- /faucet/migrations/0019_globalsettings.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2022-08-24 08:09 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('faucet', '0018_chain_order'), 10 | ] 11 | 12 | operations = [ 13 | migrations.CreateModel( 14 | name='GlobalSettings', 15 | fields=[ 16 | ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 17 | ('weekly_chain_claim_limit', models.IntegerField(default=10)), 18 | ], 19 | ), 20 | ] 21 | -------------------------------------------------------------------------------- /faucet/migrations/0020_merge_20220824_0830.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2022-08-24 08:30 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('faucet', '0019_brightuser__last_verified_datetime'), 10 | ('faucet', '0019_globalsettings'), 11 | ] 12 | 13 | operations = [ 14 | ] 15 | -------------------------------------------------------------------------------- /faucet/migrations/0021_chain_modal_url_alter_claimreceipt__status.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2022-11-10 09:15 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('faucet', '0020_merge_20220824_0830'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='chain', 15 | name='modal_url', 16 | field=models.URLField(blank=True, max_length=255, null=True), 17 | ), 18 | migrations.AlterField( 19 | model_name='claimreceipt', 20 | name='_status', 21 | field=models.CharField(choices=[('0', 'Pending'), ('1', 'Verified'), ('2', 'Rejected'), ('3', 'Updating')], default='0', max_length=1), 22 | ), 23 | ] 24 | -------------------------------------------------------------------------------- /faucet/migrations/0022_chain_max_gas_price.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2022-11-14 06:25 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('faucet', '0021_chain_modal_url_alter_claimreceipt__status'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='chain', 15 | name='max_gas_price', 16 | field=models.BigIntegerField(default=250000000000), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /faucet/migrations/0024_copy_tx_hash.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2022-11-14 06:25 2 | 3 | from django.db import migrations, models 4 | import django.db.models.deletion 5 | 6 | from django.db import migrations 7 | 8 | 9 | def create_batch(apps, schema_editor): 10 | ClaimReceipt = apps.get_model("faucet", "ClaimReceipt") 11 | TransactionBatch = apps.get_model("faucet", "TransactionBatch") 12 | 13 | for receipt in ClaimReceipt.objects.exclude(tx_hash=None): 14 | batch = TransactionBatch.objects.create( 15 | chain=receipt.chain, 16 | tx_hash=receipt.tx_hash, 17 | _status=receipt._status, 18 | ) 19 | receipt.batch = batch 20 | receipt.save() 21 | 22 | 23 | class Migration(migrations.Migration): 24 | 25 | dependencies = [ 26 | ("faucet", "0023_transaction_batch"), 27 | ] 28 | 29 | operations = [migrations.RunPython(create_batch, migrations.RunPython.noop)] 30 | -------------------------------------------------------------------------------- /faucet/migrations/0025_remove_claimreceipt_tx_hash_and_more.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2022-11-18 21:44 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ("faucet", "0024_copy_tx_hash"), 10 | ] 11 | 12 | operations = [ 13 | migrations.RemoveField( 14 | model_name="claimreceipt", 15 | name="tx_hash", 16 | ), 17 | migrations.AlterField( 18 | model_name="claimreceipt", 19 | name="_status", 20 | field=models.CharField( 21 | choices=[("0", "Pending"), ("1", "Verified"), ("2", "Rejected")], 22 | default="0", 23 | max_length=1, 24 | ), 25 | ), 26 | ] 27 | -------------------------------------------------------------------------------- /faucet/migrations/0026_transactionbatch_updating.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2022-11-20 05:10 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('faucet', '0025_remove_claimreceipt_tx_hash_and_more'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='transactionbatch', 15 | name='updating', 16 | field=models.BooleanField(default=False), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /faucet/migrations/0027_chain_gas_multiplier.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2022-11-28 04:52 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('faucet', '0026_transactionbatch_updating'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='chain', 15 | name='gas_multiplier', 16 | field=models.FloatField(default=1), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /faucet/migrations/0028_chain_needs_funding.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2022-11-29 06:24 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('faucet', '0027_chain_gas_multiplier'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='chain', 15 | name='needs_funding', 16 | field=models.BooleanField(default=False), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /faucet/migrations/0029_chain_chain_type_chain_is_testnet.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2022-12-05 06:38 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('faucet', '0028_chain_needs_funding'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='chain', 15 | name='chain_type', 16 | field=models.CharField(choices=[('EVM', 'EVM')], default='EVM', max_length=3), 17 | ), 18 | migrations.AddField( 19 | model_name='chain', 20 | name='is_testnet', 21 | field=models.BooleanField(default=False), 22 | ), 23 | ] 24 | -------------------------------------------------------------------------------- /faucet/migrations/0030_chain_gas_image_url.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2022-12-05 06:40 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('faucet', '0029_chain_chain_type_chain_is_testnet'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='chain', 15 | name='gas_image_url', 16 | field=models.URLField(blank=True, max_length=255, null=True), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /faucet/migrations/0031_chain_is_active.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2022-12-17 10:28 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('faucet', '0030_chain_gas_image_url'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='chain', 15 | name='is_active', 16 | field=models.BooleanField(default=True), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /faucet/migrations/0033_claimreceipt_bright_user_and_more.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-03-12 09:10 2 | 3 | from django.db import migrations, models 4 | import django.db.models.deletion 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('authentication', '0009_temporarywalletaddress'), 11 | ('faucet', '0032_remove_claimreceipt_bright_user_and_more'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AddField( 16 | model_name='claimreceipt', 17 | name='bright_user', 18 | field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='claims', to='faucet.brightuser'), 19 | ), 20 | migrations.AlterField( 21 | model_name='claimreceipt', 22 | name='user_profile', 23 | field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='claims', to='authentication.userprofile'), 24 | ), 25 | ] 26 | -------------------------------------------------------------------------------- /faucet/migrations/0034_alter_claimreceipt_user_profile.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-03-12 09:16 2 | 3 | from django.db import migrations, models 4 | import django.db.models.deletion 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('authentication', '0009_temporarywalletaddress'), 11 | ('faucet', '0033_claimreceipt_bright_user_and_more'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AlterField( 16 | model_name='claimreceipt', 17 | name='user_profile', 18 | field=models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='claims', to='authentication.userprofile'), 19 | ), 20 | ] 21 | -------------------------------------------------------------------------------- /faucet/migrations/0035_claimreceipt_passive_address.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-03-23 10:43 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('faucet', '0034_alter_claimreceipt_user_profile'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='claimreceipt', 15 | name='passive_address', 16 | field=models.CharField(blank=True, max_length=512, null=True), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /faucet/migrations/0036_alter_chain_chain_type.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-04-03 10:02 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('faucet', '0035_claimreceipt_passive_address'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='chain', 15 | name='chain_type', 16 | field=models.CharField(choices=[('EVM', 'EVM'), ('Solana', 'Solana'), ('Lightning', 'Lightning'), ('NONEVM', 'Non-EVM')], default='EVM', max_length=10), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /faucet/migrations/0037_alter_chain_chain_type.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-04-03 14:11 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('faucet', '0036_alter_chain_chain_type'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='chain', 15 | name='chain_type', 16 | field=models.CharField(choices=[('EVM', 'EVM'), ('Solana', 'Solana'), ('Lightning', 'Lightning'), ('Non-EVM', 'Non-EVM')], default='EVM', max_length=10), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /faucet/migrations/0038_alter_claimreceipt__status_and_more.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-04-03 18:01 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('faucet', '0037_alter_chain_chain_type'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='claimreceipt', 15 | name='_status', 16 | field=models.CharField(choices=[('Pending', 'Pending'), ('Verified', 'Verified'), ('Rejected', 'Rejected')], default='Pending', max_length=10), 17 | ), 18 | migrations.AlterField( 19 | model_name='transactionbatch', 20 | name='_status', 21 | field=models.CharField(choices=[('Pending', 'Pending'), ('Verified', 'Verified'), ('Rejected', 'Rejected')], default='Pending', max_length=10), 22 | ), 23 | ] 24 | -------------------------------------------------------------------------------- /faucet/migrations/0039_alter_chain_chain_type.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-04-03 18:18 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('faucet', '0038_alter_claimreceipt__status_and_more'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='chain', 15 | name='chain_type', 16 | field=models.CharField(choices=[('EVM', 'EVM'), ('Solana', 'Solana'), ('Lightning', 'Lightning'), ('NONEVM', 'NONEVM')], default='EVM', max_length=10), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /faucet/migrations/0040_claimreceipt_last_updated.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-04-18 18:38 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('faucet', '0039_alter_chain_chain_type'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='claimreceipt', 15 | name='last_updated', 16 | field=models.DateTimeField(auto_now=True, null=True), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /faucet/migrations/0041_chain_enough_fee_multiplier.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-04-22 10:46 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('faucet', '0040_claimreceipt_last_updated'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='chain', 15 | name='enough_fee_multiplier', 16 | field=models.BigIntegerField(default=200000), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /faucet/migrations/0042_lightningconfig.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-04-29 12:56 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('faucet', '0041_chain_enough_fee_multiplier'), 10 | ] 11 | 12 | operations = [ 13 | migrations.CreateModel( 14 | name='LightningConfig', 15 | fields=[ 16 | ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 17 | ('period', models.IntegerField(default=64800)), 18 | ('period_max_cap', models.BigIntegerField()), 19 | ('claimed_amount', models.BigIntegerField(default=0)), 20 | ('current_round', models.IntegerField(null=True)), 21 | ], 22 | ), 23 | ] 24 | -------------------------------------------------------------------------------- /faucet/migrations/0042_walletaccount_network_type.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-04-28 08:02 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('faucet', '0041_chain_enough_fee_multiplier'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='walletaccount', 15 | name='network_type', 16 | field=models.CharField(choices=[('EVM', 'EVM'), ('Solana', 'Solana'), ('Lightning', 'Lightning'), ('NONEVM', 'NONEVM')], default='EVM', max_length=10), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /faucet/migrations/0043_alter_chain_chain_type_and_more.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-04-29 06:23 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('faucet', '0042_walletaccount_network_type'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='chain', 15 | name='chain_type', 16 | field=models.CharField(choices=[('EVM', 'EVM'), ('Solana', 'Solana'), ('Lightning', 'Lightning'), ('NONEVM', 'NONEVM'), ('NONEVMXDC', 'NONEVMXDC')], default='EVM', max_length=10), 17 | ), 18 | migrations.AlterField( 19 | model_name='walletaccount', 20 | name='network_type', 21 | field=models.CharField(choices=[('EVM', 'EVM'), ('Solana', 'Solana'), ('Lightning', 'Lightning'), ('NONEVM', 'NONEVM'), ('NONEVMXDC', 'NONEVMXDC')], default='EVM', max_length=10), 22 | ), 23 | ] 24 | -------------------------------------------------------------------------------- /faucet/migrations/0044_merge_20230507_1530.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-05-07 15:30 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('faucet', '0042_lightningconfig'), 10 | ('faucet', '0043_alter_chain_chain_type_and_more'), 11 | ] 12 | 13 | operations = [ 14 | ] 15 | -------------------------------------------------------------------------------- /faucet/migrations/0045_chain_tokentap_contract_address.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-05-07 17:06 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('faucet', '0044_merge_20230507_1530'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='chain', 15 | name='tokentap_contract_address', 16 | field=models.CharField(blank=True, max_length=255, null=True), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /faucet/migrations/0046_globalsettings_tokentap_weekly_claim_limit.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-05-11 16:12 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('faucet', '0045_chain_tokentap_contract_address'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='globalsettings', 15 | name='tokentap_weekly_claim_limit', 16 | field=models.IntegerField(default=2), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /faucet/migrations/0047_globalsettings_is_gas_tap_available.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-06-07 09:29 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('faucet', '0046_globalsettings_tokentap_weekly_claim_limit'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='globalsettings', 15 | name='is_gas_tap_available', 16 | field=models.BooleanField(default=True), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /faucet/migrations/0048_globalsettings_prizetap_weekly_claim_limit_and_more.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-06-10 06:35 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('faucet', '0047_globalsettings_is_gas_tap_available'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='globalsettings', 15 | name='prizetap_weekly_claim_limit', 16 | field=models.IntegerField(default=3), 17 | ), 18 | migrations.AlterField( 19 | model_name='globalsettings', 20 | name='tokentap_weekly_claim_limit', 21 | field=models.IntegerField(default=3), 22 | ), 23 | migrations.AlterField( 24 | model_name='globalsettings', 25 | name='weekly_chain_claim_limit', 26 | field=models.IntegerField(default=5), 27 | ), 28 | ] 29 | -------------------------------------------------------------------------------- /faucet/migrations/0049_remove_claimreceipt_already_processed_and_more.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-06-24 19:15 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('faucet', '0048_globalsettings_prizetap_weekly_claim_limit_and_more'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='claimreceipt', 15 | name='_status', 16 | field=models.CharField(choices=[('Pending', 'Pending'), ('Verified', 'Verified'), ('Rejected', 'Rejected'), ('Processed', 'Processed')], default='Pending', max_length=10), 17 | ), 18 | migrations.AlterField( 19 | model_name='transactionbatch', 20 | name='_status', 21 | field=models.CharField(choices=[('Pending', 'Pending'), ('Verified', 'Verified'), ('Rejected', 'Rejected'), ('Processed', 'Processed')], default='Pending', max_length=10), 22 | ), 23 | ] 24 | -------------------------------------------------------------------------------- /faucet/migrations/0050_alter_chain_max_claim_amount.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-07-10 17:53 2 | 3 | from django.db import migrations 4 | import faucet.models 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('faucet', '0049_remove_claimreceipt_already_processed_and_more'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AlterField( 15 | model_name='chain', 16 | name='max_claim_amount', 17 | field=faucet.models.BigNumField(max_length=200), 18 | ), 19 | ] 20 | -------------------------------------------------------------------------------- /faucet/migrations/0051_chain_show_in_gastap.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-07-11 08:12 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('faucet', '0050_alter_chain_max_claim_amount'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='chain', 15 | name='show_in_gastap', 16 | field=models.BooleanField(default=True), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /faucet/migrations/0052_alter_claimreceipt__status_and_more.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-07-19 18:17 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('faucet', '0051_chain_show_in_gastap'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='claimreceipt', 15 | name='_status', 16 | field=models.CharField(choices=[('Pending', 'Pending'), ('Verified', 'Verified'), ('Rejected', 'Rejected'), ('Processed', 'Processed'), ('Processed_Rejected', 'Processed_Rejected')], default='Pending', max_length=30), 17 | ), 18 | migrations.AlterField( 19 | model_name='transactionbatch', 20 | name='_status', 21 | field=models.CharField(choices=[('Pending', 'Pending'), ('Verified', 'Verified'), ('Rejected', 'Rejected'), ('Processed', 'Processed'), ('Processed_Rejected', 'Processed_Rejected')], default='Pending', max_length=30), 22 | ), 23 | ] 24 | -------------------------------------------------------------------------------- /faucet/migrations/0053_tokenprice.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-08-08 08:12 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('faucet', '0052_alter_claimreceipt__status_and_more'), 10 | ] 11 | 12 | operations = [ 13 | migrations.CreateModel( 14 | name='TokenPrice', 15 | fields=[ 16 | ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 17 | ('usd_price', models.CharField(max_length=255)), 18 | ('datetime', models.DateTimeField(auto_now_add=True)), 19 | ('last_updated', models.DateTimeField(auto_now=True, null=True)), 20 | ('price_url', models.URLField(blank=True, max_length=255)), 21 | ('symbol', models.CharField(max_length=255)), 22 | ], 23 | ), 24 | ] 25 | -------------------------------------------------------------------------------- /faucet/migrations/0056_alter_claimreceipt_amount.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-10-02 21:42 2 | 3 | import core.models 4 | from django.db import migrations 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('faucet', '0055_donationreceipt_status_and_more'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AlterField( 15 | model_name='claimreceipt', 16 | name='amount', 17 | field=core.models.BigNumField(max_length=200), 18 | ), 19 | ] 20 | -------------------------------------------------------------------------------- /faucet/migrations/0057_alter_claimreceipt_amount.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-10-02 21:59 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('faucet', '0056_alter_claimreceipt_amount'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='claimreceipt', 15 | name='amount', 16 | field=models.BigIntegerField(), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /faucet/migrations/0058_alter_claimreceipt_amount.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-10-02 22:29 2 | 3 | import core.models 4 | from django.db import migrations 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('faucet', '0057_alter_claimreceipt_amount'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AlterField( 15 | model_name='claimreceipt', 16 | name='amount', 17 | field=core.models.BigNumField(max_length=200), 18 | ), 19 | ] 20 | -------------------------------------------------------------------------------- /faucet/migrations/0059_chain_explorer_api_key_chain_explorer_api_url.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-10-08 19:28 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('faucet', '0058_alter_claimreceipt_amount'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='chain', 15 | name='explorer_api_key', 16 | field=models.CharField(blank=True, max_length=255, null=True), 17 | ), 18 | migrations.AddField( 19 | model_name='chain', 20 | name='explorer_api_url', 21 | field=models.URLField(blank=True, max_length=255, null=True), 22 | ), 23 | ] 24 | -------------------------------------------------------------------------------- /faucet/migrations/0060_alter_donationreceipt_status.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-10-22 04:20 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('faucet', '0059_chain_explorer_api_key_chain_explorer_api_url'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='donationreceipt', 15 | name='status', 16 | field=models.CharField(choices=[('Pending', 'Pending'), ('Verified', 'Verified'), ('Rejected', 'Rejected')], default='Pending', max_length=30), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /faucet/migrations/0060_rename_weekly_chain_claim_limit_globalsettings_gastap_claim_limit.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-10-24 13:33 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('faucet', '0059_chain_explorer_api_key_chain_explorer_api_url'), 10 | ] 11 | 12 | operations = [ 13 | migrations.RenameField( 14 | model_name='globalsettings', 15 | old_name='weekly_chain_claim_limit', 16 | new_name='gastap_claim_limit', 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /faucet/migrations/0061_rename_gastap_claim_limit_globalsettings_gastap_round_claim_limit.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-10-24 13:34 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('faucet', '0060_rename_weekly_chain_claim_limit_globalsettings_gastap_claim_limit'), 10 | ] 11 | 12 | operations = [ 13 | migrations.RenameField( 14 | model_name='globalsettings', 15 | old_name='gastap_claim_limit', 16 | new_name='gastap_round_claim_limit', 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /faucet/migrations/0062_rename_tokentap_weekly_claim_limit_globalsettings_tokentap_round_claim_limit.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-10-24 13:35 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('faucet', '0061_rename_gastap_claim_limit_globalsettings_gastap_round_claim_limit'), 10 | ] 11 | 12 | operations = [ 13 | migrations.RenameField( 14 | model_name='globalsettings', 15 | old_name='tokentap_weekly_claim_limit', 16 | new_name='tokentap_round_claim_limit', 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /faucet/migrations/0063_rename_prizetap_weekly_claim_limit_globalsettings_prizetap_round_claim_limit.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-10-24 13:35 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('faucet', '0062_rename_tokentap_weekly_claim_limit_globalsettings_tokentap_round_claim_limit'), 10 | ] 11 | 12 | operations = [ 13 | migrations.RenameField( 14 | model_name='globalsettings', 15 | old_name='prizetap_weekly_claim_limit', 16 | new_name='prizetap_round_claim_limit', 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /faucet/migrations/0064_merge_20231108_1331.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-11-08 13:31 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('faucet', '0060_alter_donationreceipt_status'), 10 | ('faucet', '0063_rename_prizetap_weekly_claim_limit_globalsettings_prizetap_round_claim_limit'), 11 | ] 12 | 13 | operations = [ 14 | ] 15 | -------------------------------------------------------------------------------- /faucet/migrations/0065_chain_is_one_time.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-11-26 17:48 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('faucet', '0064_merge_20231108_1331'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='chain', 15 | name='is_one_time', 16 | field=models.BooleanField(default=False), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /faucet/migrations/0065_rename_passive_address_claimreceipt_to_address.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-11-30 14:21 2 | from django.db.models import Q 3 | from django.db import migrations 4 | 5 | 6 | def set_to_address(apps, schema_editor): 7 | # set the wallet address in claim receipts 8 | CR = apps.get_model("faucet", "ClaimReceipt") 9 | 10 | for c in CR.objects.filter(Q(to_address__isnull=True) | Q(to_address="")): 11 | try: 12 | c.to_address = c.user_profile.wallets.get(wallet_type="EVM").address 13 | c.save() 14 | except Exception as e: 15 | print("set to_address error", e) 16 | 17 | 18 | class Migration(migrations.Migration): 19 | dependencies = [ 20 | ("faucet", "0064_merge_20231108_1331"), 21 | ] 22 | 23 | operations = [ 24 | migrations.RenameField( 25 | model_name="claimreceipt", 26 | old_name="passive_address", 27 | new_name="to_address", 28 | ), 29 | migrations.RunPython(set_to_address), 30 | ] 31 | -------------------------------------------------------------------------------- /faucet/migrations/0066_rename_is_one_time_chain_is_one_time_claim.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-11-26 17:48 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('faucet', '0065_chain_is_one_time'), 10 | ] 11 | 12 | operations = [ 13 | migrations.RenameField( 14 | model_name='chain', 15 | old_name='is_one_time', 16 | new_name='is_one_time_claim', 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /faucet/migrations/0067_merge_20231216_1727.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-12-16 17:27 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('faucet', '0065_rename_passive_address_claimreceipt_to_address'), 10 | ('faucet', '0066_rename_is_one_time_chain_is_one_time_claim'), 11 | ] 12 | 13 | operations = [ 14 | ] 15 | -------------------------------------------------------------------------------- /faucet/migrations/0067_merge_20231226_1046.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-12-26 10:46 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('faucet', '0065_rename_passive_address_claimreceipt_to_address'), 10 | ('faucet', '0066_rename_is_one_time_chain_is_one_time_claim'), 11 | ] 12 | 13 | operations = [ 14 | ] 15 | -------------------------------------------------------------------------------- /faucet/migrations/0068_merge_20240105_1916.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2024-01-05 19:16 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('faucet', '0067_merge_20231216_1727'), 10 | ('faucet', '0067_merge_20231226_1046'), 11 | ] 12 | 13 | operations = [ 14 | ] 15 | -------------------------------------------------------------------------------- /faucet/migrations/0069_merge_20240105_1932.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2024-01-05 19:32 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('faucet', '0067_auto_20231219_1401'), 10 | ('faucet', '0068_merge_20240105_1916'), 11 | ] 12 | 13 | operations = [ 14 | ] 15 | -------------------------------------------------------------------------------- /faucet/migrations/0070_delete_walletaccount.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2024-01-05 20:24 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('faucet', '0069_merge_20240105_1932'), 10 | ] 11 | 12 | operations = [ 13 | migrations.DeleteModel( 14 | name='WalletAccount', 15 | ), 16 | ] 17 | -------------------------------------------------------------------------------- /faucet/migrations/0073_faucet_fuel_level.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2024-02-19 15:07 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('faucet', '0072_remove_globalsettings_gastap_round_claim_limit_and_more'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='faucet', 15 | name='fuel_level', 16 | field=models.IntegerField(default=100), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /faucet/migrations/0074_faucet_is_deprecated.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2024-03-22 13:07 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('faucet', '0073_faucet_fuel_level'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='faucet', 15 | name='is_deprecated', 16 | field=models.BooleanField(default=False), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /faucet/migrations/0075_delete_lightningconfig.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2024-05-31 10:53 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('faucet', '0074_faucet_is_deprecated'), 10 | ] 11 | 12 | operations = [ 13 | migrations.DeleteModel( 14 | name='LightningConfig', 15 | ), 16 | ] 17 | -------------------------------------------------------------------------------- /faucet/migrations/0076_faucet_total_claims_since_last_round_and_more.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2024-06-20 19:07 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('faucet', '0075_delete_lightningconfig'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='faucet', 15 | name='total_claims_since_last_round', 16 | field=models.IntegerField(blank=True, default=0, null=True), 17 | ), 18 | migrations.AddField( 19 | model_name='faucet', 20 | name='total_claims_this_round', 21 | field=models.IntegerField(blank=True, default=0, null=True), 22 | ), 23 | ] 24 | -------------------------------------------------------------------------------- /faucet/migrations/0077_faucet_used_unitap_pass_list.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2024-06-24 13:59 2 | 3 | import django.contrib.postgres.fields 4 | from django.db import migrations, models 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('faucet', '0076_faucet_total_claims_since_last_round_and_more'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AddField( 15 | model_name='faucet', 16 | name='used_unitap_pass_list', 17 | field=django.contrib.postgres.fields.ArrayField(base_field=models.IntegerField(), blank=True, default=list, size=None), 18 | ), 19 | ] 20 | -------------------------------------------------------------------------------- /faucet/migrations/0078_alter_faucet_used_unitap_pass_list.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2024-07-17 14:08 2 | 3 | import core.models 4 | from django.db import migrations, models 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('faucet', '0077_faucet_used_unitap_pass_list'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AlterField( 15 | model_name='faucet', 16 | name='used_unitap_pass_list', 17 | field=core.models.UniqueArrayField(base_field=models.IntegerField(), blank=True, default=list, size=None), 18 | ), 19 | ] 20 | -------------------------------------------------------------------------------- /faucet/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UnitapApp/unitap-backend/95fe09d8f8519d6719a11716550b81f2e85531a2/faucet/migrations/__init__.py -------------------------------------------------------------------------------- /load_test.py: -------------------------------------------------------------------------------- 1 | from locust import HttpUser, between, task 2 | 3 | 4 | class WebsiteUser(HttpUser): 5 | wait_time = between(1, 2) 6 | 7 | @task 8 | def load_page(self): 9 | self.client.get("/api/gastap/faucet/list/") 10 | # self.client.get("/api/tokentap/get-valid-chains/") 11 | # self.client.get("/api/gastap/settings/") 12 | -------------------------------------------------------------------------------- /manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | """Django's command-line utility for administrative tasks.""" 3 | import os 4 | import sys 5 | 6 | 7 | def main(): 8 | """Run administrative tasks.""" 9 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "brightIDfaucet.settings") 10 | try: 11 | from django.core.management import execute_from_command_line 12 | except ImportError as exc: 13 | raise ImportError( 14 | "Couldn't import Django. Are you sure it's installed and " 15 | "available on your PYTHONPATH environment variable? Did you " 16 | "forget to activate a virtual environment?" 17 | ) from exc 18 | execute_from_command_line(sys.argv) 19 | 20 | 21 | if __name__ == "__main__": 22 | main() 23 | -------------------------------------------------------------------------------- /prizetap/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UnitapApp/unitap-backend/95fe09d8f8519d6719a11716550b81f2e85531a2/prizetap/__init__.py -------------------------------------------------------------------------------- /prizetap/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | from core.admin import UserConstraintBaseAdmin 4 | from prizetap.models import Constraint, LineaRaffleEntries, Raffle, RaffleEntry 5 | 6 | 7 | class RaffleAdmin(admin.ModelAdmin): 8 | list_display = ["pk", "name", "creator_name", "status"] 9 | readonly_fields = ["vrf_tx_hash"] 10 | autocomplete_fields = ["creator_profile"] 11 | 12 | 13 | class RaffleEntryAdmin(admin.ModelAdmin): 14 | list_display = [ 15 | "pk", 16 | "raffle", 17 | "user_wallet_address", 18 | "tx_hash", 19 | "age", 20 | ] 21 | 22 | 23 | class LineaRaffleEntriesAdmin(admin.ModelAdmin): 24 | list_display = ["pk", "wallet_address", "is_winner"] 25 | 26 | 27 | admin.site.register(Raffle, RaffleAdmin) 28 | admin.site.register(RaffleEntry, RaffleEntryAdmin) 29 | admin.site.register(Constraint, UserConstraintBaseAdmin) 30 | admin.site.register(LineaRaffleEntries, LineaRaffleEntriesAdmin) 31 | -------------------------------------------------------------------------------- /prizetap/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class PrizetapConfig(AppConfig): 5 | default_auto_field = 'django.db.models.BigAutoField' 6 | name = 'prizetap' 7 | -------------------------------------------------------------------------------- /prizetap/migrations/0002_raffle_is_prize_nft.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-06-09 16:06 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('prizetap', '0001_initial'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='raffle', 15 | name='is_prize_nft', 16 | field=models.BooleanField(default=False), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /prizetap/migrations/0003_raffle_permissions.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-06-09 16:17 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | dependencies = [ 8 | # ('permissions', '0004_oncepermonthverification'), 9 | ("prizetap", "0002_raffle_is_prize_nft"), 10 | ] 11 | 12 | operations = [ 13 | # migrations.AddField( 14 | # model_name='raffle', 15 | # name='permissions', 16 | # field=models.ManyToManyField(blank=True, to='permissions.permission'), 17 | # ), 18 | ] 19 | -------------------------------------------------------------------------------- /prizetap/migrations/0004_raffle_contract_raffle_raffleid_raffle_signer.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-06-26 18:54 2 | 3 | from django.db import migrations, models 4 | import django.db.models.deletion 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('faucet', '0048_globalsettings_prizetap_weekly_claim_limit_and_more'), 11 | ('prizetap', '0003_raffle_permissions'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AddField( 16 | model_name='raffle', 17 | name='contract', 18 | field=models.CharField(default=0, max_length=256), 19 | preserve_default=False, 20 | ), 21 | migrations.AddField( 22 | model_name='raffle', 23 | name='raffleId', 24 | field=models.BigIntegerField(default=1), 25 | preserve_default=False, 26 | ), 27 | migrations.AddField( 28 | model_name='raffle', 29 | name='signer', 30 | field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.DO_NOTHING, to='core.walletaccount'), 31 | preserve_default=False, 32 | ), 33 | ] 34 | -------------------------------------------------------------------------------- /prizetap/migrations/0005_alter_raffleentry_options.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-06-26 19:34 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('prizetap', '0004_raffle_contract_raffle_raffleid_raffle_signer'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterModelOptions( 14 | name='raffleentry', 15 | options={'verbose_name_plural': 'raffle entries'}, 16 | ), 17 | ] 18 | -------------------------------------------------------------------------------- /prizetap/migrations/0006_remove_raffle_winner_raffleentry_is_winner.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-06-27 12:20 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('prizetap', '0005_alter_raffleentry_options'), 10 | ] 11 | 12 | operations = [ 13 | migrations.RemoveField( 14 | model_name='raffle', 15 | name='winner', 16 | ), 17 | migrations.AddField( 18 | model_name='raffleentry', 19 | name='is_winner', 20 | field=models.BooleanField(blank=True, default=False), 21 | ), 22 | ] 23 | -------------------------------------------------------------------------------- /prizetap/migrations/0007_remove_raffleentry_nonce.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-06-30 15:36 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('prizetap', '0006_remove_raffle_winner_raffleentry_is_winner'), 10 | ] 11 | 12 | operations = [ 13 | migrations.RemoveField( 14 | model_name='raffleentry', 15 | name='nonce', 16 | ), 17 | ] 18 | -------------------------------------------------------------------------------- /prizetap/migrations/0008_raffleentry_tx_hash.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-07-02 07:26 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('prizetap', '0007_remove_raffleentry_nonce'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='raffleentry', 15 | name='tx_hash', 16 | field=models.CharField(blank=True, max_length=255, null=True), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /prizetap/migrations/0010_raffleentry_claiming_prize_tx.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-07-09 08:11 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('prizetap', '0009_constraint_remove_raffle_permissions_and_more'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='raffleentry', 15 | name='claiming_prize_tx', 16 | field=models.CharField(blank=True, max_length=255, null=True), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /prizetap/migrations/0012_raffleentry_multiplier.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-07-13 08:40 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('prizetap', '0011_rename_prize_raffle_prize_name_raffle_decimals_and_more'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='raffleentry', 15 | name='multiplier', 16 | field=models.IntegerField(default=1), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /prizetap/migrations/0013_constraint_type.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-07-19 15:46 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('prizetap', '0012_raffleentry_multiplier'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='constraint', 15 | name='type', 16 | field=models.CharField(choices=[('VER', 'Verification'), ('TIME', 'Time')], default='VER', max_length=10), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /prizetap/migrations/0014_constraint_description_constraint_title.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-07-20 15:28 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('prizetap', '0013_constraint_type'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='constraint', 15 | name='description', 16 | field=models.TextField(blank=True, null=True), 17 | ), 18 | migrations.AddField( 19 | model_name='constraint', 20 | name='title', 21 | field=models.CharField(default='User constraint', max_length=255), 22 | preserve_default=False, 23 | ), 24 | ] 25 | -------------------------------------------------------------------------------- /prizetap/migrations/0015_raffle_constraint_params.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-08-09 11:50 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('prizetap', '0014_constraint_description_constraint_title'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='raffle', 15 | name='constraint_params', 16 | field=models.TextField(blank=True, null=True), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /prizetap/migrations/0016_remove_raffle_signer.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-08-15 06:31 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('prizetap', '0015_raffle_constraint_params'), 10 | ] 11 | 12 | operations = [ 13 | migrations.RemoveField( 14 | model_name='raffle', 15 | name='signer', 16 | ), 17 | ] 18 | -------------------------------------------------------------------------------- /prizetap/migrations/0017_remove_raffleentry_signature.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-08-15 06:40 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('prizetap', '0016_remove_raffle_signer'), 10 | ] 11 | 12 | operations = [ 13 | migrations.RemoveField( 14 | model_name='raffleentry', 15 | name='signature', 16 | ), 17 | ] 18 | -------------------------------------------------------------------------------- /prizetap/migrations/0018_raffle_max_multiplier_raffle_start_at.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-08-15 09:36 2 | 3 | from django.db import migrations, models 4 | import django.utils.timezone 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('prizetap', '0017_remove_raffleentry_signature'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AddField( 15 | model_name='raffle', 16 | name='max_multiplier', 17 | field=models.IntegerField(default=1), 18 | ), 19 | migrations.AddField( 20 | model_name='raffle', 21 | name='start_at', 22 | field=models.DateTimeField(default=django.utils.timezone.now), 23 | ), 24 | ] 25 | -------------------------------------------------------------------------------- /prizetap/migrations/0019_alter_raffle_chain.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-08-27 08:29 2 | 3 | from django.db import migrations, models 4 | import django.db.models.deletion 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('faucet', '0053_tokenprice'), 11 | ('prizetap', '0018_raffle_max_multiplier_raffle_start_at'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AlterField( 16 | model_name='raffle', 17 | name='chain', 18 | field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='raffles', to='core.chain'), 19 | ), 20 | ] 21 | -------------------------------------------------------------------------------- /prizetap/migrations/0020_alter_raffle_deadline_and_more.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-09-05 07:19 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('prizetap', '0019_alter_raffle_chain'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='raffle', 15 | name='deadline', 16 | field=models.DateTimeField(blank=True), 17 | ), 18 | migrations.AlterField( 19 | model_name='raffle', 20 | name='max_number_of_entries', 21 | field=models.IntegerField(blank=True), 22 | ), 23 | ] 24 | -------------------------------------------------------------------------------- /prizetap/migrations/0021_alter_raffle_deadline_and_more.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-09-05 07:43 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('prizetap', '0020_alter_raffle_deadline_and_more'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='raffle', 15 | name='deadline', 16 | field=models.DateTimeField(), 17 | ), 18 | migrations.AlterField( 19 | model_name='raffle', 20 | name='max_number_of_entries', 21 | field=models.IntegerField(), 22 | ), 23 | ] 24 | -------------------------------------------------------------------------------- /prizetap/migrations/0022_alter_constraint_name.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-09-12 11:30 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('prizetap', '0021_alter_raffle_deadline_and_more'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='constraint', 15 | name='name', 16 | field=models.CharField(choices=[('BrightIDMeetVerification', 'BrightIDMeetVerification'), ('BrightIDAuraVerification', 'BrightIDAuraVerification'), ('NotHaveUnitapPass', 'NotHaveUnitapPass')], max_length=255, unique=True), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /prizetap/migrations/0023_alter_constraint_name.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-09-12 14:21 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('prizetap', '0022_alter_constraint_name'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='constraint', 15 | name='name', 16 | field=models.CharField(choices=[('BrightIDMeetVerification', 'BrightIDMeetVerification'), ('BrightIDAuraVerification', 'BrightIDAuraVerification'), ('HaveUnitapPass', 'HaveUnitapPass'), ('NotHaveUnitapPass', 'NotHaveUnitapPass')], max_length=255, unique=True), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /prizetap/migrations/0024_alter_raffle_prize_amount.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-09-13 18:07 2 | 3 | import core.models 4 | from django.db import migrations 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('prizetap', '0023_alter_constraint_name'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AlterField( 15 | model_name='raffle', 16 | name='prize_amount', 17 | field=core.models.BigNumField(max_length=200), 18 | ), 19 | ] 20 | -------------------------------------------------------------------------------- /prizetap/migrations/0025_alter_raffle_nft_id.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-09-15 20:29 2 | 3 | import core.models 4 | from django.db import migrations 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('prizetap', '0024_alter_raffle_prize_amount'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AlterField( 15 | model_name='raffle', 16 | name='nft_id', 17 | field=core.models.BigNumField(blank=True, max_length=200, null=True), 18 | ), 19 | ] 20 | -------------------------------------------------------------------------------- /prizetap/migrations/0026_alter_raffle_nft_id.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-09-17 09:05 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('prizetap', '0025_alter_raffle_nft_id'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='raffle', 15 | name='nft_id', 16 | field=models.CharField(blank=True, max_length=256, null=True), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /prizetap/migrations/0027_raffle_status.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-09-18 08:55 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('prizetap', '0026_alter_raffle_nft_id'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='raffle', 15 | name='status', 16 | field=models.CharField(choices=[('OPEN', 'Open'), ('REJECTED', 'Rejected'), ('HELD', 'Held'), ('WS', 'Winner is set')], default='OPEN', max_length=10), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /prizetap/migrations/0029_constraint_icon_url.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-10-07 05:50 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('prizetap', '0028_remove_raffle_creator_raffle_creator_address_and_more'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='constraint', 15 | name='icon_url', 16 | field=models.CharField(blank=True, max_length=255, null=True), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /prizetap/migrations/0030_alter_constraint_name.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-10-07 08:33 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('prizetap', '0029_constraint_icon_url'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='constraint', 15 | name='name', 16 | field=models.CharField(choices=[('BrightIDMeetVerification', 'BrightIDMeetVerification'), ('BrightIDAuraVerification', 'BrightIDAuraVerification'), ('HaveUnitapPass', 'HaveUnitapPass'), ('NotHaveUnitapPass', 'NotHaveUnitapPass'), ('OptimismDonationConstraint', 'OptimismDonationConstraint')], max_length=255, unique=True), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /prizetap/migrations/0031_alter_constraint_name.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-10-09 10:12 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('prizetap', '0030_alter_constraint_name'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='constraint', 15 | name='name', 16 | field=models.CharField(choices=[('BrightIDMeetVerification', 'BrightIDMeetVerification'), ('BrightIDAuraVerification', 'BrightIDAuraVerification'), ('HaveUnitapPass', 'HaveUnitapPass'), ('NotHaveUnitapPass', 'NotHaveUnitapPass'), ('OptimismDonationConstraint', 'OptimismDonationConstraint'), ('OptimismClaimingGasConstraint', 'OptimismClaimingGasConstraint')], max_length=255, unique=True), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /prizetap/migrations/0032_linearaffleentries.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-10-10 23:03 2 | 3 | from django.db import migrations, models 4 | import django.db.models.deletion 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('prizetap', '0031_alter_constraint_name'), 11 | ] 12 | 13 | operations = [ 14 | migrations.CreateModel( 15 | name='LineaRaffleEntries', 16 | fields=[ 17 | ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 18 | ('wallet_address', models.CharField(max_length=255)), 19 | ('is_winner', models.BooleanField(blank=True, default=False)), 20 | ('claim_tx', models.CharField(blank=True, max_length=255, null=True)), 21 | ('raffle', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='linear_entries', to='prizetap.raffle')), 22 | ], 23 | ), 24 | ] 25 | -------------------------------------------------------------------------------- /prizetap/migrations/0033_alter_linearaffleentries_raffle.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-10-16 07:44 2 | 3 | from django.db import migrations, models 4 | import django.db.models.deletion 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('prizetap', '0032_linearaffleentries'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AlterField( 15 | model_name='linearaffleentries', 16 | name='raffle', 17 | field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='linea_entries', to='prizetap.raffle'), 18 | ), 19 | ] 20 | -------------------------------------------------------------------------------- /prizetap/migrations/0034_raffle_vrf_tx_hash_alter_raffle_status.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-10-16 08:43 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('prizetap', '0033_alter_linearaffleentries_raffle'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='raffle', 15 | name='vrf_tx_hash', 16 | field=models.CharField(blank=True, max_length=255, null=True), 17 | ), 18 | migrations.AlterField( 19 | model_name='raffle', 20 | name='status', 21 | field=models.CharField(choices=[('PENDING', 'Pending'), ('REJECTED', 'Rejected'), ('VERIFIED', 'Verified'), ('CLOSED', 'Closed'), ('WS', 'Winner is set')], default='PENDING', max_length=10), 22 | ), 23 | ] 24 | -------------------------------------------------------------------------------- /prizetap/migrations/0035_alter_raffle_status.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-10-16 21:56 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('prizetap', '0034_raffle_vrf_tx_hash_alter_raffle_status'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='raffle', 15 | name='status', 16 | field=models.CharField(choices=[('PENDING', 'Pending'), ('REJECTED', 'Rejected'), ('VERIFIED', 'Verified'), ('HELD', 'Held'), ('CLOSED', 'Closed'), ('WS', 'Winner is set')], default='PENDING', max_length=10), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /prizetap/migrations/0036_raffle_winners_count.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-10-26 08:13 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('prizetap', '0035_alter_raffle_status'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='raffle', 15 | name='winners_count', 16 | field=models.IntegerField(default=1), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /prizetap/migrations/0037_alter_raffle_status.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-10-26 13:10 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('prizetap', '0036_raffle_winners_count'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='raffle', 15 | name='status', 16 | field=models.CharField(choices=[('PENDING', 'Pending'), ('REJECTED', 'Rejected'), ('VERIFIED', 'Verified'), ('RWS', 'Random words are set'), ('WS', 'Winners are set'), ('CLOSED', 'Closed')], default='PENDING', max_length=10), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /prizetap/migrations/0038_alter_constraint_name.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-11-09 09:09 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('prizetap', '0037_alter_raffle_status'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='constraint', 15 | name='name', 16 | field=models.CharField(choices=[('core.BrightIDMeetVerification', 'BrightIDMeetVerification'), ('core.BrightIDAuraVerification', 'BrightIDAuraVerification'), ('prizetap.HaveUnitapPass', 'HaveUnitapPass'), ('prizetap.NotHaveUnitapPass', 'NotHaveUnitapPass'), ('faucet.OptimismDonationConstraint', 'OptimismDonationConstraint'), ('faucet.OptimismClaimingGasConstraint', 'OptimismClaimingGasConstraint')], max_length=255, unique=True), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /prizetap/migrations/0039_rename_nft_id_raffle_nft_ids.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-11-09 07:02 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('prizetap', '0038_alter_constraint_name'), 10 | ] 11 | 12 | operations = [ 13 | migrations.RenameField( 14 | model_name='raffle', 15 | old_name='nft_id', 16 | new_name='nft_ids', 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /prizetap/migrations/0040_alter_raffle_nft_ids.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-11-09 07:03 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('prizetap', '0039_rename_nft_id_raffle_nft_ids'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='raffle', 15 | name='nft_ids', 16 | field=models.TextField(blank=True, null=True), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /prizetap/migrations/0042_alter_raffle_max_multiplier_and_more.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-11-20 14:36 2 | 3 | import django.core.validators 4 | from django.db import migrations, models 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('prizetap', '0041_raffle_email_url_raffle_necessary_information_and_more'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AlterField( 15 | model_name='raffle', 16 | name='max_multiplier', 17 | field=models.IntegerField(default=1, validators=[django.core.validators.MinValueValidator(1)]), 18 | ), 19 | migrations.AlterField( 20 | model_name='raffle', 21 | name='max_number_of_entries', 22 | field=models.IntegerField(validators=[django.core.validators.MinValueValidator(1)]), 23 | ), 24 | migrations.AlterField( 25 | model_name='raffle', 26 | name='winners_count', 27 | field=models.IntegerField(default=1, validators=[django.core.validators.MinValueValidator(1)]), 28 | ), 29 | ] 30 | -------------------------------------------------------------------------------- /prizetap/migrations/0043_constraint_explanation.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-11-22 05:30 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('prizetap', '0042_alter_raffle_max_multiplier_and_more'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='constraint', 15 | name='explanation', 16 | field=models.TextField(blank=True, null=True), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /prizetap/migrations/0044_raffle_reversed_constraints.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-11-23 09:12 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('prizetap', '0043_constraint_explanation'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='raffle', 15 | name='reversed_constraints', 16 | field=models.TextField(blank=True, null=True), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /prizetap/migrations/0045_alter_raffle_chain.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-12-04 07:17 2 | 3 | from django.db import migrations, models 4 | import django.db.models.deletion 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('core', '0005_auto_20231203_0832'), 11 | ('prizetap', '0044_raffle_reversed_constraints'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AlterField( 16 | model_name='raffle', 17 | name='chain', 18 | field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='raffles', to='core.chain'), 19 | ), 20 | ] 21 | -------------------------------------------------------------------------------- /prizetap/migrations/0046_alter_raffle_creator_name_alter_raffle_description.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-12-27 14:50 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('prizetap', '0045_alter_raffle_chain'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='raffle', 15 | name='creator_name', 16 | field=models.CharField(max_length=255), 17 | ), 18 | migrations.AlterField( 19 | model_name='raffle', 20 | name='description', 21 | field=models.TextField(), 22 | ), 23 | ] 24 | -------------------------------------------------------------------------------- /prizetap/migrations/0047_alter_raffleentry_user_wallet_address.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-11-30 17:04 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('prizetap', '0046_remove_raffleentry_user_wallet_and_more'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='raffleentry', 15 | name='user_wallet_address', 16 | field=models.CharField(max_length=255), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /prizetap/migrations/0047_constraint_negative_description.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2024-01-03 08:03 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('prizetap', '0046_alter_raffle_creator_name_alter_raffle_description'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='constraint', 15 | name='negative_description', 16 | field=models.TextField(blank=True, null=True), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /prizetap/migrations/0048_merge_20231216_1727.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-12-16 17:27 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('prizetap', '0045_alter_raffle_chain'), 10 | ('prizetap', '0047_alter_raffleentry_user_wallet_address'), 11 | ] 12 | 13 | operations = [ 14 | ] 15 | -------------------------------------------------------------------------------- /prizetap/migrations/0048_merge_20231226_1046.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-12-26 10:46 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('prizetap', '0045_alter_raffle_chain'), 10 | ('prizetap', '0047_alter_raffleentry_user_wallet_address'), 11 | ] 12 | 13 | operations = [ 14 | ] 15 | -------------------------------------------------------------------------------- /prizetap/migrations/0049_merge_20240105_1905.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2024-01-05 19:05 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('prizetap', '0047_constraint_negative_description'), 10 | ('prizetap', '0048_merge_20231226_1046'), 11 | ] 12 | 13 | operations = [ 14 | ] 15 | -------------------------------------------------------------------------------- /prizetap/migrations/0050_merge_20240105_1916.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2024-01-05 19:16 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('prizetap', '0048_merge_20231216_1727'), 10 | ('prizetap', '0049_merge_20240105_1905'), 11 | ] 12 | 13 | operations = [ 14 | ] 15 | -------------------------------------------------------------------------------- /prizetap/migrations/0051_alter_raffle_twitter_url.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2024-01-06 18:27 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('prizetap', '0050_merge_20240105_1916'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='raffle', 15 | name='twitter_url', 16 | field=models.URLField(blank=True, max_length=255, null=True), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /prizetap/migrations/0052_alter_constraint_name.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2024-01-17 10:37 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('prizetap', '0051_alter_raffle_twitter_url'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='constraint', 15 | name='name', 16 | field=models.CharField(choices=[('core.BrightIDMeetVerification', 'BrightIDMeetVerification'), ('core.BrightIDAuraVerification', 'BrightIDAuraVerification'), ('core.HasNFTVerification', 'HasNFTVerification'), ('core.AllowListVerification', 'AllowListVerification'), ('prizetap.HaveUnitapPass', 'HaveUnitapPass'), ('prizetap.NotHaveUnitapPass', 'NotHaveUnitapPass'), ('faucet.OptimismDonationConstraint', 'OptimismDonationConstraint'), ('faucet.OptimismClaimingGasConstraint', 'OptimismClaimingGasConstraint')], max_length=255, unique=True), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /prizetap/migrations/0053_alter_constraint_name.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2024-02-24 08:18 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('prizetap', '0052_alter_constraint_name'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='constraint', 15 | name='name', 16 | field=models.CharField(choices=[('core.BrightIDMeetVerification', 'BrightIDMeetVerification'), ('core.BrightIDAuraVerification', 'BrightIDAuraVerification'), ('core.HasNFTVerification', 'HasNFTVerification'), ('core.HasTokenVerification', 'HasTokenVerification'), ('core.AllowListVerification', 'AllowListVerification'), ('core.HasENSVerification', 'HasENSVerification'), ('prizetap.HaveUnitapPass', 'HaveUnitapPass'), ('prizetap.NotHaveUnitapPass', 'NotHaveUnitapPass'), ('faucet.OptimismDonationConstraint', 'OptimismDonationConstraint'), ('faucet.OptimismClaimingGasConstraint', 'OptimismClaimingGasConstraint')], max_length=255, unique=True), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /prizetap/migrations/0056_constraint_is_active.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2024-03-20 21:28 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('prizetap', '0055_alter_constraint_name'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='constraint', 15 | name='is_active', 16 | field=models.BooleanField(default=True), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /prizetap/migrations/0062_raffle_is_processed_raffle_pre_enrollment_file_and_more.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2024-07-01 19:50 2 | 3 | import django.core.validators 4 | from django.db import migrations, models 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('prizetap', '0061_alter_constraint_name'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AddField( 15 | model_name='raffle', 16 | name='is_processed', 17 | field=models.BooleanField(default=False), 18 | ), 19 | migrations.AddField( 20 | model_name='raffle', 21 | name='pre_enrollment_file', 22 | field=models.FileField(blank=True, null=True, upload_to='prizetap/pre_enrollments/%Y/%m/%d', validators=[django.core.validators.FileExtensionValidator(allowed_extensions=['csv'])]), 23 | ), 24 | migrations.AddField( 25 | model_name='raffleentry', 26 | name='pre_enrollment', 27 | field=models.BooleanField(blank=True, default=False), 28 | ), 29 | ] 30 | -------------------------------------------------------------------------------- /prizetap/migrations/0063_alter_raffleentry_user_profile.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2024-07-12 17:56 2 | 3 | from django.db import migrations, models 4 | import django.db.models.deletion 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('authentication', '0039_lensconnection_farcasterconnection'), 11 | ('prizetap', '0062_raffle_is_processed_raffle_pre_enrollment_file_and_more'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AlterField( 16 | model_name='raffleentry', 17 | name='user_profile', 18 | field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='raffle_entries', to='authentication.userprofile'), 19 | ), 20 | ] 21 | -------------------------------------------------------------------------------- /prizetap/migrations/0064_raffle_pre_enrollment_wallets.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2024-07-16 07:46 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('prizetap', '0063_alter_raffleentry_user_profile'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='raffle', 15 | name='pre_enrollment_wallets', 16 | field=models.TextField(blank=True, null=True), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /prizetap/migrations/0077_remove_raffle_image_url_raffle_image.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 5.0 on 2024-08-26 11:54 2 | 3 | import cloudflare_images.field 4 | from django.db import migrations 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('prizetap', '0077_alter_constraint_name'), 11 | ] 12 | 13 | operations = [ 14 | migrations.RenameField( 15 | model_name='raffle', 16 | old_name='image_url', 17 | new_name='image', 18 | ), 19 | migrations.AlterField( 20 | model_name='raffle', 21 | name='image', 22 | field=cloudflare_images.field.CloudflareImagesField(blank=True, max_length=255, null=True, upload_to='', variant='public'), 23 | ), 24 | ] -------------------------------------------------------------------------------- /prizetap/migrations/0079_fix_raffle_image_urls.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2024-08-25 09:12 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | def fix_raffle_images_prefix(apps, schema): 7 | Raffle = apps.get_model("prizetap", "Raffle") 8 | 9 | raffles = Raffle.objects.all() 10 | 11 | for raffle in raffles: 12 | if ( 13 | raffle.image 14 | and raffle.image.name 15 | and raffle.image.name.startswith("https://imagedelivery.net") 16 | ): 17 | # split the url to get the image id 18 | raffle.image.name = raffle.image.name.split("/")[-2] 19 | raffle.save() 20 | 21 | 22 | class Migration(migrations.Migration): 23 | 24 | dependencies = [ 25 | ("prizetap", "0078_alter_constraint_name"), 26 | ] 27 | 28 | operations = [ 29 | migrations.RunPython( 30 | fix_raffle_images_prefix, reverse_code=migrations.RunPython.noop 31 | ) 32 | ] 33 | -------------------------------------------------------------------------------- /prizetap/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UnitapApp/unitap-backend/95fe09d8f8519d6719a11716550b81f2e85531a2/prizetap/migrations/__init__.py -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- 1 | [tool.isort] 2 | profile = "black" 3 | 4 | [tool.black] 5 | target-version = ['py310'] 6 | include = '\.pyi?$' 7 | 8 | [tool.coverage.run] 9 | source = [ "." ] 10 | branch ='true' 11 | omit = [ 12 | "*/migrations/*", 13 | "*/test*.*", 14 | "*/*/__init__.py", 15 | "*/apps.py", 16 | "*/admin.py", 17 | "*/urls.py", 18 | "tmp.py", 19 | "manage.py", 20 | "load_test.py", 21 | "faucet/management/*", 22 | "faucet/faucet_manager/*_abi.py", 23 | "faucet/faucet_manager/anchor_client/*", 24 | "faucet/faucet_manager/brightid_user_registry.py", 25 | "faucet/faucet_manager/bright_id_interface.py", 26 | "faucet/faucet_manager/lnpay_manager/*", 27 | "*/settings.py", 28 | "*/asgi.py", 29 | "*/wsgi.py", 30 | "*/celery.py" 31 | ] 32 | -------------------------------------------------------------------------------- /quiztap/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UnitapApp/unitap-backend/95fe09d8f8519d6719a11716550b81f2e85531a2/quiztap/__init__.py -------------------------------------------------------------------------------- /quiztap/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class QuiztapConfig(AppConfig): 5 | default_auto_field = "django.db.models.BigAutoField" 6 | name = "quiztap" 7 | -------------------------------------------------------------------------------- /quiztap/constants.py: -------------------------------------------------------------------------------- 1 | REGISTER_COMPETITION_TASK_PERIOD_SECONDS = 10 2 | REST_BETWEEN_EACH_QUESTION_SECOND = 8 3 | ANSWER_TIME_SECOND = 22 4 | -------------------------------------------------------------------------------- /quiztap/filters.py: -------------------------------------------------------------------------------- 1 | from rest_framework import filters 2 | from rest_framework.generics import get_object_or_404 3 | 4 | from quiztap.models import Competition 5 | 6 | 7 | class CompetitionFilter(filters.BaseFilterBackend): 8 | """ 9 | Filter with competition_pk 10 | """ 11 | 12 | def filter_queryset(self, request, queryset, view): 13 | competition_pk = request.query_params.get("competition_pk") 14 | if competition_pk is None: 15 | return queryset 16 | return queryset.filter( 17 | competition=get_object_or_404(Competition, pk=competition_pk) 18 | ) 19 | 20 | 21 | class NestedCompetitionFilter(filters.BaseFilterBackend): 22 | """ 23 | Filter with competition_pk 24 | """ 25 | 26 | def filter_queryset(self, request, queryset, view): 27 | competition_pk = request.query_params.get("competition_pk") 28 | if competition_pk is None: 29 | return queryset 30 | return queryset.filter( 31 | user_competition__competition=get_object_or_404( 32 | Competition, pk=competition_pk 33 | ) 34 | ) 35 | -------------------------------------------------------------------------------- /quiztap/migrations/0002_remove_competition_rest_time_seconds_and_more.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2024-04-05 14:36 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('authentication', '0031_userprofile_is_verified'), 10 | ('quiztap', '0001_initial'), 11 | ] 12 | 13 | operations = [ 14 | migrations.RemoveField( 15 | model_name='competition', 16 | name='rest_time_seconds', 17 | ), 18 | migrations.RemoveField( 19 | model_name='question', 20 | name='answer_time_limit_seconds', 21 | ), 22 | migrations.AlterField( 23 | model_name='competition', 24 | name='status', 25 | field=models.CharField(choices=[('not_started', 'NOT_STARTED'), ('in_progress', 'IN_PROGRESS'), ('finished', 'FINISHED')], default='not_started', max_length=20), 26 | ), 27 | migrations.AlterUniqueTogether( 28 | name='useranswer', 29 | unique_together={('user_profile', 'question')}, 30 | ), 31 | ] 32 | -------------------------------------------------------------------------------- /quiztap/migrations/0004_alter_competition_status.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2024-04-05 21:43 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('quiztap', '0003_alter_useranswer_question_and_more'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='competition', 15 | name='status', 16 | field=models.CharField(choices=[('NOT_STARTED', 'Not started'), ('IN_PROGRESS', 'In progress'), ('FINISHED', 'Finished')], default='NOT_STARTED', max_length=20), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /quiztap/migrations/0006_question_answer_can_be_shown_question_can_be_shown.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2024-04-06 10:17 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('quiztap', '0005_alter_useranswer_unique_together_and_more'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='question', 15 | name='answer_can_be_shown', 16 | field=models.BooleanField(default=False), 17 | ), 18 | migrations.AddField( 19 | model_name='question', 20 | name='can_be_shown', 21 | field=models.BooleanField(default=False), 22 | ), 23 | ] 24 | -------------------------------------------------------------------------------- /quiztap/migrations/0007_competition_title.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2024-04-06 23:33 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | dependencies = [ 8 | ('quiztap', '0006_question_answer_can_be_shown_question_can_be_shown'), 9 | ] 10 | 11 | operations = [ 12 | migrations.AddField( 13 | model_name='competition', 14 | name='title', 15 | field=models.CharField(max_length=255), 16 | preserve_default=False, 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /quiztap/migrations/0008_alter_usercompetition_amount_won.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2024-04-07 00:41 2 | 3 | import core.models 4 | from django.db import migrations 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('quiztap', '0007_competition_title'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AlterField( 15 | model_name='usercompetition', 16 | name='amount_won', 17 | field=core.models.BigNumField(default=0, max_length=200), 18 | ), 19 | ] 20 | -------------------------------------------------------------------------------- /quiztap/migrations/0009_competition_amount_won_competition_winner_count.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2024-04-08 13:39 2 | 3 | import core.models 4 | from django.db import migrations, models 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('quiztap', '0008_alter_usercompetition_amount_won'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AddField( 15 | model_name='competition', 16 | name='amount_won', 17 | field=core.models.BigNumField(default=0, max_length=200), 18 | ), 19 | migrations.AddField( 20 | model_name='competition', 21 | name='winner_count', 22 | field=models.IntegerField(default=0), 23 | ), 24 | ] 25 | -------------------------------------------------------------------------------- /quiztap/migrations/0010_alter_competition_sponsor.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2024-04-15 18:02 2 | 3 | from django.db import migrations, models 4 | import django.db.models.deletion 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('core', '0006_sponsor'), 11 | ('quiztap', '0009_competition_amount_won_competition_winner_count'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AlterField( 16 | model_name='competition', 17 | name='sponsor', 18 | field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='competitions', to='core.sponsor'), 19 | ), 20 | ] 21 | -------------------------------------------------------------------------------- /quiztap/migrations/0011_alter_competition_sponsor.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2024-04-15 18:16 2 | 3 | from django.db import migrations, models 4 | import django.db.models.deletion 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('core', '0006_sponsor'), 11 | ('quiztap', '0010_alter_competition_sponsor'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AlterField( 16 | model_name='competition', 17 | name='sponsor', 18 | field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='competitions', to='core.sponsor'), 19 | ), 20 | ] 21 | -------------------------------------------------------------------------------- /quiztap/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UnitapApp/unitap-backend/95fe09d8f8519d6719a11716550b81f2e85531a2/quiztap/migrations/__init__.py -------------------------------------------------------------------------------- /quiztap/permissions.py: -------------------------------------------------------------------------------- 1 | from rest_framework.permissions import BasePermission 2 | 3 | from quiztap.models import UserCompetition 4 | from quiztap.utils import is_user_eligible_to_participate 5 | 6 | 7 | class IsEligibleToAnswer(BasePermission): 8 | """ 9 | Permission to allow access if the 10 | user is eligible to answer questions in the competition. 11 | """ 12 | 13 | def has_permission(self, request, view): 14 | user_competition_pk = request.data.get("user_competition") 15 | if user_competition_pk is None: 16 | return False 17 | user_profile = request.user.profile 18 | try: 19 | user_competition = UserCompetition.objects.get(pk=user_competition_pk) 20 | return is_user_eligible_to_participate( 21 | user_profile, user_competition.competition 22 | ) 23 | except UserCompetition.DoesNotExist: 24 | return False 25 | -------------------------------------------------------------------------------- /quiztap/tests.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UnitapApp/unitap-backend/95fe09d8f8519d6719a11716550b81f2e85531a2/quiztap/tests.py -------------------------------------------------------------------------------- /quiztap/urls.py: -------------------------------------------------------------------------------- 1 | from django.urls import path 2 | 3 | from quiztap.views import ( 4 | CompetitionView, 5 | CompetitionViewList, 6 | EnrollInCompetitionView, 7 | QuestionView, 8 | UserAnswerView, 9 | ) 10 | 11 | urlpatterns = [ 12 | path("competitions/", CompetitionViewList.as_view(), name="competition-list"), 13 | path("competitions//", CompetitionView.as_view(), name="competition"), 14 | path("questions//", QuestionView.as_view(), name="question"), 15 | path( 16 | "competitions/enroll/", 17 | EnrollInCompetitionView.as_view(), 18 | name="enroll-competition", 19 | ), 20 | path( 21 | "competitions/submit-answer/", 22 | UserAnswerView.as_view(), 23 | name="user-competition-answers", 24 | ), 25 | ] 26 | -------------------------------------------------------------------------------- /quiztap/utils.py: -------------------------------------------------------------------------------- 1 | from django.core.cache import cache 2 | from django.utils import timezone 3 | 4 | from authentication.models import UserProfile 5 | from quiztap.models import Competition, UserCompetition 6 | 7 | 8 | def is_user_eligible_to_participate( 9 | user_profile: UserProfile, competition: Competition 10 | ) -> bool: 11 | try: 12 | user_competition_pk = UserCompetition.objects.get( 13 | user_profile=user_profile, competition=competition 14 | ).pk 15 | except UserCompetition.DoesNotExist: 16 | return False 17 | eligible_users = cache.get(f"comp_{competition.pk}_eligible_users") 18 | return ( 19 | competition.is_active 20 | and competition.status == competition.Status.IN_PROGRESS 21 | and competition.start_at <= timezone.now() 22 | and (eligible_users is None or user_competition_pk in eligible_users) 23 | ) 24 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | bip-utils==2.3.0 2 | django==5.1.2 3 | anchorpy==0.15.0 4 | djangorestframework==3.15.2 5 | djangorestframework-camel-case==1.3.0 6 | dj-database-url==0.5.0 7 | django-celery-results==2.3.1 8 | django-bmemcached==0.3.0 9 | django-cors-headers==4.4.0 10 | django-encrypted-model-fields==0.6.5 11 | django-filter==24.3 12 | django-polymorphic==3.1.0 13 | django-rest-polymorphic==0.1.10 14 | drf-yasg~=1.21 15 | ed25519==1.5 16 | psycopg2-binary==2.9.3 17 | gunicorn==20.1.0 18 | locust==2.26.0 19 | redis==4.3.3 20 | python-dotenv==0.20.0 21 | python-memcached==1.59 22 | sentry-sdk==1.5.12 23 | uWSGI==2.0.22 24 | web3==6.9.0 25 | whitenoise==6.1.0 26 | solana==0.29.1 27 | solders==0.14.3 28 | coverage~=7.3.2 29 | pytz~=2023.3.post1 30 | requests~=2.31.0 31 | celery~=5.3.4 32 | django-safedelete~=1.3.3 33 | tweepy~=4.14.0 34 | ratelimit~=2.2.1 35 | pillow==10.4.0 36 | django-cloudflare-images~=0.6.0 37 | zstandard~=0.17.0 38 | pyTelegramBotAPI==4.23.0 39 | django-telegram-login==0.2.3 -------------------------------------------------------------------------------- /requirements/local.txt: -------------------------------------------------------------------------------- 1 | pre-commit~=3.5 2 | isort~=5.1.0 3 | -------------------------------------------------------------------------------- /sample.env: -------------------------------------------------------------------------------- 1 | POSTGRES_DB="unitap" 2 | POSTGRES_USER="postgres" 3 | POSTGRES_PASSWORD="postgres" 4 | FIELD_KEY="rnPAm1QKx8hepMhqV0IKJxB9tdR_hhU4-0EVTGVXQg0=" 5 | SECRET_KEY="django-insecure-!=_mi0j#rhk7c9p-0wg-3me6y&fk$+fahz6fh)k1n#&@s(9vf5" 6 | BRIGHT_PRIVATE_KEY="" 7 | DEBUG="True" 8 | SENTRY_DSN="DEBUG-DSN" 9 | DEPLOYMENT_ENV="dev" 10 | -------------------------------------------------------------------------------- /start.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | python manage.py collectstatic --noinput 3 | python manage.py migrate 4 | uwsgi --socket 0.0.0.0:5678 --protocol=http -w brightIDfaucet.wsgi & 5 | celery -A brightIDfaucet worker -B -------------------------------------------------------------------------------- /start_dev.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | python manage.py collectstatic --noinput 3 | python manage.py migrate 4 | python manage.py runserver 0.0.0.0:5678 5 | celery -A brightIDfaucet worker -B -------------------------------------------------------------------------------- /telegram/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UnitapApp/unitap-backend/95fe09d8f8519d6719a11716550b81f2e85531a2/telegram/__init__.py -------------------------------------------------------------------------------- /telegram/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | from django.conf import settings 3 | 4 | 5 | class TelegramConfig(AppConfig): 6 | default_auto_field = "django.db.models.BigAutoField" 7 | name = "telegram" 8 | 9 | def ready(self) -> None: 10 | if settings.DEPLOYMENT_ENV == "DEV": 11 | return super().ready() 12 | 13 | from .bot import TelegramMessenger 14 | from telegram import messages 15 | 16 | messenger = TelegramMessenger.get_instance() 17 | messenger.ensure_webhook() 18 | messenger.ready() 19 | 20 | return super().ready() 21 | -------------------------------------------------------------------------------- /telegram/forms.py: -------------------------------------------------------------------------------- 1 | from django import forms 2 | 3 | 4 | class BroadcastMessageForm(forms.Form): 5 | message = forms.CharField(widget=forms.Textarea, label="Message") 6 | -------------------------------------------------------------------------------- /telegram/messages/__init__.py: -------------------------------------------------------------------------------- 1 | from .about import AboutMessageHandler 2 | from .gastap_stats import GastapStatsHandler 3 | from .start import StartCommandHandler 4 | from .bug_reporter import * 5 | -------------------------------------------------------------------------------- /telegram/messages/about.py: -------------------------------------------------------------------------------- 1 | from telegram.bot import BaseTelegramMessageHandler 2 | from telebot import types 3 | 4 | 5 | about_text = """**About Unitap** 6 | 7 | Welcome to Unitap, your smart companion for managing tasks, getting updates, and automating processes\! Whether you're working on a project, organizing events, or just need help staying on top of things, Unitap is here to assist\. 8 | 9 | With Unitap, you can: 10 | \- **Receive timely notifications** for important events\. 11 | \- **Submit and track issues** directly within your workspace\. 12 | \- **Connect with services** and streamline your workflow\. 13 | \- **Ask for help or request hints** to navigate challenges\. 14 | 15 | Unitap is designed to integrate seamlessly with your tools, making your work life smoother and more efficient. Start interacting today by typing `/help` to see available commands\! 16 | 17 | read more here https://unitap.app/about 18 | """ 19 | 20 | 21 | class AboutMessageHandler(BaseTelegramMessageHandler): 22 | message = "About Unitap ❓" 23 | 24 | def handler(self, message: types.Message): 25 | self.messenger.reply_to(message, text=about_text, parse_mode="MarkdownV2") 26 | -------------------------------------------------------------------------------- /telegram/messages/easter_egg.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UnitapApp/unitap-backend/95fe09d8f8519d6719a11716550b81f2e85531a2/telegram/messages/easter_egg.py -------------------------------------------------------------------------------- /telegram/messages/menu.py: -------------------------------------------------------------------------------- 1 | from telebot import types 2 | 3 | 4 | home_markup = types.ReplyKeyboardMarkup() 5 | 6 | home_markup.add(types.KeyboardButton("Stats of gastap")) 7 | 8 | home_markup.add(types.KeyboardButton("Report a bug 🪲")) 9 | 10 | home_markup.add(types.KeyboardButton("About Unitap ❓")) 11 | -------------------------------------------------------------------------------- /telegram/messages/start.py: -------------------------------------------------------------------------------- 1 | from telegram.bot import BaseTelegramCommandHandler 2 | from telebot import types 3 | from .menu import home_markup 4 | 5 | 6 | class StartCommandHandler(BaseTelegramCommandHandler): 7 | command = "start" 8 | 9 | def handler(self, message: types.Message, command: str, args: list[str]): 10 | if args: 11 | return 12 | 13 | self.messenger.reply_to( 14 | message, 15 | "Welcome to unitap official telegram bot, how can i help you?", 16 | reply_markup=home_markup, 17 | ) 18 | -------------------------------------------------------------------------------- /telegram/migrations/0002_alter_telegramconnection_options.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 5.1.2 on 2024-10-17 11:56 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('telegram', '0001_initial'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterModelOptions( 14 | name='telegramconnection', 15 | options={'permissions': [('can_broadcast', 'Can broadcast messages')]}, 16 | ), 17 | ] 18 | -------------------------------------------------------------------------------- /telegram/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UnitapApp/unitap-backend/95fe09d8f8519d6719a11716550b81f2e85531a2/telegram/migrations/__init__.py -------------------------------------------------------------------------------- /telegram/models.py: -------------------------------------------------------------------------------- 1 | from typing_extensions import override 2 | from django.db import models 3 | from authentication.models import BaseThirdPartyConnection 4 | 5 | 6 | class TelegramConnection(BaseThirdPartyConnection): 7 | title = "Telegram" 8 | user_id = models.BigIntegerField() 9 | first_name = models.CharField(null=True, blank=True, max_length=255) 10 | last_name = models.CharField(null=True, blank=True, max_length=255) 11 | username = models.CharField(null=True, blank=True, max_length=600) 12 | # is_collected_easter_egg = models.BooleanField(default=False) 13 | 14 | @override 15 | def is_connected(self): 16 | return True 17 | 18 | class Meta: 19 | permissions = [ 20 | ("can_broadcast", "Can broadcast messages"), 21 | ] 22 | -------------------------------------------------------------------------------- /telegram/serializers.py: -------------------------------------------------------------------------------- 1 | from rest_framework import serializers 2 | 3 | from authentication.serializers import BaseThirdPartyConnectionSerializer 4 | from telegram.models import TelegramConnection 5 | 6 | 7 | class TelegramConnectionSerializer(BaseThirdPartyConnectionSerializer): 8 | hash = serializers.CharField(write_only=True) 9 | 10 | class Meta: 11 | model = TelegramConnection 12 | fields = "__all__" 13 | read_only_fields = ["created_at", "pk", "user_profile", "title"] 14 | 15 | def validate_address(self, raise_exception=False): 16 | return True 17 | 18 | def get_is_connected(self, obj): 19 | return True 20 | -------------------------------------------------------------------------------- /telegram/templates/admin/broadcast.html: -------------------------------------------------------------------------------- 1 | 2 | {% extends "admin/base_site.html" %} {% block content %} 3 |

Broadcast Message to Telegram Users

4 |
5 | {% csrf_token %} {{ form.as_p }} 6 | 7 |
8 | {% endblock %} 9 | -------------------------------------------------------------------------------- /telegram/tests.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UnitapApp/unitap-backend/95fe09d8f8519d6719a11716550b81f2e85531a2/telegram/tests.py -------------------------------------------------------------------------------- /telegram/urls.py: -------------------------------------------------------------------------------- 1 | from django.urls import path 2 | from .views import TelegramLoginCallbackView, telebot_respond 3 | 4 | 5 | urlpatterns = [ 6 | path( 7 | "login/callback/", 8 | TelegramLoginCallbackView.as_view(), 9 | name="telegram-login-callback", 10 | ), 11 | path("wh/", telebot_respond, name="telegram-update-messages"), 12 | ] 13 | -------------------------------------------------------------------------------- /tokenTap/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UnitapApp/unitap-backend/95fe09d8f8519d6719a11716550b81f2e85531a2/tokenTap/__init__.py -------------------------------------------------------------------------------- /tokenTap/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class TokentapConfig(AppConfig): 5 | default_auto_field = 'django.db.models.BigAutoField' 6 | name = 'tokenTap' 7 | -------------------------------------------------------------------------------- /tokenTap/migrations/0002_tokendistribution_permissions.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-05-09 19:24 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | # ('permissions', '0001_initial'), 10 | ('tokenTap', '0001_initial'), 11 | ] 12 | 13 | operations = [ 14 | # migrations.AddField( 15 | # model_name='tokendistribution', 16 | # name='permissions', 17 | # field=models.ManyToManyField(blank=True, to='permissions.permission'), 18 | # ), 19 | ] 20 | -------------------------------------------------------------------------------- /tokenTap/migrations/0003_tokendistribution_max_number_of_claims.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-05-11 16:32 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('tokenTap', '0002_tokendistribution_permissions'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='tokendistribution', 15 | name='max_number_of_claims', 16 | field=models.IntegerField(blank=True, null=True), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /tokenTap/migrations/0004_tokendistribution_notes.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-05-12 08:07 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('tokenTap', '0003_tokendistribution_max_number_of_claims'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='tokendistribution', 15 | name='notes', 16 | field=models.TextField(blank=True, null=True), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /tokenTap/migrations/0005_remove_tokendistributionclaim_signed_typed_data_and_more.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-05-14 05:18 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('tokenTap', '0004_tokendistribution_notes'), 10 | ] 11 | 12 | operations = [ 13 | migrations.RemoveField( 14 | model_name='tokendistributionclaim', 15 | name='signed_typed_data', 16 | ), 17 | migrations.AddField( 18 | model_name='tokendistributionclaim', 19 | name='nonce', 20 | field=models.BigIntegerField(blank=True, null=True), 21 | ), 22 | migrations.AddField( 23 | model_name='tokendistributionclaim', 24 | name='signature', 25 | field=models.CharField(blank=True, max_length=256, null=True), 26 | ), 27 | ] 28 | -------------------------------------------------------------------------------- /tokenTap/migrations/0006_remove_tokendistributionclaim_nonce_and_more.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-05-14 10:22 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('tokenTap', '0005_remove_tokendistributionclaim_signed_typed_data_and_more'), 10 | ] 11 | 12 | operations = [ 13 | migrations.RemoveField( 14 | model_name='tokendistributionclaim', 15 | name='nonce', 16 | ), 17 | migrations.RemoveField( 18 | model_name='tokendistributionclaim', 19 | name='signature', 20 | ), 21 | migrations.AddField( 22 | model_name='tokendistributionclaim', 23 | name='notes', 24 | field=models.TextField(blank=True, null=True), 25 | ), 26 | ] 27 | -------------------------------------------------------------------------------- /tokenTap/migrations/0007_tokendistributionclaim_nonce_and_more.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-05-14 10:24 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('tokenTap', '0006_remove_tokendistributionclaim_nonce_and_more'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='tokendistributionclaim', 15 | name='nonce', 16 | field=models.BigIntegerField(blank=True, null=True), 17 | ), 18 | migrations.AddField( 19 | model_name='tokendistributionclaim', 20 | name='signature', 21 | field=models.CharField(blank=True, default='', max_length=255, null=True), 22 | ), 23 | ] 24 | -------------------------------------------------------------------------------- /tokenTap/migrations/0008_alter_tokendistributionclaim_signature.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-05-14 10:24 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('tokenTap', '0007_tokendistributionclaim_nonce_and_more'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='tokendistributionclaim', 15 | name='signature', 16 | field=models.CharField(blank=True, max_length=255, null=True), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /tokenTap/migrations/0009_alter_tokendistributionclaim_signature.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-05-14 10:25 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('tokenTap', '0008_alter_tokendistributionclaim_signature'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='tokendistributionclaim', 15 | name='signature', 16 | field=models.CharField(blank=True, max_length=1024, null=True), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /tokenTap/migrations/0010_rename_distributer_tokendistribution_distributor_and_more.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-05-20 14:22 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('tokenTap', '0009_alter_tokendistributionclaim_signature'), 10 | ] 11 | 12 | operations = [ 13 | migrations.RenameField( 14 | model_name='tokendistribution', 15 | old_name='distributer', 16 | new_name='distributor', 17 | ), 18 | migrations.RenameField( 19 | model_name='tokendistribution', 20 | old_name='distributer_url', 21 | new_name='distributor_url', 22 | ), 23 | ] 24 | -------------------------------------------------------------------------------- /tokenTap/migrations/0011_tokendistribution_is_active_and_more.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-06-07 07:28 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('tokenTap', '0010_rename_distributer_tokendistribution_distributor_and_more'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='tokendistribution', 15 | name='is_active', 16 | field=models.BooleanField(default=True), 17 | ), 18 | migrations.AlterField( 19 | model_name='tokendistribution', 20 | name='distributor', 21 | field=models.CharField(blank=True, max_length=100, null=True), 22 | ), 23 | ] 24 | -------------------------------------------------------------------------------- /tokenTap/migrations/0012_tokendistributionclaim_status_and_more.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-06-24 18:20 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('tokenTap', '0011_tokendistribution_is_active_and_more'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='tokendistributionclaim', 15 | name='status', 16 | field=models.CharField(choices=[('Pending', 'Pending'), ('Verified', 'Verified'), ('Rejected', 'Rejected')], default='Pending', max_length=10), 17 | ), 18 | migrations.AddField( 19 | model_name='tokendistributionclaim', 20 | name='tx_hash', 21 | field=models.CharField(blank=True, max_length=255, null=True), 22 | ), 23 | ] 24 | -------------------------------------------------------------------------------- /tokenTap/migrations/0013_alter_tokendistributionclaim_status.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-06-24 19:15 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('tokenTap', '0012_tokendistributionclaim_status_and_more'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='tokendistributionclaim', 15 | name='status', 16 | field=models.CharField(choices=[('Pending', 'Pending'), ('Verified', 'Verified'), ('Rejected', 'Rejected'), ('Processed', 'Processed')], default='Pending', max_length=10), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /tokenTap/migrations/0014_alter_tokendistributionclaim_status.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-07-19 18:17 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('tokenTap', '0013_alter_tokendistributionclaim_status'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='tokendistributionclaim', 15 | name='status', 16 | field=models.CharField(choices=[('Pending', 'Pending'), ('Verified', 'Verified'), ('Rejected', 'Rejected'), ('Processed', 'Processed'), ('Processed_Rejected', 'Processed_Rejected')], default='Pending', max_length=30), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /tokenTap/migrations/0016_alter_constraint_name.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-07-20 14:07 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('tokenTap', '0015_constraint_alter_tokendistribution_permissions'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='constraint', 15 | name='name', 16 | field=models.CharField(choices=[('BrightIDMeetVerification', 'BrightIDMeetVerification'), ('BrightIDAuraVerification', 'BrightIDAuraVerification'), ('OncePerWeekVerification', 'OncePerWeekVerification'), ('OncePerMonthVerification', 'OncePerMonthVerification'), ('OnceInALifeTimeVerification', 'OnceInALifeTimeVerification')], max_length=255, unique=True), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /tokenTap/migrations/0017_tokendistribution_token_image_url.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-08-07 09:05 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('tokenTap', '0016_alter_constraint_name'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='tokendistribution', 15 | name='token_image_url', 16 | field=models.URLField(blank=True, max_length=255, null=True), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /tokenTap/migrations/0018_constraint_icon_url.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-10-07 05:51 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('tokenTap', '0017_tokendistribution_token_image_url'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='constraint', 15 | name='icon_url', 16 | field=models.CharField(blank=True, max_length=255, null=True), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /tokenTap/migrations/0019_alter_constraint_name.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-10-24 13:33 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('tokenTap', '0018_constraint_icon_url'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='constraint', 15 | name='name', 16 | field=models.CharField(choices=[('BrightIDMeetVerification', 'BrightIDMeetVerification'), ('BrightIDAuraVerification', 'BrightIDAuraVerification'), ('OncePerWeekVerification', 'OncePerWeekVerification'), ('OncePerMonthVerification', 'OncePerMonthVerification'), ('OnceInALifeTimeVerification', 'OnceInALifeTimeVerification'), ('OptimismHasClaimedGasInThisRound', 'OptimismHasClaimedGasInThisRound')], max_length=255, unique=True), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /tokenTap/migrations/0020_alter_constraint_name.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-10-27 18:29 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('tokenTap', '0019_alter_constraint_name'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='constraint', 15 | name='name', 16 | field=models.CharField(choices=[('BrightIDMeetVerification', 'BrightIDMeetVerification'), ('BrightIDAuraVerification', 'BrightIDAuraVerification'), ('OncePerMonthVerification', 'OncePerMonthVerification'), ('OnceInALifeTimeVerification', 'OnceInALifeTimeVerification'), ('OptimismHasClaimedGasInThisRound', 'OptimismHasClaimedGasInThisRound')], max_length=255, unique=True), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /tokenTap/migrations/0021_alter_constraint_name.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-11-09 09:09 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('tokenTap', '0020_alter_constraint_name'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='constraint', 15 | name='name', 16 | field=models.CharField(choices=[('core.BrightIDMeetVerification', 'BrightIDMeetVerification'), ('core.BrightIDAuraVerification', 'BrightIDAuraVerification'), ('tokenTap.OncePerMonthVerification', 'OncePerMonthVerification'), ('tokenTap.OnceInALifeTimeVerification', 'OnceInALifeTimeVerification'), ('faucet.OptimismHasClaimedGasInThisRound', 'OptimismHasClaimedGasInThisRound')], max_length=255, unique=True), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /tokenTap/migrations/0022_constraint_explanation.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-11-22 05:39 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('tokenTap', '0021_alter_constraint_name'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='constraint', 15 | name='explanation', 16 | field=models.TextField(blank=True, null=True), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /tokenTap/migrations/0023_alter_tokendistribution_chain.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-12-05 08:34 2 | 3 | from django.db import migrations, models 4 | import django.db.models.deletion 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('core', '0005_auto_20231203_0832'), 11 | ('tokenTap', '0022_constraint_explanation'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AlterField( 16 | model_name='tokendistribution', 17 | name='chain', 18 | field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='token_distribution', to='core.chain'), 19 | ), 20 | ] 21 | -------------------------------------------------------------------------------- /tokenTap/migrations/0024_tokendistribution_contract.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-12-11 07:16 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('tokenTap', '0023_alter_tokendistribution_chain'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='tokendistribution', 15 | name='contract', 16 | field=models.CharField(blank=True, max_length=255, null=True), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /tokenTap/migrations/0025_constraint_negative_description.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2024-01-03 08:04 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('tokenTap', '0024_tokendistribution_contract'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='constraint', 15 | name='negative_description', 16 | field=models.TextField(blank=True, null=True), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /tokenTap/migrations/0025_merge_20231216_1727.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-12-16 17:27 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('tokenTap', '0023_tokendistributionclaim_user_wallet_address'), 10 | ('tokenTap', '0024_tokendistribution_contract'), 11 | ] 12 | 13 | operations = [ 14 | ] 15 | -------------------------------------------------------------------------------- /tokenTap/migrations/0025_merge_20231226_1046.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2023-12-26 10:46 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('tokenTap', '0023_tokendistributionclaim_user_wallet_address'), 10 | ('tokenTap', '0024_tokendistribution_contract'), 11 | ] 12 | 13 | operations = [ 14 | ] 15 | -------------------------------------------------------------------------------- /tokenTap/migrations/0026_merge_20240105_1905.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2024-01-05 19:05 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('tokenTap', '0025_constraint_negative_description'), 10 | ('tokenTap', '0025_merge_20231226_1046'), 11 | ] 12 | 13 | operations = [ 14 | ] 15 | -------------------------------------------------------------------------------- /tokenTap/migrations/0027_merge_20240105_1916.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2024-01-05 19:16 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('tokenTap', '0025_merge_20231216_1727'), 10 | ('tokenTap', '0026_merge_20240105_1905'), 11 | ] 12 | 13 | operations = [ 14 | ] 15 | -------------------------------------------------------------------------------- /tokenTap/migrations/0028_rename_permissions_tokendistribution_constraints.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2024-01-09 19:09 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('tokenTap', '0027_merge_20240105_1916'), 10 | ] 11 | 12 | operations = [ 13 | migrations.RenameField( 14 | model_name='tokendistribution', 15 | old_name='permissions', 16 | new_name='constraints', 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /tokenTap/migrations/0030_tokendistribution_distributor_address_and_more.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2024-01-10 14:46 2 | 3 | from django.db import migrations, models 4 | import django.db.models.deletion 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('authentication', '0028_remove_wallet_unique_wallet_address_and_more'), 11 | ('tokenTap', '0029_tokendistribution_email_url_and_more'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AddField( 16 | model_name='tokendistribution', 17 | name='distributor_address', 18 | field=models.CharField(default='', max_length=255), 19 | preserve_default=False, 20 | ), 21 | migrations.AddField( 22 | model_name='tokendistribution', 23 | name='distributor_profile', 24 | field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.DO_NOTHING, related_name='token_distributions', to='authentication.userprofile'), 25 | preserve_default=False, 26 | ), 27 | ] 28 | -------------------------------------------------------------------------------- /tokenTap/migrations/0032_alter_constraint_name.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2024-01-19 14:43 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('tokenTap', '0031_tokendistribution_constraint_params_and_more'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='constraint', 15 | name='name', 16 | field=models.CharField(choices=[('core.BrightIDMeetVerification', 'BrightIDMeetVerification'), ('core.BrightIDAuraVerification', 'BrightIDAuraVerification'), ('core.HasNFTVerification', 'HasNFTVerification'), ('core.AllowListVerification', 'AllowListVerification'), ('tokenTap.OncePerMonthVerification', 'OncePerMonthVerification'), ('tokenTap.OnceInALifeTimeVerification', 'OnceInALifeTimeVerification'), ('faucet.OptimismHasClaimedGasInThisRound', 'OptimismHasClaimedGasInThisRound')], max_length=255, unique=True), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /tokenTap/migrations/0034_tokendistribution_distribution_id.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2024-02-07 09:05 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('tokenTap', '0033_globalsettings_alter_constraint_name'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='tokendistribution', 15 | name='distribution_id', 16 | field=models.BigIntegerField(blank=True, null=True), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /tokenTap/migrations/0035_tokendistribution_tx_hash.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2024-02-14 09:08 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('tokenTap', '0034_tokendistribution_distribution_id'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='tokendistribution', 15 | name='tx_hash', 16 | field=models.CharField(blank=True, max_length=255, null=True), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /tokenTap/migrations/0036_tokendistribution_decimals.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2024-02-18 17:51 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('tokenTap', '0035_tokendistribution_tx_hash'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='tokendistribution', 15 | name='decimals', 16 | field=models.IntegerField(blank=True, null=True), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /tokenTap/migrations/0037_alter_constraint_name.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2024-02-24 08:18 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('tokenTap', '0036_tokendistribution_decimals'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='constraint', 15 | name='name', 16 | field=models.CharField(choices=[('core.BrightIDMeetVerification', 'BrightIDMeetVerification'), ('core.BrightIDAuraVerification', 'BrightIDAuraVerification'), ('core.HasNFTVerification', 'HasNFTVerification'), ('core.HasTokenVerification', 'HasTokenVerification'), ('core.AllowListVerification', 'AllowListVerification'), ('core.HasENSVerification', 'HasENSVerification'), ('tokenTap.OncePerMonthVerification', 'OncePerMonthVerification'), ('tokenTap.OnceInALifeTimeVerification', 'OnceInALifeTimeVerification'), ('faucet.OptimismHasClaimedGasInThisRound', 'OptimismHasClaimedGasInThisRound')], max_length=255, unique=True), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /tokenTap/migrations/0039_tokendistribution_is_one_time_claim.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2024-03-05 06:44 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('tokenTap', '0038_alter_constraint_name'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='tokendistribution', 15 | name='is_one_time_claim', 16 | field=models.BooleanField(default=True), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /tokenTap/migrations/0041_constraint_is_active.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2024-03-20 21:28 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('tokenTap', '0040_alter_constraint_name'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='constraint', 15 | name='is_active', 16 | field=models.BooleanField(default=True), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /tokenTap/migrations/0046_tokendistribution_check_for_extension.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2024-05-25 07:47 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('tokenTap', '0045_alter_constraint_name'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='tokendistribution', 15 | name='check_for_extension', 16 | field=models.BooleanField(default=False), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /tokenTap/migrations/0049_tokendistribution_used_unitap_pass_list_and_more.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2024-07-11 10:17 2 | 3 | import django.contrib.postgres.fields 4 | from django.db import migrations, models 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('tokenTap', '0048_alter_constraint_name'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AddField( 15 | model_name='tokendistribution', 16 | name='used_unitap_pass_list', 17 | field=django.contrib.postgres.fields.ArrayField(base_field=models.IntegerField(), blank=True, default=list, size=None), 18 | ), 19 | migrations.AddField( 20 | model_name='tokendistributionclaim', 21 | name='is_unitap_pass_share', 22 | field=models.BooleanField(default=False), 23 | ), 24 | ] 25 | -------------------------------------------------------------------------------- /tokenTap/migrations/0050_alter_tokendistribution_used_unitap_pass_list.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.4 on 2024-07-17 14:08 2 | 3 | import core.models 4 | from django.db import migrations, models 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('tokenTap', '0049_tokendistribution_used_unitap_pass_list_and_more'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AlterField( 15 | model_name='tokendistribution', 16 | name='used_unitap_pass_list', 17 | field=core.models.UniqueArrayField(base_field=models.IntegerField(), blank=True, default=list, size=None), 18 | ), 19 | ] 20 | -------------------------------------------------------------------------------- /tokenTap/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UnitapApp/unitap-backend/95fe09d8f8519d6719a11716550b81f2e85531a2/tokenTap/migrations/__init__.py --------------------------------------------------------------------------------