mirror of
git://holbrook.no/eth-monitor.git
synced 2024-12-22 07:07:32 +01:00
Add vanilla gas transfer filter
This commit is contained in:
parent
5127561b1f
commit
cf59efa690
22
eth_monitor/filters/gas/__init__.py
Normal file
22
eth_monitor/filters/gas/__init__.py
Normal file
@ -0,0 +1,22 @@
|
||||
# standard imports
|
||||
import datetime
|
||||
import logging
|
||||
|
||||
logg = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def apply(c, result, chain_spec, conn, block, tx, db_session=None):
|
||||
timestamp = datetime.datetime.fromtimestamp(block.timestamp)
|
||||
value = str(tx.value)
|
||||
if len(value) < 19:
|
||||
value = '{:018d}'.format(tx.value)
|
||||
value = '0.' + value
|
||||
else:
|
||||
ridx = len(value) - 18
|
||||
value = '{}.{}'.format(value[:ridx], value[ridx:])
|
||||
value = value.rstrip('0')
|
||||
if value[len(value)-1] == '.':
|
||||
value += '0'
|
||||
s = '{} {}\t{} -> {} = {}'.format(timestamp, tx.hash, tx.outputs[0], tx.inputs[0], value)
|
||||
result.set(s)
|
||||
return False
|
@ -47,6 +47,7 @@ class AddressIndex:
|
||||
|
||||
ks = list(txs.keys())
|
||||
ks.sort()
|
||||
ks.reverse()
|
||||
for k in ks:
|
||||
self.addresses[address].append(txs[k])
|
||||
|
||||
|
@ -82,7 +82,6 @@ if os.environ.get('RPC_AUTHENTICATION') == 'basic':
|
||||
rpc = EthHTTPConnection(args.p)
|
||||
|
||||
|
||||
|
||||
def main():
|
||||
store = FileStore(chain_spec, config.get('_CACHE_DIR'))
|
||||
use_rpc = rpc
|
||||
|
Loading…
Reference in New Issue
Block a user