From 2befa3c6da4423e8d60fecad05eeb32838e1f1a3 Mon Sep 17 00:00:00 2001 From: lash Date: Sun, 30 Jan 2022 20:07:37 +0000 Subject: [PATCH] Initial commit --- ge_render/__init__.py | 47 +++++++++++++++++++++++++++++++++++++++++++ requirements.txt | 2 ++ 2 files changed, 49 insertions(+) create mode 100644 ge_render/__init__.py create mode 100644 requirements.txt diff --git a/ge_render/__init__.py b/ge_render/__init__.py new file mode 100644 index 0000000..b781994 --- /dev/null +++ b/ge_render/__init__.py @@ -0,0 +1,47 @@ +# standard imports +import logging + +# external imports +from eth_accounts_index import AccountsIndex +from chainlib.eth.error import RequestMismatchException + +logg = logging.getLogger(__name__) + + +def get_method(chain_str, tx): + data = tx.payload + s = None + if len(data) >= 8: + s = data[:8] + v = sigmap.get(chain_str) + if v != None: + return v.get(s) + raise ValueError('not minimum signature length') + + +def apply(c, s, chain_str, conn, block, tx, db_session=None): + try: + m = get_method(chain_str, tx) + except ValueError as e: + return s + + if m == None: + return s + + return m(c, s, conn, block, tx) + + +def account_registry_add(c, s, conn, block, tx): + try: + o = AccountsIndex.parse_add_request(tx.payload) + ss = '{} block {} tx {} account registration for {}'.format(c, block.number, tx.index, o[0]) + return ss + except RequestMismatchException as e: + return None + + +sigmap = { + 'evm:byzantium:8996:bloxberg': { + '0a3b0a4f': account_registry_add, + }, + } diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..5c4df54 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +eth-monitor~=0.0.4 +eth_accounts_index~=0.1.2