commit
8cfa556c04
|
@ -102,7 +102,8 @@ class Daemon:
|
||||||
}
|
}
|
||||||
|
|
||||||
data = self._make_request(data)
|
data = self._make_request(data)
|
||||||
data = data['result'].get('in', [])
|
data = data['result']
|
||||||
|
data = data.get('in', []) + data.get('pool', [])
|
||||||
|
|
||||||
# filter by current proposal
|
# filter by current proposal
|
||||||
txs = [tx for tx in data if tx.get('address') == address['address']]
|
txs = [tx for tx in data if tx.get('address') == address['address']]
|
||||||
|
@ -130,13 +131,14 @@ class Daemon:
|
||||||
|
|
||||||
data = {
|
data = {
|
||||||
"method": "get_transfers",
|
"method": "get_transfers",
|
||||||
"params": {"pool": True, "out": True, "account_index": index},
|
"params": {"pool": False, "out": True, "account_index": index},
|
||||||
"jsonrpc": "2.0",
|
"jsonrpc": "2.0",
|
||||||
"id": "0",
|
"id": "0",
|
||||||
}
|
}
|
||||||
|
|
||||||
data = self._make_request(data)
|
data = self._make_request(data)
|
||||||
data = data['result'].get('out', [])
|
data = data['result']
|
||||||
|
data = data.get('out', []) + data.get('pool', [])
|
||||||
|
|
||||||
# filter by current proposal
|
# filter by current proposal
|
||||||
txs = [tx for tx in data if tx.get('address') == address['address']]
|
txs = [tx for tx in data if tx.get('address') == address['address']]
|
||||||
|
@ -150,10 +152,10 @@ class Daemon:
|
||||||
}
|
}
|
||||||
|
|
||||||
def _make_request(self, data):
|
def _make_request(self, data):
|
||||||
if self.username:
|
options = {'json': data, 'headers': self.headers}
|
||||||
if self.password:
|
if self.username and self.password:
|
||||||
r = requests.post(self.url, auth=HTTPDigestAuth(settings.RPC_USERNAME, settings.RPC_PASSWORD), json=data, headers=self.headers)
|
options['auth'] = HTTPDigestAuth(settings.RPC_USERNAME, settings.RPC_PASSWORD)
|
||||||
else:
|
|
||||||
r = requests.post(self.url, json=data, headers=self.headers)
|
r = requests.post(self.url, **options)
|
||||||
r.raise_for_status()
|
r.raise_for_status()
|
||||||
return r.json()
|
return r.json()
|
||||||
|
|
|
@ -30,7 +30,7 @@ class Summary:
|
||||||
'coin-btc': coin_btc_value(),
|
'coin-btc': coin_btc_value(),
|
||||||
'btc-usd': price_cmc_btc_usd()
|
'btc-usd': price_cmc_btc_usd()
|
||||||
}
|
}
|
||||||
cache.set(cache_key, data=data, expiry=7200)
|
cache.set(cache_key, data=data, expiry=1200)
|
||||||
g.coin_prices = data
|
g.coin_prices = data
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
|
|
@ -57,5 +57,5 @@ class WowCache:
|
||||||
except:
|
except:
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
def set(self, key: str, data: dict, expiry = 300):
|
def set(self, key: str, data: dict, expiry=300):
|
||||||
self._cache.set(key, json.dumps(data, default=json_encoder), ex=expiry)
|
self._cache.set(key, json.dumps(data, default=json_encoder), ex=expiry)
|
||||||
|
|
|
@ -196,7 +196,7 @@ class Proposal(base):
|
||||||
if not isinstance(data, dict):
|
if not isinstance(data, dict):
|
||||||
print('error; get_transfers_in; %d' % self.id)
|
print('error; get_transfers_in; %d' % self.id)
|
||||||
return rtn
|
return rtn
|
||||||
cache.set(cache_key, data=data, expiry=300)
|
cache.set(cache_key, data=data, expiry=60)
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
print('error; get_transfers_in; %d' % self.id)
|
print('error; get_transfers_in; %d' % self.id)
|
||||||
return rtn
|
return rtn
|
||||||
|
@ -241,12 +241,14 @@ class Proposal(base):
|
||||||
if not isinstance(data, dict):
|
if not isinstance(data, dict):
|
||||||
print('error; get_transfers_out; %d' % self.id)
|
print('error; get_transfers_out; %d' % self.id)
|
||||||
return rtn
|
return rtn
|
||||||
cache.set(cache_key, data=data, expiry=300)
|
cache.set(cache_key, data=data, expiry=60)
|
||||||
except:
|
except:
|
||||||
print('error; get_transfers_out; %d' % self.id)
|
print('error; get_transfers_out; %d' % self.id)
|
||||||
return rtn
|
return rtn
|
||||||
|
|
||||||
|
data['remaining_pct'] = 0.0
|
||||||
prices = Summary.fetch_prices()
|
prices = Summary.fetch_prices()
|
||||||
|
|
||||||
for tx in data['txs']:
|
for tx in data['txs']:
|
||||||
if prices:
|
if prices:
|
||||||
tx['amount_usd'] = coin_to_usd(amt=tx['amount_human'], btc_per_coin=prices['coin-btc'], usd_per_btc=prices['btc-usd'])
|
tx['amount_usd'] = coin_to_usd(amt=tx['amount_human'], btc_per_coin=prices['coin-btc'], usd_per_btc=prices['btc-usd'])
|
||||||
|
@ -259,10 +261,10 @@ class Proposal(base):
|
||||||
data['pct'] = 0.0
|
data['pct'] = 0.0
|
||||||
data['spent'] = 0.0
|
data['spent'] = 0.0
|
||||||
|
|
||||||
if data['spent']:
|
cache_key_in = 'coin_balance_pid_%d' % self.id
|
||||||
data['remaining_pct'] = 100 / float(data['sum'] / data['spent'])
|
data_in = cache.get(cache_key_in)
|
||||||
else:
|
if data_in and data['spent']:
|
||||||
data['remaining_pct'] = 0.0
|
data['remaining_pct'] = 100 / float(data_in['sum'] / data['spent'])
|
||||||
|
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
|
|
@ -135,12 +135,12 @@ body {
|
||||||
}
|
}
|
||||||
|
|
||||||
.table-hover tbody tr:hover {
|
.table-hover tbody tr:hover {
|
||||||
background-color: rgba(0,0,0,.075);
|
background-color: rgba(0,0,0,.055);
|
||||||
}
|
}
|
||||||
|
|
||||||
.table th, .table td {
|
.table th, .table td {
|
||||||
border-top: 1px solid #008926;
|
border-top: 1px solid #00000029;
|
||||||
padding-top: .3rem;
|
padding-top: .65rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.table-tilted{
|
.table-tilted{
|
||||||
|
@ -169,7 +169,7 @@ body {
|
||||||
}
|
}
|
||||||
|
|
||||||
.table thead th {
|
.table thead th {
|
||||||
border-bottom: 1px solid #008926 !important;
|
border-bottom: 1px solid #00000029 !important;
|
||||||
border-top: none;
|
border-top: none;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
}
|
}
|
||||||
|
@ -612,4 +612,8 @@ ul.b {
|
||||||
.proposal_qr{
|
.proposal_qr{
|
||||||
margin-top:8px;
|
margin-top:8px;
|
||||||
margin-bottom:8px;
|
margin-bottom:8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-proposal tr {
|
||||||
|
background: #00000005;
|
||||||
}
|
}
|
|
@ -1,3 +1,5 @@
|
||||||
|
{% from 'proposal/macros/comment.html' import comment_entry %}
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
<div class="card my-6" id="incoming_txs">
|
<div class="card my-6" id="incoming_txs">
|
||||||
|
@ -18,69 +20,14 @@
|
||||||
<input type="submit" value="add comment">
|
<input type="submit" value="add comment">
|
||||||
</form>
|
</form>
|
||||||
{% else %}
|
{% else %}
|
||||||
You need to be logged in to comment.
|
You need to be <a href="{{ url_for('login') }}">logged in</a> to comment.
|
||||||
<br>
|
<br>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
{% for c in proposal._comments %}
|
{% for c in proposal._comments if not c.automated %}
|
||||||
<!-- Single Comment -->
|
{{ comment_entry(c, proposal) }}
|
||||||
<div class="media mb-4 comment-container" id="comment-{{c.id}}">
|
|
||||||
<div class="votearrow" title="upvote"></div>
|
|
||||||
<div class="media-body">
|
|
||||||
<span class="username">
|
|
||||||
<a href="/user/{{ c.user.username }}">
|
|
||||||
{{c.user.username}}
|
|
||||||
{% if c.user.username == proposal.user.username %}
|
|
||||||
<small>[op]</small>
|
|
||||||
{% endif %}
|
|
||||||
{% if c.user.admin %}
|
|
||||||
<small>[admin]</small>
|
|
||||||
{% endif %}
|
|
||||||
</a>
|
|
||||||
</span>
|
|
||||||
<span class="date_posted">
|
|
||||||
<a href="/proposal/{{proposal.id}}#comment-{{c.id}}">
|
|
||||||
{{c.date_added.strftime('%Y-%m-%d %H:%M')}}
|
|
||||||
</a>
|
|
||||||
</span><br>
|
|
||||||
<span data-id="{{c.id}}" class="body" style="{% if c.automated %}color:blue;{% endif %};word-break: break-all;">{{c.message}}</span>
|
|
||||||
<br>
|
|
||||||
{% if not c.automated %}
|
|
||||||
<a class="reply" href="{{url_for('propsal_comment_reply', cid=c.id, pid=proposal.id)}}">reply</a>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% for _c in c.comments %}
|
|
||||||
<div class="media mt-4 comment-container" id="comment-{{_c.id}}">
|
|
||||||
<div class="votearrow" title="upvote"></div>
|
|
||||||
<div class="media-body" id="comment">
|
|
||||||
<span class="username">
|
|
||||||
<a href="/user/{{ _c.user.username }}">
|
|
||||||
{{_c.user.username}}
|
|
||||||
{% if _c.user.username == proposal.user.username %}
|
|
||||||
<small>[op]</small>
|
|
||||||
{% endif %}
|
|
||||||
{% if _c.user.admin %}
|
|
||||||
<small>[admin]</small>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
</a>
|
|
||||||
</span>
|
|
||||||
<span class="date_posted">
|
|
||||||
<a href="/proposal/{{proposal.id}}#comment-{{_c.id}}">
|
|
||||||
{{_c.date_added.strftime('%Y-%m-%d %H:%M')}}
|
|
||||||
</a>
|
|
||||||
</span>
|
|
||||||
<br>
|
|
||||||
<span data-id="{{_c.id}}" class="body" style="word-break: break-all;">
|
|
||||||
{{_c.message}}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endfor %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<table class="table table-proposal table-hover" data-status="{{ status }}" style="margin-bottom:6px;">
|
<table class="table table-proposal table-hover" data-status="{{ status }}" style="margin-bottom:6px;">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th style="font-size: 20px;">{{title}}</th>
|
<th style="font-size: 18px;">{{title}}</th>
|
||||||
<th>Username</th>
|
<th>Username</th>
|
||||||
<th id="date">Date</th>
|
<th id="date">Date</th>
|
||||||
{% if _proposals and _proposals[0].status >= 2 %}
|
{% if _proposals and _proposals[0].status >= 2 %}
|
||||||
|
|
|
@ -51,7 +51,6 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<hr>
|
|
||||||
{% if proposal.status in [2,3] %}
|
{% if proposal.status in [2,3] %}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
|
@ -96,11 +95,14 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="col-lg-8">
|
<div class="col-lg-8">
|
||||||
{{proposal.balance['available']|round(3) or 0 }} WOW Raised
|
{{proposal.balance['available']|round(3) or 0 }} WOW Raised
|
||||||
{% if (proposal.funds_target-proposal.balance['available']|float|round(3)) > 0 %}
|
{% set remaining = proposal.funds_target - proposal.balance['available']|float|round(3) %}
|
||||||
({{ (proposal.funds_target-proposal.balance['available']|float|round(3)|int) }} WOW until goal)
|
|
||||||
{% else %}
|
{% if remaining > 0 %}
|
||||||
|
({{ (proposal.funds_target - proposal.balance['available']|float|round(3)|int) }} WOW until goal)
|
||||||
|
{% elif remaining < 0 %}
|
||||||
({{ (proposal.balance['available']-proposal.funds_target|float|round(3)|int) }} WOW past goal!)
|
({{ (proposal.balance['available']-proposal.funds_target|float|round(3)|int) }} WOW past goal!)
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<div class="progress">
|
<div class="progress">
|
||||||
<div class="progress-bar progress-warning progress-bar" style="width: {{proposal.balance['pct']}}%;">
|
<div class="progress-bar progress-warning progress-bar" style="width: {{proposal.balance['pct']}}%;">
|
||||||
</div>
|
</div>
|
||||||
|
@ -113,7 +115,7 @@
|
||||||
<div class="col-lg-8">
|
<div class="col-lg-8">
|
||||||
{{proposal.spends['spent']|round(3) or 0}} WOW Paid out
|
{{proposal.spends['spent']|round(3) or 0}} WOW Paid out
|
||||||
<div class="progress">
|
<div class="progress">
|
||||||
<div class="progress-bar progress-warning progress-bar" style="width: {{proposal.spends['spent_remaining_pct']}}%;">
|
<div class="progress-bar progress-warning progress-bar" style="width: {{proposal.spends['remaining_pct']}}%;">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<hr>
|
<hr>
|
||||||
|
@ -124,12 +126,11 @@
|
||||||
<div class="progress-bar progress-warning progress-bar" style="width: {{proposal.balance['remaining_pct']}}%;">
|
<div class="progress-bar progress-warning progress-bar" style="width: {{proposal.balance['remaining_pct']}}%;">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<hr>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<br/>
|
<br/>
|
||||||
</div>
|
</div>
|
||||||
<div class="row" style="margin-top:16px;">
|
<div class="row" style="margin-top:32px;">
|
||||||
<div class="col-lg-12">
|
<div class="col-lg-12">
|
||||||
Donation address:
|
Donation address:
|
||||||
<pre class="proposal_address">{% if proposal.addr_donation %}{{ proposal.addr_donation }}{% else %}<small>None generated yet</small>{% endif %}</pre>
|
<pre class="proposal_address">{% if proposal.addr_donation %}{{ proposal.addr_donation }}{% else %}<small>None generated yet</small>{% endif %}</pre>
|
||||||
|
@ -203,36 +204,51 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|
||||||
{% if proposal.spends['txs'] %}
|
{% if proposal.spends['txs'] %}
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<div class="card my-6" id="incoming_txs">
|
||||||
|
<h5 class="card-header">Outgoing transactions <small>({{proposal.spends['txs']|length}})</small></h5>
|
||||||
|
<div class="card-body">
|
||||||
|
<ul class="list-group">
|
||||||
|
{% for tx in proposal.spends['txs'] %}
|
||||||
|
<li class="list-group-item">
|
||||||
|
{{tx['datetime'].strftime('%Y-%m-%d %H:%M')}}
|
||||||
|
<span style="float:right"><b>Blockheight</b>: {{tx['height']}}</span>
|
||||||
|
<br>
|
||||||
|
<a target="_blank" href="https://explore.wownero.com/tx/{{tx['txid']}}">{{tx['txid'][:32]}}...</a>
|
||||||
|
<span style="float:right;color:#890000;font-weight:bold;">
|
||||||
|
- {{tx['amount_human']|round(3)}} WOW
|
||||||
|
{% if 'amount_usd' in tx %}
|
||||||
|
<small style="color: black">
|
||||||
|
➞ $ {{tx['amount_usd']}}
|
||||||
|
</small>
|
||||||
|
{% endif %}
|
||||||
|
</span>
|
||||||
|
</li>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- /.row -->
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% from 'proposal/macros/comment.html' import comment_entry %}
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
<div class="card my-6" id="incoming_txs">
|
<div class="card my-6" id="incoming_txs">
|
||||||
<h5 class="card-header">Outgoing transactions <small>({{proposal.spends['txs']|length}})</small></h5>
|
<h5 id="comments" class="card-header">Events</h5>
|
||||||
<div class="card-body">
|
<div class="card-body comments-panel">
|
||||||
<ul class="list-group">
|
{% for c in proposal._comments if c.automated %}
|
||||||
{% for tx in proposal.spends['txs'] %}
|
{{ comment_entry(c, proposal) }}
|
||||||
<li class="list-group-item">
|
{% endfor %}
|
||||||
{{tx['datetime'].strftime('%Y-%m-%d %H:%M')}}
|
|
||||||
<span style="float:right"><b>Blockheight</b>: {{tx['height']}}</span>
|
|
||||||
<br>
|
|
||||||
<a target="_blank" href="https://explore.wownero.com/tx/{{tx['txid']}}">{{tx['txid'][:32]}}...</a>
|
|
||||||
<span style="float:right;color:#890000;font-weight:bold;">
|
|
||||||
- {{tx['amount_human']|round(3)}} WOW
|
|
||||||
{% if 'amount_usd' in tx %}
|
|
||||||
<small style="color: black">
|
|
||||||
➞ $ {{tx['amount_usd']}}
|
|
||||||
</small>
|
|
||||||
{% endif %}
|
|
||||||
</span>
|
|
||||||
</li>
|
|
||||||
{% endfor %}
|
|
||||||
</ul>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- /.row -->
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
Loading…
Reference in New Issue