erc20-faucet

ERC20 token faucet
Log | Files | Refs

commit e585c158428f69679d86262ab6eafa36a23e2b12
parent b06b724edd99af39de22cd4ac9c3d50d08753488
Author: nolash <dev@holbrook.no>
Date:   Fri, 11 Dec 2020 16:53:36 +0100

Rename contracts-dir flag to abi-dir, use package data dir as abi dir

Diffstat:
Apython/CHANGELOG | 5+++++
Mpython/erc20_single_shot_faucet/runnable/deploy.py | 13++++++++-----
Mpython/setup.cfg | 2+-
3 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/python/CHANGELOG b/python/CHANGELOG @@ -0,0 +1,5 @@ +- 0.0.2 + * Rename contracts-dir flag to abi-dir + * Use package data dir as abi dir +- 0.0.1 + * Add deployer script diff --git a/python/erc20_single_shot_faucet/runnable/deploy.py b/python/erc20_single_shot_faucet/runnable/deploy.py @@ -21,12 +21,15 @@ logg = logging.getLogger() logging.getLogger('web3').setLevel(logging.WARNING) logging.getLogger('urllib3').setLevel(logging.WARNING) +script_dir = os.path.dirname(__file__) +data_dir = os.path.join(script_dir, '..', 'data') + argparser = argparse.ArgumentParser() argparser.add_argument('-p', '--provider', dest='p', default='http://localhost:8545', type=str, help='Web3 provider url (http only)') argparser.add_argument('-a', '--approvers', dest='a', action='append', type=str, help='Approver account to add') argparser.add_argument('-o', '--owner', dest='o', type=str, help='Owner account (provider must have private key)') argparser.add_argument('-t', '--token-address', dest='t', required=True, type=str, help='Token to add faucet for') -argparser.add_argument('--contracts-dir', dest='contracts_dir', default='.', help='Directory containing bytecode and abi') +argparser.add_argument('--abi-dir', dest='abi_dir', type=str, default=data_dir, help='Directory containing bytecode and abi (default: {})'.format(data_dir)) argparser.add_argument('-v', action='store_true', help='Be verbose') args = argparser.parse_args() @@ -41,11 +44,11 @@ def main(): token_address = args.t - f = open(os.path.join(args.contracts_dir, 'ERC20SingleShotFaucetStorage.abi.json'), 'r') + f = open(os.path.join(args.abi_dir, 'ERC20SingleShotFaucetStorage.abi.json'), 'r') abi = json.load(f) f.close() - f = open(os.path.join(args.contracts_dir, 'ERC20SingleShotFaucetStorage.bin'), 'r') + f = open(os.path.join(args.abi_dir, 'ERC20SingleShotFaucetStorage.bin'), 'r') bytecode = f.read() f.close() @@ -54,11 +57,11 @@ def main(): r = w3.eth.getTransactionReceipt(tx_hash) store_address = r.contractAddress - f = open(os.path.join(args.contracts_dir, 'ERC20SingleShotFaucet.abi.json'), 'r') + f = open(os.path.join(args.abi_dir, 'ERC20SingleShotFaucet.abi.json'), 'r') abi = json.load(f) f.close() - f = open(os.path.join(args.contracts_dir, 'ERC20SingleShotFaucet.bin'), 'r') + f = open(os.path.join(args.abi_dir, 'ERC20SingleShotFaucet.bin'), 'r') bytecode = f.read() f.close() diff --git a/python/setup.cfg b/python/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = erc20-single-shot-faucet -version = 0.0.1 +version = 0.0.2 description = ERC20 token faucet that can be used once per account author = Louis Holbrook author_email = dev@holbrook.no