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

UniswapLP - failed to remove liquidity (One of the tokens in this position isn't recognized) #154

Closed
nikspz opened this issue Jul 12, 2023 · 15 comments
Assignees
Labels
bug Something isn't working uniswap-lp

Comments

@nikspz
Copy link
Contributor

nikspz commented Jul 12, 2023

Describe the bug
UniswapLP - failed to remove liquidity

Steps To Reproduce
0. You Have added liquidity with id 123456

  1. Clone and install latest development Client + gateway
  2. set it up gateway to ONLINE with generate certs and yarn start
  3. connect uniswap arbitrum_one
  4. set up GATEWAY_CERT, GATEWAY_KEY and ETH_ADDRESS
  5. change eth_uniswap_position network to arbitrum_one and tokenId to 123456
  6. execute curl -s -X POST -k --key $GATEWAY_KEY --cert $GATEWAY_CERT -H "Content-Type: application/json" -d "$(envsubst < ./requests/eth_uniswap_position.json)" https://localhost:15888/amm/liquidity/remove | jq

Actual:
Failed to remove liquidity with error:

"httpErrorCode": 503,
  "errorCode": 1099,
  "stack": "Error: One of the tokens in this position isn't recognized. $token0: undefined, $token1: undefined\n    at UniswapLP.<anonymous> (/home/nikita/gwtest1/dist/src/connectors/uniswap/uniswap.lp.helper.js:285:23)\n    at Generator.next (<anonymous>)\n    at fulfilled (/home/nikita/gwtest1/dist/src/connectors/uniswap/uniswap.lp.helper.js:28:58)\n    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)"

image
Release version
dev-1.18.0

@nikspz nikspz added bug Something isn't working uniswap-lp labels Jul 12, 2023
@nikspz nikspz changed the title UniswapLP - failed to remove liquidity UniswapLP - failed to remove liquidity (One of the tokens in this position isn't recognized) Jul 12, 2023
@fengtality
Copy link
Sponsor Contributor

@nikspz Can you provide more info about the position you added and tried to remove?

  • transaction hash for the add position tx?
  • more info about the position created (tokens, address, etc)

@nikspz
Copy link
Contributor Author

nikspz commented Jul 12, 2023

@fengtality position added:
ID: 719721
Txhash: https://arbiscan.io/tx/0xbdb5878f9c30c9229783296e7241023e59fa27459e47635582398bdb3840686b

gateway logs: logs_gateway_app.log

2023-07-12 06:57:51 | info | 	Requesting balance for owner 0x08940dc9B5a19FAb9319b77C61DDA7B8067E6843. | undefined
2023-07-12 06:57:51 | info | 	Raw balance of 0x912ce59144191c1204e64559fe8253a0e49e6548 for 0x08940dc9B5a19FAb9319b77C61DDA7B8067E6843: 9925517082389357311 | undefined
2023-07-12 06:57:51 | info | 	Raw balance of 0x82af49447d8a07e3bd95bd0d56f35241523fbab1 for 0x08940dc9B5a19FAb9319b77C61DDA7B8067E6843: 6700060766820287 | undefined
2023-07-12 06:57:54 | info | 	Requesting balance for owner 0x08940dc9B5a19FAb9319b77C61DDA7B8067E6843. | undefined
2023-07-12 06:57:54 | info | 	Requesting balance for owner 0x08940dc9B5a19FAb9319b77C61DDA7B8067E6843. | undefined
2023-07-12 06:57:55 | info | 	Raw balance of 0x912ce59144191c1204e64559fe8253a0e49e6548 for 0x08940dc9B5a19FAb9319b77C61DDA7B8067E6843: 9925517082389357311 | undefined
2023-07-12 06:57:55 | info | 	Raw balance of 0x82af49447d8a07e3bd95bd0d56f35241523fbab1 for 0x08940dc9B5a19FAb9319b77C61DDA7B8067E6843: 6700060766820287 | undefined
2023-07-12 06:58:03 | info | 	Requesting spender 0xC36442b4a4522E871399CD717aBDD847Ab11FE88 allowance for owner 0x08940dc9B5a19FAb9319b77C61DDA7B8067E6843. | undefined
2023-07-12 06:58:03 | info | 	Requesting spender 0xC36442b4a4522E871399CD717aBDD847Ab11FE88 allowance for owner 0x08940dc9B5a19FAb9319b77C61DDA7B8067E6843. | undefined
2023-07-12 06:58:03 | info | 	Requesting spender 0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45 allowance for owner 0x08940dc9B5a19FAb9319b77C61DDA7B8067E6843. | undefined
2023-07-12 06:58:03 | info | 	Requesting spender 0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45 allowance for owner 0x08940dc9B5a19FAb9319b77C61DDA7B8067E6843. | undefined
2023-07-12 06:58:04 | info | 	115792089237316195423570985008687907853269984665640564039457584007913129639935 | undefined
2023-07-12 06:58:04 | info | 	9925517082389357311 | undefined
2023-07-12 06:58:04 | info | 	115792089237316195423570985008687907853269984665640564039457558134370683127830 | undefined
2023-07-12 06:58:04 | info | 	115792089237316195423570985008687907853269984665640564039457584007913129639935 | undefined
2023-07-12 06:58:04 | info | 	Requesting balance for owner 0x08940dc9B5a19FAb9319b77C61DDA7B8067E6843. | undefined
2023-07-12 06:58:04 | info | 	Requesting balance for owner 0x08940dc9B5a19FAb9319b77C61DDA7B8067E6843. | undefined
2023-07-12 06:58:04 | info | 	Raw balance of 0x82af49447d8a07e3bd95bd0d56f35241523fbab1 for 0x08940dc9B5a19FAb9319b77C61DDA7B8067E6843: 6700060766820287 | undefined
2023-07-12 06:58:04 | info | 	Raw balance of 0x912ce59144191c1204e64559fe8253a0e49e6548 for 0x08940dc9B5a19FAb9319b77C61DDA7B8067E6843: 9925517082389357311 | undefined
2023-07-12 06:58:08 | info | 	Uniswap V3 Add position Tx Hash: 0xbdb5878f9c30c9229783296e7241023e59fa27459e47635582398bdb3840686b | undefined
2023-07-12 06:58:08 | info | 	Liquidity added, txHash is 0xbdb5878f9c30c9229783296e7241023e59fa27459e47635582398bdb3840686b, nonce is 377, gasPrice is 0.1. | undefined
2023-07-12 06:58:08 | info | 	Poll arbitrum_one, txHash 0xbdb5878f9c30c9229783296e7241023e59fa27459e47635582398bdb3840686b, status 1. | undefined
2023-07-12 06:58:09 | error | 	One of the tokens in this position isn't recognized. | Error: One of the tokens in this position isn't recognized.
    at UniswapLP.<anonymous> (/home/nikita/gwfixlp/dist/src/connectors/uniswap/uniswap.lp.js:76:23)
    at Generator.next (<anonymous>)
    at fulfilled (/home/nikita/gwfixlp/dist/src/connectors/uniswap/uniswap.lp.js:28:58)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
2023-07-12 06:58:10 | error | 	One of the tokens in this position isn't recognized. | Error: One of the tokens in this position isn't recognized.
    at UniswapLP.<anonymous> (/home/nikita/gwfixlp/dist/src/connectors/uniswap/uniswap.lp.js:76:23)
    at Generator.next (<anonymous>)
    at fulfilled (/home/nikita/gwfixlp/dist/src/connectors/uniswap/uniswap.lp.js:28:58)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
2023-07-12 06:58:11 | error | 	One of the tokens in this position isn't recognized. | Error: One of the tokens in this position isn't recognized.
    at UniswapLP.<anonymous> (/home/nikita/gwfixlp/dist/src/connectors/uniswap/uniswap.lp.js:76:23)
    at Generator.next (<anonymous>)
    at fulfilled (/home/nikita/gwfixlp/dist/src/connectors/uniswap/uniswap.lp.js:28:58)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
2023-07-12 06:58:12 | error | 	One of the tokens in this position isn't recognized. | Error: One of the tokens in this position isn't recognized.
    at UniswapLP.<anonymous> (/home/nikita/gwfixlp/dist/src/connectors/uniswap/uniswap.lp.js:76:23)
    at Generator.next (<anonymous>)
    at fulfilled (/home/nikita/gwfixlp/dist/src/connectors/uniswap/uniswap.lp.js:28:58)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
2023-07-12 06:58:13 | error | 	One of the tokens in this position isn't recognized. | Error: One of the tokens in this position isn't recognized.
    at UniswapLP.<anonymous> (/home/nikita/gwfixlp/dist/src/connectors/uniswap/uniswap.lp.js:76:23)
    at Generator.next (<anonymous>)
    at fulfilled (/home/nikita/gwfixlp/dist/src/connectors/uniswap/uniswap.lp.js:28:58)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
2023-07-12 06:58:14 | error | 	One of the tokens in this position isn't recognized. | Error: One of the tokens in this position isn't recognized.
    at UniswapLP.<anonymous> (/home/nikita/gwfixlp/dist/src/connectors/uniswap/uniswap.lp.js:76:23)
    at Generator.next (<anonymous>)
    at fulfilled (/home/nikita/gwfixlp/dist/src/connectors/uniswap/uniswap.lp.js:28:58)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
2023-07-12 06:58:15 | error | 	One of the tokens in this position isn't recognized. | Error: One of the tokens in this position isn't recognized.
    at UniswapLP.<anonymous> (/home/nikita/gwfixlp/dist/src/connectors/uniswap/uniswap.lp.js:76:23)
    at Generator.next (<anonymous>)
    at fulfilled (/home/nikita/gwfixlp/dist/src/connectors/uniswap/uniswap.lp.js:28:58)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
2023-07-12 06:58:16 | error | 	One of the tokens in this position isn't recognized. | Error: One of the tokens in this position isn't recognized.
    at UniswapLP.<anonymous> (/home/nikita/gwfixlp/dist/src/connectors/uniswap/uniswap.lp.js:76:23)
    at Generator.next (<anonymous>)
    at fulfilled (/home/nikita/gwfixlp/dist/src/connectors/uniswap/uniswap.lp.js:28:58)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
2023-07-12 06:58:17 | error | 	One of the tokens in this position isn't recognized. | Error: One of the tokens in this position isn't recognized.
    at UniswapLP.<anonymous> (/home/nikita/gwfixlp/dist/src/connectors/uniswap/uniswap.lp.js:76:23)
    at Generator.next (<anonymous>)
    at fulfilled (/home/nikita/gwfixlp/dist/src/connectors/uniswap/uniswap.lp.js:28:58)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
2023-07-12 06:58:18 | error | 	One of the tokens in this position isn't recognized. | Error: One of the tokens in this position isn't recognized.
    at UniswapLP.<anonymous> (/home/nikita/gwfixlp/dist/src/connectors/uniswap/uniswap.lp.js:76:23)
    at Generator.next (<anonymous>)
    at fulfilled (/home/nikita/gwfixlp/dist/src/connectors/uniswap/uniswap.lp.js:28:58)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

image

Curl command to remove:

curl -s -X POST -k --key $GATEWAY_KEY --cert $GATEWAY_CERT -H "Content-Type: application/json" -d "$(envsubst < ./requests/eth_uniswap_position.json)" https://localhost:15888/amm/liquidity/remove | jq

eth_uniswap_position.json

{
  "address": "$ETH_ADDRESS",
  "tokenId": 719721,
  "chain": "ethereum",
  "network": "arbitrum_one",
  "connector": "uniswapLP"
}

@nikspz
Copy link
Contributor Author

nikspz commented Jul 12, 2023

tokens:
ARB:
{
"chainId":42161,
"address":"0x912ce59144191c1204e64559fe8253a0e49e6548",
"name":"Arbitrum",
"symbol":"ARB",
"decimals":18,
"logoURI":"https://assets.coingecko.com/coins/images/16547/thumb/photo_2023-03-29_21.47.00.jpeg?1680097630"
}

WETH:

{
"chainId":42161,
"address":"0x82af49447d8a07e3bd95bd0d56f35241523fbab1",
"name":"WETH",
"symbol":"WETH",
"decimals":18,
"logoURI":"https://assets.coingecko.com/coins/images/2518/thumb/weth.png?1628852295"
},

@nikspz
Copy link
Contributor Author

nikspz commented Jul 13, 2023

get position request:

curl -s -X POST -k --key $GATEWAY_KEY --cert $GATEWAY_CERT -H "Content-Type: application/json" -d "$(envsubst < ./requests/eth_uniswap_position.json)" https://localhost:15888/amm/liquidity/position | jq

image

get pool price:


curl -s -X POST -k --key $GATEWAY_KEY --cert $GATEWAY_CERT -H "Content-Type: application/json" -d "$(envsubst < ./requests/eth_uniswap_pool_price.json)" https://localhost:15888/amm/liquidity/price | jq

0x82aF49447D8a07e3bd95BD0d56f35241523fBab1 (https://arbiscan.io/address/0x82aF49447D8a07e3bd95BD0d56f35241523fBab1)
0x912CE59144191C1204E64559FE8253a0e49E6548 (https://arbiscan.io/address/0x912CE59144191C1204E64559FE8253a0e49E6548)

image

uniswapLP Client strategy status

image

@fengtality
Copy link
Sponsor Contributor

fengtality commented Jul 13, 2023

Bounty

  • Description: Fix the UniswapLP connector code so that removing liquidity works
  • Sponsor: Hummingbot Foundation
  • Bounty Rationale: Uniswap is the Gold DEX connector for Epoch 5
  • Bounty Amount: 50,000 HBOT (P2)
  • Developer Payment: 50,000 HBOT (100%)
  • Status: Open

@vic-en Can you take this bounty? I think this issue may be related to the chain configuration change, since the call to getTokenByAddress now returns undefined in https://github.com/hummingbot/gateway/blob/main/src/connectors/uniswap/uniswap.lp.ts#L74.

@ZAABY
Copy link

ZAABY commented Jul 16, 2023

Bounty

  • Description: Fix the UniswapLP connector code so that removing liquidity works
  • Sponsor: Hummingbot Foundation
  • Bounty Rationale: Uniswap is the Gold DEX connector for Epoch 5
  • Bounty Amount: 50,000 HBOT (P2)
  • Developer Payment: 50,000 HBOT (100%)
  • Status: Open

@vic-en Can you take this bounty? I think this issue may be related to the chain configuration change, since the call to getTokenByAddress now returns undefined in https://github.com/hummingbot/gateway/blob/main/src/connectors/uniswap/uniswap.lp.ts#L74.

Bounty Accepted!

@nikspz
Copy link
Contributor Author

nikspz commented Jul 17, 2023

Assigned to @ZAABY , please be informed:

  • Since you’re assigned to this bounty exclusively, please keep us informed on your progress over the next few days
  • Let us know if you don’t have time, and we will unassigned and keep it open for other devs
  • Only one dev can be assigned to one bounty

Thanks for your contribution!

@ZAABY
Copy link

ZAABY commented Jul 17, 2023

So, from my understanding till now I have traced back the error to get contact function. I think this is were the problem is. So, I am giving a try to get gateway interact directly with the pool instead of via router (Which it's doing rn!)

@ZAABY
Copy link

ZAABY commented Jul 19, 2023

Hello Everyone!
So I came to some solution but facing the attached error. Can any one help me what to do to get out of it?
WhatsApp Image 2023-07-20 at 01 51 50

@fengtality
Copy link
Sponsor Contributor

fengtality commented Jul 19, 2023 via email

@ZAABY
Copy link

ZAABY commented Jul 21, 2023

I resign!

@nikspz
Copy link
Contributor Author

nikspz commented Jul 21, 2023

@ZAABY unassigned from this bounty

@nikspz nikspz assigned vic-en and unassigned ZAABY Jul 21, 2023
@nikspz
Copy link
Contributor Author

nikspz commented Jul 21, 2023

Assigned to @vic-en , please be informed:

  • Since you’re assigned to this bounty exclusively, please keep us informed on your progress over the next few days
  • Let us know if you don’t have time, and we will unassigned and keep it open for other devs
  • Only one dev can be assigned to one bounty

Thanks for your contribution!

@vic-en vic-en mentioned this issue Jul 23, 2023
2 tasks
@nikspz
Copy link
Contributor Author

nikspz commented Jul 26, 2023

fix #169 was merged to the latest development branch

@nikspz
Copy link
Contributor Author

nikspz commented Jul 31, 2023

Thanks for your participation, the bounty has been sent to @vic-en. The fix has been deployed on development branch and next hummingbot version 1.19.0

@nikspz nikspz closed this as completed Jul 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working uniswap-lp
Projects
Status: Paid
Development

No branches or pull requests

4 participants