Skip to content

Read curve liquidity from realQuoteReserve, not the curve's ETH balance - #12

Open
hey-research-lab wants to merge 1 commit into
leopardracer:mainfrom
hey-research-lab:fix-curve-liquidity-reserve
Open

hey-research-lab wants to merge 1 commit into
leopardracer:mainfrom
hey-research-lab:fix-curve-liquidity-reserve

Conversation

@hey-research-lab

Copy link
Copy Markdown

Problem

readLiquidity takes pre-graduation liquidity from getBalance(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:

balance = realQuoteReserve() + quoteFeeBalance() + creatorTaxBalance()

Read on Robinhood Chain at block 93176631:

curve (token) balance realQuoteReserve quoteFeeBalance creatorTaxBalance
0x7182b3fe…539b (0xbaf80239…47ce) 463123947996377 7 463123947996370 0
0x5d07f2b3…d39c (0x20959bef…4e70) 393032972460320 164295112217776 57327784521940 171410075720604

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, liquidityUsd falls, and signalEngine emits LIQUIDITY_DECREASE (HIGH when the drop is 30% or more). isDeadToken reads the same inflated figure.

Fix

For native-ETH pairs, read realQuoteReserve() from the curve (a new curveReserveAbi in src/chain/pons.ts; curveAbi and its event indexes are unchanged). The README, docs/DATA.md and 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 of TokenLaunched. Wherever the curve is still trading, the three getters sum exactly to the balance.
  • npm test: 449 pass, 0 fail (it builds with tsc first).
  • npm run lint: 0 errors (the 17 existing warnings are unchanged).

Notes

I could not run readLiquidity end to end against the public RPC. Its launch-record lookup is bounded and returned found: false for these tokens both before and after the change, so I validated the contract reads directly.

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.
@vercel

vercel Bot commented Oct 20, 2026

Copy link
Copy Markdown

@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

No deployments
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.

1 participant