eth-erc20

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

commit db30d4aaf4652ae03173af3ebf0f54b6ed6b843d
parent 7ab3cd14f52a724a9b25622a82aa06c83998c2e3
Author: lash <dev@holbrook.no>
Date:   Tue, 14 Feb 2023 05:24:29 +0000

Add named variables scheme for chainlib gen, args definitions return

Diffstat:
Mpython/giftable_erc20_token/__init__.py | 2+-
Mpython/giftable_erc20_token/factory.py | 16+++++++++++-----
2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/python/giftable_erc20_token/__init__.py b/python/giftable_erc20_token/__init__.py @@ -1,4 +1,4 @@ from .factory import GiftableToken from .factory import bytecode from .factory import create -from .factory import default +from .factory import args diff --git a/python/giftable_erc20_token/factory.py b/python/giftable_erc20_token/factory.py @@ -103,11 +103,17 @@ class GiftableToken(TxFactory): return tx -def bytecode(version=None): - return GiftableToken.bytecode(version=version) +def bytecode(**kwargs): + return GiftableToken.bytecode(version=kwargs.get('version')) -def create(name, symbol, decimals, version=None): - return GiftableToken.cargs(name, symbol, decimals, version=version) +def create(**kwargs): + return GiftableToken.cargs(kwargs['name'], kwargs['symbol'], kwargs['decimals'], version=kwargs.get('version')) -default = bytecode + +def args(v): + if v == 'create': + return (['name', 'symbol', 'decimals'], ['version'],) + elif v == 'default' or v == 'bytecode': + return ([], 'version',) + raise ValueError('unknown command: ' + v)