CoinAlpha / gateway-api

Apache License 2.0
47 stars 25 forks source link

Update balancer for recent gateway changes #140

Closed fengtality closed 2 years ago

fengtality commented 2 years ago

While we have fixed Uniswap and Uniswap-V3, these fixes have not yet been applied to the Balancer connector.

Modify the Balancer connector so that the AMM-ARB strategy can work with it. Since it should have the same responses and routes as the Uniswap connector, no client changes should be needed.

During testing, I encountered the following issues:

  1. Approval bug

    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)
  2. Pool not found when it exists

    2021-08-27 07:24:31,138 - 56341 - hummingbot.connector.connector.balancer.balancer_connector - INFO - Unable to get price. No Pool Available

3 QA bug #139