From f375f7d8705b073c0a2c1d6f86eb253ea2cf331c Mon Sep 17 00:00:00 2001 From: owocki Date: Tue, 6 Oct 2020 14:42:07 -0600 Subject: [PATCH 1/3] payout round --- .../management/commands/payout_round.py | 28 +++++++++++++++---- app/grants/models.py | 2 +- app/marketing/mails.py | 19 ++++++------- 3 files changed, 32 insertions(+), 17 deletions(-) diff --git a/app/grants/management/commands/payout_round.py b/app/grants/management/commands/payout_round.py index 2d607c629eb..159b7b970c7 100644 --- a/app/grants/management/commands/payout_round.py +++ b/app/grants/management/commands/payout_round.py @@ -29,8 +29,7 @@ from dashboard.models import Activity, Earning, Profile from dashboard.utils import get_tx_status, get_web3, has_tx_mined from gas.utils import recommend_min_gas_price_to_confirm_in_time -from grants.models import CLRMatch, Contribution, Grant, Subscription -from grants.views import clr_round # TODO-SELF-SERVICE: REMOVE THIS +from grants.models import CLRMatch, Contribution, Grant, GrantCLR, Subscription from marketing.mails import ( grant_match_distribution_final_txn, grant_match_distribution_kyc, grant_match_distribution_test_txn, ) @@ -47,7 +46,19 @@ def add_arguments(self, parser): parser.add_argument('what', default='finalize', type=str, - help="what do we do? (finalize, payout_test, payout_dai, prepare_final_payout)" + help="what do we do? (finalize, payout_test, prepare_final_payout, payout_dai)" + ) + + parser.add_argument('clr_pks', + default='', + type=str, + help="what CLR PKs should we payout? (eg 1,2,3,4)" + ) + + parser.add_argument('clr_round', + default='', + type=int, + help="what CLR round number is this? eg 7" ) @@ -61,12 +72,19 @@ def handle(self, *args, **options): from_pk = settings.GRANTS_PAYOUT_PRIVATE_KEY DECIMALS = 18 what = options['what'] + clr_round = options['clr_round'] DAI_ADDRESS = '0x6b175474e89094c44da98b954eedeac495271d0f' if network=='mainnet' else '0x6a6e8b58dee0ca4b4ee147ad72d3ddd2ef1bf6f7' - CLR_TOKEN_ADDRESS = '0xed8306f10a5aa548d09c1d9c622f3f58dd9f2144' if network=='mainnet' else '0xc19b694ebd4309d7a2adcd9970f8d7f424a1528b' + CLR_TOKEN_ADDRESS = '0xe4101d014443af2b7f6f9f603e904adc9faf0de5' if network=='mainnet' else '0xc19b694ebd4309d7a2adcd9970f8d7f424a1528b' # get data + clr_pks = options['clr_pks'].split(',') + gclrs = GrantCLR.objects.filter(pk__in=clr_pks) + pks = [] + for gclr in gclrs: + pks += gclr.grants.values_list('pk', flat=True) scheduled_matches = CLRMatch.objects.filter(round_number=clr_round) - grants = Grant.objects.filter(active=True, network='mainnet', link_to_new_grant__isnull=True) + grants = Grant.objects.filter(active=True, network='mainnet', link_to_new_grant__isnull=True, pk__in=pks) + print(f"got {grants.count()} grants") # finalize rankings if what == 'finalize': diff --git a/app/grants/models.py b/app/grants/models.py index 7a77be3e6fb..29169dc37f1 100644 --- a/app/grants/models.py +++ b/app/grants/models.py @@ -167,7 +167,7 @@ def __str__(self): @property def grants(self): - return Grant.objects.filter(**self.grant_filters) + return Grant.objects.filter(**self.grant_filters).filter(is_clr_eligible=True) class Grant(SuperModel): diff --git a/app/marketing/mails.py b/app/marketing/mails.py index 03159033d4e..deb20bc11f9 100644 --- a/app/marketing/mails.py +++ b/app/marketing/mails.py @@ -1106,9 +1106,9 @@ def grant_match_distribution_test_txn(match): rounded_amount = round(match.amount, 2) token_name = f"CLR{match.round_number}" coupon = f"Pick up ONE item of Gitcoin Schwag at http://store.gitcoin.co/ at 25% off with coupon code {settings.GRANTS_COUPON_25_OFF}" - if match.amount > 100: + if match.amount > 500: coupon = f"Pick up ONE item of Gitcoin Schwag at http://store.gitcoin.co/ at 50% off with coupon code {settings.GRANTS_COUPON_50_OFF}" - if match.amount > 1000: + if match.amount > 3000: coupon = f"Pick up ONE item of Gitcoin Schwag at http://store.gitcoin.co/ at 100% off with coupon code {settings.GRANTS_COUPON_100_OFF}" # NOTE: IF YOURE A CLEVER BISCUT AND FOUND THIS BY READING OUR CODEBASE, # THEN GOOD FOR YOU! HERE IS A 100% OFF COUPON CODE U CAN USE (LIMIT OF 1 FOR THE FIRST PERSON @@ -1128,14 +1128,11 @@ def grant_match_distribution_test_txn(match): We will be issuing a final payout transaction in DAI within 24-72 hours of this email. No action is needed on your part, we will issue the final payout transaction automatically. -If you're looking to kill time before your payout is administered: -1. {coupon} (The Gitcoin Spring 2020 Edition is available at https://store.gitcoin.co/collections/ethereal-2020 ) -2. Mind helping us make Grants Round 6 even better? Fill out this donor survey: https://gitcoin.typeform.com/to/tAxEwe -3. Attend the Gitcoin livestream this week to let us know what you think should change for Grants Round 6: https://twitter.com/owocki/status/1250760421637644288 +If you're looking to kill time before your payout is administered.... {coupon} Thanks, -Kevin, Scott, Vivek and the Gitcoin Community -"Our mission is to Grow Open Source & provide economic opportunities to our community" https://gitcoin.co/mission +Kevin, Scott, Vivek & the Gitcoin Community +"Our mission is to Grow Open Source & provide economic opportunities to software developers" https://gitcoin.co/mission """ @@ -1172,13 +1169,13 @@ def grant_match_distribution_final_txn(match): Congratulations on a successful Gitcoin Grants Round {match.round_number}. What now? -1. Send a tweet letting us know how these grant funds are being used to support your project (our twitter username is @gitcoin). +1. Send a thank you tweet to the public goods justice league (who funded this round) on twitter: @balancerlabs @synthetix_io @iearnfinance @optimismpbc @chainlink @defiancecapital . Here is a handy one click link: https://twitter.com/intent/tweet?text=@balancerlabs+@synthetix_io+@iearnfinance+@optimismpbc+@chainlink+@defiancecapital+thank+you+for+funding+gitcoin+grants! 2. Remember to update your grantees on what you use the funds for by clicking through to your grant ( https://gitcoin.co{match.grant.get_absolute_url()} ) and posting to your activity feed. 3. Celebrate 🎉 and then get back to BUIDLing something great. 🛠 Thanks, -Kevin, Scott, Vivek and the Gitcoin Community -"Our mission is to Grow Open Source & provide economic opportunities to our community" https://gitcoin.co/mission +Kevin, Scott, Vivek & the Gitcoin Community +"Our mission is to Grow Open Source & provide economic opportunities to software developers" https://gitcoin.co/mission """ From b9522fea90b5df7f3554314d02fadcf7c335500f Mon Sep 17 00:00:00 2001 From: owocki Date: Tue, 6 Oct 2020 16:15:52 -0600 Subject: [PATCH 2/3] no more warnings when grants is out of gas --- .../management/commands/warn_when_wallet_out_of_eth.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/marketing/management/commands/warn_when_wallet_out_of_eth.py b/app/marketing/management/commands/warn_when_wallet_out_of_eth.py index b6539690007..d7dd21218aa 100644 --- a/app/marketing/management/commands/warn_when_wallet_out_of_eth.py +++ b/app/marketing/management/commands/warn_when_wallet_out_of_eth.py @@ -29,7 +29,7 @@ class Command(BaseCommand): def handle(self, *args, **options): w3 = get_web3('mainnet') - monitored_accounts = [settings.KUDOS_OWNER_ACCOUNT, settings.GRANTS_OWNER_ACCOUNT] + monitored_accounts = [settings.KUDOS_OWNER_ACCOUNT] for account in monitored_accounts: balance_eth_threshold = 0.1 if account == settings.KUDOS_OWNER_ACCOUNT: From 4ad725e6327a76018267ebbd1125ce6d3ec54ecf Mon Sep 17 00:00:00 2001 From: Aditya Anand M C Date: Wed, 7 Oct 2020 15:15:05 +0530 Subject: [PATCH 3/3] throw in shit fix to ensure right projects load --- app/dashboard/router.py | 9 +++++++++ app/grants/management/commands/ingest_grant_txns.py | 4 ++-- app/grants/urls.py | 10 +++++----- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/app/dashboard/router.py b/app/dashboard/router.py index 15a13c647ab..4bae2a3bc74 100644 --- a/app/dashboard/router.py +++ b/app/dashboard/router.py @@ -263,6 +263,15 @@ def get_queryset(self): bounty__bounty_owner_github_username=sponsor)).exclude( status='invalid').prefetch_related('profiles', 'bounty').order_by('-winner', order_by, 'id') + projects = [] + for project in queryset: + bounty = project.bounty + org_name = bounty.org_name + if org_name != sponsor: + projects.append(project.pk) + + queryset = queryset.exclude(pk__in=projects) + if q: queryset = queryset.filter( Q(name__icontains=q) | diff --git a/app/grants/management/commands/ingest_grant_txns.py b/app/grants/management/commands/ingest_grant_txns.py index 8f1164a49f6..8cfd21bcf9f 100644 --- a/app/grants/management/commands/ingest_grant_txns.py +++ b/app/grants/management/commands/ingest_grant_txns.py @@ -20,15 +20,15 @@ import datetime import os -import pytz from django.conf import settings from django.core.management.base import BaseCommand +import pytz import requests from dashboard.models import Activity, Profile -from economy.tx import headers from economy.models import Token +from economy.tx import headers from economy.utils import convert_token_to_usdt from grants.models import Contribution, Grant, Subscription from web3 import Web3 diff --git a/app/grants/urls.py b/app/grants/urls.py index bc7bd0c5aa2..5aa937c5f88 100644 --- a/app/grants/urls.py +++ b/app/grants/urls.py @@ -21,11 +21,11 @@ from grants.views import ( add_grant_from_collection, bulk_fund, bulk_grants_for_cart, clr_grants, flag, get_collection, get_collections_list, - get_grant_payload, get_grants, get_replaced_tx, grant_activity, grant_categories, grant_details, grant_fund, - grant_new, grant_new_whitelabel, grants, grants_addr_as_json, grants_bulk_add, grants_by_grant_type, - grants_cart_view, grants_clr, grants_stats_view, invoice, leaderboard, new_matching_partner, profile, quickstart, - remove_grant_from_collection, save_collection, subscription_cancel, toggle_grant_favorite, verify_grant, - zksync_get_interrupt_status, zksync_set_interrupt_status, grants_zksync_recovery_view, get_interrupted_contributions + get_grant_payload, get_grants, get_interrupted_contributions, get_replaced_tx, grant_activity, grant_categories, + grant_details, grant_fund, grant_new, grant_new_whitelabel, grants, grants_addr_as_json, grants_bulk_add, + grants_by_grant_type, grants_cart_view, grants_clr, grants_stats_view, grants_zksync_recovery_view, invoice, + leaderboard, new_matching_partner, profile, quickstart, remove_grant_from_collection, save_collection, + subscription_cancel, toggle_grant_favorite, verify_grant, zksync_get_interrupt_status, zksync_set_interrupt_status, ) app_name = 'grants'