Skip to content

Commit

Permalink
stable -> master (#7633)
Browse files Browse the repository at this point in the history
* payout round

* no more warnings when grants is out of gas

* throw in shit fix to ensure right projects load

Co-authored-by: owocki <[email protected]>
  • Loading branch information
thelostone-mc and owocki authored Oct 7, 2020
1 parent 5f3b99a commit 9027b8c
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 25 deletions.
9 changes: 9 additions & 0 deletions app/dashboard/router.py
Original file line number Diff line number Diff line change
Expand Up @@ -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) |
Expand Down
4 changes: 2 additions & 2 deletions app/grants/management/commands/ingest_grant_txns.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
28 changes: 23 additions & 5 deletions app/grants/management/commands/payout_round.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand All @@ -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"
)


Expand All @@ -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':
Expand Down
2 changes: 1 addition & 1 deletion app/grants/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
10 changes: 5 additions & 5 deletions app/grants/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
19 changes: 8 additions & 11 deletions app/marketing/mails.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
</pre>
"""
Expand Down Expand Up @@ -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
</pre>
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 9027b8c

Please sign in to comment.