diff --git a/README.md b/README.md index 21a166e..47b666d 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ Samples below: ``` cd /api flask -A api create_enabled_token GNO 10200 0x19C653Da7c37c66208fbfbE8908A5051B57b4C70 0.01 erc20 -flask -A api create_enabled_token GNO 10200 0x0000000000000000000000000000000000000000 0.01 native +flask -A api create_enabled_token xDAI 10200 0x0000000000000000000000000000000000000000 0.01 native ``` Once enabled, the token wil appear in the list of enabled tokens on the endpoint `api/v1/info`. diff --git a/api/api/routes.py b/api/api/routes.py index 2767b45..da0f966 100644 --- a/api/api/routes.py +++ b/api/api/routes.py @@ -133,7 +133,7 @@ def _ask(request_data, validate_captcha=True, access_key=None): if transaction: time_diff_seconds = (datetime.utcnow() - transaction.created).total_seconds() if time_diff_seconds < current_app.config['FAUCET_RATE_LIMIT_TIME_LIMIT_SECONDS']: - time_diff_hours = time_diff_seconds/(24*60) + time_diff_hours = 24-(time_diff_seconds/(24*60)) return jsonify(errors=['recipient: you have exceeded the limit for today. Try again in %d hours' % time_diff_hours]), 429 # convert amount to wei format @@ -144,7 +144,8 @@ def _ask(request_data, validate_captcha=True, access_key=None): w3 = Web3Singleton(current_app.config['FAUCET_RPC_URL'], current_app.config['FAUCET_PRIVATE_KEY']) - if token_address == 'native': + token = Token.get_by_address(token_address) + if token.type == 'native': tx_hash = claim_native(w3, current_app.config['FAUCET_ADDRESS'], recipient, amount_wei) else: tx_hash = claim_token(w3, current_app.config['FAUCET_ADDRESS'], recipient, amount_wei, token_address)