From c9bd061ec483eeca5061620e0ddf2f87cc1303e6 Mon Sep 17 00:00:00 2001 From: Aditya Anand M C Date: Thu, 22 Jul 2021 07:15:42 +0530 Subject: [PATCH 1/7] bug: user being able to fire multiple start work events (#9310) --- app/assets/v2/js/pages/bounty_details2.js | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/app/assets/v2/js/pages/bounty_details2.js b/app/assets/v2/js/pages/bounty_details2.js index 20ce375b631..c77f70c1a27 100644 --- a/app/assets/v2/js/pages/bounty_details2.js +++ b/app/assets/v2/js/pages/bounty_details2.js @@ -1119,7 +1119,7 @@ var show_interest_modal = function() { _alert({ message: gettext('Please provide an action plan for this ticket. (min 30 chars)') }, 'danger'); return false; } - + $('#submit').attr('disabled', true); add_interest(document.result['pk'], { issue_message: msg }).then(success => { @@ -1157,20 +1157,6 @@ var show_interest_modal = function() { modals.bootstrapModal('show'); }; -// $('body').on('click', '.issue_description img', function() { -// var content = $.parseHTML( -// '
' + -// '' + -// '' + -// '' + -// '
' + -// '
'); - -// $(content).appendTo('body').modal({ -// modalClass: 'modal magnify' -// }); -// }); - function sleep(ms) { return new Promise(resolve => setTimeout(resolve, ms)); } From 132ec0410805aa33a6ffe20648f375b9408d178c Mon Sep 17 00:00:00 2001 From: Aditya Anand M C Date: Fri, 23 Jul 2021 10:07:03 +0530 Subject: [PATCH 2/7] update payout-address (#9319) --- app/app/settings.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/app/settings.py b/app/app/settings.py index f0e90679cd8..3ac202c5f41 100644 --- a/app/app/settings.py +++ b/app/app/settings.py @@ -909,8 +909,8 @@ def callback(request): # Match Payouts contract MATCH_PAYOUTS_ABI = '[ { "inputs": [ { "internalType": "address", "name": "_owner", "type": "address" }, { "internalType": "address", "name": "_funder", "type": "address" }, { "internalType": "contract IERC20", "name": "_dai", "type": "address" } ], "stateMutability": "nonpayable", "type": "constructor" }, { "anonymous": false, "inputs": [], "name": "Finalized", "type": "event" }, { "anonymous": false, "inputs": [], "name": "Funded", "type": "event" }, { "anonymous": false, "inputs": [], "name": "FundingWithdrawn", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": false, "internalType": "address", "name": "recipient", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" } ], "name": "PayoutAdded", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": false, "internalType": "address", "name": "recipient", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" } ], "name": "PayoutClaimed", "type": "event" }, { "inputs": [ { "internalType": "address", "name": "_recipient", "type": "address" } ], "name": "claimMatchPayout", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "dai", "outputs": [ { "internalType": "contract IERC20", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "enablePayouts", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "finalize", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "funder", "outputs": [ { "internalType": "address", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "owner", "outputs": [ { "internalType": "address", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "", "type": "address" } ], "name": "payouts", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "components": [ { "internalType": "address", "name": "recipient", "type": "address" }, { "internalType": "uint256", "name": "amount", "type": "uint256" } ], "internalType": "struct MatchPayouts.PayoutFields[]", "name": "_payouts", "type": "tuple[]" } ], "name": "setPayouts", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "state", "outputs": [ { "internalType": "enum MatchPayouts.State", "name": "", "type": "uint8" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "withdrawFunding", "outputs": [], "stateMutability": "nonpayable", "type": "function" } ]' -MATCH_PAYOUTS_ADDRESS = '0x3342e3737732d879743f2682a3953a730ae4f47c' -MATCH_PAYOUTS_ROUND_NUM = 9 +MATCH_PAYOUTS_ADDRESS = '0xa967fECb5Db61FB4078aA299Fe31D453cA38aCF2' +MATCH_PAYOUTS_ROUND_NUM = 10 # BulkCheckout contract # BulkCheckout parameters From 534b3f529e22a3ed0930feac4b128022795b8469 Mon Sep 17 00:00:00 2001 From: Aditya Anand M C Date: Fri, 23 Jul 2021 12:02:19 +0530 Subject: [PATCH 3/7] allow running CLR as sync fo debugging (#9320) --- .../management/commands/estimate_clr.py | 31 +++++++++++++------ 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/app/grants/management/commands/estimate_clr.py b/app/grants/management/commands/estimate_clr.py index e0b6db0c58a..11f5bdd9c9f 100644 --- a/app/grants/management/commands/estimate_clr.py +++ b/app/grants/management/commands/estimate_clr.py @@ -23,7 +23,7 @@ from grants.models import GrantCLR from grants.tasks import process_predict_clr - +from grants.clr import predict_clr class Command(BaseCommand): @@ -33,6 +33,7 @@ def add_arguments(self, parser): parser.add_argument('network', type=str, default='mainnet', choices=['rinkeby', 'mainnet']) parser.add_argument('clr_pk', type=str, default="all") parser.add_argument('what', type=str, default="full") + parser.add_argument('sync', type=str, default="false") # slim = just run 0 contribution match upcate calcs # full, run [0, 1, 10, 100, calcs across all grants] @@ -42,7 +43,8 @@ def handle(self, *args, **options): network = options['network'] clr_pk = options['clr_pk'] what = options['what'] - print (network, clr_pk, what) + sync = options['sync'] + print (network, clr_pk, what, sync) if clr_pk and clr_pk.isdigit(): active_clr_rounds = GrantCLR.objects.filter(pk=clr_pk) @@ -51,12 +53,23 @@ def handle(self, *args, **options): if active_clr_rounds: for clr_round in active_clr_rounds: - process_predict_clr( - save_to_db=True, - from_date=timezone.now(), - clr_round=clr_round, - network=network, - what=what, - ) + if sync == 'true': + # run it sync -> useful for payout / debugging + predict_clr( + save_to_db=True, + from_date=timezone.now(), + clr_round=clr_round, + network=network, + what=what, + ) + else: + # runs it as celery task. + process_predict_clr( + save_to_db=True, + from_date=timezone.now(), + clr_round=clr_round, + network=network, + what=what, + ) else: print("No active CLRs found") From 7179603f4b8aa40081981f798af68c02652c6617 Mon Sep 17 00:00:00 2001 From: Aditya Anand M C Date: Sun, 25 Jul 2021 09:54:28 +0530 Subject: [PATCH 4/7] disable cron clr --- scripts/crontab2 | 2 +- scripts/crontab4 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/crontab2 b/scripts/crontab2 index 982644fe3f5..83779c48a25 100644 --- a/scripts/crontab2 +++ b/scripts/crontab2 @@ -1,4 +1,4 @@ PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin ## CLR -1,30 * * * * cd gitcoin/coin; bash scripts/run_clr.bash slim 2>&1 +# 1,30 * * * * cd gitcoin/coin; bash scripts/run_clr.bash slim 2>&1 diff --git a/scripts/crontab4 b/scripts/crontab4 index a23ac4773db..d13b4af13cb 100644 --- a/scripts/crontab4 +++ b/scripts/crontab4 @@ -1,4 +1,4 @@ PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin ## CLR -1 */4 * * * cd gitcoin/coin; bash scripts/run_clr.bash full 2>&1 +# 1 */4 * * * cd gitcoin/coin; bash scripts/run_clr.bash full 2>&1 From 8f810d95acfa6c96e7a7047a62a85e0b75dfa972 Mon Sep 17 00:00:00 2001 From: Aditya Anand M C Date: Mon, 26 Jul 2021 17:11:18 +0530 Subject: [PATCH 5/7] chore: ability to ignore prediction values (#9323) --- app/grants/clr.py | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/app/grants/clr.py b/app/grants/clr.py index 5e711cdcc38..052d8a06a49 100644 --- a/app/grants/clr.py +++ b/app/grants/clr.py @@ -438,18 +438,28 @@ def predict_clr(save_to_db=False, from_date=None, clr_round=None, network='mainn if counter % 10 == 0 or True: print(f"- {counter}/{total_count} grants iter, pk:{grant.pk}, at {round(time.time(),1)}") - for amount in potential_donations: - # calculate clr with each additional donation and save to grants model - # print(f'using {total_pot_close}') - predicted_clr, grants_clr, _, _ = calculate_clr_for_donation( - grant, - amount, - grant_contributions_curr, - total_pot, - v_threshold, - uv_threshold - ) - potential_clr.append(predicted_clr) + if what == 'final': + # this is used when you want to count final distribution and ignore the prediction + for amount in potential_donations: + if amount == 0: + # actual calculation + predicted_clr, grants_clr, _, _ = calculate_clr_for_donation( + grant, amount, grant_contributions_curr, total_pot, v_threshold, uv_threshold + ) + else: + # ignore the other ones + predicted_clr = 0.0 + grants_clr = None + + potential_clr.append(predicted_clr) + else: + for amount in potential_donations: + # calculate clr with each additional donation and save to grants model + # print(f'using {total_pot_close}') + predicted_clr, grants_clr, _, _ = calculate_clr_for_donation( + grant, amount, grant_contributions_curr, total_pot, v_threshold, uv_threshold + ) + potential_clr.append(predicted_clr) if save_to_db: _grant = Grant.objects.get(pk=grant.pk) From bdf0364c74d34e0a4d6ba39ab2c90d4839749b7c Mon Sep 17 00:00:00 2001 From: owocki Date: Mon, 26 Jul 2021 11:01:35 -0600 Subject: [PATCH 6/7] email copy udpates for aditya --- app/marketing/mails.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/marketing/mails.py b/app/marketing/mails.py index a0b4006993b..3968c2c01e9 100644 --- a/app/marketing/mails.py +++ b/app/marketing/mails.py @@ -1126,6 +1126,7 @@ def grant_more_info_required(grant, more_info): def grant_match_distribution_test_txn(match): + raise Exception("no longer supported since we moved to non custodial payouts/email copy needs updated") to_email = match.grant.admin_profile.email cc_emails = [profile.email for profile in match.grant.team_members.all()] from_email = 'kyc@gitcoin.co' @@ -1203,12 +1204,13 @@ def grant_match_distribution_final_txn(match, needs_claimed=False): What next? 1. 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. -2. Celebrate 🎉 and consider joining us for KERNEL 3 ( https://kernel.community/ ) as you continue growing your project. 🛠🛠 -3. Please take a moment to comment on this thread to let us know what you thought of this grants round [https://github.com/gitcoinco/web/issues/8597]. We'd love to hear how the round went for you. +2. Celebrate 🎉 and consider joining us for KERNEL 4 ( https://kernel.community/ ) as you continue growing your project. 🛠🛠 +3. Feel free to grab some Gitcoin schwag at store.gitcoin.co - use code GRANTS_ROUND_10_GRANTEE for 45% off. +4. Please take a moment to comment on this thread to let us know what you thought of this grants round [https://twitter.com/owocki/status/1410651364850495489]. We'd love to hear how the round went for you. Thanks, -Team Gitcoin & The Funders League -"Our mission is to Grow Open Source & provide economic opportunities to software developers" https://gitcoin.co/mission +Team Gitcoin & The GitcoinDAO +"Our mission is to build & fund the open web" https://gitcoin.co/mission """ From 91621c60e58d03f54963e85f0786483f520587b2 Mon Sep 17 00:00:00 2001 From: Aditya Anand M C Date: Tue, 27 Jul 2021 22:42:34 +0530 Subject: [PATCH 7/7] update MATCH_PAYOUTS_ADDRESS --- app/app/settings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/app/settings.py b/app/app/settings.py index 3ac202c5f41..1dce4559135 100644 --- a/app/app/settings.py +++ b/app/app/settings.py @@ -909,7 +909,7 @@ def callback(request): # Match Payouts contract MATCH_PAYOUTS_ABI = '[ { "inputs": [ { "internalType": "address", "name": "_owner", "type": "address" }, { "internalType": "address", "name": "_funder", "type": "address" }, { "internalType": "contract IERC20", "name": "_dai", "type": "address" } ], "stateMutability": "nonpayable", "type": "constructor" }, { "anonymous": false, "inputs": [], "name": "Finalized", "type": "event" }, { "anonymous": false, "inputs": [], "name": "Funded", "type": "event" }, { "anonymous": false, "inputs": [], "name": "FundingWithdrawn", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": false, "internalType": "address", "name": "recipient", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" } ], "name": "PayoutAdded", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": false, "internalType": "address", "name": "recipient", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" } ], "name": "PayoutClaimed", "type": "event" }, { "inputs": [ { "internalType": "address", "name": "_recipient", "type": "address" } ], "name": "claimMatchPayout", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "dai", "outputs": [ { "internalType": "contract IERC20", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "enablePayouts", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "finalize", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "funder", "outputs": [ { "internalType": "address", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "owner", "outputs": [ { "internalType": "address", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "", "type": "address" } ], "name": "payouts", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "components": [ { "internalType": "address", "name": "recipient", "type": "address" }, { "internalType": "uint256", "name": "amount", "type": "uint256" } ], "internalType": "struct MatchPayouts.PayoutFields[]", "name": "_payouts", "type": "tuple[]" } ], "name": "setPayouts", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "state", "outputs": [ { "internalType": "enum MatchPayouts.State", "name": "", "type": "uint8" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "withdrawFunding", "outputs": [], "stateMutability": "nonpayable", "type": "function" } ]' -MATCH_PAYOUTS_ADDRESS = '0xa967fECb5Db61FB4078aA299Fe31D453cA38aCF2' +MATCH_PAYOUTS_ADDRESS = '0x3ebAFfe01513164e638480404c651E885cCA0AA4' MATCH_PAYOUTS_ROUND_NUM = 10 # BulkCheckout contract