commit 7e5409eb16791c851c5ce8a465eb1a18c8a8b413 parent 93cd82682e3caab8ea9c25cdaf565ab99f85e67f Author: nolash <dev@holbrook.no> Date: Fri, 30 Apr 2021 19:53:17 +0200 Rename package Diffstat:
27 files changed, 251 insertions(+), 248 deletions(-)
diff --git a/.gitignore b/.gitignore @@ -4,3 +4,5 @@ gmon.out *.egg-info build/ dist/ +solidity/*.bin +solidity/*.json diff --git a/python/erc20_single_shot_faucet/__init__.py b/python/erc20_faucet/__init__.py diff --git a/python/erc20_faucet/data/ERC20Faucet.bin b/python/erc20_faucet/data/ERC20Faucet.bin @@ -0,0 +1 @@ +60806040523480156200001157600080fd5b506040516200166a3803806200166a833981810160405281019062000037919062000337565b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060018060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060005b8451811015620001895760018060008784815181106200011a577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080620001809062000488565b915050620000d1565b5081600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555082600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600681905550505050506200055f565b6000620002956200028f84620003e5565b620003bc565b90508083825260208201905082856020860282011115620002b557600080fd5b60005b85811015620002e95781620002ce8882620002f3565b845260208401935060208301925050600181019050620002b8565b5050509392505050565b600081519050620003048162000545565b92915050565b600082601f8301126200031c57600080fd5b81516200032e8482602086016200027e565b91505092915050565b600080600080608085870312156200034e57600080fd5b600085015167ffffffffffffffff8111156200036957600080fd5b62000377878288016200030a565b94505060206200038a87828801620002f3565b93505060406200039d87828801620002f3565b9250506060620003b087828801620002f3565b91505092959194509250565b6000620003c8620003db565b9050620003d6828262000452565b919050565b6000604051905090565b600067ffffffffffffffff82111562000403576200040262000505565b5b602082029050602081019050919050565b6000620004218262000428565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b6200045d8262000534565b810181811067ffffffffffffffff821117156200047f576200047e62000505565b5b80604052505050565b6000620004958262000448565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415620004cb57620004ca620004d6565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b620005508162000414565b81146200055c57600080fd5b50565b6110fb806200056f6000396000f3fe608060405234801561001057600080fd5b5060043610610074576000357c010000000000000000000000000000000000000000000000000000000090048063271f88b41461007957806363e4bff4146100a9578063aa8c217c146100d9578063b222e0c2146100f7578063fc0c546a14610127575b600080fd5b610093600480360381019061008e9190610cc1565b610145565b6040516100a09190610e52565b60405180910390f35b6100c360048036038101906100be9190610c98565b6101e4565b6040516100d09190610e52565b60405180910390f35b6100e1610b00565b6040516100ee9190610f0d565b60405180910390f35b610111600480360381019061010c9190610c98565b610b06565b60405161011e9190610f0d565b60405180910390f35b61012f610c48565b60405161013c9190610e0e565b60405180910390f35b6000600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1661019d57600080fd5b816002819055507f748f1cf617bdc8ef4fcd1cb516dc05cedf269e8dcad82183846d57eeec4bba5e826040516101d39190610f0d565b60405180910390a160019050919050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610273576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161026a90610e8d565b60405180910390fd5b60006060600073ffffffffffffffffffffffffffffffffffffffff16600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146104f857600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16846040516024016103179190610e0e565b6040516020818303038152906040527f3ef25013000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506040516103a19190610df7565b6000604051808303816000865af19150503d80600081146103de576040519150601f19603f3d011682016040523d82523d6000602084013e6103e3565b606091505b50809250819350505060007f01000000000000000000000000000000000000000000000000000000000000000281601f8151811061044a577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101517f010000000000000000000000000000000000000000000000000000000000000090047f0100000000000000000000000000000000000000000000000000000000000000027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614156104f7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104ee90610e6d565b60405180910390fd5b5b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16846040516024016105429190610e0e565b6040516020818303038152906040527f3ef25013000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506040516105cc9190610df7565b6000604051808303816000865af19150503d8060008114610609576040519150601f19603f3d011682016040523d82523d6000602084013e61060e565b606091505b50809250819350505060007f01000000000000000000000000000000000000000000000000000000000000000281601f81518110610675577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101517f010000000000000000000000000000000000000000000000000000000000000090047f0100000000000000000000000000000000000000000000000000000000000000027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614610721576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161071890610eed565b60405180910390fd5b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168460405160240161076b9190610e0e565b6040516020818303038152906040527f0a3b0a4f000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506040516107f59190610df7565b6000604051808303816000865af19150503d8060008114610832576040519150601f19603f3d011682016040523d82523d6000602084013e610837565b606091505b50809250819350505081610880576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161087790610ecd565b60405180910390fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16846002546040516024016108ce929190610e29565b6040516020818303038152906040527fa9059cbb000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506040516109589190610df7565b6000604051808303816000865af19150503d8060008114610995576040519150601f19603f3d011682016040523d82523d6000602084013e61099a565b606091505b50809250819350505081610a6c57600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f2a56a00a5c532c49314f19361f71cdca8a5d10fdcb42c3fa52800d13419d6070600254604051610a299190610f0d565b60405180910390a36040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a6390610ead565b60405180910390fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f45c201a59ac545000ead84f30b2db67da23353aa1d58ac522c48505412143ffa600254604051610aed9190610f0d565b60405180910390a3600192505050919050565b60025481565b6000806060600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1684604051602401610b559190610e0e565b6040516020818303038152906040527f3ef25013000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051610bdf9190610df7565b6000604051808303816000865af19150503d8060008114610c1c576040519150601f19603f3d011682016040523d82523d6000602084013e610c21565b606091505b5080925081935050508115610c3c5760065492505050610c43565b6000925050505b919050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600081359050610c7d81611097565b92915050565b600081359050610c92816110ae565b92915050565b600060208284031215610caa57600080fd5b6000610cb884828501610c6e565b91505092915050565b600060208284031215610cd357600080fd5b6000610ce184828501610c83565b91505092915050565b610cf381610f4f565b82525050565b610d0281610f61565b82525050565b6000610d1382610f28565b610d1d8185610f33565b9350610d2d818560208601610f97565b80840191505092915050565b6000610d46601883610f3e565b9150610d5182610fca565b602082019050919050565b6000610d69600a83610f3e565b9150610d7482610ff3565b602082019050919050565b6000610d8c600c83610f3e565b9150610d978261101c565b602082019050919050565b6000610daf600d83610f3e565b9150610dba82611045565b602082019050919050565b6000610dd2601083610f3e565b9150610ddd8261106e565b602082019050919050565b610df181610f8d565b82525050565b6000610e038284610d08565b915081905092915050565b6000602082019050610e236000830184610cea565b92915050565b6000604082019050610e3e6000830185610cea565b610e4b6020830184610de8565b9392505050565b6000602082019050610e676000830184610cf9565b92915050565b60006020820190508181036000830152610e8681610d39565b9050919050565b60006020820190508181036000830152610ea681610d5c565b9050919050565b60006020820190508181036000830152610ec681610d7f565b9050919050565b60006020820190508181036000830152610ee681610da2565b9050919050565b60006020820190508181036000830152610f0681610dc5565b9050919050565b6000602082019050610f226000830184610de8565b92915050565b600081519050919050565b600081905092915050565b600082825260208201905092915050565b6000610f5a82610f6d565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b60005b83811015610fb5578082015181840152602081019050610f9a565b83811115610fc4576000848401525b50505050565b7f4552525f4143434f554e545f4e4f545f494e5f494e4445580000000000000000600082015250565b7f4552525f41434345535300000000000000000000000000000000000000000000600082015250565b7f4552525f5452414e534645520000000000000000000000000000000000000000600082015250565b7f4552525f4d41524b5f4641494c00000000000000000000000000000000000000600082015250565b7f4552525f4143434f554e545f5553454400000000000000000000000000000000600082015250565b6110a081610f4f565b81146110ab57600080fd5b50565b6110b781610f8d565b81146110c257600080fd5b5056fea264697066735822122089da56a5cdcd8975d86915a2053621346881f937d93c08cdad743042d133c29464736f6c63430008030033 +\ No newline at end of file diff --git a/python/erc20_single_shot_faucet/data/ERC20SingleShotFaucet.json b/python/erc20_faucet/data/ERC20Faucet.json diff --git a/python/erc20_faucet/data/ERC20FaucetStorage.bin b/python/erc20_faucet/data/ERC20FaucetStorage.bin @@ -0,0 +1 @@ +608060405234801561001057600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600360009080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600260008073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610915806101096000396000f3fe608060405234801561001057600080fd5b50600436106100a5576000357c01000000000000000000000000000000000000000000000000000000009004806379ba50971161007857806379ba50971461016a5780638da5cb5b14610188578063e2095c07146101a6578063f2fde38b146101d6576100a5565b806301ffc9a7146100aa5780630a3b0a4f146100da5780633ef250131461010a578063764b07e71461013a575b600080fd5b6100c460048036038101906100bf9190610756565b6101f2565b6040516100d191906107f0565b60405180910390f35b6100f460048036038101906100ef919061072d565b61034a565b60405161010191906107f0565b60405180910390f35b610124600480360381019061011f919061072d565b61044a565b60405161013191906107f0565b60405180910390f35b610154600480360381019061014f919061072d565b610495565b604051610161919061080b565b60405180910390f35b6101726104ad565b60405161017f91906107f0565b60405180910390f35b6101906105ef565b60405161019d91906107d5565b60405180910390f35b6101c060048036038101906101bb919061077f565b610613565b6040516101cd91906107d5565b60405180910390f35b6101f060048036038101906101eb919061072d565b610652565b005b600063cbdb05c77c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614156102475760019050610345565b6301ffc9a77c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916141561029a5760019050610345565b639493f8b27c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614156102ed5760019050610345565b6337a47be47c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614156103405760019050610345565b600090505b919050565b60008060038054905090506003839080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550808373ffffffffffffffffffffffffffffffffffffffff167f9cc987676e7d63379f176ea50df0ae8d2d9d1141d1231d4ce15b5965f73c943060405160405180910390a36001915050919050565b600080600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054119050919050565b60026020528060005260406000206000915090505481565b60008060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461052d57600080fd5b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3600191505090565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6003818154811061062357600080fd5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146106aa57600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000813590506106fd8161089a565b92915050565b600081359050610712816108b1565b92915050565b600081359050610727816108c8565b92915050565b60006020828403121561073f57600080fd5b600061074d848285016106ee565b91505092915050565b60006020828403121561076857600080fd5b600061077684828501610703565b91505092915050565b60006020828403121561079157600080fd5b600061079f84828501610718565b91505092915050565b6107b181610826565b82525050565b6107c081610838565b82525050565b6107cf81610890565b82525050565b60006020820190506107ea60008301846107a8565b92915050565b600060208201905061080560008301846107b7565b92915050565b600060208201905061082060008301846107c6565b92915050565b600061083182610870565b9050919050565b60008115159050919050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b6108a381610826565b81146108ae57600080fd5b50565b6108ba81610844565b81146108c557600080fd5b50565b6108d181610890565b81146108dc57600080fd5b5056fea264697066735822122015d2235935738af4845d274294be7115812c52b811daf7c18f5655f4c01b0ec664736f6c63430008030033 +\ No newline at end of file diff --git a/python/erc20_single_shot_faucet/data/ERC20SingleShotFaucetStorage.json b/python/erc20_faucet/data/ERC20FaucetStorage.json diff --git a/python/erc20_single_shot_faucet/data/ERC20SingleShotFaucet.bin b/python/erc20_faucet/data/ERC20SingleShotFaucet.bin diff --git a/solidity/ERC20SingleShotFaucet.json b/python/erc20_faucet/data/ERC20SingleShotFaucet.json diff --git a/python/erc20_single_shot_faucet/data/ERC20SingleShotFaucetStorage.bin b/python/erc20_faucet/data/ERC20SingleShotFaucetStorage.bin diff --git a/solidity/ERC20SingleShotFaucetStorage.json b/python/erc20_faucet/data/ERC20SingleShotFaucetStorage.json diff --git a/python/erc20_single_shot_faucet/data/GiftableToken.bin b/python/erc20_faucet/data/GiftableToken.bin diff --git a/python/erc20_single_shot_faucet/data/GiftableToken.json b/python/erc20_faucet/data/GiftableToken.json diff --git a/python/erc20_single_shot_faucet/data/IERC20SingleShotFaucet.json b/python/erc20_faucet/data/IERC20SingleShotFaucet.json diff --git a/python/erc20_single_shot_faucet/data/IERC20SingleShotFaucetStorage.json b/python/erc20_faucet/data/IERC20SingleShotFaucetStorage.json diff --git a/python/erc20_single_shot_faucet/faucet.py b/python/erc20_faucet/faucet.py diff --git a/python/erc20_single_shot_faucet/interface.py b/python/erc20_faucet/interface.py diff --git a/python/erc20_faucet/runnable/deploy.py b/python/erc20_faucet/runnable/deploy.py @@ -0,0 +1,141 @@ +"""Deploys erc20 single shot faucet + +.. moduleauthor:: Louis Holbrook <dev@holbrook.no> +.. pgp:: 0826EDA1702D1E87C6E2875121D2E7BB88C2A746 + +""" + +# standard imports +import os +import json +import argparse +import logging + +# external imports +import web3 +from crypto_dev_signer.eth.signer import ReferenceSigner as EIP155Signer +from crypto_dev_signer.keystore import DictKeystore +from crypto_dev_signer.eth.helper import EthTxExecutor + +logging.basicConfig(level=logging.WARNING) +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('-w', action='store_true', help='Wait for the last transaction to be confirmed') +argparser.add_argument('-ww', action='store_true', help='Wait for every transaction to be confirmed') +argparser.add_argument('-i', '--chain-spec', dest='i', type=str, default='Ethereum:1', help='Chain specification string') +argparser.add_argument('--editor', action='append', type=str, help='Amount editor account to add') +argparser.add_argument('-a', '--signer-address', dest='a', type=str, help='Owner account (provider must have private key)') +argparser.add_argument('-y', '--key-file', dest='y', type=str, help='Ethereum keystore file to use for signing') +argparser.add_argument('--token-address', dest='token_address', required=True, type=str, help='Token to add faucet for') +argparser.add_argument('--set-amount', dest='set_amount', default=0, type=int, help='Initial amount to set. Will be 0 if not set!') +argparser.add_argument('--accounts-index-address', dest='accounts_index_address', required=False, type=str, help='Accounts index to verify requesting address against (if not specified, any address may use the faucet') +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') +argparser.add_argument('-vv', action='store_true', help='Be more verbose') +args = argparser.parse_args() + +if args.vv: + logg.setLevel(logging.DEBUG) +elif args.v: + logg.setLevel(logging.INFO) + +block_last = args.w +block_all = args.ww + +w3 = web3.Web3(web3.Web3.HTTPProvider(args.p)) + +signer_address = None +keystore = DictKeystore() +if args.y != None: + logg.debug('loading keystore file {}'.format(args.y)) + signer_address = keystore.import_keystore_file(args.y) + logg.debug('now have key for signer address {}'.format(signer_address)) +signer = EIP155Signer(keystore) + + +chain_pair = args.i.split(':') +chain_id = int(chain_pair[1]) + +helper = EthTxExecutor( + w3, + signer_address, + signer, + chain_id, + block=args.ww, + ) + + +def main(): + token_address = args.token_address + + f = open(os.path.join(args.abi_dir, 'ERC20SingleShotFaucetStorage.json'), 'r') + abi = json.load(f) + f.close() + + f = open(os.path.join(args.abi_dir, 'ERC20SingleShotFaucetStorage.bin'), 'r') + bytecode = f.read() + f.close() + + c = w3.eth.contract(abi=abi, bytecode=bytecode) + (tx_hash, rcpt) = helper.sign_and_send( + [ + c.constructor().buildTransaction + ], + force_wait=True, + ) + store_address = rcpt.contractAddress + + f = open(os.path.join(args.abi_dir, 'ERC20SingleShotFaucet.json'), 'r') + abi = json.load(f) + f.close() + + f = open(os.path.join(args.abi_dir, 'ERC20SingleShotFaucet.bin'), 'r') + bytecode = f.read() + f.close() + + c = w3.eth.contract(abi=abi, bytecode=bytecode) + + editors = [signer_address] + if args.editor != None: + for a in args.editor: + editors.append(a) + logg.info('add approver {}'.format(a)) + + accounts_index_address = '0x0000000000000000000000000000000000000000' + if args.accounts_index_address != None: + accounts_index_address = args.accounts_index_address + + (tx_hash, rcpt) = helper.sign_and_send( + [ + c.constructor(editors, token_address, store_address, accounts_index_address).buildTransaction, + ], + force_wait=True, + ) + address = rcpt.contractAddress + + if args.set_amount > 0: + c = w3.eth.contract(abi=abi, address=address) + (tx_hash, rcpt) = helper.sign_and_send( + [ + c.functions.setAmount(args.set_amount).buildTransaction, + ], + force_wait=True, + ) + + logg.debug('setting initial ammount to {} tx_hash {}'.format(args.set_amount, tx_hash)) + amount = c.functions.amount().call() + logg.info('set initial ammount tx_hash {}'.format(amount)) + + print(address) + + +if __name__ == '__main__': + main() diff --git a/python/erc20_faucet/runnable/list.py b/python/erc20_faucet/runnable/list.py @@ -0,0 +1,83 @@ +"""Query faucet store + +.. moduleauthor:: Louis Holbrook <dev@holbrook.no> +.. pgp:: 0826EDA1702D1E87C6E2875121D2E7BB88C2A746 + +""" + +# standard imports +import sys +import os +import json +import argparse +import logging + +# external imports +from crypto_dev_signer.eth.signer import ReferenceSigner as EIP155Signer +from crypto_dev_signer.keystore.dict import DictKeystore +from crypto_dev_signer.eth.helper import EthTxExecutor +from chainlib.chain import ChainSpec +from chainlib.eth.nonce import RPCNonceOracle +from chainlib.eth.gas import RPCGasOracle +from chainlib.eth.connection import EthHTTPConnection +from chainlib.eth.tx import receipt +from chainlib.eth.constant import ZERO_CONTENT +from chainlib.error import JSONRPCException + +# local imports +from erc20_faucet import Faucet + +logging.basicConfig(level=logging.WARNING) +logg = logging.getLogger() + +script_dir = os.path.dirname(__file__) +data_dir = os.path.join(script_dir, '..', 'data') + +default_format = 'terminal' + +argparser = argparse.ArgumentParser() +argparser.add_argument('-p', '--provider', dest='p', default='http://localhost:8545', type=str, help='RPC provider url (http only)') +argparser.add_argument('-i', '--chain-spec', dest='i', type=str, default='evm:ethereum:1', help='Chain specification string') +argparser.add_argument('-a', '--contract-address', dest='a', required=True, type=str, help='Faucet store contract address') +argparser.add_argument('-f', '--format', dest='f', type=str, default=default_format, help='Output format [human, brief]') +argparser.add_argument('-v', action='store_true', help='Be verbose') +argparser.add_argument('-vv', action='store_true', help='Be more verbose') +argparser.add_argument('--env-prefix', default=os.environ.get('CONFINI_ENV_PREFIX'), dest='env_prefix', type=str, help='environment prefix for variables to overwrite configuration') +argparser.add_argument('address', type=str, help='Address to check faucet usage for') +args = argparser.parse_args() + +if args.vv: + logg.setLevel(logging.DEBUG) +elif args.v: + logg.setLevel(logging.INFO) + +chain_spec = ChainSpec.from_chain_str(args.i) + +rpc = EthHTTPConnection(args.p) +faucet_store_address = args.a +address = args.address +fmt = args.f + + +def out_element(e, fmt=default_format, w=sys.stdout): + logg.debug('format {}'.format(fmt)) + if fmt == 'brief': + w.write(str(e[1]) + '\n') + else: + w.write('{} {}\n'.format(e[0], e[1])) + + +def element(ifc, address, fmt=default_format, w=sys.stdout): + o = ifc.usable_for(faucet_store_address, address) + r = rpc.do(o) + have = ifc.parse_usable_for(r) + out_element((address, have), fmt, w) + + +def main(): + c = Faucet(chain_spec) + element(c, address, fmt=fmt, w=sys.stdout) + + +if __name__ == '__main__': + main() diff --git a/python/erc20_single_shot_faucet/runnable/deploy.py b/python/erc20_single_shot_faucet/runnable/deploy.py @@ -1,141 +0,0 @@ -"""Deploys erc20 single shot faucet - -.. moduleauthor:: Louis Holbrook <dev@holbrook.no> -.. pgp:: 0826EDA1702D1E87C6E2875121D2E7BB88C2A746 - -""" - -# standard imports -import os -import json -import argparse -import logging - -# third-party imports -import web3 -from crypto_dev_signer.eth.signer import ReferenceSigner as EIP155Signer -from crypto_dev_signer.keystore import DictKeystore -from crypto_dev_signer.eth.helper import EthTxExecutor - -logging.basicConfig(level=logging.WARNING) -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('-w', action='store_true', help='Wait for the last transaction to be confirmed') -argparser.add_argument('-ww', action='store_true', help='Wait for every transaction to be confirmed') -argparser.add_argument('-i', '--chain-spec', dest='i', type=str, default='Ethereum:1', help='Chain specification string') -argparser.add_argument('--editor', action='append', type=str, help='Amount editor account to add') -argparser.add_argument('-a', '--signer-address', dest='a', type=str, help='Owner account (provider must have private key)') -argparser.add_argument('-y', '--key-file', dest='y', type=str, help='Ethereum keystore file to use for signing') -argparser.add_argument('--token-address', dest='token_address', required=True, type=str, help='Token to add faucet for') -argparser.add_argument('--set-amount', dest='set_amount', default=0, type=int, help='Initial amount to set. Will be 0 if not set!') -argparser.add_argument('--accounts-index-address', dest='accounts_index_address', required=False, type=str, help='Accounts index to verify requesting address against (if not specified, any address may use the faucet') -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') -argparser.add_argument('-vv', action='store_true', help='Be more verbose') -args = argparser.parse_args() - -if args.vv: - logg.setLevel(logging.DEBUG) -elif args.v: - logg.setLevel(logging.INFO) - -block_last = args.w -block_all = args.ww - -w3 = web3.Web3(web3.Web3.HTTPProvider(args.p)) - -signer_address = None -keystore = DictKeystore() -if args.y != None: - logg.debug('loading keystore file {}'.format(args.y)) - signer_address = keystore.import_keystore_file(args.y) - logg.debug('now have key for signer address {}'.format(signer_address)) -signer = EIP155Signer(keystore) - - -chain_pair = args.i.split(':') -chain_id = int(chain_pair[1]) - -helper = EthTxExecutor( - w3, - signer_address, - signer, - chain_id, - block=args.ww, - ) - - -def main(): - token_address = args.token_address - - f = open(os.path.join(args.abi_dir, 'ERC20SingleShotFaucetStorage.json'), 'r') - abi = json.load(f) - f.close() - - f = open(os.path.join(args.abi_dir, 'ERC20SingleShotFaucetStorage.bin'), 'r') - bytecode = f.read() - f.close() - - c = w3.eth.contract(abi=abi, bytecode=bytecode) - (tx_hash, rcpt) = helper.sign_and_send( - [ - c.constructor().buildTransaction - ], - force_wait=True, - ) - store_address = rcpt.contractAddress - - f = open(os.path.join(args.abi_dir, 'ERC20SingleShotFaucet.json'), 'r') - abi = json.load(f) - f.close() - - f = open(os.path.join(args.abi_dir, 'ERC20SingleShotFaucet.bin'), 'r') - bytecode = f.read() - f.close() - - c = w3.eth.contract(abi=abi, bytecode=bytecode) - - editors = [signer_address] - if args.editor != None: - for a in args.editor: - editors.append(a) - logg.info('add approver {}'.format(a)) - - accounts_index_address = '0x0000000000000000000000000000000000000000' - if args.accounts_index_address != None: - accounts_index_address = args.accounts_index_address - - (tx_hash, rcpt) = helper.sign_and_send( - [ - c.constructor(editors, token_address, store_address, accounts_index_address).buildTransaction, - ], - force_wait=True, - ) - address = rcpt.contractAddress - - if args.set_amount > 0: - c = w3.eth.contract(abi=abi, address=address) - (tx_hash, rcpt) = helper.sign_and_send( - [ - c.functions.setAmount(args.set_amount).buildTransaction, - ], - force_wait=True, - ) - - logg.debug('setting initial ammount to {} tx_hash {}'.format(args.set_amount, tx_hash)) - amount = c.functions.amount().call() - logg.info('set initial ammount tx_hash {}'.format(amount)) - - print(address) - - -if __name__ == '__main__': - main() diff --git a/python/erc20_single_shot_faucet/runnable/list.py b/python/erc20_single_shot_faucet/runnable/list.py @@ -1,83 +0,0 @@ -"""Query faucet store - -.. moduleauthor:: Louis Holbrook <dev@holbrook.no> -.. pgp:: 0826EDA1702D1E87C6E2875121D2E7BB88C2A746 - -""" - -# standard imports -import sys -import os -import json -import argparse -import logging - -# third-party imports -from crypto_dev_signer.eth.signer import ReferenceSigner as EIP155Signer -from crypto_dev_signer.keystore.dict import DictKeystore -from crypto_dev_signer.eth.helper import EthTxExecutor -from chainlib.chain import ChainSpec -from chainlib.eth.nonce import RPCNonceOracle -from chainlib.eth.gas import RPCGasOracle -from chainlib.eth.connection import EthHTTPConnection -from chainlib.eth.tx import receipt -from chainlib.eth.constant import ZERO_CONTENT -from chainlib.error import JSONRPCException - -# local imports -from erc20_single_shot_faucet import SingleShotFaucet - -logging.basicConfig(level=logging.WARNING) -logg = logging.getLogger() - -script_dir = os.path.dirname(__file__) -data_dir = os.path.join(script_dir, '..', 'data') - -default_format = 'terminal' - -argparser = argparse.ArgumentParser() -argparser.add_argument('-p', '--provider', dest='p', default='http://localhost:8545', type=str, help='RPC provider url (http only)') -argparser.add_argument('-i', '--chain-spec', dest='i', type=str, default='evm:ethereum:1', help='Chain specification string') -argparser.add_argument('-a', '--contract-address', dest='a', required=True, type=str, help='Faucet store contract address') -argparser.add_argument('-f', '--format', dest='f', type=str, default=default_format, help='Output format [human, brief]') -argparser.add_argument('-v', action='store_true', help='Be verbose') -argparser.add_argument('-vv', action='store_true', help='Be more verbose') -argparser.add_argument('--env-prefix', default=os.environ.get('CONFINI_ENV_PREFIX'), dest='env_prefix', type=str, help='environment prefix for variables to overwrite configuration') -argparser.add_argument('address', type=str, help='Address to check faucet usage for') -args = argparser.parse_args() - -if args.vv: - logg.setLevel(logging.DEBUG) -elif args.v: - logg.setLevel(logging.INFO) - -chain_spec = ChainSpec.from_chain_str(args.i) - -rpc = EthHTTPConnection(args.p) -faucet_store_address = args.a -address = args.address -fmt = args.f - - -def out_element(e, fmt=default_format, w=sys.stdout): - logg.debug('format {}'.format(fmt)) - if fmt == 'brief': - w.write(str(e[1]) + '\n') - else: - w.write('{} {}\n'.format(e[0], e[1])) - - -def element(ifc, address, fmt=default_format, w=sys.stdout): - o = ifc.usable_for(faucet_store_address, address) - r = rpc.do(o) - have = ifc.parse_usable_for(r) - out_element((address, have), fmt, w) - - -def main(): - c = SingleShotFaucet(chain_spec) - element(c, address, fmt=fmt, w=sys.stdout) - - -if __name__ == '__main__': - main() diff --git a/python/setup.cfg b/python/setup.cfg @@ -1,7 +1,7 @@ [metadata] -name = erc20-single-shot-faucet -version = 0.2.0a15 -description = ERC20 token faucet that can be used once per account +name = erc20-faucet +version = 0.2.1a1 +description = ERC20 token faucet author = Louis Holbrook author_email = dev@holbrook.no url = https://gitlab.com/nolash/simple-multisig @@ -24,22 +24,23 @@ licence_files = include_package_data = True python_requires = >= 3.6 packages = - erc20_single_shot_faucet - erc20_single_shot_faucet.runnable + erc20_faucet + erc20_faucet.runnable [options.extras_require] testing = eth-tester==0.5.0b2 py-evm==0.3.0a20 + web3==5.12.2 [options.package_data] * = - data/ERC20SingleShotFaucet.json - data/ERC20SingleShotFaucet.bin - data/ERC20SingleShotFaucetStorage.json - data/ERC20SingleShotFaucetStorage.bin + data/ERC20Faucet.json + data/ERC20Faucet.bin + data/ERC20FaucetStorage.json + data/ERC20FaucetStorage.bin [options.entry_points] console_scripts = - erc20-single-shot-faucet-deploy = erc20_single_shot_faucet.runnable.deploy:main - erc20-single-shot-faucet-list = erc20_single_shot_list.runnable.deploy:main + erc20-faucet-deploy = erc20_faucet.runnable.deploy:main + erc20-faucet-list = erc20_faucet.runnable.list:main diff --git a/python/tests/test_basic.py b/python/tests/test_basic.py @@ -24,8 +24,8 @@ from chainlib.eth.constant import ZERO_ADDRESS from giftable_erc20_token import GiftableToken # local imports -from erc20_single_shot_faucet import Faucet -from erc20_single_shot_faucet.faucet import SingleShotFaucet +from erc20_faucet import Faucet +from erc20_faucet.faucet import SingleShotFaucet logging.basicConfig(level=logging.DEBUG) logg = logging.getLogger() diff --git a/solidity/ERC20SingleShotFaucet.sol b/solidity/ERC20Faucet.sol diff --git a/solidity/ERC20SingleShotFaucetStorage.sol b/solidity/ERC20FaucetStorage.sol diff --git a/solidity/ERC20SingleShotFaucet.bin b/solidity/ERC20SingleShotFaucet.bin @@ -1 +0,0 @@ -60806040523480156200001157600080fd5b506040516200166a3803806200166a833981810160405281019062000037919062000337565b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060018060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060005b8451811015620001895760018060008784815181106200011a577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080620001809062000488565b915050620000d1565b5081600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555082600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600681905550505050506200055f565b6000620002956200028f84620003e5565b620003bc565b90508083825260208201905082856020860282011115620002b557600080fd5b60005b85811015620002e95781620002ce8882620002f3565b845260208401935060208301925050600181019050620002b8565b5050509392505050565b600081519050620003048162000545565b92915050565b600082601f8301126200031c57600080fd5b81516200032e8482602086016200027e565b91505092915050565b600080600080608085870312156200034e57600080fd5b600085015167ffffffffffffffff8111156200036957600080fd5b62000377878288016200030a565b94505060206200038a87828801620002f3565b93505060406200039d87828801620002f3565b9250506060620003b087828801620002f3565b91505092959194509250565b6000620003c8620003db565b9050620003d6828262000452565b919050565b6000604051905090565b600067ffffffffffffffff82111562000403576200040262000505565b5b602082029050602081019050919050565b6000620004218262000428565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b6200045d8262000534565b810181811067ffffffffffffffff821117156200047f576200047e62000505565b5b80604052505050565b6000620004958262000448565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415620004cb57620004ca620004d6565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b620005508162000414565b81146200055c57600080fd5b50565b6110fb806200056f6000396000f3fe608060405234801561001057600080fd5b5060043610610074576000357c010000000000000000000000000000000000000000000000000000000090048063271f88b41461007957806363e4bff4146100a9578063aa8c217c146100d9578063b222e0c2146100f7578063fc0c546a14610127575b600080fd5b610093600480360381019061008e9190610cc1565b610145565b6040516100a09190610e52565b60405180910390f35b6100c360048036038101906100be9190610c98565b6101e4565b6040516100d09190610e52565b60405180910390f35b6100e1610b00565b6040516100ee9190610f0d565b60405180910390f35b610111600480360381019061010c9190610c98565b610b06565b60405161011e9190610f0d565b60405180910390f35b61012f610c48565b60405161013c9190610e0e565b60405180910390f35b6000600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1661019d57600080fd5b816002819055507f748f1cf617bdc8ef4fcd1cb516dc05cedf269e8dcad82183846d57eeec4bba5e826040516101d39190610f0d565b60405180910390a160019050919050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610273576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161026a90610e8d565b60405180910390fd5b60006060600073ffffffffffffffffffffffffffffffffffffffff16600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146104f857600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16846040516024016103179190610e0e565b6040516020818303038152906040527f3ef25013000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506040516103a19190610df7565b6000604051808303816000865af19150503d80600081146103de576040519150601f19603f3d011682016040523d82523d6000602084013e6103e3565b606091505b50809250819350505060007f01000000000000000000000000000000000000000000000000000000000000000281601f8151811061044a577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101517f010000000000000000000000000000000000000000000000000000000000000090047f0100000000000000000000000000000000000000000000000000000000000000027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614156104f7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104ee90610e6d565b60405180910390fd5b5b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16846040516024016105429190610e0e565b6040516020818303038152906040527f3ef25013000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506040516105cc9190610df7565b6000604051808303816000865af19150503d8060008114610609576040519150601f19603f3d011682016040523d82523d6000602084013e61060e565b606091505b50809250819350505060007f01000000000000000000000000000000000000000000000000000000000000000281601f81518110610675577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101517f010000000000000000000000000000000000000000000000000000000000000090047f0100000000000000000000000000000000000000000000000000000000000000027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614610721576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161071890610eed565b60405180910390fd5b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168460405160240161076b9190610e0e565b6040516020818303038152906040527f0a3b0a4f000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506040516107f59190610df7565b6000604051808303816000865af19150503d8060008114610832576040519150601f19603f3d011682016040523d82523d6000602084013e610837565b606091505b50809250819350505081610880576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161087790610ecd565b60405180910390fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16846002546040516024016108ce929190610e29565b6040516020818303038152906040527fa9059cbb000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506040516109589190610df7565b6000604051808303816000865af19150503d8060008114610995576040519150601f19603f3d011682016040523d82523d6000602084013e61099a565b606091505b50809250819350505081610a6c57600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f2a56a00a5c532c49314f19361f71cdca8a5d10fdcb42c3fa52800d13419d6070600254604051610a299190610f0d565b60405180910390a36040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a6390610ead565b60405180910390fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f45c201a59ac545000ead84f30b2db67da23353aa1d58ac522c48505412143ffa600254604051610aed9190610f0d565b60405180910390a3600192505050919050565b60025481565b6000806060600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1684604051602401610b559190610e0e565b6040516020818303038152906040527f3ef25013000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051610bdf9190610df7565b6000604051808303816000865af19150503d8060008114610c1c576040519150601f19603f3d011682016040523d82523d6000602084013e610c21565b606091505b5080925081935050508115610c3c5760065492505050610c43565b6000925050505b919050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600081359050610c7d81611097565b92915050565b600081359050610c92816110ae565b92915050565b600060208284031215610caa57600080fd5b6000610cb884828501610c6e565b91505092915050565b600060208284031215610cd357600080fd5b6000610ce184828501610c83565b91505092915050565b610cf381610f4f565b82525050565b610d0281610f61565b82525050565b6000610d1382610f28565b610d1d8185610f33565b9350610d2d818560208601610f97565b80840191505092915050565b6000610d46601883610f3e565b9150610d5182610fca565b602082019050919050565b6000610d69600a83610f3e565b9150610d7482610ff3565b602082019050919050565b6000610d8c600c83610f3e565b9150610d978261101c565b602082019050919050565b6000610daf600d83610f3e565b9150610dba82611045565b602082019050919050565b6000610dd2601083610f3e565b9150610ddd8261106e565b602082019050919050565b610df181610f8d565b82525050565b6000610e038284610d08565b915081905092915050565b6000602082019050610e236000830184610cea565b92915050565b6000604082019050610e3e6000830185610cea565b610e4b6020830184610de8565b9392505050565b6000602082019050610e676000830184610cf9565b92915050565b60006020820190508181036000830152610e8681610d39565b9050919050565b60006020820190508181036000830152610ea681610d5c565b9050919050565b60006020820190508181036000830152610ec681610d7f565b9050919050565b60006020820190508181036000830152610ee681610da2565b9050919050565b60006020820190508181036000830152610f0681610dc5565b9050919050565b6000602082019050610f226000830184610de8565b92915050565b600081519050919050565b600081905092915050565b600082825260208201905092915050565b6000610f5a82610f6d565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b60005b83811015610fb5578082015181840152602081019050610f9a565b83811115610fc4576000848401525b50505050565b7f4552525f4143434f554e545f4e4f545f494e5f494e4445580000000000000000600082015250565b7f4552525f41434345535300000000000000000000000000000000000000000000600082015250565b7f4552525f5452414e534645520000000000000000000000000000000000000000600082015250565b7f4552525f4d41524b5f4641494c00000000000000000000000000000000000000600082015250565b7f4552525f4143434f554e545f5553454400000000000000000000000000000000600082015250565b6110a081610f4f565b81146110ab57600080fd5b50565b6110b781610f8d565b81146110c257600080fd5b5056fea26469706673582212207417c0a37a2a655498c4fdd1155580910a71fd87a9426ed7cfd539196b97622064736f6c63430008030033 -\ No newline at end of file diff --git a/solidity/ERC20SingleShotFaucetStorage.bin b/solidity/ERC20SingleShotFaucetStorage.bin @@ -1 +0,0 @@ -608060405234801561001057600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600360009080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600260008073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610915806101096000396000f3fe608060405234801561001057600080fd5b50600436106100a5576000357c01000000000000000000000000000000000000000000000000000000009004806379ba50971161007857806379ba50971461016a5780638da5cb5b14610188578063e2095c07146101a6578063f2fde38b146101d6576100a5565b806301ffc9a7146100aa5780630a3b0a4f146100da5780633ef250131461010a578063764b07e71461013a575b600080fd5b6100c460048036038101906100bf9190610756565b6101f2565b6040516100d191906107f0565b60405180910390f35b6100f460048036038101906100ef919061072d565b61034a565b60405161010191906107f0565b60405180910390f35b610124600480360381019061011f919061072d565b61044a565b60405161013191906107f0565b60405180910390f35b610154600480360381019061014f919061072d565b610495565b604051610161919061080b565b60405180910390f35b6101726104ad565b60405161017f91906107f0565b60405180910390f35b6101906105ef565b60405161019d91906107d5565b60405180910390f35b6101c060048036038101906101bb919061077f565b610613565b6040516101cd91906107d5565b60405180910390f35b6101f060048036038101906101eb919061072d565b610652565b005b600063cbdb05c77c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614156102475760019050610345565b6301ffc9a77c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916141561029a5760019050610345565b639493f8b27c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614156102ed5760019050610345565b6337a47be47c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614156103405760019050610345565b600090505b919050565b60008060038054905090506003839080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550808373ffffffffffffffffffffffffffffffffffffffff167f9cc987676e7d63379f176ea50df0ae8d2d9d1141d1231d4ce15b5965f73c943060405160405180910390a36001915050919050565b600080600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054119050919050565b60026020528060005260406000206000915090505481565b60008060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461052d57600080fd5b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3600191505090565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6003818154811061062357600080fd5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146106aa57600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000813590506106fd8161089a565b92915050565b600081359050610712816108b1565b92915050565b600081359050610727816108c8565b92915050565b60006020828403121561073f57600080fd5b600061074d848285016106ee565b91505092915050565b60006020828403121561076857600080fd5b600061077684828501610703565b91505092915050565b60006020828403121561079157600080fd5b600061079f84828501610718565b91505092915050565b6107b181610826565b82525050565b6107c081610838565b82525050565b6107cf81610890565b82525050565b60006020820190506107ea60008301846107a8565b92915050565b600060208201905061080560008301846107b7565b92915050565b600060208201905061082060008301846107c6565b92915050565b600061083182610870565b9050919050565b60008115159050919050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b6108a381610826565b81146108ae57600080fd5b50565b6108ba81610844565b81146108c557600080fd5b50565b6108d181610890565b81146108dc57600080fd5b5056fea2646970667358221220c9946d1d5ce7247846f019cfa3051aae1e32efe8f4d6aaf6be588bf4aadeb9f264736f6c63430008030033 -\ No newline at end of file diff --git a/solidity/Makefile b/solidity/Makefile @@ -1,13 +1,13 @@ SOLC = /usr/bin/solc all: - $(SOLC) --bin ERC20SingleShotFaucetStorage.sol --evm-version byzantium | awk 'NR>3' > ERC20SingleShotFaucetStorage.bin - truncate -s -1 ERC20SingleShotFaucetStorage.bin - $(SOLC) --abi ERC20SingleShotFaucetStorage.sol --evm-version byzantium | awk 'NR>3' > ERC20SingleShotFaucetStorage.json - $(SOLC) --bin ERC20SingleShotFaucet.sol --evm-version byzantium | awk 'NR>3' > ERC20SingleShotFaucet.bin - truncate -s -1 ERC20SingleShotFaucet.bin - $(SOLC) --abi ERC20SingleShotFaucet.sol --evm-version byzantium | awk 'NR==4' > ERC20SingleShotFaucet.json + $(SOLC) --bin ERC20FaucetStorage.sol --evm-version byzantium | awk 'NR>3' > ERC20FaucetStorage.bin + truncate -s -1 ERC20FaucetStorage.bin + $(SOLC) --abi ERC20FaucetStorage.sol --evm-version byzantium | awk 'NR>3' > ERC20FaucetStorage.json + $(SOLC) --bin ERC20Faucet.sol --evm-version byzantium | awk 'NR>3' > ERC20Faucet.bin + truncate -s -1 ERC20Faucet.bin + $(SOLC) --abi ERC20Faucet.sol --evm-version byzantium | awk 'NR==4' > ERC20Faucet.json install: all - cp -v *{json,bin} ../python/erc20_single_shot_faucet/data/ + cp -v *{json,bin} ../python/erc20_faucet/data/