Open johna1203 opened 11 months ago
Hi, The solution I wrote above is not correct. I am still researching to see if I can find the problem.
The problem is similar to this issue. It seems that the UniswapLPHelper is not creating the correct object when the chain is Polygon. https://github.com/hummingbot/gateway/blob/main/src/connectors/uniswap/uniswap.ts#L61
my solution is check the chain and create a correct Object for this.ethereum
uniswap.lp.helper.ts
constructor(chain: string, network: string) {
if (chain === 'ethereum') {
this.ethereum = Ethereum.getInstance(network);
} else if (chain === 'polygon') {
this.ethereum = Polygon.getInstance(network);
} else {
throw new Error('Chain not supported');
}
The problem is similar to this issue. It seems that the UniswapLPHelper is not creating the correct object when the chain is Polygon. https://github.com/hummingbot/gateway/blob/main/src/connectors/uniswap/uniswap.ts#L61
my solution is check the chain and create a correct Object for this.ethereum
uniswap.lp.helper.ts
constructor(chain: string, network: string) { if (chain === 'ethereum') { this.ethereum = Ethereum.getInstance(network); } else if (chain === 'polygon') { this.ethereum = Polygon.getInstance(network); } else { throw new Error('Chain not supported'); }
Hey, does the solution works for you?
@johna1203 @emusol what chain and network are you trying to connect to?
@johna1203 @emusol what chain and network are you trying to connect to?
hey the error is when I try to work with polygon, on arbitrum it work perfectly
@emusol I see that there has been some refactoring to some evm networks.
So reconnect to uniswapLP using ethereum
as chain and polygon
as network.
Hey thats what I get when i try this way
@emusol I see that there has been some refactoring to some evm networks.
So reconnect to uniswapLP using
ethereum
as chain andpolygon
as network.
@vic-en
@johna1203 @emusol what chain and network are you trying to connect to?
Sorry for the delay, I was trying to connect to Polygon.
https://github.com/hummingbot/gateway/issues/228#issuecomment-1799353579
The code I wrote above worked, I had to add a check for Polygon.
Hey thats what I get when i try this way
@emusol I see that there has been some refactoring to some evm networks. So reconnect to uniswapLP using
ethereum
as chain andpolygon
as network.
This error does not happen to me. What version of the gateway are you using?
Hey thats what I get when i try this way
@emusol I see that there has been some refactoring to some evm networks. So reconnect to uniswapLP using
ethereum
as chain andpolygon
as network.This error does not happen to me. What version of the gateway are you using?
In fact, it is not an error... you are choosing the wrong network In the question "Which chain do you want uniswapLP...." you need to choose polygon instead of ethereum.
When I use uniswapLP in a script, this.ethereum.storedTokenList is always empty. I researched the reason and found a possibility of a bug.
It appears that this.ethereum.init() is not being called, meaning it is not being initialized. This prevents it from loading tokens.
I changed 3 lines in uniswap.lp.helper.ts and it worked for me.
Steps To Reproduce
1, create a Script with
markets = {"uniswapLP_polygon_mainnet": "XXXX-XXX"}
2, then, call theawait self.connectors["uniswapLP_polygon_mainnet"].get_price(trading_pair, fee_tier)
Screenshots
uniswap.lp.helper.ts
Release version { "name": "hummingbot-gateway", "version": "1.21.0", }
uniswap.lp.helper.ts
Here is a solution that is working for me. I am calling await this.ethereum.init(); if ethereum is not ready.
Optional: your discord username:johna1203