Add vanilla gas transfer filter

This commit is contained in:
lash 2022-02-28 22:22:20 +00:00
parent 5127561b1f
commit cf59efa690
Signed by: lash
GPG Key ID: 21D2E7BB88C2A746
3 changed files with 23 additions and 1 deletions

View 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

View File

@ -47,6 +47,7 @@ class AddressIndex:
ks = list(txs.keys())
ks.sort()
ks.reverse()
for k in ks:
self.addresses[address].append(txs[k])

View File

@ -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