Comments (23)
Progress update @nikspz @chasevoorhees
- Can reproduced the issue
- Found new issue: Strategy always create position with wrong price range for pair OSMO-USDC making new lp position out of range
For now, I'm investigate the connector implementation on client side and gateway to see what goes wrong.
from gateway.
Updated the strategy again - will keep testing stuff on my side.
BTW this bug report may be better suited on hummingbot/hummingbot, considering this is definitely an issue with gateway_osmosis_amm_lp.py
from gateway.
Error: Bad status on response: 429
at filterBadStatus (/home/vboxuser/hbot/pecugateway-dev/gateway/node_modules/osmojs/node_modules/@cosmjs/tendermint-rpc/src/rpcclients/http.ts:9:11)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at async HttpClient.execute (/home/vboxuser/hbot/pecugateway-dev/gateway/node_modules/osmojs/node_modules/@cosmjs/tendermint-rpc/src/rpcclients/httpclient.ts:44:43)
at async Tendermint34Client.doCall (/home/vboxuser/hbot/pecugateway-dev/gateway/node_modules/osmojs/node_modules/@cosmjs/tendermint-rpc/src/tendermint34/tendermint34client.ts:341:20)
at async QueryClient.queryUnverified (/home/vboxuser/hbot/pecugateway-dev/gateway/node_modules/osmojs/node_modules/@cosmjs/stargate/src/queryclient/queryclient.ts:578:22)
I'm seeing a whole bunch of 429s back from the RPC server now.. making it hard to test this currently.
@rapcmia Apologies but I also made a couple small changes to the development branch again:
Osmosis: Return feeTier instead of pool.fee from poolPositions(). Wrapped getCurrentBlock() and return 0 when HTTP429 back from RPC
from gateway.
Adding bounty for this issue:
Acceptance: status and amm_v3_lp strategy are working on osmosis
Bounty:
Sponsor: Funded by Hummingbot community sponsors
Bounty Amount: 60K HBOT
Developer Payment: 54K HBOT or 272 USDC
from gateway.
Hey, I will take this bounty π
from gateway.
Assigned to @mlguys, please be informed:
- Since youβre assigned to this bounty exclusively, please keep us informed on your progress over the next few days
- Please review and follow contribution guidelines (https://hummingbot.org/developers/contributions/)
- Please review the checklist after PR submitted (https://hummingbot.org/developers/contributions/#checklist)
- 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!
from gateway.
@mlguys
Currently there's a new bounty process.
Assigned developer should choose bounty amount (from advised) when dev assigned,
please specify with comment below 54K HBOT or 272 USDC
from gateway.
54k HBOT works for me π
from gateway.
Noted
from gateway.
Pushed fix for the bug:
- When using Osmosis connector on AMM-Lp strategy, it kept on creating position but does not indicate that its available when looking into status command. These positions are created successfully on the exchange
PR: hummingbot/hummingbot#6959
Now focusing on new bug:
- Strategy always create position with wrong price range for pair OSMO-USDC making new lp position out of range
from gateway.
Found new bug:
- When connector run
update_nft
to update the lp position status, the return result doesn't contain the required information for the lp position:
from gateway.
Pushed fix for:
- Strategy always create position with wrong price range for pair OSMO-USDC making new lp position out of range (hummingbot/hummingbot@9f9c3bd)
My next task: discuss with osmosis connector team on how to deal with the new found bug. @chasevoorhees
from gateway.
I've been instructed to reply here for optics - I've been helping @mlguys on Discord (or lmk if I missed anything)
from gateway.
Added fix on client and gateway side:
What fixed:
- AMM LP strategy should work with Osmosis now, from start to end
- In the event that you manually close lp position on Osmosis, the strategy will detect and remove the closed position automatically
Note to developer:
- There is issue with tick calculation:
gateway/src/chains/osmosis/osmosis.ts
Lines 1363 to 1365 in b8ba322
-1251000
, but got-125100
instead). I made a quick fix by adding back that missing exponent.
Screen recording:
https://github.com/hummingbot/gateway/assets/9627489/ee821b1c-f569-4948-9ba3-e2e411acf7b2
I guess this solution is what the bounty amount can cover, please review the fix for this bounty
@nkhrs @chasevoorhees @nikspz
from gateway.
Added fix on client and gateway side:
* [[Fix] Osmosis - Continuously creating position on amm-LP strategy #318](https://github.com/hummingbot/gateway/pull/318) * [[Fix] Osmosis - Continuously creating position on amm-LP strategy hummingbot#6959](https://github.com/hummingbot/hummingbot/pull/6959)
What fixed:
* AMM LP strategy should work with Osmosis now, from start to end * In the event that you manually close lp position on Osmosis, the strategy will detect and remove the closed position automatically
Note to developer:
* There is issue with tick calculation: https://github.com/hummingbot/gateway/blob/b8ba322567bb0c01cd38355723b97937eb9b9924/src/chains/osmosis/osmosis.ts#L1363-L1365 , the calculated tick is less than 1 exponent (for example, we expected a value of `-1251000`, but got `-125100` instead)
Screen recording: https://github.com/hummingbot/gateway/assets/9627489/ee821b1c-f569-4948-9ba3-e2e411acf7b2
I guess this solution is what the bounty amount can cover, please review the fix for this bounty @nkhrs @chasevoorhees @nikspz
I think your tick fixme + '0' isn't going to be constant.
Has this been tested with multiple coin pairs? Specifically ones with different #s of significant figures, eg. Osmo/dai and usdc/eth?
Maybe someone else can comment but I'm pretty sure the tick calc's issue was with the sig fig difference btween the coins.
from gateway.
Right, the number of missing exponent is not constant, the fix above will work for OSMO/USDC but for other pair like ETH/WBTC, it will not work, since the missing exponent is even bigger. However, the fix is just temporary since fixing it would be out of this bounty scope, the purpose is to let the connector developer know that there is issue with the tick calculation.
@chasevoorhees @nkhrs
from gateway.
I've updated the FIXME content as follow:
gateway/src/chains/osmosis/osmosis.ts
Lines 1363 to 1365 in 19e25b6
The calculation in findTickForPrice
is not correct for price less than 1.
For the scope of the bounty, I think it is getting bigger and bigger, should we re-scope this bounty? The amm v3 lp strategy technically is working now but only for pools with price that is greater than 1.0
@nkhrs
from gateway.
We need error logs here but I'm pretty sure this:
// FIXME: The calculation of lowerTick and upperTick is not correct for the case where price is less than 1
This should be fixed already (somewhere...) - They took forever so I made my own NPM: https://www.npmjs.com/package/@chasevoorhees/osmonauts-math-decimal (was just an issue with using bignumber.js instead of decimal.js, and bn.js doesn't support fractional exponents).
But I believe osmonauts-math-decimal has been merged with my fix already, so either make sure yours is up to date or try using my package instead.
Little busy rn, but probably more to say on the tick calc.. again, screenshots would be very helpful
from gateway.
I added new price to tick calculation here: ed45375
Basically it is a rewrite from https://github.com/osmosis-labs/osmosis/blob/0f9eb3c1259078035445b3e3269659469b95fd9f/x/concentrated-liquidity/math/tick.go#L160
I also check the math in https://docs.osmosis.zone/osmosis-core/modules/concentrated-liquidity/#ticks and the calculation I implemented should check out.
For example I tried to add liquidity to INJ/USDC pool using this parameters:
- upper_price: 27.078618
- lower_price: 24.499702
and the calculation gave me:
Inputs: desiredPriceString=24.499702000000000, exponentAtPriceOne=-6, tickSpacing=100, is_lowerBound=true
Initial calculations: desiredPrice=24.499702, exponent=-6, geometricExponentIncrementDistanceInTicks=9000000
Loop (desiredPrice > 1): currentPrice=10, exponentAtCurrentTick=-5, ticksPassed=9000000
Loop (desiredPrice > 1): currentPrice=100, exponentAtCurrentTick=-4, ticksPassed=18000000
Ticks to be fulfilled by current exponent: -7550029.8
Tick index: 10449970.2
Final calculations: tickIndex=10449970.2, returnTick=10449900
Inputs: desiredPriceString=27.078618000000000, exponentAtPriceOne=-6, tickSpacing=100, is_lowerBound=false
Initial calculations: desiredPrice=27.078618, exponent=-6, geometricExponentIncrementDistanceInTicks=9000000
Loop (desiredPrice > 1): currentPrice=10, exponentAtCurrentTick=-5, ticksPassed=9000000
Loop (desiredPrice > 1): currentPrice=100, exponentAtCurrentTick=-4, ticksPassed=18000000
Ticks to be fulfilled by current exponent: -7292138.2
Tick index: 10707861.8
Final calculations: tickIndex=10707861.8, returnTick=10707900
lowerTick 10449900
upperTick 10707900
However, the lp position I got back has wrong price range so I tried to create lp manually using the same price range and here is what I got from the transaction (https://www.mintscan.io/osmosis/tx/876727A12DE8EFDA789B9D2FF35D7ADF5B6C824D22915E55F4E477E921276D0E?height=15254452§or=message):
Lower_tick:-97,549,900
Upper_tick:-97,292,000
As we can see, the actual upper and lower ticks we got from the osmosis website is completely different from the calculation we got from osmosis official repo, not sure if they updated the tick calculation elsewhere or not π€· @chasevoorhees
from gateway.
Look like they updated the calculation for tick: https://github.com/osmosis-labs/osmosis/blob/main/x/concentrated-liquidity/math/tick.go#L202
Did you add this update yet? I can't find it anywhere in the development
branch. @chasevoorhees
from gateway.
from gateway.
Look like they updated the calculation for tick: https://github.com/osmosis-labs/osmosis/blob/main/x/concentrated-liquidity/math/tick.go#L202
Did you add this update yet? I can't find it anywhere in the
development
branch. @chasevoorhees
I still can't find this in the Osmosis math package. I'm going to make my own NPM (again) unless I can find it in cosmos-sdk
from gateway.
No chance I'm getting this go project compiled for npm. Can someone from osmomath/etc get the above version re- .goreleased and push the new version to NPM? That'll solve our tick issue.
Then we can probably fix the last active position display bug pretty easily... Idk who to tag for the above though @nkhrs
from gateway.
Related Issues (20)
- CLOB - There was an error requesting exchange info when gateway is OFFLINE
- Uniswap Liquidity Error "unkown error: Couldnot get position with id **" HOT 15
- secp256k1 unavailable in docker, unable to start https server HOT 1
- The this.ethereum of uniswapLP is not initialized. HOT 10
- Dexalot - EUROC and sAVAX balances are not recognized HOT 2
- Dexalot - Fetching status update for order is causing exchange rate limit
- Dexalot - Order lost when creating order
- Upgrading from GATEWAY V1.21 to V1.22 docker image gives an error when starting HOT 1
- Gateway - "gateway connector-tokens" command does not display any balance for connectors that support LP HOT 1
- feat/carbondefi - Add Carbon DeFi AMM and CLOB_SPOT connector
- CAN I GET SOME HELP PLEASE HOT 4
- Ref - Token not supported HOT 4
- Gateway connect LP connectors - Autocomplete for `chain` displays connected LP connectors HOT 4
- Ethereum - add Sepolia (testnet) network to the connector HOT 1
- Error: Cannot find module HOT 2
- Add `poolID` to Gateway AMM endpoints HOT 15
- Add Chain Support for Ethereum Classic (61), the largest PoW Smart Contract Blockchain
- Error on POST https://localhost:15888/amm/price HOT 2
- Error: Looping Question: "Do you want to connect to ethereum-mainnet with one of your existing wallets on Gateway?" HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gateway.