erc20-faucet

ERC20 token faucet
Log | Files | Refs

commit c0cf53789d23a4c3e3ab47e42eafb370d06a9f50
parent 18abda7d2b746ef7538c81a653b3ae6d378a5a1e
Author: nolash <dev@holbrook.no>
Date:   Mon, 28 Jun 2021 10:08:21 +0200

Move to chainlib-eth

Diffstat:
Mpython/CHANGELOG | 3+++
Mpython/erc20_faucet/faucet.py | 1-
Mpython/erc20_faucet/interface.py | 21+++++++++++++--------
Mpython/requirements.txt | 4++--
Mpython/setup.cfg | 2+-
Mpython/test_requirements.txt | 3+--
Mpython/tests/test_basic.py | 2+-
7 files changed, 21 insertions(+), 15 deletions(-)

diff --git a/python/CHANGELOG b/python/CHANGELOG @@ -1,3 +1,6 @@ +- 0.2.2-pending + * Move to chainlib-eth +- 0.2.1-unreleased - 0.2.0-unreleased * Add external signer * Standardize arg flags diff --git a/python/erc20_faucet/faucet.py b/python/erc20_faucet/faucet.py @@ -16,7 +16,6 @@ from chainlib.eth.contract import ( ABIContractEncoder, ABIContractType, ) -from chainlib.jsonrpc import jsonrpc_template from hexathon import add_0x # local imports diff --git a/python/erc20_faucet/interface.py b/python/erc20_faucet/interface.py @@ -15,7 +15,7 @@ from chainlib.eth.contract import ( from chainlib.eth.tx import ( TxFormat, ) -from chainlib.jsonrpc import jsonrpc_template +from chainlib.jsonrpc import JSONRPCRequest from chainlib.eth.error import RequestMismatchException from hexathon import ( add_0x, @@ -115,8 +115,9 @@ class Faucet(TxFactory): return tx - def usable_for(self, contract_address, address, sender_address=ZERO_ADDRESS): - o = jsonrpc_template() + def usable_for(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('cooldown') @@ -126,6 +127,7 @@ class Faucet(TxFactory): tx = self.template(sender_address, contract_address) tx = self.set_code(tx, data) o['params'].append(self.normalize(tx)) + o = j.finalize(o) return o @@ -135,8 +137,9 @@ class Faucet(TxFactory): return r == 0 - def token(self, contract_address, sender_address=ZERO_ADDRESS): - o = jsonrpc_template() + def token(self, contract_address, sender_address=ZERO_ADDRESS, id_generator=None): + j = JSONRPCRequest(id_generator) + o = j.template() o['method'] = 'eth_call' enc = ABIContractEncoder() enc.method('token') @@ -144,6 +147,7 @@ class Faucet(TxFactory): tx = self.template(sender_address, contract_address) tx = self.set_code(tx, data) o['params'].append(self.normalize(tx)) + o = j.finalize(o) return o @@ -152,8 +156,9 @@ class Faucet(TxFactory): return abi_decode_single(ABIContractType.ADDRESS, v) - def token_amount(self, contract_address, block_height=None, sender_address=ZERO_ADDRESS): - o = jsonrpc_template() + def token_amount(self, contract_address, block_height=None, sender_address=ZERO_ADDRESS, id_generator=None): + j = JSONRPCRequest(id_generator) + o = j.template() o['method'] = 'eth_call' enc = ABIContractEncoder() enc.method('tokenAmount') @@ -164,7 +169,7 @@ class Faucet(TxFactory): if block_height != None: o['params'].append(block_height) - + o = j.finalize(o) return o diff --git a/python/requirements.txt b/python/requirements.txt @@ -1,3 +1,3 @@ confini~=0.3.6rc3 -crypto-dev-signer~=0.4.14b3 -chainlib~=0.0.3a1 +crypto-dev-signer~=0.4.14b6 +chainlib-eth~=0.0.5a1 diff --git a/python/setup.cfg b/python/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = erc20-faucet -version = 0.2.1a5 +version = 0.2.2a1 description = ERC20 token faucet author = Louis Holbrook author_email = dev@holbrook.no diff --git a/python/test_requirements.txt b/python/test_requirements.txt @@ -1,4 +1,3 @@ eth_tester==0.5.0b3 py-evm==0.3.0a20 -web3==5.12.2 -giftable_erc20_token==0.0.8a10 +eth-erc20~=0.0.10a1 diff --git a/python/tests/test_basic.py b/python/tests/test_basic.py @@ -18,7 +18,7 @@ from chainlib.eth.contract import ( abi_decode_single, ABIContractType, ) -from chainlib.eth.erc20 import ERC20 +from eth_erc20 import ERC20 from chainlib.eth.nonce import RPCNonceOracle from chainlib.eth.constant import ZERO_ADDRESS from giftable_erc20_token import GiftableToken