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

feat/Interact directly with the pool in Uniswap connector #136

Conversation

VPashkov
Copy link
Contributor

Before submitting this PR, please make sure:

  • Your code builds clean without any errors or warnings
  • You are using approved title ("feat/", "fix/", "docs/", "refactor/")

A description of the changes proposed in the pull request:
Adds the ability to use Quoter rather than Smart Order Router to the Uniswap connector as an option.
To achieve this uniswap.yml config file is extended with the following:

  • useRouter (bool, default=true) - if True, estimation and execution functions use the Router; if false, use quote and trade functions of SDK.
  • feeTier (string, default='MEDIUM') - Matches one of the Uniswap fee tier strings. If useRouter is False, then the user has to specify feeTier to find the right pool.
  • uniswapV3QuoterV2ContractAddress (string) - a variable added to each network in contractAddresses section. Stores the address of Uniswap Quoter V2. It can be found here https://docs.uniswap.org/contracts/v3/reference/deployments.

Tests performed by the developer:

  • Requests to get price and to execute trade sent using examples from test-helpers/curl/curl.sh. E.g.:
curl -s -X POST -k --key $GATEWAY_KEY --cert $GATEWAY_CERT -H "Content-Type: application/json" -d "$(envsubst < ./test-helpers/curl/requests/price_uniswap.json)" https://localhost:15888/amm/price | jq
  • Checked that prices returned by the Quoter are the same(or very close) as those returned by the Router when using the same fee tier.
  • Checked that executing trades(/amm/trade) works with the Quoter.

Tips for QA testing:

  • Sometimes price returned using the Router is different than using the Quoter. This is usually due to a different fee tier. Try a different value for feeTier variable in uniswap.yml config file to get the same price.

@VPashkov
Copy link
Contributor Author

Resolves #112

@nikspz nikspz requested review from fengtality and nikspz June 28, 2023 14:23
@toxicehc
Copy link

toxicehc commented Jul 2, 2023

Hi @VPashkov , how would I test this on a HB/gateway instance running from source? The production version of the gateway is no longer able to get prices from Uniswap as of some days ago..

Copy link
Contributor

@fengtality fengtality left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

  • Reviewed code - looks clean
  • Tested on Goerli - buy and sell trades worked
  • Ran tests successfully

Thanks for the contribution!

@fengtality fengtality merged commit 6416491 into hummingbot:development Jul 2, 2023
@emusol
Copy link

emusol commented Jul 9, 2023

Hey this seems to not solve the LP side of uniswap, maybe similar udpate to the code can help?

@nikspz
Copy link
Contributor

nikspz commented Jul 11, 2023

#152 Created issue for UniswapLP

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

5 participants