commit 35df6482fbf9a0334c81ef879d52a6e663569dfb
parent 4d33821358deff2ed70f51ea16e1b083d7067481
Author: nolash <dev@holbrook.no>
Date: Wed, 14 Apr 2021 20:18:24 +0200
Add amount query
Diffstat:
2 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/python/erc20_single_shot_faucet/faucet.py b/python/erc20_single_shot_faucet/faucet.py
@@ -108,3 +108,22 @@ class SingleShotFaucet(TxFactory):
return abi_decode_single(ABIContractType.ADDRESS, v)
+ def amount(self, contract_address, block_height=None, sender_address=ZERO_ADDRESS):
+ o = jsonrpc_template()
+ o['method'] = 'eth_call'
+ enc = ABIContractEncoder()
+ enc.method('amount')
+ data = add_0x(enc.get())
+ tx = self.template(sender_address, contract_address)
+ tx = self.set_code(tx, data)
+ o['params'].append(self.normalize(tx))
+
+ if block_height != None:
+ o['params'].append(block_height)
+
+ return o
+
+
+ @classmethod
+ def parse_amount(self, v):
+ return abi_decode_single(ABIContractType.UINT256, v)
diff --git a/python/setup.cfg b/python/setup.cfg
@@ -1,6 +1,6 @@
[metadata]
name = erc20-single-shot-faucet
-version = 0.2.0a13
+version = 0.2.0a14
description = ERC20 token faucet that can be used once per account
author = Louis Holbrook
author_email = dev@holbrook.no