eth-faucet

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

commit 80fb3c98b53f74028165df1da6ca963108556fe6
parent 2ed3f466606fbd1460362d456a694eaf78968a4a
Author: lash <dev@holbrook.no>
Date:   Sat,  4 Feb 2023 10:57:08 +0000

Merge branch 'master' into lash/period

Diffstat:
M.gitignore | 2++
Mpython/requirements.txt | 2+-
Mpython/test_requirements.txt | 2+-
Mpython/tests/test_basic.py | 22++++++++++++++++++++++
4 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -4,3 +4,4 @@ build/ dist/ solidity/*.json solidity/*.bin +.venv +\ No newline at end of file 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.5.0 diff --git a/python/test_requirements.txt b/python/test_requirements.txt @@ -1,3 +1,3 @@ eth_tester==0.5.0b3 py-evm==0.3.0a20 -accounts_index~=0.3.0 +eth-accounts-index~=0.3.0 diff --git a/python/tests/test_basic.py b/python/tests/test_basic.py @@ -146,6 +146,28 @@ class TestFaucet(EthTesterCase): r = self.conn.do(o) self.assertEqual(int(r, 16), prebalance - cost + 1000) + def test_payable_with_tx_data(self): + nonce_oracle = RPCNonceOracle(self.accounts[0], self.conn) + c = EthFaucet(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle) + + o = balance(self.accounts[0]) + r = self.conn.do(o) + prebalance = int(r, 16) + + gas_price = 1000000000 + contract_gas_oracle = OverrideGasOracle(limit=21055, price=gas_price, conn=self.conn) + cg = Gas(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle, gas_oracle=contract_gas_oracle) + (tx_hash_hex, o) = cg.create(self.accounts[0], self.address, 1000, data='0x0') + self.conn.do(o) + + o = receipt(tx_hash_hex) + r = self.conn.do(o) + cost = r['gas_used'] * gas_price + self.assertEqual(r['status'], 0) + + o = balance(self.accounts[0]) + r = self.conn.do(o) + self.assertEqual(int(r, 16), prebalance - cost) if __name__ == '__main__': unittest.main()