add: GFT transfer tracker #2
2
.gitignore
vendored
2
.gitignore
vendored
@ -2,3 +2,5 @@ __pycache__
|
||||
*.egg-info
|
||||
*.pyc
|
||||
*.d/
|
||||
.venv
|
||||
state
|
@ -9,7 +9,7 @@ from cic_contracts.erc20 import ERC20
|
||||
from chainlib.eth.error import RequestMismatchException
|
||||
from chainlib.eth.address import AddressChecksum
|
||||
from chainlib.eth.constant import ZERO_ADDRESS
|
||||
from hexathon import uniform
|
||||
from hexathon import uniform, add_0x
|
||||
|
||||
logg = logging.getLogger(__name__)
|
||||
|
||||
@ -57,7 +57,7 @@ def apply(c, s, chain_spec, conn, block, tx, db_session=None):
|
||||
def account_registry_add(c, s, chain_spec, conn, block, tx):
|
||||
try:
|
||||
o = AccountsIndex.parse_add_request(tx.payload)
|
||||
s = '{} block {} tx {} account registration for {}'.format(c, block.number, tx.index, o[0])
|
||||
s = '{} block {} tx {} account registration for {}'.format(c, block.number, tx.index, o[0])
|
||||
return s
|
||||
except RequestMismatchException as e:
|
||||
pass
|
||||
@ -101,6 +101,22 @@ def ge_faucet_gift(i, s, chain_spec, conn, block, tx):
|
||||
return None
|
||||
|
||||
|
||||
def erc20_transfer(c, s, chain_spec, conn, block, tx):
|
||||
t = ERC20(chain_spec)
|
||||
|
||||
try:
|
||||
transfer_data = t.parse_transfer_request(tx.payload)
|
||||
|
||||
token_sender = tx.outputs[0]
|
||||
token_recipient = transfer_data[0]
|
||||
token_value = transfer_data[1]
|
||||
|
||||
return '{} GFT {} sent from {} to {}'.format(c, token_value ,add_0x(token_sender), add_0x(token_recipient))
|
||||
except RequestMismatchException as e:
|
||||
pass
|
||||
|
||||
return None
|
||||
|
||||
|
||||
sigmap = {
|
||||
'evm:byzantium:8996:bloxberg': {
|
||||
@ -112,6 +128,9 @@ addrmap = {
|
||||
'evm:byzantium:8996:bloxberg': {
|
||||
'd462aadb7251d418e6a9e4f205928f678e1c6b3b': {
|
||||
'63e4bff4': ge_faucet_gift,
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
'32e860c2a0645d1b7b005273696905f5d6dc5d05': {
|
||||
'a9059cbb': erc20_transfer,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user