Repository navigation
Read curve liquidity from realQuoteReserve, not the curve's ETH balance - #12
Open
hey-research-lab wants to merge 1 commit into
Open
hey-research-lab wants to merge 1 commit into
hey-research-lab wants to merge 1 commit into
Conversation
A Pons V2 curve's balance is realQuoteReserve + quoteFeeBalance + creatorTaxBalance. The fees and tax are not tradeable, so they inflated liquidity, and a creator-tax or fee claim showed up as a liquidity drop.
|
@hey-research-lab is attempting to deploy a commit to the leopard's projects Team on Vercel. A member of the Team first needs to authorize it. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
readLiquiditytakes pre-graduation liquidity fromgetBalance(launch.curve). A Pons V2 curve's ETH balance is not only its trading reserve. It also holds the accrued protocol fee and the creator tax until they are claimed:Read on Robinhood Chain at block 93176631:
0x7182b3fe…539b(0xbaf80239…47ce)0x5d07f2b3…d39c(0x20959bef…4e70)So the first curve reports about 0.00046 ETH of liquidity with 7 wei actually tradeable, and the second reports 2.4× its reserve. This also produces false signals. When the creator or the protocol claims, the balance drops with no trade,
liquidityUsdfalls, andsignalEngineemitsLIQUIDITY_DECREASE(HIGH when the drop is 30% or more).isDeadTokenreads the same inflated figure.Fix
For native-ETH pairs, read
realQuoteReserve()from the curve (a newcurveReserveAbiinsrc/chain/pons.ts;curveAbiand its event indexes are unchanged). The README,docs/DATA.mdand one comment said "curve balance"; they now say "curve reserve".Validation
cast balance/cast call <curve> "realQuoteReserve()(uint256)","quoteFeeBalance()(uint256)","creatorTaxBalance()(uint256)"on the curves above, and on 13 other curves from the last 200k blocks ofTokenLaunched. Wherever the curve is still trading, the three getters sum exactly to the balance.npm test: 449 pass, 0 fail (it builds withtscfirst).npm run lint: 0 errors (the 17 existing warnings are unchanged).Notes
I could not run
readLiquidityend to end against the public RPC. Its launch-record lookup is bounded and returnedfound: falsefor these tokens both before and after the change, so I validated the contract reads directly.