Skip unnecessary lookups in balance call

This commit is contained in:
lash 2023-02-19 16:14:48 +00:00
parent 273cf23f21
commit ea7c106fa4
Signed by: lash
GPG Key ID: 21D2E7BB88C2A746
3 changed files with 24 additions and 15 deletions

View File

@ -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
- Enable setting sender address on contract read calls
* 0.5.3

View File

@ -94,20 +94,21 @@ def main():
)
# determine decimals
decimals_o = g.decimals(token_address, sender_address=sender_address)
r = conn.do(decimals_o)
decimals = int(strip_0x(r), 16)
logg.info('decimals {}'.format(decimals))
if not config.get('_RAW'):
decimals_o = g.decimals(token_address, sender_address=sender_address)
r = conn.do(decimals_o)
decimals = int(strip_0x(r), 16)
logg.info('decimals {}'.format(decimals))
name_o = g.name(token_address, sender_address=sender_address)
r = conn.do(name_o)
token_name = g.parse_name(r)
logg.info('name {}'.format(token_name))
symbol_o = g.symbol(token_address, sender_address=sender_address)
r = conn.do(symbol_o)
token_symbol = g.parse_symbol(r)
logg.info('symbol {}'.format(token_symbol))
# name_o = g.name(token_address, sender_address=sender_address)
# r = conn.do(name_o)
# token_name = g.parse_name(r)
# logg.info('name {}'.format(token_name))
#
# symbol_o = g.symbol(token_address, sender_address=sender_address)
# r = conn.do(symbol_o)
# token_symbol = g.parse_symbol(r)
# logg.info('symbol {}'.format(token_symbol))
# get balance
balance_o = g.balance(token_address, settings.get('RECIPIENT'), sender_address=sender_address)
@ -115,7 +116,10 @@ def main():
hx = strip_0x(r)
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_len = len(balance_str)

View File

@ -1,6 +1,6 @@
[metadata]
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.
author = Louis Holbrook
author_email = dev@holbrook.no