eth-faucet

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

commit 86652cc5f0abb956d2df34b38bbb9b52318cfb9e
parent 524d88a0c64c9843cdb2ab72d06d2c6995c38703
Author: lash <dev@holbrook.no>
Date:   Mon, 20 Mar 2023 10:49:20 +0000

Merge branch 'tmp' into dev-0.2.0

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/requirements.txt | 2+-
Mpython/tests/test_period.py | 30++++++++++++++++++++++++++++++
Msolidity/EthFaucet.sol | 101++++++++++++++++++++++++++++++++++++++++++++++++++-----------------------------
Msolidity/PeriodSimple.sol | 12++++++++----
8 files changed, 109 insertions(+), 48 deletions(-)

diff --git a/python/eth_faucet/data/EthFaucet.bin b/python/eth_faucet/data/EthFaucet.bin @@ -1 +1 @@ -608060405234801561001057600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550611cb6806100606000396000f3fe6080604052600436106100e3576000357c0100000000000000000000000000000000000000000000000000000000900480638da5cb5b1161009c578063c23697a811610076578063c23697a8146102a6578063cb10d59a146102e3578063d6eca01e1461030e578063de82efb414610337576100ea565b80638da5cb5b14610227578063a91ee0dc14610252578063aa8c217c1461027b576100ea565b806318cbbcfc146100ef578063271f88b41461011a57806331a5995d1461015757806363e4bff4146101825780637b103999146101bf57806386fe212d146101ea576100ea565b366100ea57005b600080fd5b3480156100fb57600080fd5b50610104610362565b60405161011191906115f3565b60405180910390f35b34801561012657600080fd5b50610141600480360381019061013c919061163f565b610367565b60405161014e91906115f3565b60405180910390f35b34801561016357600080fd5b5061016c61048d565b60405161017991906115f3565b60405180910390f35b34801561018e57600080fd5b506101a960048036038101906101a491906116ca565b610493565b6040516101b691906115f3565b60405180910390f35b3480156101cb57600080fd5b506101d46104fa565b6040516101e19190611706565b60405180910390f35b3480156101f657600080fd5b50610211600480360381019061020c919061163f565b610520565b60405161021e91906115f3565b60405180910390f35b34801561023357600080fd5b5061023c610646565b6040516102499190611706565b60405180910390f35b34801561025e57600080fd5b50610279600480360381019061027491906116ca565b61066a565b005b34801561028757600080fd5b50610290610807565b60405161029d91906115f3565b60405180910390f35b3480156102b257600080fd5b506102cd60048036038101906102c891906116ca565b61080d565b6040516102da919061173c565b60405180910390f35b3480156102ef57600080fd5b506102f86109df565b6040516103059190611706565b60405180910390f35b34801561031a57600080fd5b50610335600480360381019061033091906116ca565b610a05565b005b34801561034357600080fd5b5061034c610ba2565b60405161035991906115f3565b60405180910390f35b600781565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146103f8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103ef906117b4565b60405180910390fd5b6000600460ff166003541614610443576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161043a90611820565b60405180910390fd5b816004819055507f748f1cf617bdc8ef4fcd1cb516dc05cedf269e8dcad82183846d57eeec4bba5e60045460405161047b91906115f3565b60405180910390a16004549050919050565b60035481565b600061049e82610c07565b6104a757600080fd5b8173ffffffffffffffffffffffffffffffffffffffff166108fc6004549081150290604051600060405180830381858888f193505050501580156104ef573d6000803e3d6000fd5b506004549050919050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600060088210610565576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161055c9061188c565b60405180910390fd5b60006003548316146105ac576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105a3906118f8565b60405180910390fd5b816003600082825417925050819055506003547fe4b3d0535ec4cfd7bbe7b41fc94f6ee6bd15e97724854e3c3db2beb336d23a95600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16604051610634929190611918565b60405180910390a26003549050919050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146106f8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106ef906117b4565b60405180910390fd5b6000600160ff166003541614610743576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161073a90611820565b60405180910390fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506003547fe4b3d0535ec4cfd7bbe7b41fc94f6ee6bd15e97724854e3c3db2beb336d23a95600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040516107fc929190611918565b60405180910390a250565b60045481565b6000806060600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168460405160240161085c9190611706565b6040516020818303038152906040527f3ef25013000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506040516108e691906119b2565b6000604051808303816000865af19150503d8060008114610923576040519150601f19603f3d011682016040523d82523d6000602084013e610928565b606091505b50809250819350505060007f01000000000000000000000000000000000000000000000000000000000000000281601f81518110610969576109686119c9565b5b60200101517f010000000000000000000000000000000000000000000000000000000000000090047f0100000000000000000000000000000000000000000000000000000000000000027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161492505050919050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610a93576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a8a906117b4565b60405180910390fd5b6000600260ff166003541614610ade576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ad590611820565b60405180910390fd5b80600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506003547fe4b3d0535ec4cfd7bbe7b41fc94f6ee6bd15e97724854e3c3db2beb336d23a95600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16604051610b97929190611918565b60405180910390a250565b6000610bad33610c07565b610bb657600080fd5b3373ffffffffffffffffffffffffffffffffffffffff166108fc6004549081150290604051600060405180830381858888f19350505050158015610bfe573d6000803e3d6000fd5b50600454905090565b60008073ffffffffffffffffffffffffffffffffffffffff16600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c6957610c6782610cdb565b505b600073ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610cca57610cc8826111c5565b505b610cd2611550565b60019050919050565b6000806060600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1684604051602401610d2a9190611706565b6040516020818303038152906040527fc23697a8000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051610db491906119b2565b6000604051808303816000865af19150503d8060008114610df1576040519150601f19603f3d011682016040523d82523d6000602084013e610df6565b606091505b50809250819350505081610ea757600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f2a56a00a5c532c49314f19361f71cdca8a5d10fdcb42c3fa52800d13419d6070600454604051610e6491906115f3565b60405180910390a36040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e9e90611a44565b60405180910390fd5b60007f01000000000000000000000000000000000000000000000000000000000000000281601f81518110610edf57610ede6119c9565b5b60200101517f010000000000000000000000000000000000000000000000000000000000000090047f0100000000000000000000000000000000000000000000000000000000000000027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191603610ff357600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f2a56a00a5c532c49314f19361f71cdca8a5d10fdcb42c3fa52800d13419d6070600454604051610fb091906115f3565b60405180910390a36040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fea90611ab0565b60405180910390fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168460405160240161103d9190611706565b6040516020818303038152906040527fb1a997ac000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506040516110c791906119b2565b6000604051808303816000865af19150503d8060008114611104576040519150601f19603f3d011682016040523d82523d6000602084013e611109565b606091505b508092508193505050816111ba57600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f2a56a00a5c532c49314f19361f71cdca8a5d10fdcb42c3fa52800d13419d607060045460405161117791906115f3565b60405180910390a36040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111b190611b1c565b60405180910390fd5b600192505050919050565b6000806060600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16846040516024016112149190611706565b6040516020818303038152906040527f3ef25013000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505060405161129e91906119b2565b6000604051808303816000865af19150503d80600081146112db576040519150601f19603f3d011682016040523d82523d6000602084013e6112e0565b606091505b5080925081935050508161139157600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f2a56a00a5c532c49314f19361f71cdca8a5d10fdcb42c3fa52800d13419d607060045460405161134e91906115f3565b60405180910390a36040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138890611b88565b60405180910390fd5b60007f01000000000000000000000000000000000000000000000000000000000000000281601f815181106113c9576113c86119c9565b5b60200101517f010000000000000000000000000000000000000000000000000000000000000090047f0100000000000000000000000000000000000000000000000000000000000000027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916036114dd57600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f2a56a00a5c532c49314f19361f71cdca8a5d10fdcb42c3fa52800d13419d607060045460405161149a91906115f3565b60405180910390a36040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114d490611bf4565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f45c201a59ac545000ead84f30b2db67da23353aa1d58ac522c48505412143ffa60045460405161153d91906115f3565b60405180910390a3600192505050919050565b3073ffffffffffffffffffffffffffffffffffffffff163160045411156115d8577fd5fc280270ad7a4858a11280d5228b85502cacf121cc91fd35436bed31bb659c60405160405180910390a16040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115cf90611c60565b60405180910390fd5b565b6000819050919050565b6115ed816115da565b82525050565b600060208201905061160860008301846115e4565b92915050565b600080fd5b61161c816115da565b811461162757600080fd5b50565b60008135905061163981611613565b92915050565b6000602082840312156116555761165461160e565b5b60006116638482850161162a565b91505092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006116978261166c565b9050919050565b6116a78161168c565b81146116b257600080fd5b50565b6000813590506116c48161169e565b92915050565b6000602082840312156116e0576116df61160e565b5b60006116ee848285016116b5565b91505092915050565b6117008161168c565b82525050565b600060208201905061171b60008301846116f7565b92915050565b60008115159050919050565b61173681611721565b82525050565b6000602082019050611751600083018461172d565b92915050565b600082825260208201905092915050565b7f4552525f4e4f545f4f574e455200000000000000000000000000000000000000600082015250565b600061179e600d83611757565b91506117a982611768565b602082019050919050565b600060208201905081810360008301526117cd81611791565b9050919050565b7f4552525f5345414c454400000000000000000000000000000000000000000000600082015250565b600061180a600a83611757565b9150611815826117d4565b602082019050919050565b60006020820190508181036000830152611839816117fd565b9050919050565b7f4552525f494e56414c49445f5354415445000000000000000000000000000000600082015250565b6000611876601183611757565b915061188182611840565b602082019050919050565b600060208201905081810360008301526118a581611869565b9050919050565b7f4552525f414c52454144595f4c4f434b45440000000000000000000000000000600082015250565b60006118e2601283611757565b91506118ed826118ac565b602082019050919050565b60006020820190508181036000830152611911816118d5565b9050919050565b600060408201905061192d60008301856116f7565b61193a60208301846116f7565b9392505050565b600081519050919050565b600081905092915050565b60005b8381101561197557808201518184015260208101905061195a565b60008484015250505050565b600061198c82611941565b611996818561194c565b93506119a6818560208601611957565b80840191505092915050565b60006119be8284611981565b915081905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4552525f504552494f445f4241434b454e445f4552524f520000000000000000600082015250565b6000611a2e601883611757565b9150611a39826119f8565b602082019050919050565b60006020820190508181036000830152611a5d81611a21565b9050919050565b7f4552525f504552494f445f434845434b00000000000000000000000000000000600082015250565b6000611a9a601083611757565b9150611aa582611a64565b602082019050919050565b60006020820190508181036000830152611ac981611a8d565b9050919050565b7f4552525f52454749535452595f4241434b454e445f4552524f52000000000000600082015250565b6000611b06601a83611757565b9150611b1182611ad0565b602082019050919050565b60006020820190508181036000830152611b3581611af9565b9050919050565b7f4552525f5452414e534645520000000000000000000000000000000000000000600082015250565b6000611b72600c83611757565b9150611b7d82611b3c565b602082019050919050565b60006020820190508181036000830152611ba181611b65565b9050919050565b7f4552525f52454749535452595f434845434b0000000000000000000000000000600082015250565b6000611bde601283611757565b9150611be982611ba8565b602082019050919050565b60006020820190508181036000830152611c0d81611bd1565b9050919050565b7f4552525f4954534e4f5441474153000000000000000000000000000000000000600082015250565b6000611c4a600e83611757565b9150611c5582611c14565b602082019050919050565b60006020820190508181036000830152611c7981611c3d565b905091905056fea2646970667358221220aa140bbf9fa949363aa5b71e4396b58270ddfbf2b1ec7c28b61ecfda864fabde64736f6c63430008120033 -\ No newline at end of file +608060405234801561001057600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550611d27806100606000396000f3fe608060405260043610610109576000357c0100000000000000000000000000000000000000000000000000000000900480638da5cb5b116100a7578063d6eca01e11610076578063d6eca01e14610346578063de82efb41461036f578063eec7faa11461039a578063fc0c546a146103c557610110565b80638da5cb5b1461028a578063a91ee0dc146102b5578063c23697a8146102de578063cb10d59a1461031b57610110565b80633b1bd134116100e35780633b1bd134146101a857806363e4bff4146101e55780637b1039991461022257806386fe212d1461024d57610110565b806318cbbcfc14610115578063271f88b41461014057806331a5995d1461017d57610110565b3661011057005b600080fd5b34801561012157600080fd5b5061012a6103f0565b60405161013791906115be565b60405180910390f35b34801561014c57600080fd5b506101676004803603810190610162919061160a565b6103f5565b60405161017491906115be565b60405180910390f35b34801561018957600080fd5b5061019261051b565b60405161019f91906115be565b60405180910390f35b3480156101b457600080fd5b506101cf60048036038101906101ca9190611695565b610521565b6040516101dc91906115be565b60405180910390f35b3480156101f157600080fd5b5061020c60048036038101906102079190611695565b61069c565b60405161021991906115be565b60405180910390f35b34801561022e57600080fd5b5061023761076b565b60405161024491906116d1565b60405180910390f35b34801561025957600080fd5b50610274600480360381019061026f919061160a565b610791565b60405161028191906115be565b60405180910390f35b34801561029657600080fd5b5061029f6108b7565b6040516102ac91906116d1565b60405180910390f35b3480156102c157600080fd5b506102dc60048036038101906102d79190611695565b6108db565b005b3480156102ea57600080fd5b5061030560048036038101906103009190611695565b610a78565b6040516103129190611707565b60405180910390f35b34801561032757600080fd5b50610330610ab6565b60405161033d91906116d1565b60405180910390f35b34801561035257600080fd5b5061036d60048036038101906103689190611695565b610adc565b005b34801561037b57600080fd5b50610384610c79565b60405161039191906115be565b60405180910390f35b3480156103a657600080fd5b506103af610d46565b6040516103bc91906115be565b60405180910390f35b3480156103d157600080fd5b506103da610d50565b6040516103e791906116d1565b60405180910390f35b600781565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610486576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161047d9061177f565b60405180910390fd5b6000600460ff1660035416146104d1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104c8906117eb565b60405180910390fd5b816004819055507f748f1cf617bdc8ef4fcd1cb516dc05cedf269e8dcad82183846d57eeec4bba5e60045460405161050991906115be565b60405180910390a16004549050919050565b60035481565b6000806060600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168460405160240161057091906116d1565b6040516020818303038152906040527fab73e316000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506040516105fa919061187c565b6000604051808303816000865af19150503d8060008114610637576040519150601f19603f3d011682016040523d82523d6000602084013e61063c565b606091505b50809250819350505081610685576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161067c906118df565b60405180910390fd5b8061068f9061193e565b6001900492505050919050565b60006106a782610d55565b6106b057600080fd5b8173ffffffffffffffffffffffffffffffffffffffff166108fc6004549081150290604051600060405180830381858888f193505050501580156106f8573d6000803e3d6000fd5b50600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167f26162814817e23ec5035d6a2edc6c422da2da2119e27cfca6be65cc2dc55ca4c60045460405161075991906115be565b60405180910390a36004549050919050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600882106107d6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107cd906119f1565b60405180910390fd5b600060035483161461081d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161081490611a5d565b60405180910390fd5b816003600082825417925050819055506003547f829c15f635123f612942c5f6ba4c6c203609473dc8b2398f38ccda8866f6ff7d600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040516108a5929190611a7d565b60405180910390a26003549050919050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610969576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109609061177f565b60405180910390fd5b6000600160ff1660035416146109b4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109ab906117eb565b60405180910390fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506003547f829c15f635123f612942c5f6ba4c6c203609473dc8b2398f38ccda8866f6ff7d600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16604051610a6d929190611a7d565b60405180910390a250565b6000610a8382611099565b610a905760009050610ab1565b610a998261130d565b610aa65760009050610ab1565b610aae611581565b90505b919050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610b6a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b619061177f565b60405180910390fd5b6000600260ff166003541614610bb5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bac906117eb565b60405180910390fd5b80600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506003547f829c15f635123f612942c5f6ba4c6c203609473dc8b2398f38ccda8866f6ff7d600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16604051610c6e929190611a7d565b60405180910390a250565b6000610c8433610d55565b610c8d57600080fd5b3373ffffffffffffffffffffffffffffffffffffffff166108fc6004549081150290604051600060405180830381858888f19350505050158015610cd5573d6000803e3d6000fd5b50600073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f26162814817e23ec5035d6a2edc6c422da2da2119e27cfca6be65cc2dc55ca4c600454604051610d3691906115be565b60405180910390a3600454905090565b6000600454905090565b600090565b6000806060610d62611581565b610da1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d9890611af2565b60405180910390fd5b610daa8461130d565b610de9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610de090611b5e565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1603610e4a57600192505050611094565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1684604051602401610e9491906116d1565b6040516020818303038152906040527fb1a997ac000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051610f1e919061187c565b6000604051808303816000865af19150503d8060008114610f5b576040519150601f19603f3d011682016040523d82523d6000602084013e610f60565b606091505b50809250819350505081610fa9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fa090611bca565b60405180910390fd5b60007f01000000000000000000000000000000000000000000000000000000000000000281601f81518110610fe157610fe0611bea565b5b60200101517f010000000000000000000000000000000000000000000000000000000000000090047f0100000000000000000000000000000000000000000000000000000000000000027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19160361108d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161108490611c65565b60405180910390fd5b6001925050505b919050565b6000806060600073ffffffffffffffffffffffffffffffffffffffff16600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16036110ff57600192505050611308565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168460405160240161114991906116d1565b6040516020818303038152906040527fc23697a8000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506040516111d3919061187c565b6000604051808303816000865af19150503d8060008114611210576040519150601f19603f3d011682016040523d82523d6000602084013e611215565b606091505b5080925081935050508161125e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161125590611bca565b60405180910390fd5b60017f01000000000000000000000000000000000000000000000000000000000000000281601f8151811061129657611295611bea565b5b60200101517f010000000000000000000000000000000000000000000000000000000000000090047f0100000000000000000000000000000000000000000000000000000000000000027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614925050505b919050565b6000806060600073ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16036113735760019250505061157c565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16846040516024016113bd91906116d1565b6040516020818303038152906040527f3ef25013000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051611447919061187c565b6000604051808303816000865af19150503d8060008114611484576040519150601f19603f3d011682016040523d82523d6000602084013e611489565b606091505b508092508193505050816114d2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114c990611cd1565b60405180910390fd5b60017f01000000000000000000000000000000000000000000000000000000000000000281601f8151811061150a57611509611bea565b5b60200101517f010000000000000000000000000000000000000000000000000000000000000090047f0100000000000000000000000000000000000000000000000000000000000000027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614925050505b919050565b60003073ffffffffffffffffffffffffffffffffffffffff16316004541015905090565b6000819050919050565b6115b8816115a5565b82525050565b60006020820190506115d360008301846115af565b92915050565b600080fd5b6115e7816115a5565b81146115f257600080fd5b50565b600081359050611604816115de565b92915050565b6000602082840312156116205761161f6115d9565b5b600061162e848285016115f5565b91505092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061166282611637565b9050919050565b61167281611657565b811461167d57600080fd5b50565b60008135905061168f81611669565b92915050565b6000602082840312156116ab576116aa6115d9565b5b60006116b984828501611680565b91505092915050565b6116cb81611657565b82525050565b60006020820190506116e660008301846116c2565b92915050565b60008115159050919050565b611701816116ec565b82525050565b600060208201905061171c60008301846116f8565b92915050565b600082825260208201905092915050565b7f4552525f4e4f545f4f574e455200000000000000000000000000000000000000600082015250565b6000611769600d83611722565b915061177482611733565b602082019050919050565b600060208201905081810360008301526117988161175c565b9050919050565b7f4552525f5345414c454400000000000000000000000000000000000000000000600082015250565b60006117d5600a83611722565b91506117e08261179f565b602082019050919050565b60006020820190508181036000830152611804816117c8565b9050919050565b600081519050919050565b600081905092915050565b60005b8381101561183f578082015181840152602081019050611824565b60008484015250505050565b60006118568261180b565b6118608185611816565b9350611870818560208601611821565b80840191505092915050565b6000611888828461184b565b915081905092915050565b7f4552525f504552494f445f4241434b454e445f4552524f520000000000000000600082015250565b60006118c9601883611722565b91506118d482611893565b602082019050919050565b600060208201905081810360008301526118f8816118bc565b9050919050565b6000819050602082019050919050565b6000819050919050565b6000611925825161190f565b80915050919050565b60008160020a8302905092915050565b60006119498261180b565b82611953846118ff565b905061195e81611919565b9250602082101561199e576119997fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8360200360080261192e565b831692505b5050919050565b7f4552525f494e56414c49445f5354415445000000000000000000000000000000600082015250565b60006119db601183611722565b91506119e6826119a5565b602082019050919050565b60006020820190508181036000830152611a0a816119ce565b9050919050565b7f4552525f414c52454144595f4c4f434b45440000000000000000000000000000600082015250565b6000611a47601283611722565b9150611a5282611a11565b602082019050919050565b60006020820190508181036000830152611a7681611a3a565b9050919050565b6000604082019050611a9260008301856116c2565b611a9f60208301846116c2565b9392505050565b7f4552525f494e53554646494349454e545f42414c414e43450000000000000000600082015250565b6000611adc601883611722565b9150611ae782611aa6565b602082019050919050565b60006020820190508181036000830152611b0b81611acf565b9050919050565b7f4552525f4e4f545f494e5f57484954454c495354000000000000000000000000600082015250565b6000611b48601483611722565b9150611b5382611b12565b602082019050919050565b60006020820190508181036000830152611b7781611b3b565b9050919050565b7f4552525f504552494f445f4241434b454e440000000000000000000000000000600082015250565b6000611bb4601283611722565b9150611bbf82611b7e565b602082019050919050565b60006020820190508181036000830152611be381611ba7565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4552525f504552494f445f434845434b00000000000000000000000000000000600082015250565b6000611c4f601083611722565b9150611c5a82611c19565b602082019050919050565b60006020820190508181036000830152611c7e81611c42565b9050919050565b7f4552525f52454749535452595f4241434b454e44000000000000000000000000600082015250565b6000611cbb601483611722565b9150611cc682611c85565b602082019050919050565b60006020820190508181036000830152611cea81611cae565b905091905056fea2646970667358221220579622913630fb32ffc443938de91a6dfdc32ac2b68b5b2d775f44b115a76c8664736f6c63430008120033 +\ 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":[{"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"}] +[{"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":"Give","type":"event"},{"anonymous":false,"inputs":[],"name":"ImNotGassy","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":"SealStateChange","type":"event"},{"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":[{"internalType":"address","name":"_subject","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":[],"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"},{"inputs":[],"name":"token","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"tokenAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}] diff --git a/python/eth_faucet/data/PeriodSimple.bin b/python/eth_faucet/data/PeriodSimple.bin @@ -1 +1 @@ -608060405234801561001057600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610a29806100c16000396000f3fe608060405234801561001057600080fd5b50600436106100bb576000357c010000000000000000000000000000000000000000000000000000000090048063b1a997ac11610083578063b1a997ac14610164578063c23697a814610180578063c3173774146101b0578063ef78d4fd146101ce578063f4430dd8146101ec576100bb565b80630f3a9f65146100c05780634b6bdf1d146100dc5780634ee577b4146100fa57806387020d6b1461012a5780638da5cb5b14610146575b600080fd5b6100da60048036038101906100d591906106f9565b610208565b005b6100e46102d7565b6040516100f19190610767565b60405180910390f35b610114600480360381019061010f91906107ae565b6102fd565b60405161012191906107ea565b60405180910390f35b610144600480360381019061013f91906106f9565b610315565b005b61014e6103ae565b60405161015b9190610767565b60405180910390f35b61017e600480360381019061017991906107ae565b6103d2565b005b61019a600480360381019061019591906107ae565b610547565b6040516101a79190610820565b60405180910390f35b6101b8610616565b6040516101c591906107ea565b60405180910390f35b6101d661061c565b6040516101e391906107ea565b60405180910390f35b610206600480360381019061020191906107ae565b610622565b005b3373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610296576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161028d90610898565b60405180910390fd5b806002819055507faf2decb129b74e79e086ab3d8c7bb0399bfba530c01e74fe4130ab9784e11557816040516102cc91906107ea565b60405180910390a150565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60046020528060005260406000206000915090505481565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461036d57600080fd5b806003819055507f565196b96812774c1c5f73698d513cb6d8141ec4ecdbb428486d6ad64b4c81aa816040516103a391906107ea565b60405180910390a150565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806104795750600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b6104b8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104af90610904565b60405180910390fd5b6104c181610547565b610500576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104f790610970565b60405180910390fd5b42600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555050565b60006003548273ffffffffffffffffffffffffffffffffffffffff1631101561056f57600080fd5b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054036105bf5760019050610611565b600254600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461060c91906109bf565b421190505b919050565b60035481565b60025481565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461067a57600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600080fd5b6000819050919050565b6106d6816106c3565b81146106e157600080fd5b50565b6000813590506106f3816106cd565b92915050565b60006020828403121561070f5761070e6106be565b5b600061071d848285016106e4565b91505092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061075182610726565b9050919050565b61076181610746565b82525050565b600060208201905061077c6000830184610758565b92915050565b61078b81610746565b811461079657600080fd5b50565b6000813590506107a881610782565b92915050565b6000602082840312156107c4576107c36106be565b5b60006107d284828501610799565b91505092915050565b6107e4816106c3565b82525050565b60006020820190506107ff60008301846107db565b92915050565b60008115159050919050565b61081a81610805565b82525050565b60006020820190506108356000830184610811565b92915050565b600082825260208201905092915050565b7f4552525f4e4f545f4f574e455200000000000000000000000000000000000000600082015250565b6000610882600d8361083b565b915061088d8261084c565b602082019050919050565b600060208201905081810360008301526108b181610875565b9050919050565b7f4552525f41434345535300000000000000000000000000000000000000000000600082015250565b60006108ee600a8361083b565b91506108f9826108b8565b602082019050919050565b6000602082019050818103600083015261091d816108e1565b9050919050565b7f4552525f5052454d415455524500000000000000000000000000000000000000600082015250565b600061095a600d8361083b565b915061096582610924565b602082019050919050565b600060208201905081810360008301526109898161094d565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006109ca826106c3565b91506109d5836106c3565b92508282019050808211156109ed576109ec610990565b5b9291505056fea264697066735822122036f6b1b7696d1efea751861cc717ebac331ef41e7627090024ecf5b26c13a0a764736f6c63430008120033 -\ No newline at end of file +608060405234801561001057600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610c48806100c16000396000f3fe608060405234801561001057600080fd5b50600436106100c6576000357c010000000000000000000000000000000000000000000000000000000090048063ab73e3161161008e578063ab73e3161461016f578063b1a997ac1461019f578063c23697a8146101cf578063c3173774146101ff578063ef78d4fd1461021d578063f4430dd81461023b576100c6565b80630f3a9f65146100cb5780634b6bdf1d146100e75780634ee577b41461010557806387020d6b146101355780638da5cb5b14610151575b600080fd5b6100e560048036038101906100e0919061087d565b610257565b005b6100ef610326565b6040516100fc91906108eb565b60405180910390f35b61011f600480360381019061011a9190610932565b61034c565b60405161012c919061096e565b60405180910390f35b61014f600480360381019061014a919061087d565b610364565b005b6101596103fd565b60405161016691906108eb565b60405180910390f35b61018960048036038101906101849190610932565b610421565b604051610196919061096e565b60405180910390f35b6101b960048036038101906101b49190610932565b610477565b6040516101c691906109a4565b60405180910390f35b6101e960048036038101906101e49190610932565b610682565b6040516101f691906109a4565b60405180910390f35b61020761079a565b604051610214919061096e565b60405180910390f35b6102256107a0565b604051610232919061096e565b60405180910390f35b61025560048036038101906102509190610932565b6107a6565b005b3373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146102e5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102dc90610a1c565b60405180910390fd5b806002819055507faf2decb129b74e79e086ab3d8c7bb0399bfba530c01e74fe4130ab9784e115578160405161031b919061096e565b60405180910390a150565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60046020528060005260406000206000915090505481565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146103bc57600080fd5b806003819055507f565196b96812774c1c5f73698d513cb6d8141ec4ecdbb428486d6ad64b4c81aa816040516103f2919061096e565b60405180910390a150565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600254600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546104709190610a6b565b9050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806105215750600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b610560576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161055790610aeb565b60405180910390fd5b3073ffffffffffffffffffffffffffffffffffffffff1663c23697a8836040518263ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004016105b591906108eb565b602060405180830381865afa1580156105d2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105f69190610b37565b610635576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161062c90610bb0565b60405180910390fd5b42600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555060019050919050565b60006003548273ffffffffffffffffffffffffffffffffffffffff163110156106aa57600080fd5b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054036106fa5760019050610795565b3073ffffffffffffffffffffffffffffffffffffffff1663ab73e316836040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040161074f91906108eb565b602060405180830381865afa15801561076c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107909190610be5565b421190505b919050565b60035481565b60025481565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146107fe57600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600080fd5b6000819050919050565b61085a81610847565b811461086557600080fd5b50565b60008135905061087781610851565b92915050565b60006020828403121561089357610892610842565b5b60006108a184828501610868565b91505092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006108d5826108aa565b9050919050565b6108e5816108ca565b82525050565b600060208201905061090060008301846108dc565b92915050565b61090f816108ca565b811461091a57600080fd5b50565b60008135905061092c81610906565b92915050565b60006020828403121561094857610947610842565b5b60006109568482850161091d565b91505092915050565b61096881610847565b82525050565b6000602082019050610983600083018461095f565b92915050565b60008115159050919050565b61099e81610989565b82525050565b60006020820190506109b96000830184610995565b92915050565b600082825260208201905092915050565b7f4552525f4e4f545f4f574e455200000000000000000000000000000000000000600082015250565b6000610a06600d836109bf565b9150610a11826109d0565b602082019050919050565b60006020820190508181036000830152610a35816109f9565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000610a7682610847565b9150610a8183610847565b9250828201905080821115610a9957610a98610a3c565b5b92915050565b7f4552525f41434345535300000000000000000000000000000000000000000000600082015250565b6000610ad5600a836109bf565b9150610ae082610a9f565b602082019050919050565b60006020820190508181036000830152610b0481610ac8565b9050919050565b610b1481610989565b8114610b1f57600080fd5b50565b600081519050610b3181610b0b565b92915050565b600060208284031215610b4d57610b4c610842565b5b6000610b5b84828501610b22565b91505092915050565b7f4552525f5052454d415455524500000000000000000000000000000000000000600082015250565b6000610b9a600d836109bf565b9150610ba582610b64565b602082019050919050565b60006020820190508181036000830152610bc981610b8d565b9050919050565b600081519050610bdf81610851565b92915050565b600060208284031215610bfb57610bfa610842565b5b6000610c0984828501610bd0565b9150509291505056fea2646970667358221220f1bca856487cc7834827fc8deb7e33a665fb08ecaee9bc82fe19b972a843c1d064736f6c63430008120033 +\ 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":"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"}] +[{"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":[{"internalType":"address","name":"_subject","type":"address"}],"name":"next","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":[{"internalType":"bool","name":"","type":"bool"}],"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/requirements.txt b/python/requirements.txt @@ -1,2 +1,2 @@ chainlib-eth~=0.4.8 -erc20-faucet~=0.5.0 +erc20-faucet~=0.6.0 diff --git a/python/tests/test_period.py b/python/tests/test_period.py @@ -206,5 +206,35 @@ class TestFaucetPeriod(EthTesterCase): self.assertEqual(r['status'], 1) + def test_period_front(self): + nonce_oracle = RPCNonceOracle(self.accounts[0], self.conn) + c = TxFactory(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle) + enc = ABIContractEncoder() + enc.method('setPeriod') + enc.typ(ABIContractType.UINT256) + enc.uint256(100) + data = enc.get() + tx = c.template(self.accounts[0], self.period_store_address, use_nonce=True) + tx = c.set_code(tx, data) + (tx_hash_hex, o) = c.finalize(tx) + self.conn.do(o) + + nonce_oracle = RPCNonceOracle(self.accounts[0], self.conn) + c = EthFaucet(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle) + (tx_hash_hex, o) = c.gimme(self.address, self.accounts[0]) + self.conn.do(o) + o = receipt(tx_hash_hex) + r = self.conn.do(o) + o = block_by_number(r['block_number']) + r = self.conn.do(o) + thistime = r['timestamp'] + + o = c.next_time(self.address, self.accounts[0], sender_address=self.accounts[0]) + r = self.conn.do(o) + nexttime = int(r, 16) + + self.assertEqual(nexttime, thistime+100) + + if __name__ == '__main__': unittest.main() diff --git a/solidity/EthFaucet.sol b/solidity/EthFaucet.sol @@ -8,17 +8,16 @@ contract EthFacuet { address public registry; address public periodChecker; uint256 public sealState; - uint256 public amount; + uint256 amount; uint8 constant REGISTRY_STATE = 1; uint8 constant PERIODCHECKER_STATE = 2; uint8 constant VALUE_STATE = 4; uint256 constant public maxSealState = 7; - event FaucetUsed(address indexed _recipient, address indexed _token, uint256 _amount); - event FaucetFail(address indexed _recipient, address indexed _token, uint256 _amount); + event Give(address indexed _recipient, address indexed _token, uint256 _amount); event FaucetAmountChange(uint256 _amount); - event FaucetStateChange(uint256 indexed _sealState, address _registry, address _periodChecker); + event SealStateChange(uint256 indexed _sealState, address _registry, address _periodChecker); event ImNotGassy(); constructor() { @@ -29,7 +28,7 @@ contract EthFacuet { require(_state < 8, 'ERR_INVALID_STATE'); require(_state & sealState == 0, 'ERR_ALREADY_LOCKED'); sealState |= _state; - emit FaucetStateChange(sealState, registry, periodChecker); + emit SealStateChange(sealState, registry, periodChecker); return uint256(sealState); } @@ -45,91 +44,119 @@ contract EthFacuet { require(msg.sender == owner, 'ERR_NOT_OWNER'); require(sealState & PERIODCHECKER_STATE == 0, 'ERR_SEALED'); periodChecker = _checker; - emit FaucetStateChange(sealState, registry, periodChecker); + emit SealStateChange(sealState, registry, periodChecker); } function setRegistry(address _registry) public { require(msg.sender == owner, 'ERR_NOT_OWNER'); require(sealState & REGISTRY_STATE == 0, 'ERR_SEALED'); registry = _registry; - emit FaucetStateChange(sealState, registry, periodChecker); + emit SealStateChange(sealState, registry, periodChecker); } function checkPeriod(address _recipient) private returns(bool) { bool _ok; bytes memory _result; + if (periodChecker == address(0)) { + return true; + } + (_ok, _result) = periodChecker.call(abi.encodeWithSignature("check(address)", _recipient)); if (!_ok) { revert('ERR_PERIOD_BACKEND'); } - if (_result[31] == 0) { - return false; - } - - } + return _result[31] == 0x01; + } function checkRegistry(address _recipient) private returns(bool) { bool _ok; bytes memory _result; + if (registry == address(0)) { + return true; + } + (_ok, _result) = registry.call(abi.encodeWithSignature("have(address)", _recipient)); if (!_ok) { - emit FaucetFail(_recipient, address(0), amount); revert('ERR_REGISTRY_BACKEND'); } - if (_result[31] == 0) { - emit FaucetFail(_recipient, address(0), amount); - revert('ERR_REGISTRY_CHECK'); - } - - emit FaucetUsed(_recipient, address(0), amount); - return true; + return _result[31] == 0x01; } - function checkBalance() private returns(bool) { - if (amount > address(this).balance) { - return false; - emit ImNotGassy(); - revert('ERR_ITSNOTAGAS'); - } + function checkBalance() private view returns(bool) { + return amount >= address(this).balance; } - function checkCanPoke(address _recipient) private returns(uint256) { - if (periodChecker != address(0)) { - checkPeriod(_recipient); + function check(address _recipient) public returns(bool) { + if (!checkPeriod(_recipient)) { + return false; } - if (registry != address(0)) { - checkRegistry(_recipient); + if (!checkRegistry(_recipient)) { + return false; } - checkBalance(); - return true; + return checkBalance(); } - function check(address _recipient) public returns(bool){ + function checkAndPoke(address _recipient) private returns(bool){ bool _ok; bytes memory _result; + if (!checkBalance()) { + revert('ERR_INSUFFICIENT_BALANCE'); + } + + if (!checkRegistry(_recipient)) { + revert('ERR_NOT_IN_WHITELIST'); + } + + if (periodChecker == address(0)) { + return true; + } + (_ok, _result) = periodChecker.call(abi.encodeWithSignature("poke(address)", _recipient)); if (!_ok) { - emit FaucetFail(_recipient, address(0), amount); revert('ERR_PERIOD_BACKEND'); + } + if (_result[31] == 0) { + revert('ERR_PERIOD_CHECK'); } return true; } function gimme() public returns(uint256) { - require(checkCanPoke(msg.sender)); + require(checkAndPoke(msg.sender)); payable(msg.sender).transfer(amount); + emit Give(msg.sender, address(0), amount); return amount; } function giveTo(address _recipient) public returns(uint256) { - require(checkCanPoke(_recipient)); + require(checkAndPoke(_recipient)); payable(_recipient).transfer(amount); + emit Give(_recipient, address(0), amount); + return amount; + } + + function nextTime(address _subject) public returns(uint256) { + bool _ok; + bytes memory _result; + + (_ok, _result) = periodChecker.call(abi.encodeWithSignature("next(address)", _subject)); + if (!_ok) { + revert('ERR_PERIOD_BACKEND_ERROR'); + } + return uint256(bytes32(_result)); + } + + function tokenAmount() public view returns(uint256) { return amount; } + function token() public pure returns(address) { + return address(0); + } + receive () payable external { } } diff --git a/solidity/PeriodSimple.sol b/solidity/PeriodSimple.sol @@ -34,17 +34,21 @@ contract PeriodSimple { emit BalanceThresholdChange(_threshold); } - function check(address _subject) public view returns(bool) { + function next(address _subject) external view returns(uint256) { + return lastUsed[_subject] + period; + } + + function check(address _subject) external view returns(bool) { require(_subject.balance >= balanceThreshold); if (lastUsed[_subject] == 0) { return true; } - return block.timestamp > lastUsed[_subject] + period; + return block.timestamp > this.next(_subject); } - function poke(address _subject) public { + function poke(address _subject) external { require(msg.sender == owner || msg.sender == poker, 'ERR_ACCESS'); - require(check(_subject), 'ERR_PREMATURE'); + require(this.check(_subject), 'ERR_PREMATURE'); lastUsed[_subject] = block.timestamp; } }