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/curve connector #190

Merged
merged 20 commits into from
Nov 7, 2023
Merged

Conversation

vic-en
Copy link
Collaborator

@vic-en vic-en commented Aug 23, 2023

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 Curve connector as requested in #101

Tests performed by the developer:

  • End-to-end testing
  • Curl test

Tips for QA testing:

  • End-to-end testing
  • Curl test

@nikspz
Copy link
Contributor

nikspz commented Sep 7, 2023

hi @vic-en Could you please resolve PR conflicts?

@nikspz
Copy link
Contributor

nikspz commented Oct 2, 2023

hi @vic-en Could you please resolve branch conflicts?

@vic-en
Copy link
Collaborator Author

vic-en commented Oct 3, 2023

@nikspz Thanks for the remider. I'll do that soon.

@nikspz
Copy link
Contributor

nikspz commented Oct 4, 2023

@vic-en
image
Failed to connect curve_ethereum_arbitrum_one, we changed arbitrum_one to arbitrum in this PR:
#182

https://github.com/hummingbot/gateway/pull/190/files#diff-3da0f62b628e70f6c6c61c5639b159cef26ac44014ad209777d499620c694fe4R14

@nikspz
Copy link
Contributor

nikspz commented Oct 6, 2023

@vic-en image Failed to connect, we changed arbitrum_one to arbitrum in this PR: #182

https://github.com/hummingbot/gateway/pull/190/files#diff-3da0f62b628e70f6c6c61c5639b159cef26ac44014ad209777d499620c694fe4R14

Also connected ethereum mainnet, avalanche and polygon successfully, however failed connecting curve_ethereum_optimism:

logs_hummingbot.log
logs_gateway_app.log

image

@vic-en
Copy link
Collaborator Author

vic-en commented Oct 16, 2023

@nikspz This is ready for review again.

Note that you may have to restart the stategy a second time if apporval don't go through the first time.

@nikspz
Copy link
Contributor

nikspz commented Oct 16, 2023

@vic-en Could you please add fix for arbitrum_one to arbitrum here?

image
image

Failed to connect curve_ethereum_arbitrum,
For the reference: we changed arbitrum_one to arbitrum in this PR #182

https://github.com/hummingbot/gateway/pull/190/files#diff-3da0f62b628e70f6c6c61c5639b159cef26ac44014ad209777d499620c694fe4R14

@vic-en
Copy link
Collaborator Author

vic-en commented Oct 16, 2023

@nikspz Renamed.

@nikspz
Copy link
Contributor

nikspz commented Oct 17, 2023

  • Test performed:
    • Cloned and installed latest dev branch + gwPR190
    • connected curve_ethereum_mainnet and curve_avalanche_avalanche successfully
    • checked balance for curve_ethereum_mainnet and curve_avalanche_avalanche successfully
    • connected curve_ethereum_arbitrum, curve_ethereum_optimism successfully
    • gateway connector-tokens curve_ethereum_arbitrum WETH,USDC added successfully
    • checked balance curve_ethereum_arbitrum, curve_ethereum_optimism successfully
    • token approval for curve_ethereum_arbitrum successful
    • created/started amm_arb strategy using curve_ethereum_arbitrum
    • failed to check buy/sell/mid prices for curve_ethereum_arbitrum
      image

Steps to reproduce:

  1. Cloned and installed latest dev branch + gwPR190
  2. gateway connect curve_ethereum_mainnet, gateway connect curve_ethereum_arbitrum
  3. create/start amm_arb using this connectors, review no price showed for curve

Same thing for Curl tests for arbitrum and mainnet:

{
  "connector": "curve",
  "chain": "ethereum",
  "network": "mainnet",
  "quote": "WETH",
  "base": "USDC",
  "amount": "0.04",
  "side": "BUY"
}

image
image
image

@vic-en
Copy link
Collaborator Author

vic-en commented Oct 18, 2023

@nikspz
I'm using the registry to find the best pool. That implies that the registry couldn't find a pool that has reserves for the tokens in that pair.

For Arbitrum(https://curve.fi/#/arbitrum/pools), there are only 18 pools in total.

For Eth mainnet(https://curve.fi/#/ethereum/pools), no single pool has reserves for both WETH and USDC.

Note that some pools have ETH reserves. Unfortunately, we don't currently support that case. So there may be a pool that has ETH and USDC reserves.

@vic-en
Copy link
Collaborator Author

vic-en commented Oct 18, 2023

I'll push a commit to properly return an error rather than Zero prices.

pls let me know who will be doing dev review.

Thanks.

@nikspz
Copy link
Contributor

nikspz commented Oct 18, 2023

  • Test performed:
    • Cloned and installed latest development and gwPR190 latest commit 382b551
    • created/start amm_arb using curve_ethereum_arbitrum
    • curl on curve:
      • ethereum_mainnet: Error: Price query failed: No pool found for
      • ethereum_arbitrum: Error: Price query failed: No pool found for
      • polygon_mainnet: Error: Price query failed: No pool found for
      • avalanche_avalanche Error: unsupported chain or connector
        image

amm_arb using curve_ethereum_arbitrum

No pool found for WETH-USDC arbitrum1

@vic-en
Copy link
Collaborator Author

vic-en commented Oct 18, 2023

@nikspz You can also test with markets that have a pool.

@nikspz
Copy link
Contributor

nikspz commented Oct 19, 2023

  • Test performed:
    - Cloned and installed latest development and gwPR190 latest commit [382b551](382b551)
    - test another pairs that have pools on curve
    - ethereum mainnet
    - triple pool WBTC, ETH, USDC (factory, (Factory pool is permissionless, deployed by anyone))

gw curve190 WBTC-USDC

  • ethereum mainnet: WBTC-USDC ❌Price query failed: No pool found

image
image

  • pool with one pair FRAX-USDC ✅
  • pool with 3 tokens WBTC-ETH-USDT works ✅
    - WBTC-USDT and WETH-USDT ✅

image

  • avalanche
    - Pool DAI.e-USDC.e - request failed with Error: unsupported chain or connector ❌❌
            {
              "connector": "curve",
              "chain": "avalanche",
              "network": "avalanche",
              "quote": "USDC.e",
              "base": "DAI.e",
              "amount": "100",
              "side": "BUY"
            }

image

  • polygon mainnet
    - pool https://curve.fi/#/polygon/pools/atricrypto3/deposit
    - have WBTC-USDC
    - request failed ❌ with error: Price query failed: No pool found for 0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174 to 0x1BFD67037B42Cf73acF2047067bd4F2C47D9BfD6 (however pool above has liquidity for it)

image

  • WBTC-USDT
    - request failed ❌with error: Price query failed: No pool found for
    image

  • USDT-USDC
    - request failed ❌❌ with error:

            {
              "message": "Price query failed: missing revert data in call exception; Transaction reverted without a reason string [ See: https://links.ethers.org/v5-errors-CALL_EXCEPTION ] (data=\"0x\", transaction={\"gasLimit\":{\"type\":\"BigNumber\",\"hex\":\"0x11d16339\"},\"to\":\"0x2a426b3Bb4fa87488387545f15D01d81352732F9\",\"data\":\"0x4e21df75000000000000000000000000c2132d05d31c914a87c6611c10748aeb04b58e8f0000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa841740000000000000000000000000000000000000000000000000000000005f5e100\",\"accessList\":null}, error={\"reason\":\"processing response error\",\"code\":\"SERVER_ERROR\",\"body\":\"{\\\"jsonrpc\\\":\\\"2.0\\\",\\\"id\\\":47,\\\"error\\\":{\\\"code\\\":-32000,\\\"message\\\":\\\"execution reverted\\\"}}\",\"error\":{\"code\":-32000},\"requestBody\":\"{\\\"method\\\":\\\"eth_call\\\",\\\"params\\\":[{\\\"gas\\\":\\\"0x11d16339\\\",\\\"to\\\":\\\"0x2a426b3bb4fa87488387545f15d01d81352732f9\\\",\\\"data\\\":\\\"0x4e21df75000000000000000000000000c2132d05d31c914a87c6611c10748aeb04b58e8f0000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa841740000000000000000000000000000000000000000000000000000000005f5e100\\\"},\\\"latest\\\"],\\\"id\\\":47,\\\"jsonrpc\\\":\\\"2.0\\\"}\",\"requestMethod\":\"POST\",\"url\":\"https://polygon-mainnet.infura.io/v3/4937790794744fe781f3f9b0e64c1d83\"}, code=CALL_EXCEPTION, version=providers/5.7.2)",
              "httpErrorCode": 500,
              "errorCode": 1013,
              "stack": "Error: Price query failed: missing revert data in call exception; Transaction reverted without a reason string [ See: https://links.ethers.org/v5-errors-CALL_EXCEPTION ] (data=\"0x\", transaction={\"gasLimit\":{\"type\":\"BigNumber\",\"hex\":\"0x11d16339\"},\"to\":\"0x2a426b3Bb4fa87488387545f15D01d81352732F9\",\"data\":\"0x4e21df75000000000000000000000000c2132d05d31c914a87c6611c10748aeb04b58e8f0000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa841740000000000000000000000000000000000000000000000000000000005f5e100\",\"accessList\":null}, error={\"reason\":\"processing response error\",\"code\":\"SERVER_ERROR\",\"body\":\"{\\\"jsonrpc\\\":\\\"2.0\\\",\\\"id\\\":47,\\\"error\\\":{\\\"code\\\":-32000,\\\"message\\\":\\\"execution reverted\\\"}}\",\"error\":{\"code\":-32000},\"requestBody\":\"{\\\"method\\\":\\\"eth_call\\\",\\\"params\\\":[{\\\"gas\\\":\\\"0x11d16339\\\",\\\"to\\\":\\\"0x2a426b3bb4fa87488387545f15d01d81352732f9\\\",\\\"data\\\":\\\"0x4e21df75000000000000000000000000c2132d05d31c914a87c6611c10748aeb04b58e8f0000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa841740000000000000000000000000000000000000000000000000000000005f5e100\\\"},\\\"latest\\\"],\\\"id\\\":47,\\\"jsonrpc\\\":\\\"2.0\\\"}\",\"requestMethod\":\"POST\",\"url\":\"https://polygon-mainnet.infura.io/v3/4937790794744fe781f3f9b0e64c1d83\"}, code=CALL_EXCEPTION, version=providers/5.7.2)\n    at /home/etozhe/gwcu2/dist/src/connectors/uniswap/uniswap.controllers.js:74:23\n    at Generator.throw (<anonymous>)\n    at rejected (/home/etozhe/gwcu2/dist/src/connectors/uniswap/uniswap.controllers.js:6:65)\n    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)"
            }

image

@rapcmia rapcmia requested review from fengtality and nikspz October 20, 2023 02:05
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

@fengtality
Copy link
Contributor

I added a commit that fixes yarn.lock: #215

@fengtality fengtality merged commit 886b768 into hummingbot:development Nov 7, 2023
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants