mirror of
https://github.com/chaintool-py/eth-erc20.git
synced 2024-11-22 09:46:46 +01:00
Skip unnecessary lookups in balance call
This commit is contained in:
parent
273cf23f21
commit
ea7c106fa4
@ -1,3 +1,8 @@
|
|||||||
|
* 0.5.6
|
||||||
|
- Remove name and symbol lookup
|
||||||
|
- Remove decimals lookup for raw output
|
||||||
|
* 0.5.5
|
||||||
|
- Implement chainlib-gen for giftable token
|
||||||
* 0.5.4
|
* 0.5.4
|
||||||
- Enable setting sender address on contract read calls
|
- Enable setting sender address on contract read calls
|
||||||
* 0.5.3
|
* 0.5.3
|
||||||
|
@ -94,20 +94,21 @@ def main():
|
|||||||
)
|
)
|
||||||
|
|
||||||
# determine decimals
|
# determine decimals
|
||||||
decimals_o = g.decimals(token_address, sender_address=sender_address)
|
if not config.get('_RAW'):
|
||||||
r = conn.do(decimals_o)
|
decimals_o = g.decimals(token_address, sender_address=sender_address)
|
||||||
decimals = int(strip_0x(r), 16)
|
r = conn.do(decimals_o)
|
||||||
logg.info('decimals {}'.format(decimals))
|
decimals = int(strip_0x(r), 16)
|
||||||
|
logg.info('decimals {}'.format(decimals))
|
||||||
|
|
||||||
name_o = g.name(token_address, sender_address=sender_address)
|
# name_o = g.name(token_address, sender_address=sender_address)
|
||||||
r = conn.do(name_o)
|
# r = conn.do(name_o)
|
||||||
token_name = g.parse_name(r)
|
# token_name = g.parse_name(r)
|
||||||
logg.info('name {}'.format(token_name))
|
# logg.info('name {}'.format(token_name))
|
||||||
|
#
|
||||||
symbol_o = g.symbol(token_address, sender_address=sender_address)
|
# symbol_o = g.symbol(token_address, sender_address=sender_address)
|
||||||
r = conn.do(symbol_o)
|
# r = conn.do(symbol_o)
|
||||||
token_symbol = g.parse_symbol(r)
|
# token_symbol = g.parse_symbol(r)
|
||||||
logg.info('symbol {}'.format(token_symbol))
|
# logg.info('symbol {}'.format(token_symbol))
|
||||||
|
|
||||||
# get balance
|
# get balance
|
||||||
balance_o = g.balance(token_address, settings.get('RECIPIENT'), sender_address=sender_address)
|
balance_o = g.balance(token_address, settings.get('RECIPIENT'), sender_address=sender_address)
|
||||||
@ -115,7 +116,10 @@ def main():
|
|||||||
|
|
||||||
hx = strip_0x(r)
|
hx = strip_0x(r)
|
||||||
balance_value = int(hx, 16)
|
balance_value = int(hx, 16)
|
||||||
logg.debug('balance {} = {} decimals {}'.format(even(hx), balance_value, decimals))
|
if config.get('_RAW'):
|
||||||
|
logg.debug('balance {} = {}'.format(even(hx), balance_value))
|
||||||
|
else:
|
||||||
|
logg.debug('balance {} = {} decimals {}'.format(even(hx), balance_value, decimals))
|
||||||
|
|
||||||
balance_str = str(balance_value)
|
balance_str = str(balance_value)
|
||||||
balance_len = len(balance_str)
|
balance_len = len(balance_str)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[metadata]
|
[metadata]
|
||||||
name = eth-erc20
|
name = eth-erc20
|
||||||
version = 0.5.5
|
version = 0.5.6
|
||||||
description = ERC20 interface and simple contract with deployment script that lets any address mint and gift itself tokens.
|
description = ERC20 interface and simple contract with deployment script that lets any address mint and gift itself tokens.
|
||||||
author = Louis Holbrook
|
author = Louis Holbrook
|
||||||
author_email = dev@holbrook.no
|
author_email = dev@holbrook.no
|
||||||
|
Loading…
Reference in New Issue
Block a user