erc20-faucet

ERC20 token faucet
Log | Files | Refs

commit c115717d1d8e639452640f3bf1da983d539ee761
parent 8b2ccdd2a0955e6581916430f7431857a47efc37
Author: nolash <dev@holbrook.no>
Date:   Wed, 24 Mar 2021 07:06:44 +0100

Use requirements file for deps, rename object

Diffstat:
Mpython/erc20_single_shot_faucet/__init__.py | 2+-
Mpython/erc20_single_shot_faucet/data/ERC20SingleShotFaucet.bin | 4++--
Mpython/erc20_single_shot_faucet/data/ERC20SingleShotFaucet.json | 2+-
Mpython/erc20_single_shot_faucet/faucet.py | 45+++++++++++++++------------------------------
Apython/requirements.txt | 3+++
Mpython/setup.cfg | 8+-------
Mpython/setup.py | 21+++++++++++++++++++++
Apython/test_requirements.txt | 2++
Msolidity/ERC20SingleShotFaucet.bin | 4++--
Msolidity/ERC20SingleShotFaucet.json | 2+-
Msolidity/ERC20SingleShotFaucet.sol | 3++-
11 files changed, 51 insertions(+), 45 deletions(-)

diff --git a/python/erc20_single_shot_faucet/__init__.py b/python/erc20_single_shot_faucet/__init__.py @@ -3,4 +3,4 @@ # File-version: 1 # Description: Python interface to abi and bin files for faucet contracts -from .faucet import Faucet +from .faucet import SingleShotFaucet diff --git a/python/erc20_single_shot_faucet/data/ERC20SingleShotFaucet.bin b/python/erc20_single_shot_faucet/data/ERC20SingleShotFaucet.bin @@ -1 +1 @@ -60806040523480156200001157600080fd5b50604051620015bb380380620015bb833981810160405281019062000037919062000337565b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060018060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060005b8451811015620001895760018060008784815181106200011a577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808062000180906200045d565b915050620000d1565b5081600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555082600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6006819055505050505062000523565b6000620002956200028f84620003f0565b620003bc565b90508083825260208201905082856020860282011115620002b557600080fd5b60005b85811015620002e95781620002ce8882620002f3565b845260208401935060208301925050600181019050620002b8565b5050509392505050565b600081519050620003048162000509565b92915050565b600082601f8301126200031c57600080fd5b81516200032e8482602086016200027e565b91505092915050565b600080600080608085870312156200034e57600080fd5b600085015167ffffffffffffffff8111156200036957600080fd5b62000377878288016200030a565b94505060206200038a87828801620002f3565b93505060406200039d87828801620002f3565b9250506060620003b087828801620002f3565b91505092959194509250565b6000604051905081810181811067ffffffffffffffff82111715620003e657620003e5620004da565b5b8060405250919050565b600067ffffffffffffffff8211156200040e576200040d620004da565b5b602082029050602081019050919050565b60006200042c8262000433565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b60006200046a8262000453565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415620004a0576200049f620004ab565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b62000514816200041f565b81146200052057600080fd5b50565b61108880620005336000396000f3fe608060405234801561001057600080fd5b5060043610610074576000357c010000000000000000000000000000000000000000000000000000000090048063271f88b41461007957806363e4bff4146100a9578063aa8c217c146100d9578063b222e0c2146100f7578063fc0c546a14610127575b600080fd5b610093600480360381019061008e9190610c8a565b610145565b6040516100a09190610eac565b60405180910390f35b6100c360048036038101906100be9190610c61565b6101ad565b6040516100d09190610eac565b60405180910390f35b6100e1610ac9565b6040516100ee9190610f67565b60405180910390f35b610111600480360381019061010c9190610c61565b610acf565b60405161011e9190610f67565b60405180910390f35b61012f610c11565b60405161013c9190610e68565b60405180910390f35b6000600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1661019d57600080fd5b8160028190555060019050919050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561023c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161023390610ee7565b60405180910390fd5b60006060600073ffffffffffffffffffffffffffffffffffffffff16600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146104c157600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16846040516024016102e09190610e68565b6040516020818303038152906040527f3ef25013000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505060405161036a9190610e51565b6000604051808303816000865af19150503d80600081146103a7576040519150601f19603f3d011682016040523d82523d6000602084013e6103ac565b606091505b50809250819350505060007f01000000000000000000000000000000000000000000000000000000000000000281601f81518110610413577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101517f010000000000000000000000000000000000000000000000000000000000000090047f0100000000000000000000000000000000000000000000000000000000000000027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614156104c0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104b790610ec7565b60405180910390fd5b5b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168460405160240161050b9190610e68565b6040516020818303038152906040527f3ef25013000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506040516105959190610e51565b6000604051808303816000865af19150503d80600081146105d2576040519150601f19603f3d011682016040523d82523d6000602084013e6105d7565b606091505b50809250819350505060007f01000000000000000000000000000000000000000000000000000000000000000281601f8151811061063e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101517f010000000000000000000000000000000000000000000000000000000000000090047f0100000000000000000000000000000000000000000000000000000000000000027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916146106ea576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106e190610f47565b60405180910390fd5b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16846040516024016107349190610e68565b6040516020818303038152906040527f0a3b0a4f000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506040516107be9190610e51565b6000604051808303816000865af19150503d80600081146107fb576040519150601f19603f3d011682016040523d82523d6000602084013e610800565b606091505b50809250819350505081610849576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161084090610f27565b60405180910390fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1684600254604051602401610897929190610e83565b6040516020818303038152906040527fa9059cbb000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506040516109219190610e51565b6000604051808303816000865af19150503d806000811461095e576040519150601f19603f3d011682016040523d82523d6000602084013e610963565b606091505b50809250819350505081610a3557600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f2a56a00a5c532c49314f19361f71cdca8a5d10fdcb42c3fa52800d13419d60706002546040516109f29190610f67565b60405180910390a36040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a2c90610f07565b60405180910390fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f45c201a59ac545000ead84f30b2db67da23353aa1d58ac522c48505412143ffa600254604051610ab69190610f67565b60405180910390a3600192505050919050565b60025481565b6000806060600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1684604051602401610b1e9190610e68565b6040516020818303038152906040527f3ef25013000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051610ba89190610e51565b6000604051808303816000865af19150503d8060008114610be5576040519150601f19603f3d011682016040523d82523d6000602084013e610bea565b606091505b5080925081935050508115610c055760065492505050610c0c565b6000925050505b919050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600081359050610c4681611024565b92915050565b600081359050610c5b8161103b565b92915050565b600060208284031215610c7357600080fd5b6000610c8184828501610c37565b91505092915050565b600060208284031215610c9c57600080fd5b6000610caa84828501610c4c565b91505092915050565b610cbc81610fa9565b82525050565b610ccb81610fbb565b82525050565b6000610cdc82610f82565b610ce68185610f8d565b9350610cf6818560208601610ff1565b80840191505092915050565b6000610d0f601883610f98565b91507f4552525f4143434f554e545f4e4f545f494e5f494e44455800000000000000006000830152602082019050919050565b6000610d4f600a83610f98565b91507f4552525f414343455353000000000000000000000000000000000000000000006000830152602082019050919050565b6000610d8f600c83610f98565b91507f4552525f5452414e5346455200000000000000000000000000000000000000006000830152602082019050919050565b6000610dcf600d83610f98565b91507f4552525f4d41524b5f4641494c000000000000000000000000000000000000006000830152602082019050919050565b6000610e0f601083610f98565b91507f4552525f4143434f554e545f55534544000000000000000000000000000000006000830152602082019050919050565b610e4b81610fe7565b82525050565b6000610e5d8284610cd1565b915081905092915050565b6000602082019050610e7d6000830184610cb3565b92915050565b6000604082019050610e986000830185610cb3565b610ea56020830184610e42565b9392505050565b6000602082019050610ec16000830184610cc2565b92915050565b60006020820190508181036000830152610ee081610d02565b9050919050565b60006020820190508181036000830152610f0081610d42565b9050919050565b60006020820190508181036000830152610f2081610d82565b9050919050565b60006020820190508181036000830152610f4081610dc2565b9050919050565b60006020820190508181036000830152610f6081610e02565b9050919050565b6000602082019050610f7c6000830184610e42565b92915050565b600081519050919050565b600081905092915050565b600082825260208201905092915050565b6000610fb482610fc7565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b60005b8381101561100f578082015181840152602081019050610ff4565b8381111561101e576000848401525b50505050565b61102d81610fa9565b811461103857600080fd5b50565b61104481610fe7565b811461104f57600080fd5b5056fea26469706673582212200b1f0c589921b53409bb66c659727ec4bc227ac653cebb5ada8127dc7a92330364736f6c63430008000033 -\ No newline at end of file +60806040523480156200001157600080fd5b50604051620015f2380380620015f2833981810160405281019062000037919062000337565b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060018060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060005b8451811015620001895760018060008784815181106200011a577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808062000180906200045d565b915050620000d1565b5081600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555082600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6006819055505050505062000523565b6000620002956200028f84620003f0565b620003bc565b90508083825260208201905082856020860282011115620002b557600080fd5b60005b85811015620002e95781620002ce8882620002f3565b845260208401935060208301925050600181019050620002b8565b5050509392505050565b600081519050620003048162000509565b92915050565b600082601f8301126200031c57600080fd5b81516200032e8482602086016200027e565b91505092915050565b600080600080608085870312156200034e57600080fd5b600085015167ffffffffffffffff8111156200036957600080fd5b62000377878288016200030a565b94505060206200038a87828801620002f3565b93505060406200039d87828801620002f3565b9250506060620003b087828801620002f3565b91505092959194509250565b6000604051905081810181811067ffffffffffffffff82111715620003e657620003e5620004da565b5b8060405250919050565b600067ffffffffffffffff8211156200040e576200040d620004da565b5b602082029050602081019050919050565b60006200042c8262000433565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b60006200046a8262000453565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415620004a0576200049f620004ab565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b62000514816200041f565b81146200052057600080fd5b50565b6110bf80620005336000396000f3fe608060405234801561001057600080fd5b5060043610610074576000357c010000000000000000000000000000000000000000000000000000000090048063271f88b41461007957806363e4bff4146100a9578063aa8c217c146100d9578063b222e0c2146100f7578063fc0c546a14610127575b600080fd5b610093600480360381019061008e9190610cc1565b610145565b6040516100a09190610ee3565b60405180910390f35b6100c360048036038101906100be9190610c98565b6101e4565b6040516100d09190610ee3565b60405180910390f35b6100e1610b00565b6040516100ee9190610f9e565b60405180910390f35b610111600480360381019061010c9190610c98565b610b06565b60405161011e9190610f9e565b60405180910390f35b61012f610c48565b60405161013c9190610e9f565b60405180910390f35b6000600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1661019d57600080fd5b816002819055507f748f1cf617bdc8ef4fcd1cb516dc05cedf269e8dcad82183846d57eeec4bba5e826040516101d39190610f9e565b60405180910390a160019050919050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610273576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161026a90610f1e565b60405180910390fd5b60006060600073ffffffffffffffffffffffffffffffffffffffff16600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146104f857600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16846040516024016103179190610e9f565b6040516020818303038152906040527f3ef25013000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506040516103a19190610e88565b6000604051808303816000865af19150503d80600081146103de576040519150601f19603f3d011682016040523d82523d6000602084013e6103e3565b606091505b50809250819350505060007f01000000000000000000000000000000000000000000000000000000000000000281601f8151811061044a577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101517f010000000000000000000000000000000000000000000000000000000000000090047f0100000000000000000000000000000000000000000000000000000000000000027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614156104f7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104ee90610efe565b60405180910390fd5b5b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16846040516024016105429190610e9f565b6040516020818303038152906040527f3ef25013000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506040516105cc9190610e88565b6000604051808303816000865af19150503d8060008114610609576040519150601f19603f3d011682016040523d82523d6000602084013e61060e565b606091505b50809250819350505060007f01000000000000000000000000000000000000000000000000000000000000000281601f81518110610675577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101517f010000000000000000000000000000000000000000000000000000000000000090047f0100000000000000000000000000000000000000000000000000000000000000027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614610721576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161071890610f7e565b60405180910390fd5b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168460405160240161076b9190610e9f565b6040516020818303038152906040527f0a3b0a4f000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506040516107f59190610e88565b6000604051808303816000865af19150503d8060008114610832576040519150601f19603f3d011682016040523d82523d6000602084013e610837565b606091505b50809250819350505081610880576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161087790610f5e565b60405180910390fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16846002546040516024016108ce929190610eba565b6040516020818303038152906040527fa9059cbb000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506040516109589190610e88565b6000604051808303816000865af19150503d8060008114610995576040519150601f19603f3d011682016040523d82523d6000602084013e61099a565b606091505b50809250819350505081610a6c57600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f2a56a00a5c532c49314f19361f71cdca8a5d10fdcb42c3fa52800d13419d6070600254604051610a299190610f9e565b60405180910390a36040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a6390610f3e565b60405180910390fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f45c201a59ac545000ead84f30b2db67da23353aa1d58ac522c48505412143ffa600254604051610aed9190610f9e565b60405180910390a3600192505050919050565b60025481565b6000806060600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1684604051602401610b559190610e9f565b6040516020818303038152906040527f3ef25013000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051610bdf9190610e88565b6000604051808303816000865af19150503d8060008114610c1c576040519150601f19603f3d011682016040523d82523d6000602084013e610c21565b606091505b5080925081935050508115610c3c5760065492505050610c43565b6000925050505b919050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600081359050610c7d8161105b565b92915050565b600081359050610c9281611072565b92915050565b600060208284031215610caa57600080fd5b6000610cb884828501610c6e565b91505092915050565b600060208284031215610cd357600080fd5b6000610ce184828501610c83565b91505092915050565b610cf381610fe0565b82525050565b610d0281610ff2565b82525050565b6000610d1382610fb9565b610d1d8185610fc4565b9350610d2d818560208601611028565b80840191505092915050565b6000610d46601883610fcf565b91507f4552525f4143434f554e545f4e4f545f494e5f494e44455800000000000000006000830152602082019050919050565b6000610d86600a83610fcf565b91507f4552525f414343455353000000000000000000000000000000000000000000006000830152602082019050919050565b6000610dc6600c83610fcf565b91507f4552525f5452414e5346455200000000000000000000000000000000000000006000830152602082019050919050565b6000610e06600d83610fcf565b91507f4552525f4d41524b5f4641494c000000000000000000000000000000000000006000830152602082019050919050565b6000610e46601083610fcf565b91507f4552525f4143434f554e545f55534544000000000000000000000000000000006000830152602082019050919050565b610e828161101e565b82525050565b6000610e948284610d08565b915081905092915050565b6000602082019050610eb46000830184610cea565b92915050565b6000604082019050610ecf6000830185610cea565b610edc6020830184610e79565b9392505050565b6000602082019050610ef86000830184610cf9565b92915050565b60006020820190508181036000830152610f1781610d39565b9050919050565b60006020820190508181036000830152610f3781610d79565b9050919050565b60006020820190508181036000830152610f5781610db9565b9050919050565b60006020820190508181036000830152610f7781610df9565b9050919050565b60006020820190508181036000830152610f9781610e39565b9050919050565b6000602082019050610fb36000830184610e79565b92915050565b600081519050919050565b600081905092915050565b600082825260208201905092915050565b6000610feb82610ffe565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b60005b8381101561104657808201518184015260208101905061102b565b83811115611055576000848401525b50505050565b61106481610fe0565b811461106f57600080fd5b50565b61107b8161101e565b811461108657600080fd5b5056fea26469706673582212200e2828c8d7bd66aeccec34b87b9b8b4e17e8765d616631314197d2019366947764736f6c63430008000033 +\ No newline at end of file diff --git a/python/erc20_single_shot_faucet/data/ERC20SingleShotFaucet.json b/python/erc20_single_shot_faucet/data/ERC20SingleShotFaucet.json @@ -1 +1 @@ -[{"inputs":[{"internalType":"address[]","name":"_overriders","type":"address[]"},{"internalType":"address","name":"_token","type":"address"},{"internalType":"address","name":"_store","type":"address"},{"internalType":"address","name":"_accountsIndex","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"_value","type":"uint256"}],"name":"FaucetAmountChange","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_recipient","type":"address"},{"indexed":true,"internalType":"address","name":"_token","type":"address"},{"indexed":false,"internalType":"uint256","name":"_value","type":"uint256"}],"name":"FaucetFail","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_recipient","type":"address"},{"indexed":true,"internalType":"address","name":"_token","type":"address"},{"indexed":false,"internalType":"uint256","name":"_value","type":"uint256"}],"name":"FaucetUsed","type":"event"},{"inputs":[],"name":"amount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_recipient","type":"address"}],"name":"cooldown","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_recipient","type":"address"}],"name":"giveTo","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"setAmount","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"token","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}] +[{"inputs":[{"internalType":"address[]","name":"_overriders","type":"address[]"},{"internalType":"address","name":"_token","type":"address"},{"internalType":"address","name":"_store","type":"address"},{"internalType":"address","name":"_accountsIndex","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_value","type":"uint256"}],"name":"FaucetAmountChange","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_recipient","type":"address"},{"indexed":true,"internalType":"address","name":"_token","type":"address"},{"indexed":false,"internalType":"uint256","name":"_value","type":"uint256"}],"name":"FaucetFail","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_recipient","type":"address"},{"indexed":true,"internalType":"address","name":"_token","type":"address"},{"indexed":false,"internalType":"uint256","name":"_value","type":"uint256"}],"name":"FaucetUsed","type":"event"},{"inputs":[],"name":"amount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_recipient","type":"address"}],"name":"cooldown","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_recipient","type":"address"}],"name":"giveTo","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"setAmount","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"token","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}] diff --git a/python/erc20_single_shot_faucet/faucet.py b/python/erc20_single_shot_faucet/faucet.py @@ -8,37 +8,26 @@ import logging import json import os +# external imports +from chainlib.eth.tx import TxFactory + logg = logging.getLogger() moddir = os.path.dirname(__file__) datadir = os.path.join(moddir, 'data') -class Faucet: +class SingleShotFaucet(TxFactory): __abi = None __bytecode = None __address = None - def __init__(self, w3, address, signer_address=None): - abi = Faucet.abi() - Faucet.bytecode() - self.__address = address - self.contract = w3.eth.contract(abi=abi, address=address) - self.w3 = w3 - if signer_address != None: - self.signer_address = signer_address - else: - if type(self.w3.eth.defaultAccount).__name__ == 'Empty': - self.w3.eth.defaultAccount = self.w3.eth.accounts[0] - self.signer_address = self.w3.eth.defaultAccount - - @staticmethod def abi(part=None): - if Faucet.__abi == None: + if SingleShotFaucet.__abi == None: f = open(os.path.join(datadir, 'ERC20SingleShotFaucet.json'), 'r') - Faucet.__abi = json.load(f) + SingleShotFaucet.__abi = json.load(f) f.close() if part == 'storage': f = open(os.path.join(datadir, 'ERC20SingleShotFaucetStorage.json')) @@ -47,14 +36,14 @@ class Faucet: return abi elif part != None: raise ValueError('unknown abi identifier "{}"'.format(part)) - return Faucet.__abi + return SingleShotFaucet.__abi @staticmethod def bytecode(part=None): - if Faucet.__bytecode == None: + if SingleShotFaucet.__bytecode == None: f = open(os.path.join(datadir, 'ERC20SingleShotFaucet.bin')) - Faucet.__bytecode = f.read() + SingleShotFaucet.__bytecode = f.read() f.close() if part == 'storage': f = open(os.path.join(datadir, 'ERC20SingleShotFaucetStorage.bin')) @@ -64,15 +53,11 @@ class Faucet: elif part != None: raise ValueError('unknown bytecode identifier "{}"'.format(part)) - return Faucet.__bytecode - - - def give_to(self, address): - tx_hash = self.contract.functions.giveTo(address).transact({ - 'from': self.signer_address, - }) - return tx_hash + return SingleShotFaucet.__bytecode - def address(self): - return self.__address + def store_constructor(self, sender_address): + code = SingleShotFaucet.bytecode(part='storage') + tx = self.template(sender_address, None, use_nonce=True) + tx = self.set_code(tx, code) + return self.build(tx) diff --git a/python/requirements.txt b/python/requirements.txt @@ -0,0 +1,3 @@ +confini~=0.3.6rc3 +crypto-dev-signer~=0.4.14a4 +chainlib~=0.0.1a28 diff --git a/python/setup.cfg b/python/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = erc20-single-shot-faucet -version = 0.2.0a6 +version = 0.2.0a7 description = ERC20 token faucet that can be used once per account author = Louis Holbrook author_email = dev@holbrook.no @@ -26,12 +26,6 @@ python_requires = >= 3.6 packages = erc20_single_shot_faucet erc20_single_shot_faucet.runnable -install_requires = - web3==5.12.2 - crypto-dev-signer~=0.4.13rc2 -tests_require = - eth-tester==0.5.0b2 - py-evm==0.3.0a20 [options.extras_require] testing = diff --git a/python/setup.py b/python/setup.py @@ -1,4 +1,25 @@ from setuptools import setup +requirements = [] +f = open('requirements.txt', 'r') +while True: + l = f.readline() + if l == '': + break + requirements.append(l.rstrip()) +f.close() + +test_requirements = [] +f = open('test_requirements.txt', 'r') +while True: + l = f.readline() + if l == '': + break + test_requirements.append(l.rstrip()) +f.close() + + setup( + install_requires=requirements, + tests_require=test_requirements, ) diff --git a/python/test_requirements.txt b/python/test_requirements.txt @@ -0,0 +1,2 @@ +eth_tester==0.5.0b3 +py-evm==0.3.0a20 diff --git a/solidity/ERC20SingleShotFaucet.bin b/solidity/ERC20SingleShotFaucet.bin @@ -1 +1 @@ -60806040523480156200001157600080fd5b50604051620015bb380380620015bb833981810160405281019062000037919062000337565b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060018060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060005b8451811015620001895760018060008784815181106200011a577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808062000180906200045d565b915050620000d1565b5081600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555082600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6006819055505050505062000523565b6000620002956200028f84620003f0565b620003bc565b90508083825260208201905082856020860282011115620002b557600080fd5b60005b85811015620002e95781620002ce8882620002f3565b845260208401935060208301925050600181019050620002b8565b5050509392505050565b600081519050620003048162000509565b92915050565b600082601f8301126200031c57600080fd5b81516200032e8482602086016200027e565b91505092915050565b600080600080608085870312156200034e57600080fd5b600085015167ffffffffffffffff8111156200036957600080fd5b62000377878288016200030a565b94505060206200038a87828801620002f3565b93505060406200039d87828801620002f3565b9250506060620003b087828801620002f3565b91505092959194509250565b6000604051905081810181811067ffffffffffffffff82111715620003e657620003e5620004da565b5b8060405250919050565b600067ffffffffffffffff8211156200040e576200040d620004da565b5b602082029050602081019050919050565b60006200042c8262000433565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b60006200046a8262000453565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415620004a0576200049f620004ab565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b62000514816200041f565b81146200052057600080fd5b50565b61108880620005336000396000f3fe608060405234801561001057600080fd5b5060043610610074576000357c010000000000000000000000000000000000000000000000000000000090048063271f88b41461007957806363e4bff4146100a9578063aa8c217c146100d9578063b222e0c2146100f7578063fc0c546a14610127575b600080fd5b610093600480360381019061008e9190610c8a565b610145565b6040516100a09190610eac565b60405180910390f35b6100c360048036038101906100be9190610c61565b6101ad565b6040516100d09190610eac565b60405180910390f35b6100e1610ac9565b6040516100ee9190610f67565b60405180910390f35b610111600480360381019061010c9190610c61565b610acf565b60405161011e9190610f67565b60405180910390f35b61012f610c11565b60405161013c9190610e68565b60405180910390f35b6000600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1661019d57600080fd5b8160028190555060019050919050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561023c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161023390610ee7565b60405180910390fd5b60006060600073ffffffffffffffffffffffffffffffffffffffff16600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146104c157600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16846040516024016102e09190610e68565b6040516020818303038152906040527f3ef25013000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505060405161036a9190610e51565b6000604051808303816000865af19150503d80600081146103a7576040519150601f19603f3d011682016040523d82523d6000602084013e6103ac565b606091505b50809250819350505060007f01000000000000000000000000000000000000000000000000000000000000000281601f81518110610413577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101517f010000000000000000000000000000000000000000000000000000000000000090047f0100000000000000000000000000000000000000000000000000000000000000027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614156104c0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104b790610ec7565b60405180910390fd5b5b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168460405160240161050b9190610e68565b6040516020818303038152906040527f3ef25013000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506040516105959190610e51565b6000604051808303816000865af19150503d80600081146105d2576040519150601f19603f3d011682016040523d82523d6000602084013e6105d7565b606091505b50809250819350505060007f01000000000000000000000000000000000000000000000000000000000000000281601f8151811061063e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101517f010000000000000000000000000000000000000000000000000000000000000090047f0100000000000000000000000000000000000000000000000000000000000000027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916146106ea576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106e190610f47565b60405180910390fd5b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16846040516024016107349190610e68565b6040516020818303038152906040527f0a3b0a4f000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506040516107be9190610e51565b6000604051808303816000865af19150503d80600081146107fb576040519150601f19603f3d011682016040523d82523d6000602084013e610800565b606091505b50809250819350505081610849576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161084090610f27565b60405180910390fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1684600254604051602401610897929190610e83565b6040516020818303038152906040527fa9059cbb000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506040516109219190610e51565b6000604051808303816000865af19150503d806000811461095e576040519150601f19603f3d011682016040523d82523d6000602084013e610963565b606091505b50809250819350505081610a3557600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f2a56a00a5c532c49314f19361f71cdca8a5d10fdcb42c3fa52800d13419d60706002546040516109f29190610f67565b60405180910390a36040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a2c90610f07565b60405180910390fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f45c201a59ac545000ead84f30b2db67da23353aa1d58ac522c48505412143ffa600254604051610ab69190610f67565b60405180910390a3600192505050919050565b60025481565b6000806060600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1684604051602401610b1e9190610e68565b6040516020818303038152906040527f3ef25013000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051610ba89190610e51565b6000604051808303816000865af19150503d8060008114610be5576040519150601f19603f3d011682016040523d82523d6000602084013e610bea565b606091505b5080925081935050508115610c055760065492505050610c0c565b6000925050505b919050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600081359050610c4681611024565b92915050565b600081359050610c5b8161103b565b92915050565b600060208284031215610c7357600080fd5b6000610c8184828501610c37565b91505092915050565b600060208284031215610c9c57600080fd5b6000610caa84828501610c4c565b91505092915050565b610cbc81610fa9565b82525050565b610ccb81610fbb565b82525050565b6000610cdc82610f82565b610ce68185610f8d565b9350610cf6818560208601610ff1565b80840191505092915050565b6000610d0f601883610f98565b91507f4552525f4143434f554e545f4e4f545f494e5f494e44455800000000000000006000830152602082019050919050565b6000610d4f600a83610f98565b91507f4552525f414343455353000000000000000000000000000000000000000000006000830152602082019050919050565b6000610d8f600c83610f98565b91507f4552525f5452414e5346455200000000000000000000000000000000000000006000830152602082019050919050565b6000610dcf600d83610f98565b91507f4552525f4d41524b5f4641494c000000000000000000000000000000000000006000830152602082019050919050565b6000610e0f601083610f98565b91507f4552525f4143434f554e545f55534544000000000000000000000000000000006000830152602082019050919050565b610e4b81610fe7565b82525050565b6000610e5d8284610cd1565b915081905092915050565b6000602082019050610e7d6000830184610cb3565b92915050565b6000604082019050610e986000830185610cb3565b610ea56020830184610e42565b9392505050565b6000602082019050610ec16000830184610cc2565b92915050565b60006020820190508181036000830152610ee081610d02565b9050919050565b60006020820190508181036000830152610f0081610d42565b9050919050565b60006020820190508181036000830152610f2081610d82565b9050919050565b60006020820190508181036000830152610f4081610dc2565b9050919050565b60006020820190508181036000830152610f6081610e02565b9050919050565b6000602082019050610f7c6000830184610e42565b92915050565b600081519050919050565b600081905092915050565b600082825260208201905092915050565b6000610fb482610fc7565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b60005b8381101561100f578082015181840152602081019050610ff4565b8381111561101e576000848401525b50505050565b61102d81610fa9565b811461103857600080fd5b50565b61104481610fe7565b811461104f57600080fd5b5056fea26469706673582212200b1f0c589921b53409bb66c659727ec4bc227ac653cebb5ada8127dc7a92330364736f6c63430008000033 -\ No newline at end of file +60806040523480156200001157600080fd5b50604051620015f2380380620015f2833981810160405281019062000037919062000337565b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060018060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060005b8451811015620001895760018060008784815181106200011a577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808062000180906200045d565b915050620000d1565b5081600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555082600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6006819055505050505062000523565b6000620002956200028f84620003f0565b620003bc565b90508083825260208201905082856020860282011115620002b557600080fd5b60005b85811015620002e95781620002ce8882620002f3565b845260208401935060208301925050600181019050620002b8565b5050509392505050565b600081519050620003048162000509565b92915050565b600082601f8301126200031c57600080fd5b81516200032e8482602086016200027e565b91505092915050565b600080600080608085870312156200034e57600080fd5b600085015167ffffffffffffffff8111156200036957600080fd5b62000377878288016200030a565b94505060206200038a87828801620002f3565b93505060406200039d87828801620002f3565b9250506060620003b087828801620002f3565b91505092959194509250565b6000604051905081810181811067ffffffffffffffff82111715620003e657620003e5620004da565b5b8060405250919050565b600067ffffffffffffffff8211156200040e576200040d620004da565b5b602082029050602081019050919050565b60006200042c8262000433565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b60006200046a8262000453565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415620004a0576200049f620004ab565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b62000514816200041f565b81146200052057600080fd5b50565b6110bf80620005336000396000f3fe608060405234801561001057600080fd5b5060043610610074576000357c010000000000000000000000000000000000000000000000000000000090048063271f88b41461007957806363e4bff4146100a9578063aa8c217c146100d9578063b222e0c2146100f7578063fc0c546a14610127575b600080fd5b610093600480360381019061008e9190610cc1565b610145565b6040516100a09190610ee3565b60405180910390f35b6100c360048036038101906100be9190610c98565b6101e4565b6040516100d09190610ee3565b60405180910390f35b6100e1610b00565b6040516100ee9190610f9e565b60405180910390f35b610111600480360381019061010c9190610c98565b610b06565b60405161011e9190610f9e565b60405180910390f35b61012f610c48565b60405161013c9190610e9f565b60405180910390f35b6000600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1661019d57600080fd5b816002819055507f748f1cf617bdc8ef4fcd1cb516dc05cedf269e8dcad82183846d57eeec4bba5e826040516101d39190610f9e565b60405180910390a160019050919050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610273576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161026a90610f1e565b60405180910390fd5b60006060600073ffffffffffffffffffffffffffffffffffffffff16600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146104f857600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16846040516024016103179190610e9f565b6040516020818303038152906040527f3ef25013000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506040516103a19190610e88565b6000604051808303816000865af19150503d80600081146103de576040519150601f19603f3d011682016040523d82523d6000602084013e6103e3565b606091505b50809250819350505060007f01000000000000000000000000000000000000000000000000000000000000000281601f8151811061044a577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101517f010000000000000000000000000000000000000000000000000000000000000090047f0100000000000000000000000000000000000000000000000000000000000000027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614156104f7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104ee90610efe565b60405180910390fd5b5b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16846040516024016105429190610e9f565b6040516020818303038152906040527f3ef25013000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506040516105cc9190610e88565b6000604051808303816000865af19150503d8060008114610609576040519150601f19603f3d011682016040523d82523d6000602084013e61060e565b606091505b50809250819350505060007f01000000000000000000000000000000000000000000000000000000000000000281601f81518110610675577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101517f010000000000000000000000000000000000000000000000000000000000000090047f0100000000000000000000000000000000000000000000000000000000000000027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614610721576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161071890610f7e565b60405180910390fd5b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168460405160240161076b9190610e9f565b6040516020818303038152906040527f0a3b0a4f000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506040516107f59190610e88565b6000604051808303816000865af19150503d8060008114610832576040519150601f19603f3d011682016040523d82523d6000602084013e610837565b606091505b50809250819350505081610880576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161087790610f5e565b60405180910390fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16846002546040516024016108ce929190610eba565b6040516020818303038152906040527fa9059cbb000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506040516109589190610e88565b6000604051808303816000865af19150503d8060008114610995576040519150601f19603f3d011682016040523d82523d6000602084013e61099a565b606091505b50809250819350505081610a6c57600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f2a56a00a5c532c49314f19361f71cdca8a5d10fdcb42c3fa52800d13419d6070600254604051610a299190610f9e565b60405180910390a36040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a6390610f3e565b60405180910390fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f45c201a59ac545000ead84f30b2db67da23353aa1d58ac522c48505412143ffa600254604051610aed9190610f9e565b60405180910390a3600192505050919050565b60025481565b6000806060600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1684604051602401610b559190610e9f565b6040516020818303038152906040527f3ef25013000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051610bdf9190610e88565b6000604051808303816000865af19150503d8060008114610c1c576040519150601f19603f3d011682016040523d82523d6000602084013e610c21565b606091505b5080925081935050508115610c3c5760065492505050610c43565b6000925050505b919050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600081359050610c7d8161105b565b92915050565b600081359050610c9281611072565b92915050565b600060208284031215610caa57600080fd5b6000610cb884828501610c6e565b91505092915050565b600060208284031215610cd357600080fd5b6000610ce184828501610c83565b91505092915050565b610cf381610fe0565b82525050565b610d0281610ff2565b82525050565b6000610d1382610fb9565b610d1d8185610fc4565b9350610d2d818560208601611028565b80840191505092915050565b6000610d46601883610fcf565b91507f4552525f4143434f554e545f4e4f545f494e5f494e44455800000000000000006000830152602082019050919050565b6000610d86600a83610fcf565b91507f4552525f414343455353000000000000000000000000000000000000000000006000830152602082019050919050565b6000610dc6600c83610fcf565b91507f4552525f5452414e5346455200000000000000000000000000000000000000006000830152602082019050919050565b6000610e06600d83610fcf565b91507f4552525f4d41524b5f4641494c000000000000000000000000000000000000006000830152602082019050919050565b6000610e46601083610fcf565b91507f4552525f4143434f554e545f55534544000000000000000000000000000000006000830152602082019050919050565b610e828161101e565b82525050565b6000610e948284610d08565b915081905092915050565b6000602082019050610eb46000830184610cea565b92915050565b6000604082019050610ecf6000830185610cea565b610edc6020830184610e79565b9392505050565b6000602082019050610ef86000830184610cf9565b92915050565b60006020820190508181036000830152610f1781610d39565b9050919050565b60006020820190508181036000830152610f3781610d79565b9050919050565b60006020820190508181036000830152610f5781610db9565b9050919050565b60006020820190508181036000830152610f7781610df9565b9050919050565b60006020820190508181036000830152610f9781610e39565b9050919050565b6000602082019050610fb36000830184610e79565b92915050565b600081519050919050565b600081905092915050565b600082825260208201905092915050565b6000610feb82610ffe565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b60005b8381101561104657808201518184015260208101905061102b565b83811115611055576000848401525b50505050565b61106481610fe0565b811461106f57600080fd5b50565b61107b8161101e565b811461108657600080fd5b5056fea26469706673582212200e2828c8d7bd66aeccec34b87b9b8b4e17e8765d616631314197d2019366947764736f6c63430008000033 +\ No newline at end of file diff --git a/solidity/ERC20SingleShotFaucet.json b/solidity/ERC20SingleShotFaucet.json @@ -1 +1 @@ -[{"inputs":[{"internalType":"address[]","name":"_overriders","type":"address[]"},{"internalType":"address","name":"_token","type":"address"},{"internalType":"address","name":"_store","type":"address"},{"internalType":"address","name":"_accountsIndex","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"_value","type":"uint256"}],"name":"FaucetAmountChange","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_recipient","type":"address"},{"indexed":true,"internalType":"address","name":"_token","type":"address"},{"indexed":false,"internalType":"uint256","name":"_value","type":"uint256"}],"name":"FaucetFail","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_recipient","type":"address"},{"indexed":true,"internalType":"address","name":"_token","type":"address"},{"indexed":false,"internalType":"uint256","name":"_value","type":"uint256"}],"name":"FaucetUsed","type":"event"},{"inputs":[],"name":"amount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_recipient","type":"address"}],"name":"cooldown","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_recipient","type":"address"}],"name":"giveTo","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"setAmount","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"token","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}] +[{"inputs":[{"internalType":"address[]","name":"_overriders","type":"address[]"},{"internalType":"address","name":"_token","type":"address"},{"internalType":"address","name":"_store","type":"address"},{"internalType":"address","name":"_accountsIndex","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_value","type":"uint256"}],"name":"FaucetAmountChange","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_recipient","type":"address"},{"indexed":true,"internalType":"address","name":"_token","type":"address"},{"indexed":false,"internalType":"uint256","name":"_value","type":"uint256"}],"name":"FaucetFail","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_recipient","type":"address"},{"indexed":true,"internalType":"address","name":"_token","type":"address"},{"indexed":false,"internalType":"uint256","name":"_value","type":"uint256"}],"name":"FaucetUsed","type":"event"},{"inputs":[],"name":"amount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_recipient","type":"address"}],"name":"cooldown","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_recipient","type":"address"}],"name":"giveTo","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"setAmount","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"token","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}] diff --git a/solidity/ERC20SingleShotFaucet.sol b/solidity/ERC20SingleShotFaucet.sol @@ -14,7 +14,7 @@ contract SingleShotFaucet { event FaucetUsed(address indexed _recipient, address indexed _token, uint256 _value); event FaucetFail(address indexed _recipient, address indexed _token, uint256 _value); - event FaucetAmountChange(address indexed _recipient, uint256 _value); + event FaucetAmountChange(uint256 _value); constructor(address[] memory _overriders, address _token, address _store, address _accountsIndex) public { owner = msg.sender; @@ -31,6 +31,7 @@ contract SingleShotFaucet { function setAmount(uint256 _amount) public returns (bool) { require(overriders[msg.sender]); amount = _amount; + emit FaucetAmountChange(_amount); return true; }