Initial commit
This commit is contained in:
commit
2befa3c6da
47
ge_render/__init__.py
Normal file
47
ge_render/__init__.py
Normal 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
2
requirements.txt
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
eth-monitor~=0.0.4
|
||||||
|
eth_accounts_index~=0.1.2
|
Loading…
Reference in New Issue
Block a user