eth-faucet

Gas token gifter with controls from time intervals, amounts and access
Log | Files | Refs | README

commit 524d88a0c64c9843cdb2ab72d06d2c6995c38703
parent c65bcb00599c975bf2332fd3ab1c730da1ed1518
Author: lash <dev@holbrook.no>
Date:   Fri, 17 Mar 2023 22:06:30 +0000

WIP implement non statechange check

Diffstat:
Mpython/eth_faucet/data/EthFaucet.bin | 4++--
Mpython/eth_faucet/data/EthFaucet.json | 2+-
Mpython/eth_faucet/data/PeriodSimple.bin | 4++--
Mpython/eth_faucet/data/PeriodSimple.json | 2+-
Mpython/eth_faucet/faucet.py | 19+++++++++++++++++++
Mpython/setup.cfg | 2+-
Mpython/tests/test_period.py | 5++---
Mpython/tests/test_registry.py | 8++++++++
Msolidity/EthFaucet.sol | 37+++++++++++++++++++++----------------
9 files changed, 57 insertions(+), 26 deletions(-)

diff --git a/python/eth_faucet/data/EthFaucet.bin b/python/eth_faucet/data/EthFaucet.bin @@ -1 +1 @@ -608060405234801561001057600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550611a56806100606000396000f3fe6080604052600436106100c8576000357c0100000000000000000000000000000000000000000000000000000000900480638da5cb5b116100815780638da5cb5b1461020c578063a91ee0dc14610237578063aa8c217c14610260578063cb10d59a1461028b578063d6eca01e146102b6578063de82efb4146102df576100cf565b806318cbbcfc146100d4578063271f88b4146100ff57806331a5995d1461013c57806363e4bff4146101675780637b103999146101a457806386fe212d146101cf576100cf565b366100cf57005b600080fd5b3480156100e057600080fd5b506100e961030a565b6040516100f691906113c9565b60405180910390f35b34801561010b57600080fd5b5061012660048036038101906101219190611415565b61030f565b60405161013391906113c9565b60405180910390f35b34801561014857600080fd5b50610151610435565b60405161015e91906113c9565b60405180910390f35b34801561017357600080fd5b5061018e600480360381019061018991906114a0565b61043b565b60405161019b91906113c9565b60405180910390f35b3480156101b057600080fd5b506101b96104a2565b6040516101c691906114dc565b60405180910390f35b3480156101db57600080fd5b506101f660048036038101906101f19190611415565b6104c8565b60405161020391906113c9565b60405180910390f35b34801561021857600080fd5b506102216105ee565b60405161022e91906114dc565b60405180910390f35b34801561024357600080fd5b5061025e600480360381019061025991906114a0565b610612565b005b34801561026c57600080fd5b506102756107af565b60405161028291906113c9565b60405180910390f35b34801561029757600080fd5b506102a06107b5565b6040516102ad91906114dc565b60405180910390f35b3480156102c257600080fd5b506102dd60048036038101906102d891906114a0565b6107db565b005b3480156102eb57600080fd5b506102f4610978565b60405161030191906113c9565b60405180910390f35b600781565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146103a0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161039790611554565b60405180910390fd5b6000600460ff1660035416146103eb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103e2906115c0565b60405180910390fd5b816004819055507f748f1cf617bdc8ef4fcd1cb516dc05cedf269e8dcad82183846d57eeec4bba5e60045460405161042391906113c9565b60405180910390a16004549050919050565b60035481565b6000610446826109dd565b61044f57600080fd5b8173ffffffffffffffffffffffffffffffffffffffff166108fc6004549081150290604051600060405180830381858888f19350505050158015610497573d6000803e3d6000fd5b506004549050919050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60006008821061050d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105049061162c565b60405180910390fd5b6000600354831614610554576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161054b90611698565b60405180910390fd5b816003600082825417925050819055506003547fe4b3d0535ec4cfd7bbe7b41fc94f6ee6bd15e97724854e3c3db2beb336d23a95600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040516105dc9291906116b8565b60405180910390a26003549050919050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146106a0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161069790611554565b60405180910390fd5b6000600160ff1660035416146106eb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106e2906115c0565b60405180910390fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506003547fe4b3d0535ec4cfd7bbe7b41fc94f6ee6bd15e97724854e3c3db2beb336d23a95600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040516107a49291906116b8565b60405180910390a250565b60045481565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610869576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086090611554565b60405180910390fd5b6000600260ff1660035416146108b4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108ab906115c0565b60405180910390fd5b80600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506003547fe4b3d0535ec4cfd7bbe7b41fc94f6ee6bd15e97724854e3c3db2beb336d23a95600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660405161096d9291906116b8565b60405180910390a250565b6000610983336109dd565b61098c57600080fd5b3373ffffffffffffffffffffffffffffffffffffffff166108fc6004549081150290604051600060405180830381858888f193505050501580156109d4573d6000803e3d6000fd5b50600454905090565b60008073ffffffffffffffffffffffffffffffffffffffff16600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a3f57610a3d82610ab1565b505b600073ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610aa057610a9e82610f9b565b505b610aa8611326565b60019050919050565b6000806060600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1684604051602401610b0091906114dc565b6040516020818303038152906040527fc23697a8000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051610b8a9190611752565b6000604051808303816000865af19150503d8060008114610bc7576040519150601f19603f3d011682016040523d82523d6000602084013e610bcc565b606091505b50809250819350505081610c7d57600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f2a56a00a5c532c49314f19361f71cdca8a5d10fdcb42c3fa52800d13419d6070600454604051610c3a91906113c9565b60405180910390a36040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c74906117b5565b60405180910390fd5b60007f01000000000000000000000000000000000000000000000000000000000000000281601f81518110610cb557610cb46117d5565b5b60200101517f010000000000000000000000000000000000000000000000000000000000000090047f0100000000000000000000000000000000000000000000000000000000000000027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191603610dc957600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f2a56a00a5c532c49314f19361f71cdca8a5d10fdcb42c3fa52800d13419d6070600454604051610d8691906113c9565b60405180910390a36040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610dc090611850565b60405180910390fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1684604051602401610e1391906114dc565b6040516020818303038152906040527fb1a997ac000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051610e9d9190611752565b6000604051808303816000865af19150503d8060008114610eda576040519150601f19603f3d011682016040523d82523d6000602084013e610edf565b606091505b50809250819350505081610f9057600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f2a56a00a5c532c49314f19361f71cdca8a5d10fdcb42c3fa52800d13419d6070600454604051610f4d91906113c9565b60405180910390a36040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f87906118bc565b60405180910390fd5b600192505050919050565b6000806060600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1684604051602401610fea91906114dc565b6040516020818303038152906040527f3ef25013000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506040516110749190611752565b6000604051808303816000865af19150503d80600081146110b1576040519150601f19603f3d011682016040523d82523d6000602084013e6110b6565b606091505b5080925081935050508161116757600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f2a56a00a5c532c49314f19361f71cdca8a5d10fdcb42c3fa52800d13419d607060045460405161112491906113c9565b60405180910390a36040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115e90611928565b60405180910390fd5b60007f01000000000000000000000000000000000000000000000000000000000000000281601f8151811061119f5761119e6117d5565b5b60200101517f010000000000000000000000000000000000000000000000000000000000000090047f0100000000000000000000000000000000000000000000000000000000000000027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916036112b357600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f2a56a00a5c532c49314f19361f71cdca8a5d10fdcb42c3fa52800d13419d607060045460405161127091906113c9565b60405180910390a36040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112aa90611994565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f45c201a59ac545000ead84f30b2db67da23353aa1d58ac522c48505412143ffa60045460405161131391906113c9565b60405180910390a3600192505050919050565b3073ffffffffffffffffffffffffffffffffffffffff163160045411156113ae577fd5fc280270ad7a4858a11280d5228b85502cacf121cc91fd35436bed31bb659c60405160405180910390a16040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113a590611a00565b60405180910390fd5b565b6000819050919050565b6113c3816113b0565b82525050565b60006020820190506113de60008301846113ba565b92915050565b600080fd5b6113f2816113b0565b81146113fd57600080fd5b50565b60008135905061140f816113e9565b92915050565b60006020828403121561142b5761142a6113e4565b5b600061143984828501611400565b91505092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061146d82611442565b9050919050565b61147d81611462565b811461148857600080fd5b50565b60008135905061149a81611474565b92915050565b6000602082840312156114b6576114b56113e4565b5b60006114c48482850161148b565b91505092915050565b6114d681611462565b82525050565b60006020820190506114f160008301846114cd565b92915050565b600082825260208201905092915050565b7f4552525f4e4f545f4f574e455200000000000000000000000000000000000000600082015250565b600061153e600d836114f7565b915061154982611508565b602082019050919050565b6000602082019050818103600083015261156d81611531565b9050919050565b7f4552525f5345414c454400000000000000000000000000000000000000000000600082015250565b60006115aa600a836114f7565b91506115b582611574565b602082019050919050565b600060208201905081810360008301526115d98161159d565b9050919050565b7f4552525f494e56414c49445f5354415445000000000000000000000000000000600082015250565b60006116166011836114f7565b9150611621826115e0565b602082019050919050565b6000602082019050818103600083015261164581611609565b9050919050565b7f4552525f414c52454144595f4c4f434b45440000000000000000000000000000600082015250565b60006116826012836114f7565b915061168d8261164c565b602082019050919050565b600060208201905081810360008301526116b181611675565b9050919050565b60006040820190506116cd60008301856114cd565b6116da60208301846114cd565b9392505050565b600081519050919050565b600081905092915050565b60005b838110156117155780820151818401526020810190506116fa565b60008484015250505050565b600061172c826116e1565b61173681856116ec565b93506117468185602086016116f7565b80840191505092915050565b600061175e8284611721565b915081905092915050565b7f4552525f504552494f445f4241434b454e445f4552524f520000000000000000600082015250565b600061179f6018836114f7565b91506117aa82611769565b602082019050919050565b600060208201905081810360008301526117ce81611792565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4552525f504552494f445f434845434b00000000000000000000000000000000600082015250565b600061183a6010836114f7565b915061184582611804565b602082019050919050565b600060208201905081810360008301526118698161182d565b9050919050565b7f4552525f52454749535452595f4241434b454e445f4552524f52000000000000600082015250565b60006118a6601a836114f7565b91506118b182611870565b602082019050919050565b600060208201905081810360008301526118d581611899565b9050919050565b7f4552525f5452414e534645520000000000000000000000000000000000000000600082015250565b6000611912600c836114f7565b915061191d826118dc565b602082019050919050565b6000602082019050818103600083015261194181611905565b9050919050565b7f4552525f52454749535452595f434845434b0000000000000000000000000000600082015250565b600061197e6012836114f7565b915061198982611948565b602082019050919050565b600060208201905081810360008301526119ad81611971565b9050919050565b7f4552525f4954534e4f5441474153000000000000000000000000000000000000600082015250565b60006119ea600e836114f7565b91506119f5826119b4565b602082019050919050565b60006020820190508181036000830152611a19816119dd565b905091905056fea26469706673582212204b38810c2c4b5bced9020cf10279d8df5bfb76187bead441eaff390edb1cbdd964736f6c63430008110033 -\ No newline at end of file +608060405234801561001057600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550611cb6806100606000396000f3fe6080604052600436106100e3576000357c0100000000000000000000000000000000000000000000000000000000900480638da5cb5b1161009c578063c23697a811610076578063c23697a8146102a6578063cb10d59a146102e3578063d6eca01e1461030e578063de82efb414610337576100ea565b80638da5cb5b14610227578063a91ee0dc14610252578063aa8c217c1461027b576100ea565b806318cbbcfc146100ef578063271f88b41461011a57806331a5995d1461015757806363e4bff4146101825780637b103999146101bf57806386fe212d146101ea576100ea565b366100ea57005b600080fd5b3480156100fb57600080fd5b50610104610362565b60405161011191906115f3565b60405180910390f35b34801561012657600080fd5b50610141600480360381019061013c919061163f565b610367565b60405161014e91906115f3565b60405180910390f35b34801561016357600080fd5b5061016c61048d565b60405161017991906115f3565b60405180910390f35b34801561018e57600080fd5b506101a960048036038101906101a491906116ca565b610493565b6040516101b691906115f3565b60405180910390f35b3480156101cb57600080fd5b506101d46104fa565b6040516101e19190611706565b60405180910390f35b3480156101f657600080fd5b50610211600480360381019061020c919061163f565b610520565b60405161021e91906115f3565b60405180910390f35b34801561023357600080fd5b5061023c610646565b6040516102499190611706565b60405180910390f35b34801561025e57600080fd5b50610279600480360381019061027491906116ca565b61066a565b005b34801561028757600080fd5b50610290610807565b60405161029d91906115f3565b60405180910390f35b3480156102b257600080fd5b506102cd60048036038101906102c891906116ca565b61080d565b6040516102da919061173c565b60405180910390f35b3480156102ef57600080fd5b506102f86109df565b6040516103059190611706565b60405180910390f35b34801561031a57600080fd5b50610335600480360381019061033091906116ca565b610a05565b005b34801561034357600080fd5b5061034c610ba2565b60405161035991906115f3565b60405180910390f35b600781565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146103f8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103ef906117b4565b60405180910390fd5b6000600460ff166003541614610443576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161043a90611820565b60405180910390fd5b816004819055507f748f1cf617bdc8ef4fcd1cb516dc05cedf269e8dcad82183846d57eeec4bba5e60045460405161047b91906115f3565b60405180910390a16004549050919050565b60035481565b600061049e82610c07565b6104a757600080fd5b8173ffffffffffffffffffffffffffffffffffffffff166108fc6004549081150290604051600060405180830381858888f193505050501580156104ef573d6000803e3d6000fd5b506004549050919050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600060088210610565576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161055c9061188c565b60405180910390fd5b60006003548316146105ac576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105a3906118f8565b60405180910390fd5b816003600082825417925050819055506003547fe4b3d0535ec4cfd7bbe7b41fc94f6ee6bd15e97724854e3c3db2beb336d23a95600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16604051610634929190611918565b60405180910390a26003549050919050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146106f8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106ef906117b4565b60405180910390fd5b6000600160ff166003541614610743576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161073a90611820565b60405180910390fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506003547fe4b3d0535ec4cfd7bbe7b41fc94f6ee6bd15e97724854e3c3db2beb336d23a95600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040516107fc929190611918565b60405180910390a250565b60045481565b6000806060600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168460405160240161085c9190611706565b6040516020818303038152906040527f3ef25013000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506040516108e691906119b2565b6000604051808303816000865af19150503d8060008114610923576040519150601f19603f3d011682016040523d82523d6000602084013e610928565b606091505b50809250819350505060007f01000000000000000000000000000000000000000000000000000000000000000281601f81518110610969576109686119c9565b5b60200101517f010000000000000000000000000000000000000000000000000000000000000090047f0100000000000000000000000000000000000000000000000000000000000000027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161492505050919050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610a93576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a8a906117b4565b60405180910390fd5b6000600260ff166003541614610ade576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ad590611820565b60405180910390fd5b80600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506003547fe4b3d0535ec4cfd7bbe7b41fc94f6ee6bd15e97724854e3c3db2beb336d23a95600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16604051610b97929190611918565b60405180910390a250565b6000610bad33610c07565b610bb657600080fd5b3373ffffffffffffffffffffffffffffffffffffffff166108fc6004549081150290604051600060405180830381858888f19350505050158015610bfe573d6000803e3d6000fd5b50600454905090565b60008073ffffffffffffffffffffffffffffffffffffffff16600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c6957610c6782610cdb565b505b600073ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610cca57610cc8826111c5565b505b610cd2611550565b60019050919050565b6000806060600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1684604051602401610d2a9190611706565b6040516020818303038152906040527fc23697a8000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051610db491906119b2565b6000604051808303816000865af19150503d8060008114610df1576040519150601f19603f3d011682016040523d82523d6000602084013e610df6565b606091505b50809250819350505081610ea757600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f2a56a00a5c532c49314f19361f71cdca8a5d10fdcb42c3fa52800d13419d6070600454604051610e6491906115f3565b60405180910390a36040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e9e90611a44565b60405180910390fd5b60007f01000000000000000000000000000000000000000000000000000000000000000281601f81518110610edf57610ede6119c9565b5b60200101517f010000000000000000000000000000000000000000000000000000000000000090047f0100000000000000000000000000000000000000000000000000000000000000027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191603610ff357600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f2a56a00a5c532c49314f19361f71cdca8a5d10fdcb42c3fa52800d13419d6070600454604051610fb091906115f3565b60405180910390a36040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fea90611ab0565b60405180910390fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168460405160240161103d9190611706565b6040516020818303038152906040527fb1a997ac000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506040516110c791906119b2565b6000604051808303816000865af19150503d8060008114611104576040519150601f19603f3d011682016040523d82523d6000602084013e611109565b606091505b508092508193505050816111ba57600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f2a56a00a5c532c49314f19361f71cdca8a5d10fdcb42c3fa52800d13419d607060045460405161117791906115f3565b60405180910390a36040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111b190611b1c565b60405180910390fd5b600192505050919050565b6000806060600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16846040516024016112149190611706565b6040516020818303038152906040527f3ef25013000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505060405161129e91906119b2565b6000604051808303816000865af19150503d80600081146112db576040519150601f19603f3d011682016040523d82523d6000602084013e6112e0565b606091505b5080925081935050508161139157600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f2a56a00a5c532c49314f19361f71cdca8a5d10fdcb42c3fa52800d13419d607060045460405161134e91906115f3565b60405180910390a36040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138890611b88565b60405180910390fd5b60007f01000000000000000000000000000000000000000000000000000000000000000281601f815181106113c9576113c86119c9565b5b60200101517f010000000000000000000000000000000000000000000000000000000000000090047f0100000000000000000000000000000000000000000000000000000000000000027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916036114dd57600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f2a56a00a5c532c49314f19361f71cdca8a5d10fdcb42c3fa52800d13419d607060045460405161149a91906115f3565b60405180910390a36040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114d490611bf4565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f45c201a59ac545000ead84f30b2db67da23353aa1d58ac522c48505412143ffa60045460405161153d91906115f3565b60405180910390a3600192505050919050565b3073ffffffffffffffffffffffffffffffffffffffff163160045411156115d8577fd5fc280270ad7a4858a11280d5228b85502cacf121cc91fd35436bed31bb659c60405160405180910390a16040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115cf90611c60565b60405180910390fd5b565b6000819050919050565b6115ed816115da565b82525050565b600060208201905061160860008301846115e4565b92915050565b600080fd5b61161c816115da565b811461162757600080fd5b50565b60008135905061163981611613565b92915050565b6000602082840312156116555761165461160e565b5b60006116638482850161162a565b91505092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006116978261166c565b9050919050565b6116a78161168c565b81146116b257600080fd5b50565b6000813590506116c48161169e565b92915050565b6000602082840312156116e0576116df61160e565b5b60006116ee848285016116b5565b91505092915050565b6117008161168c565b82525050565b600060208201905061171b60008301846116f7565b92915050565b60008115159050919050565b61173681611721565b82525050565b6000602082019050611751600083018461172d565b92915050565b600082825260208201905092915050565b7f4552525f4e4f545f4f574e455200000000000000000000000000000000000000600082015250565b600061179e600d83611757565b91506117a982611768565b602082019050919050565b600060208201905081810360008301526117cd81611791565b9050919050565b7f4552525f5345414c454400000000000000000000000000000000000000000000600082015250565b600061180a600a83611757565b9150611815826117d4565b602082019050919050565b60006020820190508181036000830152611839816117fd565b9050919050565b7f4552525f494e56414c49445f5354415445000000000000000000000000000000600082015250565b6000611876601183611757565b915061188182611840565b602082019050919050565b600060208201905081810360008301526118a581611869565b9050919050565b7f4552525f414c52454144595f4c4f434b45440000000000000000000000000000600082015250565b60006118e2601283611757565b91506118ed826118ac565b602082019050919050565b60006020820190508181036000830152611911816118d5565b9050919050565b600060408201905061192d60008301856116f7565b61193a60208301846116f7565b9392505050565b600081519050919050565b600081905092915050565b60005b8381101561197557808201518184015260208101905061195a565b60008484015250505050565b600061198c82611941565b611996818561194c565b93506119a6818560208601611957565b80840191505092915050565b60006119be8284611981565b915081905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4552525f504552494f445f4241434b454e445f4552524f520000000000000000600082015250565b6000611a2e601883611757565b9150611a39826119f8565b602082019050919050565b60006020820190508181036000830152611a5d81611a21565b9050919050565b7f4552525f504552494f445f434845434b00000000000000000000000000000000600082015250565b6000611a9a601083611757565b9150611aa582611a64565b602082019050919050565b60006020820190508181036000830152611ac981611a8d565b9050919050565b7f4552525f52454749535452595f4241434b454e445f4552524f52000000000000600082015250565b6000611b06601a83611757565b9150611b1182611ad0565b602082019050919050565b60006020820190508181036000830152611b3581611af9565b9050919050565b7f4552525f5452414e534645520000000000000000000000000000000000000000600082015250565b6000611b72600c83611757565b9150611b7d82611b3c565b602082019050919050565b60006020820190508181036000830152611ba181611b65565b9050919050565b7f4552525f52454749535452595f434845434b0000000000000000000000000000600082015250565b6000611bde601283611757565b9150611be982611ba8565b602082019050919050565b60006020820190508181036000830152611c0d81611bd1565b9050919050565b7f4552525f4954534e4f5441474153000000000000000000000000000000000000600082015250565b6000611c4a600e83611757565b9150611c5582611c14565b602082019050919050565b60006020820190508181036000830152611c7981611c3d565b905091905056fea2646970667358221220aa140bbf9fa949363aa5b71e4396b58270ddfbf2b1ec7c28b61ecfda864fabde64736f6c63430008120033 +\ No newline at end of file diff --git a/python/eth_faucet/data/EthFaucet.json b/python/eth_faucet/data/EthFaucet.json @@ -1 +1 @@ -[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_amount","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":"_amount","type":"uint256"}],"name":"FaucetFail","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"_sealState","type":"uint256"},{"indexed":false,"internalType":"address","name":"_registry","type":"address"},{"indexed":false,"internalType":"address","name":"_periodChecker","type":"address"}],"name":"FaucetStateChange","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":"_amount","type":"uint256"}],"name":"FaucetUsed","type":"event"},{"anonymous":false,"inputs":[],"name":"ImNotGassy","type":"event"},{"inputs":[],"name":"amount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","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":[],"name":"maxSealState","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"periodChecker","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"registry","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_state","type":"uint256"}],"name":"seal","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"sealState","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_v","type":"uint256"}],"name":"setAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_checker","type":"address"}],"name":"setPeriodChecker","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_registry","type":"address"}],"name":"setRegistry","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}] +[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_amount","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":"_amount","type":"uint256"}],"name":"FaucetFail","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"_sealState","type":"uint256"},{"indexed":false,"internalType":"address","name":"_registry","type":"address"},{"indexed":false,"internalType":"address","name":"_periodChecker","type":"address"}],"name":"FaucetStateChange","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":"_amount","type":"uint256"}],"name":"FaucetUsed","type":"event"},{"anonymous":false,"inputs":[],"name":"ImNotGassy","type":"event"},{"inputs":[],"name":"amount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_recipient","type":"address"}],"name":"check","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":[],"name":"maxSealState","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"periodChecker","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"registry","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_state","type":"uint256"}],"name":"seal","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"sealState","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_v","type":"uint256"}],"name":"setAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_checker","type":"address"}],"name":"setPeriodChecker","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_registry","type":"address"}],"name":"setRegistry","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}] diff --git a/python/eth_faucet/data/PeriodSimple.bin b/python/eth_faucet/data/PeriodSimple.bin @@ -1 +1 @@ -608060405234801561001057600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506109bb806100c16000396000f3fe608060405234801561001057600080fd5b50600436106100bb576000357c010000000000000000000000000000000000000000000000000000000090048063b1a997ac11610083578063b1a997ac14610164578063c23697a814610180578063c3173774146101b0578063ef78d4fd146101ce578063f4430dd8146101ec576100bb565b80630f3a9f65146100c05780634b6bdf1d146100dc5780634ee577b4146100fa57806387020d6b1461012a5780638da5cb5b14610146575b600080fd5b6100da60048036038101906100d5919061068b565b610208565b005b6100e46102a0565b6040516100f191906106f9565b60405180910390f35b610114600480360381019061010f9190610740565b6102c6565b604051610121919061077c565b60405180910390f35b610144600480360381019061013f919061068b565b6102de565b005b61014e610340565b60405161015b91906106f9565b60405180910390f35b61017e60048036038101906101799190610740565b610364565b005b61019a60048036038101906101959190610740565b6104d9565b6040516101a791906107b2565b60405180910390f35b6101b86105a8565b6040516101c5919061077c565b60405180910390f35b6101d66105ae565b6040516101e3919061077c565b60405180910390f35b61020660048036038101906102019190610740565b6105b4565b005b3373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610296576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161028d9061082a565b60405180910390fd5b8060028190555050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60046020528060005260406000206000915090505481565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461033657600080fd5b8060038190555050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16148061040b5750600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b61044a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161044190610896565b60405180910390fd5b610453816104d9565b610492576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161048990610902565b60405180910390fd5b42600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555050565b60006003548273ffffffffffffffffffffffffffffffffffffffff1631101561050157600080fd5b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020540361055157600190506105a3565b600254600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461059e9190610951565b421190505b919050565b60035481565b60025481565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461060c57600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600080fd5b6000819050919050565b61066881610655565b811461067357600080fd5b50565b6000813590506106858161065f565b92915050565b6000602082840312156106a1576106a0610650565b5b60006106af84828501610676565b91505092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006106e3826106b8565b9050919050565b6106f3816106d8565b82525050565b600060208201905061070e60008301846106ea565b92915050565b61071d816106d8565b811461072857600080fd5b50565b60008135905061073a81610714565b92915050565b60006020828403121561075657610755610650565b5b60006107648482850161072b565b91505092915050565b61077681610655565b82525050565b6000602082019050610791600083018461076d565b92915050565b60008115159050919050565b6107ac81610797565b82525050565b60006020820190506107c760008301846107a3565b92915050565b600082825260208201905092915050565b7f4552525f4e4f545f4f574e455200000000000000000000000000000000000000600082015250565b6000610814600d836107cd565b915061081f826107de565b602082019050919050565b6000602082019050818103600083015261084381610807565b9050919050565b7f4552525f41434345535300000000000000000000000000000000000000000000600082015250565b6000610880600a836107cd565b915061088b8261084a565b602082019050919050565b600060208201905081810360008301526108af81610873565b9050919050565b7f4552525f5052454d415455524500000000000000000000000000000000000000600082015250565b60006108ec600d836107cd565b91506108f7826108b6565b602082019050919050565b6000602082019050818103600083015261091b816108df565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061095c82610655565b915061096783610655565b925082820190508082111561097f5761097e610922565b5b9291505056fea2646970667358221220cea5f56dcc1ced45f330e44c5e38309512ae6f03042f084994943724ec31aaab64736f6c63430008110033 -\ No newline at end of file +608060405234801561001057600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610a29806100c16000396000f3fe608060405234801561001057600080fd5b50600436106100bb576000357c010000000000000000000000000000000000000000000000000000000090048063b1a997ac11610083578063b1a997ac14610164578063c23697a814610180578063c3173774146101b0578063ef78d4fd146101ce578063f4430dd8146101ec576100bb565b80630f3a9f65146100c05780634b6bdf1d146100dc5780634ee577b4146100fa57806387020d6b1461012a5780638da5cb5b14610146575b600080fd5b6100da60048036038101906100d591906106f9565b610208565b005b6100e46102d7565b6040516100f19190610767565b60405180910390f35b610114600480360381019061010f91906107ae565b6102fd565b60405161012191906107ea565b60405180910390f35b610144600480360381019061013f91906106f9565b610315565b005b61014e6103ae565b60405161015b9190610767565b60405180910390f35b61017e600480360381019061017991906107ae565b6103d2565b005b61019a600480360381019061019591906107ae565b610547565b6040516101a79190610820565b60405180910390f35b6101b8610616565b6040516101c591906107ea565b60405180910390f35b6101d661061c565b6040516101e391906107ea565b60405180910390f35b610206600480360381019061020191906107ae565b610622565b005b3373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610296576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161028d90610898565b60405180910390fd5b806002819055507faf2decb129b74e79e086ab3d8c7bb0399bfba530c01e74fe4130ab9784e11557816040516102cc91906107ea565b60405180910390a150565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60046020528060005260406000206000915090505481565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461036d57600080fd5b806003819055507f565196b96812774c1c5f73698d513cb6d8141ec4ecdbb428486d6ad64b4c81aa816040516103a391906107ea565b60405180910390a150565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806104795750600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b6104b8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104af90610904565b60405180910390fd5b6104c181610547565b610500576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104f790610970565b60405180910390fd5b42600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555050565b60006003548273ffffffffffffffffffffffffffffffffffffffff1631101561056f57600080fd5b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054036105bf5760019050610611565b600254600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461060c91906109bf565b421190505b919050565b60035481565b60025481565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461067a57600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600080fd5b6000819050919050565b6106d6816106c3565b81146106e157600080fd5b50565b6000813590506106f3816106cd565b92915050565b60006020828403121561070f5761070e6106be565b5b600061071d848285016106e4565b91505092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061075182610726565b9050919050565b61076181610746565b82525050565b600060208201905061077c6000830184610758565b92915050565b61078b81610746565b811461079657600080fd5b50565b6000813590506107a881610782565b92915050565b6000602082840312156107c4576107c36106be565b5b60006107d284828501610799565b91505092915050565b6107e4816106c3565b82525050565b60006020820190506107ff60008301846107db565b92915050565b60008115159050919050565b61081a81610805565b82525050565b60006020820190506108356000830184610811565b92915050565b600082825260208201905092915050565b7f4552525f4e4f545f4f574e455200000000000000000000000000000000000000600082015250565b6000610882600d8361083b565b915061088d8261084c565b602082019050919050565b600060208201905081810360008301526108b181610875565b9050919050565b7f4552525f41434345535300000000000000000000000000000000000000000000600082015250565b60006108ee600a8361083b565b91506108f9826108b8565b602082019050919050565b6000602082019050818103600083015261091d816108e1565b9050919050565b7f4552525f5052454d415455524500000000000000000000000000000000000000600082015250565b600061095a600d8361083b565b915061096582610924565b602082019050919050565b600060208201905081810360008301526109898161094d565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006109ca826106c3565b91506109d5836106c3565b92508282019050808211156109ed576109ec610990565b5b9291505056fea264697066735822122036f6b1b7696d1efea751861cc717ebac331ef41e7627090024ecf5b26c13a0a764736f6c63430008120033 +\ No newline at end of file diff --git a/python/eth_faucet/data/PeriodSimple.json b/python/eth_faucet/data/PeriodSimple.json @@ -1 +1 @@ -[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_value","type":"uint256"}],"name":"PeriodChange","type":"event"},{"inputs":[],"name":"balanceThreshold","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_subject","type":"address"}],"name":"check","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"lastUsed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"period","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_subject","type":"address"}],"name":"poke","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"poker","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_threshold","type":"uint256"}],"name":"setBalanceThreshold","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_period","type":"uint256"}],"name":"setPeriod","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_poker","type":"address"}],"name":"setPoker","outputs":[],"stateMutability":"nonpayable","type":"function"}] +[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_value","type":"uint256"}],"name":"BalanceThresholdChange","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_value","type":"uint256"}],"name":"PeriodChange","type":"event"},{"inputs":[],"name":"balanceThreshold","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_subject","type":"address"}],"name":"check","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"lastUsed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"period","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_subject","type":"address"}],"name":"poke","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"poker","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_threshold","type":"uint256"}],"name":"setBalanceThreshold","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_period","type":"uint256"}],"name":"setPeriod","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_poker","type":"address"}],"name":"setPoker","outputs":[],"stateMutability":"nonpayable","type":"function"}] diff --git a/python/eth_faucet/faucet.py b/python/eth_faucet/faucet.py @@ -17,6 +17,7 @@ from chainlib.eth.contract import ( ABIContractType, ) from chainlib.eth.tx import TxFormat +from chainlib.jsonrpc import JSONRPCRequest from erc20_faucet import Faucet from hexathon import add_0x @@ -86,3 +87,21 @@ class EthFaucet(Faucet): tx = self.set_code(tx, data) tx = self.finalize(tx, tx_format) return tx + + + def check(self, contract_address, address, sender_address=ZERO_ADDRESS, id_generator=None): + j = JSONRPCRequest(id_generator) + o = j.template() + o['method'] = 'eth_call' + enc = ABIContractEncoder() + enc.method('check') + enc.typ(ABIContractType.ADDRESS) + enc.address(address) + data = add_0x(enc.get()) + tx = self.template(sender_address, contract_address) + tx = self.set_code(tx, data) + o['params'].append(self.normalize(tx)) + o['params'].append('latest') + o = j.finalize(o) + return o + diff --git a/python/setup.cfg b/python/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = eth-faucet -version = 0.1.1 +version = 0.1.2 description = Gas token gifter with controls from time intervals, amounts and access. author = Louis Holbrook author_email = dev@holbrook.no diff --git a/python/tests/test_period.py b/python/tests/test_period.py @@ -35,13 +35,12 @@ class TestFaucetPeriod(EthTesterCase): def setUp(self): super(TestFaucetPeriod, self).setUp() # DRY + self.conn = RPCConnection.connect(self.chain_spec, 'default') + nonce_oracle = RPCNonceOracle(self.accounts[0], self.conn) c = PeriodSimple(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle) (tx_hash_hex, o) = c.constructor(self.accounts[0]) r = self.conn.do(o) - self.conn = RPCConnection.connect(self.chain_spec, 'default') - nonce_oracle = RPCNonceOracle(self.accounts[0], self.conn) - f = open(os.path.join(datadir, 'PeriodSimple.bin')) period_store_bytecode = f.read() f.close() diff --git a/python/tests/test_registry.py b/python/tests/test_registry.py @@ -104,5 +104,13 @@ class TestFaucetRegistry(EthTesterCase): self.assertEqual(r['status'], 1) + def test_transparent(self): + nonce_oracle = RPCNonceOracle(self.accounts[0], self.conn) + c = EthFaucet(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle) + o = c.check(self.address, self.accounts[2], sender_address=self.accounts[0]) + r = self.conn.do(o) + self.assertEqual(int(r, 16), 1) + + if __name__ == '__main__': unittest.main() diff --git a/solidity/EthFaucet.sol b/solidity/EthFaucet.sol @@ -61,21 +61,13 @@ contract EthFacuet { (_ok, _result) = periodChecker.call(abi.encodeWithSignature("check(address)", _recipient)); if (!_ok) { - emit FaucetFail(_recipient, address(0), amount); - revert('ERR_PERIOD_BACKEND_ERROR'); + revert('ERR_PERIOD_BACKEND'); } if (_result[31] == 0) { - emit FaucetFail(_recipient, address(0), amount); - revert('ERR_PERIOD_CHECK'); + return false; } - (_ok, _result) = periodChecker.call(abi.encodeWithSignature("poke(address)", _recipient)); - if (!_ok) { - emit FaucetFail(_recipient, address(0), amount); - revert('ERR_REGISTRY_BACKEND_ERROR'); - } - return true; - } + } function checkRegistry(address _recipient) private returns(bool) { bool _ok; @@ -84,7 +76,7 @@ contract EthFacuet { (_ok, _result) = registry.call(abi.encodeWithSignature("have(address)", _recipient)); if (!_ok) { emit FaucetFail(_recipient, address(0), amount); - revert('ERR_TRANSFER'); + revert('ERR_REGISTRY_BACKEND'); } if (_result[31] == 0) { emit FaucetFail(_recipient, address(0), amount); @@ -95,14 +87,15 @@ contract EthFacuet { return true; } - function checkBalance() private { + function checkBalance() private returns(bool) { if (amount > address(this).balance) { + return false; emit ImNotGassy(); revert('ERR_ITSNOTAGAS'); } } - function check(address _recipient) private returns(bool) { + function checkCanPoke(address _recipient) private returns(uint256) { if (periodChecker != address(0)) { checkPeriod(_recipient); } @@ -112,15 +105,27 @@ contract EthFacuet { checkBalance(); return true; } + + function check(address _recipient) public returns(bool){ + bool _ok; + bytes memory _result; + + (_ok, _result) = periodChecker.call(abi.encodeWithSignature("poke(address)", _recipient)); + if (!_ok) { + emit FaucetFail(_recipient, address(0), amount); + revert('ERR_PERIOD_BACKEND'); + } + return true; + } function gimme() public returns(uint256) { - require(check(msg.sender)); + require(checkCanPoke(msg.sender)); payable(msg.sender).transfer(amount); return amount; } function giveTo(address _recipient) public returns(uint256) { - require(check(_recipient)); + require(checkCanPoke(_recipient)); payable(_recipient).transfer(amount); return amount; }