eth-erc20

ERC20 interface and example giftable token contract
Log | Files | Refs | LICENSE

commit d218d93fbacfbb28341c7c406aedd5344db836c1
parent 7183e01b72f78199d398edbca32b62732883f0db
Author: lash <dev@holbrook.no>
Date:   Mon, 13 Feb 2023 06:38:17 +0000

Add sender address option to cli for read calls

Diffstat:
Mpython/CHANGELOG | 6++++++
Mpython/eth_erc20/runnable/balance.py | 11++++++-----
Mpython/eth_erc20/runnable/info.py | 11++++++-----
Mpython/requirements.txt | 2+-
Mpython/setup.cfg | 4++--
5 files changed, 21 insertions(+), 13 deletions(-)

diff --git a/python/CHANGELOG b/python/CHANGELOG @@ -1,3 +1,9 @@ +* 0.5.4 + - Enable setting sender address on contract read calls +* 0.5.3 + - Fix giftable token cli commands +* 0.5.2 + - Add block height to balance call * 0.5.1 - Change license to AGPL3 and copyright waived to public domain * 0.5.0 diff --git a/python/eth_erc20/runnable/balance.py b/python/eth_erc20/runnable/balance.py @@ -65,7 +65,7 @@ logg = logging.getLogger() arg_flags = ArgFlag() arg = Arg(arg_flags) -flags = arg_flags.STD_READ | arg_flags.EXEC +flags = arg_flags.STD_READ | arg_flags.EXEC | arg_flags.SENDER argparser = chainlib.eth.cli.ArgumentParser() argparser = process_args(argparser, arg, flags) @@ -87,29 +87,30 @@ logg.debug('settings loaded:\n{}'.format(settings)) def main(): token_address = settings.get('EXEC') conn = settings.get('CONN') + sender_address = settings.get('SENDER_ADDRESS') g = ERC20( chain_spec=settings.get('CHAIN_SPEC'), gas_oracle=settings.get('GAS_ORACLE'), ) # determine decimals - decimals_o = g.decimals(token_address) + 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) + 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) + 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')) + balance_o = g.balance(token_address, settings.get('RECIPIENT'), sender_address=sender_address) r = conn.do(balance_o) hx = strip_0x(r) diff --git a/python/eth_erc20/runnable/info.py b/python/eth_erc20/runnable/info.py @@ -74,7 +74,7 @@ def process_config_local(config, arg, args, flags): arg_flags = ArgFlag() arg = Arg(arg_flags) -flags = arg_flags.STD_READ | arg_flags.EXEC | arg_flags.TAB +flags = arg_flags.STD_READ | arg_flags.EXEC | arg_flags.TAB | arg_flags.SENDER argparser = chainlib.eth.cli.ArgumentParser() argparser = process_args(argparser, arg, flags) @@ -96,6 +96,7 @@ logg.debug('settings loaded:\n{}'.format(settings)) def main(): token_address = config.get('_CONTRACT') conn = settings.get('CONN') + sender_address = settings.get('SENDER_ADDRESS') g = ERC20( chain_spec=settings.get('CHAIN_SPEC'), gas_oracle=settings.get('GAS_ORACLE'), @@ -104,7 +105,7 @@ def main(): outkeys = config.get('_OUTARG') if not outkeys or 'address' in outkeys: - name_o = g.name(token_address) + name_o = g.name(token_address, sender_address=sender_address) r = conn.do(name_o) token_name = g.parse_name(r) s = '' @@ -114,7 +115,7 @@ def main(): print(s) if not outkeys or 'symbol' in outkeys: - symbol_o = g.symbol(token_address) + symbol_o = g.symbol(token_address, sender_address=sender_address) r = conn.do(symbol_o) token_symbol = g.parse_symbol(r) s = '' @@ -124,7 +125,7 @@ def main(): print(s) if not outkeys or 'decimals' in outkeys: - decimals_o = g.decimals(token_address) + decimals_o = g.decimals(token_address, sender_address=sender_address) r = conn.do(decimals_o) decimals = int(strip_0x(r), 16) s = '' @@ -134,7 +135,7 @@ def main(): print(s) if not outkeys or 'supply' in outkeys: - supply_o = g.total_supply(token_address) + supply_o = g.total_supply(token_address, sender_address=sender_address) r = conn.do(supply_o) supply = int(strip_0x(r), 16) s = '' diff --git a/python/requirements.txt b/python/requirements.txt @@ -1,3 +1,3 @@ confini~=0.6.1 -chainlib-eth~=0.4.2 +chainlib-eth~=0.4.15 potaahto~=0.1.1 diff --git a/python/setup.cfg b/python/setup.cfg @@ -1,10 +1,10 @@ [metadata] name = eth-erc20 -version = 0.5.3 +version = 0.5.4 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 -url = https://git.defalsify.org/eth-erc20.git +url = https://git.defalsify.org/eth-erc20 keywords = dlt ethereum