erc20-faucet

ERC20 token faucet
Log | Files | Refs

commit f831f78e3db47e91eba65001e557d76cb725ce48
parent 63e6a6bf7660ce89297102e8a6efaf43ed532e16
Author: lash <dev@holbrook.no>
Date:   Sat, 25 Mar 2023 14:01:15 +0000

Clean up faucet contract

Diffstat:
Mpython/erc20_faucet/data/ERC20Faucet.bin | 4++--
Mpython/erc20_faucet/data/ERC20Faucet.json | 2+-
Mpython/erc20_faucet/data/ERC20FaucetStorage.bin | 4++--
Mpython/erc20_faucet/data/ERC20FaucetStorage.json | 2+-
Mpython/erc20_faucet/faucet.py | 6+-----
Mpython/setup.cfg | 2+-
Mpython/test_requirements.txt | 1+
Mpython/tests/test_basic.py | 20++++++++++++++------
Msolidity/ERC20Faucet.sol | 128++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------
Msolidity/ERC20FaucetStorage.sol | 40++++++++++++++++++++--------------------
10 files changed, 121 insertions(+), 88 deletions(-)

diff --git a/python/erc20_faucet/data/ERC20Faucet.bin b/python/erc20_faucet/data/ERC20Faucet.bin @@ -1 +1 @@ -60806040523480156200001157600080fd5b5060405162001bc038038062001bc0833981810160405281019062000037919062000448565b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060018060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060005b845181101562000165576001806000878481518110620000f657620000f5620004d9565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080806200015c9062000541565b915050620000d1565b5081600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555082600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600781905550505050506200058e565b6000604051905090565b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b620002be8262000273565b810181811067ffffffffffffffff82111715620002e057620002df62000284565b5b80604052505050565b6000620002f56200025a565b9050620003038282620002b3565b919050565b600067ffffffffffffffff82111562000326576200032562000284565b5b602082029050602081019050919050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600062000369826200033c565b9050919050565b6200037b816200035c565b81146200038757600080fd5b50565b6000815190506200039b8162000370565b92915050565b6000620003b8620003b28462000308565b620002e9565b90508083825260208201905060208402830185811115620003de57620003dd62000337565b5b835b818110156200040b5780620003f688826200038a565b845260208401935050602081019050620003e0565b5050509392505050565b600082601f8301126200042d576200042c6200026e565b5b81516200043f848260208601620003a1565b91505092915050565b6000806000806080858703121562000465576200046462000264565b5b600085015167ffffffffffffffff81111562000486576200048562000269565b5b620004948782880162000415565b9450506020620004a7878288016200038a565b9350506040620004ba878288016200038a565b9250506060620004cd878288016200038a565b91505092959194509250565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000819050919050565b60006200054e8262000537565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820362000583576200058262000508565b5b600182019050919050565b611622806200059e6000396000f3fe608060405234801561001057600080fd5b50600436106100b0576000357c010000000000000000000000000000000000000000000000000000000090048063b222e0c211610083578063b222e0c214610175578063da2824a8146101a5578063de82efb4146101d5578063eec7faa1146101f3578063fc0c546a14610211576100b0565b806301ffc9a7146100b5578063271f88b4146100e55780635ae06f7e1461011557806363e4bff414610145575b600080fd5b6100cf60048036038101906100ca91906110ce565b61022f565b6040516100dc9190611116565b60405180910390f35b6100ff60048036038101906100fa9190611167565b610331565b60405161010c9190611116565b60405180910390f35b61012f600480360381019061012a91906111f2565b6103d0565b60405161013c9190611116565b60405180910390f35b61015f600480360381019061015a91906111f2565b610482565b60405161016c9190611116565b60405180910390f35b61018f600480360381019061018a91906111f2565b610d51565b60405161019c919061122e565b60405180910390f35b6101bf60048036038101906101ba91906111f2565b610f76565b6040516101cc9190611116565b60405180910390f35b6101dd611031565b6040516101ea9190611116565b60405180910390f35b6101fb611041565b604051610208919061122e565b60405180910390f35b61021961104b565b6040516102269190611258565b60405180910390f35b60006301ffc9a77c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191603610283576001905061032c565b63de3445477c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916036102d5576001905061032c565b6380c84bd67c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191603610327576001905061032c565b600090505b919050565b6000600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1661038957600080fd5b816002819055507f748f1cf617bdc8ef4fcd1cb516dc05cedf269e8dcad82183846d57eeec4bba5e826040516103bf919061122e565b60405180910390a160019050919050565b60003373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461042a57600080fd5b600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81549060ff021916905560019050919050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610511576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610508906112d0565b60405180910390fd5b60006060600073ffffffffffffffffffffffffffffffffffffffff16600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461076f57600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16846040516024016105b59190611258565b6040516020818303038152906040527f3ef25013000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505060405161063f9190611361565b6000604051808303816000865af19150503d806000811461067c576040519150601f19603f3d011682016040523d82523d6000602084013e610681565b606091505b50809250819350505060007f01000000000000000000000000000000000000000000000000000000000000000281601f815181106106c2576106c1611378565b5b60200101517f010000000000000000000000000000000000000000000000000000000000000090047f0100000000000000000000000000000000000000000000000000000000000000027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19160361076e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610765906113f3565b60405180910390fd5b5b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16846040516024016107b99190611258565b6040516020818303038152906040527f3ef25013000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506040516108439190611361565b6000604051808303816000865af19150503d8060008114610880576040519150601f19603f3d011682016040523d82523d6000602084013e610885565b606091505b50809250819350505060007f01000000000000000000000000000000000000000000000000000000000000000281601f815181106108c6576108c5611378565b5b60200101517f010000000000000000000000000000000000000000000000000000000000000090047f0100000000000000000000000000000000000000000000000000000000000000027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614610972576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109699061145f565b60405180910390fd5b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16846040516024016109bc9190611258565b6040516020818303038152906040527f0a3b0a4f000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051610a469190611361565b6000604051808303816000865af19150503d8060008114610a83576040519150601f19603f3d011682016040523d82523d6000602084013e610a88565b606091505b50809250819350505081610ad1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ac8906114cb565b60405180910390fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1684600254604051602401610b1f9291906114eb565b6040516020818303038152906040527fa9059cbb000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051610ba99190611361565b6000604051808303816000865af19150503d8060008114610be6576040519150601f19603f3d011682016040523d82523d6000602084013e610beb565b606091505b50809250819350505081610cbd57600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f2a56a00a5c532c49314f19361f71cdca8a5d10fdcb42c3fa52800d13419d6070600254604051610c7a919061122e565b60405180910390a36040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cb490611560565b60405180910390fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f45c201a59ac545000ead84f30b2db67da23353aa1d58ac522c48505412143ffa600254604051610d3e919061122e565b60405180910390a3600192505050919050565b6000806060600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1684604051602401610da09190611258565b6040516020818303038152906040527f3ef25013000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051610e2a9190611361565b6000604051808303816000865af19150503d8060008114610e67576040519150601f19603f3d011682016040523d82523d6000602084013e610e6c565b606091505b50809250819350505081610eb5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610eac906115cc565b60405180910390fd5b60017f01000000000000000000000000000000000000000000000000000000000000000281601f81518110610eed57610eec611378565b5b60200101517f010000000000000000000000000000000000000000000000000000000000000090047f0100000000000000000000000000000000000000000000000000000000000000027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191603610f6a5760075492505050610f71565b6000925050505b919050565b60003373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610fd057600080fd5b6001600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060019050919050565b600061103c33610482565b905090565b6000600254905090565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600080fd5b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b6110ab81611076565b81146110b657600080fd5b50565b6000813590506110c8816110a2565b92915050565b6000602082840312156110e4576110e3611071565b5b60006110f2848285016110b9565b91505092915050565b60008115159050919050565b611110816110fb565b82525050565b600060208201905061112b6000830184611107565b92915050565b6000819050919050565b61114481611131565b811461114f57600080fd5b50565b6000813590506111618161113b565b92915050565b60006020828403121561117d5761117c611071565b5b600061118b84828501611152565b91505092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006111bf82611194565b9050919050565b6111cf816111b4565b81146111da57600080fd5b50565b6000813590506111ec816111c6565b92915050565b60006020828403121561120857611207611071565b5b6000611216848285016111dd565b91505092915050565b61122881611131565b82525050565b6000602082019050611243600083018461121f565b92915050565b611252816111b4565b82525050565b600060208201905061126d6000830184611249565b92915050565b600082825260208201905092915050565b7f4552525f41434345535300000000000000000000000000000000000000000000600082015250565b60006112ba600a83611273565b91506112c582611284565b602082019050919050565b600060208201905081810360008301526112e9816112ad565b9050919050565b600081519050919050565b600081905092915050565b60005b83811015611324578082015181840152602081019050611309565b60008484015250505050565b600061133b826112f0565b61134581856112fb565b9350611355818560208601611306565b80840191505092915050565b600061136d8284611330565b915081905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4552525f4143434f554e545f4e4f545f494e5f494e4445580000000000000000600082015250565b60006113dd601883611273565b91506113e8826113a7565b602082019050919050565b6000602082019050818103600083015261140c816113d0565b9050919050565b7f4552525f4143434f554e545f5553454400000000000000000000000000000000600082015250565b6000611449601083611273565b915061145482611413565b602082019050919050565b600060208201905081810360008301526114788161143c565b9050919050565b7f4552525f4d41524b5f4641494c00000000000000000000000000000000000000600082015250565b60006114b5600d83611273565b91506114c08261147f565b602082019050919050565b600060208201905081810360008301526114e4816114a8565b9050919050565b60006040820190506115006000830185611249565b61150d602083018461121f565b9392505050565b7f4552525f5452414e534645520000000000000000000000000000000000000000600082015250565b600061154a600c83611273565b915061155582611514565b602082019050919050565b600060208201905081810360008301526115798161153d565b9050919050565b7f4552525f53544f52455f4641494c000000000000000000000000000000000000600082015250565b60006115b6600e83611273565b91506115c182611580565b602082019050919050565b600060208201905081810360008301526115e5816115a9565b905091905056fea26469706673582212201c920db68424a309adce7ce93a59dd36c80fa2cfcd3095b3273160ff4f0f145464736f6c63430008120033 -\ No newline at end of file +60806040523480156200001157600080fd5b5060405162001ce938038062001ce98339818101604052810190620000379190620001ad565b33600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555081600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550826000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050505062000209565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000620001758262000148565b9050919050565b620001878162000168565b81146200019357600080fd5b50565b600081519050620001a7816200017c565b92915050565b600080600060608486031215620001c957620001c862000143565b5b6000620001d98682870162000196565b9350506020620001ec8682870162000196565b9250506040620001ff8682870162000196565b9150509250925092565b611ad080620002196000396000f3fe608060405234801561001057600080fd5b5060043610610107576000357c010000000000000000000000000000000000000000000000000000000090048063c23697a8116100a9578063eec7faa111610083578063eec7faa1146102c8578063f18e126a146102e6578063f2fde38b14610316578063fc0c546a1461033257610107565b8063c23697a81461024a578063da2824a81461027a578063de82efb4146102aa57610107565b80633b1bd134116100e55780633b1bd1341461019c5780635ae06f7e146101cc57806363e4bff4146101fc5780638da5cb5b1461022c57610107565b806301ffc9a71461010c578063271f88b41461013c5780632b29ba231461016c575b600080fd5b6101266004803603810190610121919061157c565b610350565b60405161013391906115c4565b60405180910390f35b61015660048036038101906101519190611615565b610452565b60405161016391906115c4565b60405180910390f35b610186600480360381019061018191906116a0565b610549565b60405161019391906115c4565b60405180910390f35b6101b660048036038101906101b191906116a0565b610569565b6040516101c391906116dc565b60405180910390f35b6101e660048036038101906101e191906116a0565b6107ac565b6040516101f391906115c4565b60405180910390f35b610216600480360381019061021191906116a0565b61090c565b60405161022391906116dc565b60405180910390f35b61023461103a565b6040516102419190611706565b60405180910390f35b610264600480360381019061025f91906116a0565b611060565b60405161027191906115c4565b60405180910390f35b610294600480360381019061028f91906116a0565b611272565b6040516102a191906115c4565b60405180910390f35b6102b261139c565b6040516102bf91906116dc565b60405180910390f35b6102d06113ac565b6040516102dd91906116dc565b60405180910390f35b61030060048036038101906102fb91906116a0565b6113b2565b60405161030d91906116dc565b60405180910390f35b610330600480360381019061032b91906116a0565b6113b9565b005b61033a6114fb565b6040516103479190611706565b60405180910390f35b60006301ffc9a77c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916036103a4576001905061044d565b631a3ac6347c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916036103f6576001905061044d565b63abe1f1f57c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191603610448576001905061044d565b600090505b919050565b6000600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806104f95750600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b61050257600080fd5b816005819055507f748f1cf617bdc8ef4fcd1cb516dc05cedf269e8dcad82183846d57eeec4bba5e8260405161053891906116dc565b60405180910390a160019050919050565b60046020528060005260406000206000915054906101000a900460ff1681565b6000806060600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16846040516024016105b89190611706565b6040516020818303038152906040527f3ef25013000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506040516106429190611792565b6000604051808303816000865af19150503d806000811461067f576040519150601f19603f3d011682016040523d82523d6000602084013e610684565b606091505b508092508193505050816106cd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c490611806565b60405180910390fd5b60017f01000000000000000000000000000000000000000000000000000000000000000281601f8151811061070557610704611826565b5b60200101517f010000000000000000000000000000000000000000000000000000000000000090047f0100000000000000000000000000000000000000000000000000000000000000027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916036107a0577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff925050506107a7565b6000925050505b919050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16148061083557508173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b610874576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086b906118a1565b60405180910390fd5b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f9002f14780245e47491e7a2caae4712e7cea2e298e4e76c6916845145b90a51c826040516108fb9190611706565b60405180910390a160019050919050565b6000806060600073ffffffffffffffffffffffffffffffffffffffff16600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b6b57600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16846040516024016109b19190611706565b6040516020818303038152906040527f3ef25013000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051610a3b9190611792565b6000604051808303816000865af19150503d8060008114610a78576040519150601f19603f3d011682016040523d82523d6000602084013e610a7d565b606091505b50809250819350505060007f01000000000000000000000000000000000000000000000000000000000000000281601f81518110610abe57610abd611826565b5b60200101517f010000000000000000000000000000000000000000000000000000000000000090047f0100000000000000000000000000000000000000000000000000000000000000027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191603610b6a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b619061190d565b60405180910390fd5b5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1684604051602401610bb59190611706565b6040516020818303038152906040527f3ef25013000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051610c3f9190611792565b6000604051808303816000865af19150503d8060008114610c7c576040519150601f19603f3d011682016040523d82523d6000602084013e610c81565b606091505b50809250819350505060007f01000000000000000000000000000000000000000000000000000000000000000281601f81518110610cc257610cc1611826565b5b60200101517f010000000000000000000000000000000000000000000000000000000000000090047f0100000000000000000000000000000000000000000000000000000000000000027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614610d6e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d6590611979565b60405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1684604051602401610db89190611706565b6040516020818303038152906040527f0a3b0a4f000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051610e429190611792565b6000604051808303816000865af19150503d8060008114610e7f576040519150601f19603f3d011682016040523d82523d6000602084013e610e84565b606091505b50809250819350505081610ecd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ec4906119e5565b60405180910390fd5b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1684600554604051602401610f19929190611a05565b6040516020818303038152906040527fa9059cbb000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051610fa39190611792565b6000604051808303816000865af19150503d8060008114610fe0576040519150601f19603f3d011682016040523d82523d6000602084013e610fe5565b606091505b5080925081935050508161102e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161102590611a7a565b60405180910390fd5b60055492505050919050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000806060600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16846040516024016110af9190611706565b6040516020818303038152906040527f3ef25013000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506040516111399190611792565b6000604051808303816000865af19150503d8060008114611176576040519150601f19603f3d011682016040523d82523d6000602084013e61117b565b606091505b508092508193505050816111c4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111bb90611806565b60405180910390fd5b60007f01000000000000000000000000000000000000000000000000000000000000000281601f815181106111fc576111fb611826565b5b60200101517f010000000000000000000000000000000000000000000000000000000000000090047f0100000000000000000000000000000000000000000000000000000000000000027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161492505050919050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611304576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112fb906118a1565b60405180910390fd5b6001600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f6ff3aa2ea7b53070f6d9d07a445d338d89e8edef44250ffa8be19f53910d4a2e8260405161138b9190611706565b60405180910390a160019050919050565b60006113a73361090c565b905090565b60055481565b6000919050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461141557600080fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600080fd5b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b61155981611524565b811461156457600080fd5b50565b60008135905061157681611550565b92915050565b6000602082840312156115925761159161151f565b5b60006115a084828501611567565b91505092915050565b60008115159050919050565b6115be816115a9565b82525050565b60006020820190506115d960008301846115b5565b92915050565b6000819050919050565b6115f2816115df565b81146115fd57600080fd5b50565b60008135905061160f816115e9565b92915050565b60006020828403121561162b5761162a61151f565b5b600061163984828501611600565b91505092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061166d82611642565b9050919050565b61167d81611662565b811461168857600080fd5b50565b60008135905061169a81611674565b92915050565b6000602082840312156116b6576116b561151f565b5b60006116c48482850161168b565b91505092915050565b6116d6816115df565b82525050565b60006020820190506116f160008301846116cd565b92915050565b61170081611662565b82525050565b600060208201905061171b60008301846116f7565b92915050565b600081519050919050565b600081905092915050565b60005b8381101561175557808201518184015260208101905061173a565b60008484015250505050565b600061176c82611721565b611776818561172c565b9350611786818560208601611737565b80840191505092915050565b600061179e8284611761565b915081905092915050565b600082825260208201905092915050565b7f4552525f53544f52455f4641494c000000000000000000000000000000000000600082015250565b60006117f0600e836117a9565b91506117fb826117ba565b602082019050919050565b6000602082019050818103600083015261181f816117e3565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4552525f41585800000000000000000000000000000000000000000000000000600082015250565b600061188b6007836117a9565b915061189682611855565b602082019050919050565b600060208201905081810360008301526118ba8161187e565b9050919050565b7f4552525f4143434f554e545f4e4f545f494e5f494e4445580000000000000000600082015250565b60006118f76018836117a9565b9150611902826118c1565b602082019050919050565b60006020820190508181036000830152611926816118ea565b9050919050565b7f4552525f4143434f554e545f5553454400000000000000000000000000000000600082015250565b60006119636010836117a9565b915061196e8261192d565b602082019050919050565b6000602082019050818103600083015261199281611956565b9050919050565b7f4552525f4d41524b5f4641494c00000000000000000000000000000000000000600082015250565b60006119cf600d836117a9565b91506119da82611999565b602082019050919050565b600060208201905081810360008301526119fe816119c2565b9050919050565b6000604082019050611a1a60008301856116f7565b611a2760208301846116cd565b9392505050565b7f4552525f5452414e534645520000000000000000000000000000000000000000600082015250565b6000611a64600c836117a9565b9150611a6f82611a2e565b602082019050919050565b60006020820190508181036000830152611a9381611a57565b905091905056fea2646970667358221220e63c02068a62cee47a1f7e20ef5b199cf92fe07b1297c454e08c57611526763764736f6c63430008120033 +\ No newline at end of file diff --git a/python/erc20_faucet/data/ERC20Faucet.json b/python/erc20_faucet/data/ERC20Faucet.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":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":[{"internalType":"address","name":"_writer","type":"address"}],"name":"addWriter","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","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":"_writer","type":"address"}],"name":"deleteWriter","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"gimme","outputs":[{"internalType":"bool","name":"","type":"bool"}],"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":[{"internalType":"bytes4","name":"_sum","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"token","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokenAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}] +[{"inputs":[{"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":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_account","type":"address"}],"name":"WriterAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_account","type":"address"}],"name":"WriterDeleted","type":"event"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"addWriter","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_recipient","type":"address"}],"name":"check","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"deleteWriter","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"gimme","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_recipient","type":"address"}],"name":"giveTo","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isWriter","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_recipient","type":"address"}],"name":"nextBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"_recipient","type":"address"}],"name":"nextTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"setAmount","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"_sum","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"token","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokenAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}] diff --git a/python/erc20_faucet/data/ERC20FaucetStorage.bin b/python/erc20_faucet/data/ERC20FaucetStorage.bin @@ -1 +1 @@ -608060405234801561001057600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600360009080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600260008073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610922806101096000396000f3fe608060405234801561001057600080fd5b50600436106100a5576000357c01000000000000000000000000000000000000000000000000000000009004806379ba50971161007857806379ba50971461016a5780638da5cb5b14610188578063e2095c07146101a6578063f2fde38b146101d6576100a5565b806301ffc9a7146100aa5780630a3b0a4f146100da5780633ef250131461010a578063764b07e71461013a575b600080fd5b6100c460048036038101906100bf9190610747565b6101f2565b6040516100d1919061078f565b60405180910390f35b6100f460048036038101906100ef9190610808565b610346565b604051610101919061078f565b60405180910390f35b610124600480360381019061011f9190610808565b610446565b604051610131919061078f565b60405180910390f35b610154600480360381019061014f9190610808565b610491565b604051610161919061084e565b60405180910390f35b6101726104a9565b60405161017f919061078f565b60405180910390f35b6101906105eb565b60405161019d9190610878565b60405180910390f35b6101c060048036038101906101bb91906108bf565b61060f565b6040516101cd9190610878565b60405180910390f35b6101f060048036038101906101eb9190610808565b61064e565b005b600063cbdb05c77c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916036102465760019050610341565b6301ffc9a77c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916036102985760019050610341565b639493f8b27c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916036102ea5760019050610341565b6337a47be47c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19160361033c5760019050610341565b600090505b919050565b60008060038054905090506003839080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550808373ffffffffffffffffffffffffffffffffffffffff167f9cc987676e7d63379f176ea50df0ae8d2d9d1141d1231d4ce15b5965f73c943060405160405180910390a36001915050919050565b600080600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054119050919050565b60026020528060005260406000206000915090505481565b60008060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461052957600080fd5b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3600191505090565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6003818154811061061f57600080fd5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146106a657600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600080fd5b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b610724816106ef565b811461072f57600080fd5b50565b6000813590506107418161071b565b92915050565b60006020828403121561075d5761075c6106ea565b5b600061076b84828501610732565b91505092915050565b60008115159050919050565b61078981610774565b82525050565b60006020820190506107a46000830184610780565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006107d5826107aa565b9050919050565b6107e5816107ca565b81146107f057600080fd5b50565b600081359050610802816107dc565b92915050565b60006020828403121561081e5761081d6106ea565b5b600061082c848285016107f3565b91505092915050565b6000819050919050565b61084881610835565b82525050565b6000602082019050610863600083018461083f565b92915050565b610872816107ca565b82525050565b600060208201905061088d6000830184610869565b92915050565b61089c81610835565b81146108a757600080fd5b50565b6000813590506108b981610893565b92915050565b6000602082840312156108d5576108d46106ea565b5b60006108e3848285016108aa565b9150509291505056fea264697066735822122058651532266d933ce352b8a859b17bd5b5469759371648eec2c17de5e4c3f95564736f6c63430008120033 -\ No newline at end of file +608060405234801561001057600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600360009080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506001600260008073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506108e1806101096000396000f3fe608060405234801561001057600080fd5b506004361061009a576000357c0100000000000000000000000000000000000000000000000000000000900480633ef25013116100785780633ef250131461011d5780638da5cb5b1461014d578063e2095c071461016b578063f2fde38b1461019b5761009a565b806301ffc9a71461009f5780630a3b0a4f146100cf57806316ada547146100ff575b600080fd5b6100b960048036038101906100b49190610689565b6101b7565b6040516100c691906106d1565b60405180910390f35b6100e960048036038101906100e4919061074a565b6102b9565b6040516100f691906106d1565b60405180910390f35b61010761043d565b6040516101149190610790565b60405180910390f35b6101376004803603810190610132919061074a565b610442565b60405161014491906106d1565b60405180910390f35b61015561048d565b60405161016291906107ba565b60405180910390f35b61018560048036038101906101809190610801565b6104b1565b60405161019291906107ba565b60405180910390f35b6101b560048036038101906101b0919061074a565b6104f0565b005b600063b7bca6257c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19160361020b57600190506102b4565b6301ffc9a77c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19160361025d57600190506102b4565b639493f8b27c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916036102af57600190506102b4565b600090505b919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461034a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103419061088b565b60405180910390fd5b600060038054905090506003839080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550807fedec6416a94b784dc98025e70b146d8d8628117664f0da05822fc95132bc4f588460405161042b91906107ba565b60405180910390a26001915050919050565b600081565b600080600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054119050919050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600381815481106104c157600080fd5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461054b57600080fd5b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600080fd5b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b61066681610631565b811461067157600080fd5b50565b6000813590506106838161065d565b92915050565b60006020828403121561069f5761069e61062c565b5b60006106ad84828501610674565b91505092915050565b60008115159050919050565b6106cb816106b6565b82525050565b60006020820190506106e660008301846106c2565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610717826106ec565b9050919050565b6107278161070c565b811461073257600080fd5b50565b6000813590506107448161071e565b92915050565b6000602082840312156107605761075f61062c565b5b600061076e84828501610735565b91505092915050565b6000819050919050565b61078a81610777565b82525050565b60006020820190506107a56000830184610781565b92915050565b6107b48161070c565b82525050565b60006020820190506107cf60008301846107ab565b92915050565b6107de81610777565b81146107e957600080fd5b50565b6000813590506107fb816107d5565b92915050565b6000602082840312156108175761081661062c565b5b6000610825848285016107ec565b91505092915050565b600082825260208201905092915050565b7f4552525f41585800000000000000000000000000000000000000000000000000600082015250565b600061087560078361082e565b91506108808261083f565b602082019050919050565b600060208201905081810360008301526108a481610868565b905091905056fea2646970667358221220da1d1f57ec9fe8363c1afe8ebbf7527e74b26a1febd8024d5d5bf9a3b5df61ae64736f6c63430008120033 +\ No newline at end of file diff --git a/python/erc20_faucet/data/ERC20FaucetStorage.json b/python/erc20_faucet/data/ERC20FaucetStorage.json @@ -1 +1 @@ -[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"addedAccount","type":"address"},{"indexed":true,"internalType":"uint256","name":"accountIndex","type":"uint256"}],"name":"AddressAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[],"name":"acceptOwnership","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"add","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"entry","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"have","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"_sum","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"_newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"usedAccounts","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}] +[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"accountIndex","type":"uint256"},{"indexed":false,"internalType":"address","name":"_account","type":"address"}],"name":"AddressAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"add","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"entry","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"have","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"_sum","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"time","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}] diff --git a/python/erc20_faucet/faucet.py b/python/erc20_faucet/faucet.py @@ -79,18 +79,14 @@ class SingleShotFaucet(Faucet): # TODO: allow multiple overriders - def constructor(self, sender_address, token, store, accounts_index, overrider): + def constructor(self, sender_address, token, store, accounts_index): if accounts_index == None: accounts_index = ZERO_ADDRESS code = SingleShotFaucet.bytecode() enc = ABIContractEncoder() - enc.uint256(0x80) enc.address(token) enc.address(store) enc.address(accounts_index) - enc.uint256(len(overrider)) - for r in overrider: - enc.address(r) code += enc.get() tx = self.template(sender_address, None, use_nonce=True) tx = self.set_code(tx, code) diff --git a/python/setup.cfg b/python/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = erc20-faucet -version = 0.7.1 +version = 0.8.0 description = ERC20 token faucet author = Louis Holbrook author_email = dev@holbrook.no diff --git a/python/test_requirements.txt b/python/test_requirements.txt @@ -1,3 +1,4 @@ eth_tester==0.5.0b3 py-evm==0.3.0a20 eth-erc20~=0.6.1 +eth-owned==0.0.6 diff --git a/python/tests/test_basic.py b/python/tests/test_basic.py @@ -26,6 +26,7 @@ from giftable_erc20_token import GiftableToken # local imports from erc20_faucet import Faucet from erc20_faucet.faucet import SingleShotFaucet +from eth_owned import ERC173 logging.basicConfig(level=logging.DEBUG) logg = logging.getLogger() @@ -40,28 +41,28 @@ class TestFaucet(EthTesterCase): c = SingleShotFaucet(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle) (tx_hash, o) = c.store_constructor(self.accounts[0]) r = self.conn.do(o) - logg.debug('store deployed with hash {}'.format(r)) - + logg.debug('store published with hash {}'.format(r)) + o = receipt(r) r = self.conn.do(o) self.assertEqual(r['status'], 1) self.store_address = to_checksum_address(r['contract_address']) logg.debug('store contract {}'.format(self.store_address)) + ct = GiftableToken(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle) (tx_hash_hex, o) = ct.constructor(self.accounts[0], 'Foo Token', 'FOO', 6) r = self.conn.do(o) - logg.debug('token deployed with hash {}'.format(r)) + logg.debug('token published with hash {}'.format(r)) o = receipt(r) r = self.conn.do(o) self.token_address = to_checksum_address(r['contract_address']) logg.debug('token contract {}'.format(self.store_address)) - (tx_hash, o) = c.constructor(self.accounts[0], self.token_address, self.store_address, ZERO_ADDRESS, [self.accounts[1]]) + (tx_hash, o) = c.constructor(self.accounts[0], self.token_address, self.store_address, ZERO_ADDRESS) r = self.conn.do(o) - logg.debug('faucet deployed with hash {}'.format(r)) - + logg.debug('faucet published with hash {}'.format(r)) o = receipt(r) r = self.conn.do(o) self.assertEqual(r['status'], 1) @@ -69,6 +70,13 @@ class TestFaucet(EthTesterCase): self.address = to_checksum_address(r['contract_address']) logg.debug('faucet contract {}'.format(self.address)) + c_owned = ERC173(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle) + (tx_hash, o) = c_owned.transfer_ownership(self.store_address, self.accounts[0], self.address) + r = self.conn.do(o) + o = receipt(r) + r = self.conn.do(o) + self.assertEqual(r['status'], 1) + def test_basic(self): nonce_oracle = RPCNonceOracle(self.accounts[0], self.conn) diff --git a/solidity/ERC20Faucet.sol b/solidity/ERC20Faucet.sol @@ -1,46 +1,67 @@ -pragma solidity >0.6.11; +pragma solidity >=0.8.0; -// SPDX-License-Identifier: GPL-3.0-or-later +// SPDX-License-Identifier: AGPL-3.0-or-later contract SingleShotFaucet { - - address owner; - mapping( address => bool) overriders; // TODO replace with writers - uint256 amount; - address public token; // Faucet + address public token; address store; address accountsIndex; - mapping(address => bool) writers; - uint256 cooldownDisabled; + uint256 constant cooldownDisabled = uint256(0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff); + + // Implements ERC173 + address public owner; + + // Implements Writer + mapping( address => bool) public isWriter; + + // Implements Faucet + uint256 public tokenAmount; - event FaucetUsed(address indexed _recipient, address indexed _token, uint256 _value); - event FaucetFail(address indexed _recipient, address indexed _token, uint256 _value); + // Implements Faucet event FaucetAmountChange(uint256 _value); - constructor(address[] memory _overriders, address _token, address _store, address _accountsIndex) { + // Implements Writer + event WriterAdded(address _account); + + // Implements Writer + event WriterDeleted(address _account); + + // Implements EIP 173 + event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); + + constructor(address _token, address _store, address _accountsIndex) { owner = msg.sender; - overriders[msg.sender] = true; - for (uint i = 0; i < _overriders.length; i++) { - overriders[_overriders[i]] = true; - } store = _store; token = _token; accountsIndex = _accountsIndex; - cooldownDisabled = uint256(0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff); } - // Implements Faucet + // Implements Writer + function addWriter(address _address) public returns(bool) { + require(msg.sender == owner, 'ERR_AXX'); + isWriter[_address] = true; + emit WriterAdded(_address); + return true; + } + + // Implements Writer + function deleteWriter(address _address) public returns(bool) { + require(msg.sender == owner || msg.sender == _address, 'ERR_AXX'); + isWriter[_address] = false; + emit WriterDeleted(_address); + return true; + } + + // Change faucet amount function setAmount(uint256 _amount) public returns (bool) { - require(overriders[msg.sender]); - amount = _amount; + require(isWriter[msg.sender] || msg.sender == owner); + tokenAmount = _amount; emit FaucetAmountChange(_amount); return true; } // Implements Faucet - function giveTo(address _recipient) public returns (bool) { - require(!overriders[_recipient], 'ERR_ACCESS'); - + function giveTo(address _recipient) public returns (uint256) { bool _ok; bytes memory _result; @@ -51,28 +72,37 @@ contract SingleShotFaucet { (_ok, _result) = store.call(abi.encodeWithSignature("have(address)", _recipient)); - require(_result[31] == 0, 'ERR_ACCOUNT_USED'); // less conversion than: // require(abi.decode(_result, (bool)) == false, 'ERR_ACCOUNT_USED'); - - //(_ok, _result) = store.call(abi.encodeWithSignature("lock(address)", _recipient)); + require(_result[31] == 0, 'ERR_ACCOUNT_USED'); (_ok, _result) = store.call(abi.encodeWithSignature("add(address)", _recipient)); require(_ok, 'ERR_MARK_FAIL'); - (_ok, _result) = token.call(abi.encodeWithSignature("transfer(address,uint256)", _recipient, amount)); + (_ok, _result) = token.call(abi.encodeWithSignature("transfer(address,uint256)", _recipient, tokenAmount)); if (!_ok) { - emit FaucetFail(_recipient, token, amount); revert('ERR_TRANSFER'); } - emit FaucetUsed(_recipient, token, amount); - return true; + return tokenAmount; } - function gimme() public returns (bool) { + // Implements Faucet + function gimme() public returns (uint256) { return giveTo(msg.sender); } // Implements Faucet - function cooldown(address _recipient) public returns (uint256) { + function check(address _recipient) public returns (bool) { + bool _ok; + bytes memory _result; + + (_ok, _result) = store.call(abi.encodeWithSignature("have(address)", _recipient)); + + require(_ok, 'ERR_STORE_FAIL'); + + return _result[31] == 0x00; + } + + // Implements Faucet + function nextTime(address _recipient) public returns (uint256) { bool _ok; bytes memory _result; @@ -82,39 +112,37 @@ contract SingleShotFaucet { if (_result[31] == 0x01) { return cooldownDisabled; - } else { - return 0; } + + return 0; } // Implements Faucet - function tokenAmount() public view returns (uint256) { - return amount; + function nextBalance(address _recipient) public pure returns (uint256) { + _recipient; + return 0; } - // Implements Writer - function addWriter(address _writer) public returns (bool) { - require(owner == msg.sender); - writers[_writer] = true; - return true; - } + // Implements EIP 173 + function transferOwnership(address _newOwner) external { + address _oldOwner; - // Implements Writer - function deleteWriter(address _writer) public returns (bool) { - require(owner == msg.sender); - delete writers[_writer]; - return true; + require(msg.sender == owner); + _oldOwner = owner; + + owner = _newOwner; + + emit OwnershipTransferred(_oldOwner, owner); } - // Implements EIP165 function supportsInterface(bytes4 _sum) public pure returns (bool) { if (_sum == 0x01ffc9a7) { // EIP165 return true; } - if (_sum == 0xde344547) { // Faucet + if (_sum == 0x1a3ac634) { // Faucet return true; } - if (_sum == 0x80c84bd6) { // Writer + if (_sum == 0xabe1f1f5) { // Writer return true; } return false; diff --git a/solidity/ERC20FaucetStorage.sol b/solidity/ERC20FaucetStorage.sol @@ -1,39 +1,40 @@ -pragma solidity >0.6.11; +pragma solidity >=0.8.0; -// SPDX-License-Identifier: GPL-3.0-or-later +// SPDX-License-Identifier: AGPL-3.0-or-later contract SingleShotFaucetStorage { // Implements EIP 173 address public owner; address newOwner; - //mapping (address => bool) public usedAccounts; - mapping (address => uint256) public usedAccounts; + mapping (address => uint256) usedAccounts; address[] public entry; // Implements EIP 173 event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); - event AddressAdded(address indexed addedAccount, uint256 indexed accountIndex); // AccountsIndex + + // Implements AccountsIndex + event AddressAdded(uint256 indexed accountIndex, address _account); // AccountsIndex + + // Implements AccountsIndex + uint256 constant public time = 0; constructor() { owner = msg.sender; entry.push(address(0)); - usedAccounts[address(0)] = 0; + usedAccounts[address(0)] = 1; } // Implements EIP 173 function transferOwnership(address _newOwner) external { + address _oldOwner; + require(msg.sender == owner); - newOwner = _newOwner; - } + _oldOwner = owner; - // Implements OwnedAccepter - function acceptOwnership() external returns (bool) { - address previousOwner = owner; - require(msg.sender == newOwner); - owner = msg.sender; - emit OwnershipTransferred(previousOwner, owner); - return true; + owner = _newOwner; + + emit OwnershipTransferred(_oldOwner, owner); } // Implements AccountsIndex @@ -43,18 +44,20 @@ contract SingleShotFaucetStorage { // Implements AccountsIndex function add(address _account) external returns (bool) { + require(msg.sender == owner, 'ERR_AXX'); + uint256 l; l = entry.length; entry.push(_account); usedAccounts[_account] = l; - emit AddressAdded(_account, l); + emit AddressAdded(l, _account); return true; } // Implements EIP165 function supportsInterface(bytes4 _sum) public pure returns (bool) { - if (_sum == 0xcbdb05c7) { // AccountsIndex + if (_sum == 0xb7bca625) { // AccountsIndex return true; } if (_sum == 0x01ffc9a7) { // EIP165 @@ -63,9 +66,6 @@ contract SingleShotFaucetStorage { if (_sum == 0x9493f8b2) { // EIP173 return true; } - if (_sum == 0x37a47be4) { // OwnedAccepter - return true; - } return false; } }