Initial commit

This commit is contained in:
lash 2022-01-30 20:07:37 +00:00
commit 2befa3c6da
Signed by: lash
GPG Key ID: 21D2E7BB88C2A746
2 changed files with 49 additions and 0 deletions

47
ge_render/__init__.py Normal file
View File

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

2
requirements.txt Normal file
View File

@ -0,0 +1,2 @@
eth-monitor~=0.0.4
eth_accounts_index~=0.1.2