Closed martinkou closed 2 years ago
Approval isn't done every time. Strategy will skip approval if allowances exist for both router and nft-manager contracts. Approval could have been successful from an earlier run of the strategy.
@james-hummingbot add any details you want here.
It's possible that I'm also running into this. I'm trying to setup to trade a NEXO-WETH LP. Following the guides on https://docs.hummingbot.io/strategies/uniswap-v3-lp/ , https://docs.hummingbot.io/installation/gateway/#install-gateway-via-docker , and https://docs.hummingbot.io/operation/connect-exchange/#option-1-infura , I'm able to get to the place where I can check my balances and create the strategy. When I start it, though, I see the following:
And the following log outputs from client:
2021-08-15 17:00:49,968 - 1 - hummingbot.client.hummingbot_application - INFO - start command initiated.
2021-08-15 17:00:50,671 - 1 - hummingbot.connector.connector.uniswap.uniswap_connector - INFO - Network status has changed to NetworkStatus.CONNECTED. Starting networking...
2021-08-15 17:00:50,674 - 1 - hummingbot.connector.connector.uniswap.uniswap_connector - INFO - Checking for allowances...
2021-08-15 17:00:51,001 - 1 - hummingbot.strategy.uniswap_v3_lp.uniswap_v3_lp - WARNING - Uniswap v3 connector is not ready. Please wait...
2021-08-15 17:00:51,872 - 1 - hummingbot.core.utils.async_utils - ERROR - Unhandled error in background task: Expecting value: line 1 column 1 (char 0)
Traceback (most recent call last):
File "/home/hummingbot/hummingbot/core/utils/async_utils.py", line 9, in safe_wrapper
return await c
File "/home/hummingbot/hummingbot/connector/connector/uniswap/uniswap_connector.py", line 139, in auto_approve
amount_approved = await self.approve_uniswap_spender(token)
File "/home/hummingbot/hummingbot/connector/connector/uniswap_v3/uniswap_v3_connector.py", line 585, in approve_uniswap_spender
resp = await self._api_request("post",
File "/home/hummingbot/hummingbot/connector/connector/uniswap/uniswap_connector.py", line 586, in _api_request
parsed_response = json.loads(await response.text())
File "/home/hummingbot/miniconda3/envs/hummingbot/lib/python3.8/json/__init__.py", line 357, in loads
return _default_decoder.decode(s)
File "/home/hummingbot/miniconda3/envs/hummingbot/lib/python3.8/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/home/hummingbot/miniconda3/envs/hummingbot/lib/python3.8/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
2021-08-15 17:00:52,002 - 1 - hummingbot.strategy.uniswap_v3_lp.uniswap_v3_lp - WARNING - Uniswap v3 connector is not ready. Please wait...
2021-08-15 17:00:53,001 - 1 - hummingbot.strategy.uniswap_v3_lp.uniswap_v3_lp - WARNING - Uniswap v3 connector is not ready. Please wait...
2021-08-15 17:00:54,001 - 1 - hummingbot.strategy.uniswap_v3_lp.uniswap_v3_lp - WARNING - Uniswap v3 connector is not ready. Please wait...
2021-08-15 17:00:55,001 - 1 - hummingbot.strategy.uniswap_v3_lp.uniswap_v3_lp - WARNING - Uniswap v3 connector is not ready. Please wait...
2021-08-15 17:00:56,000 - 1 - hummingbot.strategy.uniswap_v3_lp.uniswap_v3_lp - WARNING - Uniswap v3 connector is not ready. Please wait...
2021-08-15 17:00:56,216 - 1 - hummingbot.client.hummingbot_application - INFO - stop command initiated.
And gateway:
2021-08-15 01:24:41 | info | Using fixed gas price: undefined
2021-08-15 01:24:41 | info | get manual fixed gas price: NaN / interval: 120 sec
2021-08-15 01:24:41 | info | {"app":"gateway-api","port":5000,"ethereumChain":"mainnet","terraChain":null}
2021-08-15 01:44:25 | info | Request from IP: ::ffff:172.17.0.1 GET /api
2021-08-15 01:44:25 | info | Request from IP: ::ffff:172.17.0.1 GET /eth/uniswap/v3/start?pairs=%5B%22NEXO-WETH%22%5D
2021-08-15 01:44:25 | info | Request from IP: ::ffff:172.17.0.1 POST /eth/allowances
2021-08-15 01:44:25 | info | Request from IP: ::ffff:172.17.0.1 POST /eth/allowances
2021-08-15 01:44:26 | info | Request from IP: ::ffff:172.17.0.1 POST /eth/balances
2021-08-15 01:44:26 | info | Request from IP: ::ffff:172.17.0.1 POST /eth/approve
2021-08-15 01:44:26 | error | value must be a string (argument="value", value=undefined, code=INVALID_ARGUMENT, version=units/5.4.0)
2021-08-15 01:59:51 | info | Request from IP: ::ffff:172.17.0.1 GET /api
I'm running the 0.42.0 from docker 'latest' using the install scripts from the 'development' branch. The gateway-api that I'm running is from the 'latest' docker image installed from create-gateway script.
Running on LinuxMint 'Tricia' in docker 19.03.
Here are the configs:
One interesting thing you may note is how quickly I stop it after I start it. That's because it racks up about 10k of eth_call
events on Infura in about a minute. In order to keep from getting rate-limited, I stop it fairly quickly.
As discussed with @vic-en, he will add nonceManager support to approvals, which should enable batch approval calls to succeed and solve this issue
This issue should be fixed by #127, which improves how multiple approvals are handled. To test this fix, the client should be able to start a new AMM-ARB strategy using the uniswap
connector successfully using a wallet that doesn't have any allowances for uniswap
.
@vic-en Running the test/add_test_script_for_uniswap_v3
branch with the approvals fix, I still got an error when starting AMM-ARB on a new wallet with no allowances. This was for balancer but I also got it for Uniswap:
Traceback (most recent call last):
File "/Users/feng/Code/hummingbot/hummingbot/core/utils/async_utils.py", line 9, in safe_wrapper
return await c
File "/Users/feng/Code/hummingbot/hummingbot/connector/connector/balancer/balancer_connector.py", line 137, in auto_approve
amount_approved = await self.approve_balancer_spender(token)
File "/Users/feng/Code/hummingbot/hummingbot/connector/connector/balancer/balancer_connector.py", line 149, in approve_balancer_spender
resp = await self._api_request("post",
File "/Users/feng/Code/hummingbot/hummingbot/connector/connector/balancer/balancer_connector.py", line 589, in _api_request
parsed_response = json.loads(await response.text())
File "/Users/feng/anaconda3/envs/hummingbot/lib/python3.8/json/__init__.py", line 357, in loads
return _default_decoder.decode(s)
File "/Users/feng/anaconda3/envs/hummingbot/lib/python3.8/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/Users/feng/anaconda3/envs/hummingbot/lib/python3.8/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
It's possible that I'm also running into this. I'm trying to setup to trade a NEXO-WETH LP. Following the guides on https://docs.hummingbot.io/strategies/uniswap-v3-lp/ , https://docs.hummingbot.io/installation/gateway/#install-gateway-via-docker , and https://docs.hummingbot.io/operation/connect-exchange/#option-1-infura , I'm able to get to the place where I can check my balances and create the strategy. When I start it, though, I see the following:
And the following log outputs from client:
2021-08-15 17:00:49,968 - 1 - hummingbot.client.hummingbot_application - INFO - start command initiated. 2021-08-15 17:00:50,671 - 1 - hummingbot.connector.connector.uniswap.uniswap_connector - INFO - Network status has changed to NetworkStatus.CONNECTED. Starting networking... 2021-08-15 17:00:50,674 - 1 - hummingbot.connector.connector.uniswap.uniswap_connector - INFO - Checking for allowances... 2021-08-15 17:00:51,001 - 1 - hummingbot.strategy.uniswap_v3_lp.uniswap_v3_lp - WARNING - Uniswap v3 connector is not ready. Please wait... 2021-08-15 17:00:51,872 - 1 - hummingbot.core.utils.async_utils - ERROR - Unhandled error in background task: Expecting value: line 1 column 1 (char 0) Traceback (most recent call last): File "/home/hummingbot/hummingbot/core/utils/async_utils.py", line 9, in safe_wrapper return await c File "/home/hummingbot/hummingbot/connector/connector/uniswap/uniswap_connector.py", line 139, in auto_approve amount_approved = await self.approve_uniswap_spender(token) File "/home/hummingbot/hummingbot/connector/connector/uniswap_v3/uniswap_v3_connector.py", line 585, in approve_uniswap_spender resp = await self._api_request("post", File "/home/hummingbot/hummingbot/connector/connector/uniswap/uniswap_connector.py", line 586, in _api_request parsed_response = json.loads(await response.text()) File "/home/hummingbot/miniconda3/envs/hummingbot/lib/python3.8/json/__init__.py", line 357, in loads return _default_decoder.decode(s) File "/home/hummingbot/miniconda3/envs/hummingbot/lib/python3.8/json/decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/home/hummingbot/miniconda3/envs/hummingbot/lib/python3.8/json/decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) 2021-08-15 17:00:52,002 - 1 - hummingbot.strategy.uniswap_v3_lp.uniswap_v3_lp - WARNING - Uniswap v3 connector is not ready. Please wait... 2021-08-15 17:00:53,001 - 1 - hummingbot.strategy.uniswap_v3_lp.uniswap_v3_lp - WARNING - Uniswap v3 connector is not ready. Please wait... 2021-08-15 17:00:54,001 - 1 - hummingbot.strategy.uniswap_v3_lp.uniswap_v3_lp - WARNING - Uniswap v3 connector is not ready. Please wait... 2021-08-15 17:00:55,001 - 1 - hummingbot.strategy.uniswap_v3_lp.uniswap_v3_lp - WARNING - Uniswap v3 connector is not ready. Please wait... 2021-08-15 17:00:56,000 - 1 - hummingbot.strategy.uniswap_v3_lp.uniswap_v3_lp - WARNING - Uniswap v3 connector is not ready. Please wait... 2021-08-15 17:00:56,216 - 1 - hummingbot.client.hummingbot_application - INFO - stop command initiated.
And gateway:
2021-08-15 01:24:41 | info | Using fixed gas price: undefined 2021-08-15 01:24:41 | info | get manual fixed gas price: NaN / interval: 120 sec 2021-08-15 01:24:41 | info | {"app":"gateway-api","port":5000,"ethereumChain":"mainnet","terraChain":null} 2021-08-15 01:44:25 | info | Request from IP: ::ffff:172.17.0.1 GET /api 2021-08-15 01:44:25 | info | Request from IP: ::ffff:172.17.0.1 GET /eth/uniswap/v3/start?pairs=%5B%22NEXO-WETH%22%5D 2021-08-15 01:44:25 | info | Request from IP: ::ffff:172.17.0.1 POST /eth/allowances 2021-08-15 01:44:25 | info | Request from IP: ::ffff:172.17.0.1 POST /eth/allowances 2021-08-15 01:44:26 | info | Request from IP: ::ffff:172.17.0.1 POST /eth/balances 2021-08-15 01:44:26 | info | Request from IP: ::ffff:172.17.0.1 POST /eth/approve 2021-08-15 01:44:26 | error | value must be a string (argument="value", value=undefined, code=INVALID_ARGUMENT, version=units/5.4.0) 2021-08-15 01:59:51 | info | Request from IP: ::ffff:172.17.0.1 GET /api
I'm running the 0.42.0 from docker 'latest' using the install scripts from the 'development' branch. The gateway-api that I'm running is from the 'latest' docker image installed from create-gateway script.
Running on LinuxMint 'Tricia' in docker 19.03.
Here are the configs:
I see you're using an old config file. Pls ensure you re-create global_config.yml file with updated key names as in global_conf.yml.example file.
Is there a workaround for this? I tried manually approving token spend for the pair for uniswap router V3, but I can see in the logs its trying to POST /eth/approve
still with the error:
value must be a string (argument="value", value=undefined, code=INVALID_ARGUMENT, version=units/5.4.0)
@dennisocana can you confirm that this was fixed by the PR #127 so we can close this?
Yes, this was fixed by #127
When I'm starting the Uniswap V3 strategy with a new Ethereum account, without pre-approving the Uniswap router to the tokens - the Hummingbot logs would say the tokens are approved, but no approval transactions are sent to the Ethereum blockchain. As a result, the Uniswap V3 strategy is unable to create any positions.