Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/gitcoinco/web
Browse files Browse the repository at this point in the history
  • Loading branch information
zoek1 committed Jul 21, 2020
2 parents 3e759cd + d4f25bf commit a4327ce
Show file tree
Hide file tree
Showing 22 changed files with 2,232 additions and 16,657 deletions.
2 changes: 1 addition & 1 deletion app/assets/v2/css/gitcoin.css
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ h4,
.sticky-top {
position: sticky!important;
top: 0;
z-index: 1;
z-index: 3;
}

.lighter {
Expand Down
6 changes: 3 additions & 3 deletions app/assets/v2/css/town_square.css
Original file line number Diff line number Diff line change
Expand Up @@ -984,8 +984,8 @@ body.green.offer_view .announce {
.nav-badge {
font-size: 9px;
color: var(--link-color);
top: -8px;
position: relative;
top: 20px;
position: absolute;
font-weight: bold;
}

Expand Down Expand Up @@ -1218,7 +1218,7 @@ body.green.offer_view .announce {
.activity.hackathon_new_hacker {
position: relative;
box-sizing: border-box;
z-index: 2;
z-index: 0;
}

.activity.hackathon_new_hacker:before {
Expand Down
Binary file added app/assets/v2/images/presskit/logos.zip
Binary file not shown.
26 changes: 15 additions & 11 deletions app/assets/v2/js/grants/new.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const init = () => {
}
*/

if (localStorage['grants_quickstart_disable'] !== 'true') {
if (localStorage['grants_quickstart_disable'] !== 'true' && window.location.pathname.includes('matic') == false) {
window.location = document.location.origin + '/grants/quickstart';
}

Expand Down Expand Up @@ -79,8 +79,10 @@ const init = () => {
data[this.name] = this.value;
});

$('#token_symbol').val($('#js-token option:selected').text());
$('#token_address').val($('#js-token option:selected').val());
if ($('#token_address').length) {
$('#token_symbol').val($('#js-token option:selected').text());
$('#token_address').val($('#js-token option:selected').val());
}

if (document.web3network) {
$('#network').val(document.web3network);
Expand Down Expand Up @@ -120,8 +122,13 @@ const init = () => {
formData.append('reference_url', $('#input-url').val());
formData.append('admin_address', $('#input-admin_address').val());
formData.append('contract_owner_address', $('#contract_owner_address').val());
formData.append('token_address', $('#token_address').val());
formData.append('token_symbol', $('#token_symbol').val());
if ($('#token_address').length) {
formData.append('token_address', $('#token_address').val());
formData.append('token_symbol', $('#token_symbol').val());
} else {
formData.append('token_address', '0x0000000000000000000000000000000000000000');
formData.append('token_symbol', 'Any Token');
}
formData.append('contract_version', $('#contract_version').val());
formData.append('transaction_hash', $('#transaction_hash').val());
formData.append('network', $('#network').val());
Expand Down Expand Up @@ -151,14 +158,11 @@ const init = () => {
});
};

window.addEventListener('dataWalletReady', function(e) {
init();
}, false);

$(document).ready(function() {

$('.select2-selection__choice').removeAttr('title');

init();
changeTokens();
});

function saveGrant(grantData, isFinal) {
Expand Down Expand Up @@ -194,7 +198,7 @@ function saveGrant(grantData, isFinal) {


$('#new_button').on('click', function(e) {
if (!provider) {
if (!provider && $('#token_address').length != 0) {
e.preventDefault();
return onConnect().then(() => init());
}
Expand Down
8 changes: 0 additions & 8 deletions app/dashboard/router.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,6 @@ class Meta:
class HackathonEventSerializer(serializers.ModelSerializer):
"""Handle serializing the hackathon object."""
sponsor_profiles = ProfileSerializer(many=True)
prizes = serializers.SerializerMethodField()
winners = serializers.SerializerMethodField()

def get_prizes(self, obj):
return Bounty.objects.filter(event=obj).distinct().count()

def get_winners(self, obj):
return reduce(lambda total, prize: total + len(prize.paid), Bounty.objects.filter(event=obj).distinct(), 0)

class Meta:
"""Define the hackathon serializer metadata."""
Expand Down
45 changes: 44 additions & 1 deletion app/dashboard/templates/dashboard/hackathon/new_bounty.html
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,49 @@
background-color: #f9f9f9;
border-color: #3E00FF;
}

.issue_description {
color: #000000;
font-size: 14px;
}

.issue_description h1,
.issue_description h2,
.issue_description h3,
.issue_description h4,
.issue_description h5,
.issue_description h6 {
letter-spacing: 1px;
font-size: 14px;
margin-top: 5px;
text-transform: none;
font-weight: 400;
}

.issue_description h1 {
font-size: 19px;
}

.issue_description h2 {
font-size: 18px;
}

.issue_description h3 {
font-size: 17px;
}

.issue_description h4 {
font-size: 16px;
}

.issue_description h5 {
font-size: 15px;
}

.vs__clear {
top: -2px;
position: relative;
}
</style>
</head>

Expand Down Expand Up @@ -181,7 +224,7 @@ <h1 class="text-center">Fund Prize</h1>
</div>
<div id="keyword-suggestion-container" class="font-caption font-weight-semibold mt-1">
<span>Add tags from your repo: </span>
<ul id="keyword-suggestions" class="d-flex list-unstyled">
<ul id="keyword-suggestions" class="d-flex list-unstyled flex-wrap">
<li class="select2-available__choice" v-for="keyword in form.issueDetails.keywords" @click="addKeyword(keyword)" :class="{'d-none': form.keywords.includes(keyword)}"><span class="text">[[keyword]]</span></li>
</ul>
</div>
Expand Down
32 changes: 27 additions & 5 deletions app/grants/management/commands/payout_round.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def handle(self, *args, **options):
DECIMALS = 18
what = options['what']
DAI_ADDRESS = '0x6b175474e89094c44da98b954eedeac495271d0f' if network=='mainnet' else '0x6a6e8b58dee0ca4b4ee147ad72d3ddd2ef1bf6f7'
CLR_TOKEN_ADDRESS = '0x7c19252abedce09724bfc3549925d3ea12770156' if network=='mainnet' else '0xc19b694ebd4309d7a2adcd9970f8d7f424a1528b'
CLR_TOKEN_ADDRESS = '0xed8306f10a5aa548d09c1d9c622f3f58dd9f2144' if network=='mainnet' else '0xc19b694ebd4309d7a2adcd9970f8d7f424a1528b'

# get data
scheduled_matches = CLRMatch.objects.filter(round_number=clr_round)
Expand Down Expand Up @@ -120,7 +120,7 @@ def handle(self, *args, **options):
is_real_payout = what == 'payout_dai'
TOKEN_ADDRESS = DAI_ADDRESS if is_real_payout else CLR_TOKEN_ADDRESS
kwargs = {}
token_name = 'CLR5' if not is_real_payout else 'DAI'
token_name = f'CLR{clr_round}' if not is_real_payout else 'DAI'
key = 'ready_for_test_payout' if not is_real_payout else 'ready_for_payout'
kwargs[key] = False
not_ready_scheduled_matches = scheduled_matches.filter(**kwargs)
Expand Down Expand Up @@ -160,14 +160,36 @@ def handle(self, *args, **options):
address = Web3.toChecksumAddress(address)

amount = int(amount_owed * 10**DECIMALS)
tx = contract.functions.transfer(address, amount).buildTransaction({
tx_args = {
'nonce': w3.eth.getTransactionCount(from_address),
'gas': 100000,
'gasPrice': int(float(recommend_min_gas_price_to_confirm_in_time(1)) * 10**9 * 1.4)
})
}
tx = contract.functions.transfer(address, amount).buildTransaction(tx_args)

signed = w3.eth.account.signTransaction(tx, from_pk)
tx_id = w3.eth.sendRawTransaction(signed.rawTransaction).hex()
tx_id = None
success = False
counter = 0
while not success:
try:
tx_id = w3.eth.sendRawTransaction(signed.rawTransaction).hex()
success = True
except Exception as e:
counter +=1
if 'replacement transaction underpriced' in str(e):
print(f'replacement transaction underpriced. retrying {counter}')
time.sleep(WAIT_TIME_BETWEEN_PAYOUTS)
elif 'nonce too low' in str(e):
print(f'nonce too low. retrying {counter}')
time.sleep(WAIT_TIME_BETWEEN_PAYOUTS)

# rebuild txn
tx_args['nonce'] = w3.eth.getTransactionCount(from_address)
tx = contract.functions.transfer(address, amount).buildTransaction(tx_args)
signed = w3.eth.account.signTransaction(tx, from_pk)
else:
raise e

if not tx_id:
print("cannot pay advance, did not get a txid")
Expand Down
2 changes: 1 addition & 1 deletion app/grants/templates/grants/card/clr_match.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ <h2 class="font-title font-weight-bold amount pt-1 mb-0">
{{ grant.clr_prediction_curve.0.1|floatformat:0|intcomma|default:0 }} DAI
</h2>
<p class="amount mb-2 font-caption font-weight-semibold">
MATCH ESTIMATE
FINAL MATCH
</p>
</div>
2 changes: 1 addition & 1 deletion app/grants/templates/grants/card/front.html
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ <h2 class="font-title font-weight-bold amount pt-1 mb-2">
{% if grant.id in round_5_5_grants %}
Current Round 5.5 Match
{% else %}
Estimated CLR Match
Final CLR Match
{% endif %}
</p>
{% else %}
Expand Down
19 changes: 9 additions & 10 deletions app/grants/templates/grants/detail/tabs.html
Original file line number Diff line number Diff line change
Expand Up @@ -109,17 +109,12 @@ <h4>Grant Sybil Profile</h4>
<pre>

A grant's SybilScore ™️ is calculated off of the total of suspicious activity on each of the following vectors:
- Account Newness
- Community Suspicous Activity Reports
- Suspicious IP Address
- Suspicious Ethereum Interactions
- Suspicious SMS Address
- Suspicious Account Activity
- Account Metadata
- Suspicious Interactions
- Grant Flags Reports
- BrightID Trust Score (coming soon)
- Idena Network Trust Score (coming soon)
- KYC (maybe coming soon)
- Inbound WebTraffic Profiles
- Time Series Data
- MACI (maybe coming soon)

a grant's RiskScore ™️ is equal to its (SybilScore ™️)^2 * sqrt(its matching funds for this round).
</pre>
Expand All @@ -129,7 +124,7 @@ <h4>{{ele.0}}: (avg {{ele.1.1|floatformat:2}})</h4>
<table>
<tr>
<td>
SybilScore ™️
Index
</td>
<td>
Contributors
Expand All @@ -147,7 +142,11 @@ <h4>{{ele.0}}: (avg {{ele.1.1|floatformat:2}})</h4>
{% for sp in ele.1.0 %}
<tr style="border-top: 1px solid grey;">
<td>
{% if '0x' in sp.0 %}
<a href="https://etherscan.io/address/{{sp.0}}">{{sp.0}}</a>
{% else %}
{{sp.0}}
{% endif %}
</td>
<td>
{{sp.1}}
Expand Down
15 changes: 0 additions & 15 deletions app/grants/templates/grants/new-whitelabel.html
Original file line number Diff line number Diff line change
Expand Up @@ -122,19 +122,6 @@ <h5 class="mt-4">Project Information</h5>

<h5 class="mt-4">Funding Information</h5>
<hr>
<div class="form__group-horizontal pb-3">
<div class="row">
<div class="col-12 col-md-12">
<label class="font-body">{% trans "Accepted Tokens" %}</label>
<div class="form__select2">
<select class='js-select2' name='denomination' id='js-token'>
<option value="" disabled="disabled" class="loading_tokens">(Loading Tokens from Web3 Wallet)</option>
</select>
</div>
</div>
</div>
</div>

<div class="form__group-horizontal pb-3">
<label class="font-body" for="input-admin_address">{% trans "Funding Recipient Wallet Address" %}</label>
<input type="text" class="form__input form__input-lg " id="input-admin_address" value="" name="admin_address" required placeholder="0x00... or domain.eth"/>
Expand All @@ -156,8 +143,6 @@ <h3 class="text-center">
<input type="hidden" id="contract_address" name="contract_address" />
<input type="hidden" id="contract_owner_address" name="contract_owner_address">
<input type="hidden" id="contract_version" name="contract_version" value="2">
<input type="hidden" id="token_address" name="token_address" value="">
<input type="hidden" id="token_symbol" name="token_symbol" value="">
<input type="hidden" id="category" name="category" value="">
<input type="hidden" id="network" name="network">
<input type="hidden" id="trusted_relayer" name="trusted_relayer" value="{{ trusted_relayer }}">
Expand Down
10 changes: 6 additions & 4 deletions app/grants/templates/grants/shared/landing_hero.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@
<span class="title-round"><span class="amount-round">${{total_clr_pot|intcomma}}</span> matching ended Friday 7/3 at noon EST!</span>
</strong>
<BR>
*DRAFT* Schedule:
Schedule:
<BR>
- Friday 7/10: Final Results & Payouts Start
- Sunday 7/12: Final Results
<BR>
- Tuesday 7/14: Target Date for Payouts Complete
- Tuesday 7/14: Payouts Start
<BR>
(note: this payout schedule is pending confirmation)
- Thursday 7/16: Target Date for Payouts Complete
<BR>
(note: all amounts & dates subject to change with anti collusion checks)
</p>
<div class="float-right">
<a class="btn btn-gc-blue" href="{% url 'grants:new' %}">
Expand Down
Loading

0 comments on commit a4327ce

Please sign in to comment.