commit ea7c106fa440e48b7eeb3c1c02ab9afce6b3d161
parent 273cf23f2111829232b8e66884893fa2f5273e74
Author: lash <dev@holbrook.no>
Date: Sun, 19 Feb 2023 16:14:48 +0000
Skip unnecessary lookups in balance call
Diffstat:
3 files changed, 25 insertions(+), 16 deletions(-)
diff --git a/python/CHANGELOG b/python/CHANGELOG
@@ -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
diff --git a/python/eth_erc20/runnable/balance.py b/python/eth_erc20/runnable/balance.py
@@ -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))
-
- 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))
+ 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))
# 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)
diff --git a/python/setup.cfg b/python/setup.cfg
@@ -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