Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Pancakeswap router not returning valid routes for /amm/price #369

Open
fengtality opened this issue Nov 23, 2024 · 2 comments · Fixed by #371
Open

[Bug] Pancakeswap router not returning valid routes for /amm/price #369

fengtality opened this issue Nov 23, 2024 · 2 comments · Fixed by #371
Assignees
Labels
bug Something isn't working pancakeswap connector

Comments

@fengtality
Copy link
Contributor

fengtality commented Nov 23, 2024

There appears to be an issue with the Pancakeswap connector where it doesn't return routes for valid token pairs:

Route: /amm/price

Params:

{
    "chain": "binance-smart-chain",
    "network": "mainnet",
    "connector": "pancakeswap",
    "base": "WBNB",
    "quote": "USDT",
    "amount": "0.001",
    "side": "SELL"
}

Response:

{
    "message": "Price query failed: Cannot find a valid swap route",
    "httpErrorCode": 500,
    "errorCode": 1013,
    "stack": "Error: Price query failed: Cannot find a valid swap route\n    at /Users/feng/gateway/dist/src/connectors/uniswap/uniswap.controllers.js:77:23\n    at Generator.throw (<anonymous>)\n    at rejected (/Users/feng/gateway/dist/src/connectors/uniswap/uniswap.controllers.js:6:65)\n    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)"
}

I did some debugging and believe the issue is with SmartRouter.getBestTrade function (https://github.com/hummingbot/gateway/blob/main/src/connectors/pancakeswap/pancakeswap.ts#L454C1-L470C4).

Here are Gateway log statements for the request above (I added some logger statements to identify the source of the issue):

2024-11-22 10:53:49 | info | 	Getting trade info with params: base=WBNB, quote=USDT, amount=0.001, side=SELL, allowedSlippage=undefined, poolId=undefined, chain=mainnet, router=0x13f4EA83D0bd40E75C8222255bc855a974568Dd4
2024-11-22 10:53:49 | info | 	Fetching pair data on PancakeSwap for 0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c-0x55d398326f99059fF775485246999027B3197955.
2024-11-22 10:53:49 | info | 	Getting best trade for WBNB-USDT, amount: 1000000000000000, type: 0
2024-11-22 10:53:49 | info | 	getBestTrade detailed inputs:
      Base Token:
        - Address: 0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c
        - Symbol: WBNB
        - Decimals: 18
        - ChainId: 56
      Quote Token:
        - Address: 0x55d398326f99059fF775485246999027B3197955
        - Symbol: USDT
        - Decimals: 18
        - ChainId: 56
      Amount: 1000000000000000
      Base Token Amount: 0.001
      Trade Type: EXACT_INPUT
      Max Hops: 4
    
2024-11-22 10:53:49 | info | 	Created quote provider
2024-11-22 10:53:49 | info | 	Found 3 pools for pair
2024-11-22 10:53:49 | info | 	Requesting best trade from SmartRouter...
2024-11-22 10:53:49 | error | 	Error in getBestTrade: Error: Cannot find a valid swap route
2024-11-22 10:53:49 | error | 	Price query failed: Cannot find a valid swap route

It looks like the router identifies 3 pools for the WBNB-USDT pair, but still doesn't return a valid route. The issue may be with the router address, function inputs, or another aspect of this connector.

@fengtality fengtality added bug Something isn't working pancakeswap connector labels Nov 23, 2024
@fengtality fengtality moved this to Open in Bounties Board Nov 23, 2024
@fengtality
Copy link
Contributor Author

Bounty

  • Type: Bug
  • Sponsor: Hummingbot Foundation
  • Source: Pancakeswap Connector Pot
  • Bounty amount: 50K HBOT
  • Developer portion: 50K HBOT

Description

  • Investigate the issue above and issue a pull request that implements a fix
  • Acceptance criteria: This route should return price for valid token pairs with at least 1 pool

@fengtality
Copy link
Contributor Author

I believe this issue is now fixed in #371

@nikspz nikspz moved this from Open to Submitted in Bounties Board Dec 2, 2024
@nikspz nikspz moved this from Submitted to Merged in Bounties Board Dec 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working pancakeswap connector
Projects
Status: Merged
Development

Successfully merging a pull request may close this issue.

1 participant