Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/stable'
Browse files Browse the repository at this point in the history
  • Loading branch information
gdixon committed Jul 27, 2021
2 parents 4776e34 + 91621c6 commit b7598d5
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 44 deletions.
4 changes: 2 additions & 2 deletions app/app/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '0x3ebAFfe01513164e638480404c651E885cCA0AA4'
MATCH_PAYOUTS_ROUND_NUM = 10

# BulkCheckout contract
# BulkCheckout parameters
Expand Down
16 changes: 1 addition & 15 deletions app/assets/v2/js/pages/bounty_details2.js
Original file line number Diff line number Diff line change
Expand Up @@ -1136,7 +1136,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 => {
Expand Down Expand Up @@ -1174,20 +1174,6 @@ var show_interest_modal = function() {
modals.bootstrapModal('show');
};

// $('body').on('click', '.issue_description img', function() {
// var content = $.parseHTML(
// '<div><div class="row"><div class="col-12 closebtn">' +
// '<a id="" rel="modal:close" href="javascript:void" class="close" aria-label="Close dialog">' +
// '<span aria-hidden="true">&times;</span>' +
// '</a>' +
// '</div>' +
// '<div class="col-12 pt-2 pb-2"><img class="magnify" src="' + $(this).attr('src') + '"/></div></div></div>');

// $(content).appendTo('body').modal({
// modalClass: 'modal magnify'
// });
// });

function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
Expand Down
34 changes: 22 additions & 12 deletions app/grants/clr.py
Original file line number Diff line number Diff line change
Expand Up @@ -443,18 +443,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)
Expand Down
31 changes: 22 additions & 9 deletions app/grants/management/commands/estimate_clr.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):

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

Expand All @@ -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)
Expand All @@ -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")
10 changes: 6 additions & 4 deletions app/marketing/mails.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '[email protected]'
Expand Down Expand Up @@ -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
</pre>
"""
Expand Down
2 changes: 1 addition & 1 deletion scripts/crontab2
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion scripts/crontab4
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit b7598d5

Please sign in to comment.