eth-faucet

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

commit 6a6ffc97d0afd8fbeb68671b96687a84048fe378
parent 86652cc5f0abb956d2df34b38bbb9b52318cfb9e
Author: lash <dev@holbrook.no>
Date:   Mon, 20 Mar 2023 10:50:11 +0000

Bump version

Diffstat:
Mpython/setup.cfg | 2+-
Mpython/tests/test_period.py | 6+++++-
Mpython/tests/test_registry.py | 4++++
Msolidity/PeriodSimple.sol | 3++-
4 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/python/setup.cfg b/python/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = eth-faucet -version = 0.1.2 +version = 0.2.0 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 @@ -232,9 +232,13 @@ class TestFaucetPeriod(EthTesterCase): 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) + o = c.check(self.address, self.accounts[0], sender_address=self.accounts[0]) + r = self.conn.do(o) + checked = int(r, 16) + self.assertEqual(checked, 0) + if __name__ == '__main__': unittest.main() diff --git a/python/tests/test_registry.py b/python/tests/test_registry.py @@ -109,6 +109,10 @@ class TestFaucetRegistry(EthTesterCase): 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), 0) + + o = c.check(self.address, self.accounts[1], sender_address=self.accounts[0]) + r = self.conn.do(o) self.assertEqual(int(r, 16), 1) diff --git a/solidity/PeriodSimple.sol b/solidity/PeriodSimple.sol @@ -46,9 +46,10 @@ contract PeriodSimple { return block.timestamp > this.next(_subject); } - function poke(address _subject) external { + function poke(address _subject) external returns(bool) { require(msg.sender == owner || msg.sender == poker, 'ERR_ACCESS'); require(this.check(_subject), 'ERR_PREMATURE'); lastUsed[_subject] = block.timestamp; + return true; } }