Fix cy/cy pool LP deposit matching#60
Merged
Merged
Conversation
When both pool tokens are cy tokens, the same IncreaseLiquidity event matches both Transfer events. Add pool-side check: cyToken as token0 checks amount0, cyToken as token1 checks amount1. This correctly attributes each deposit to the right cy token's lpBalance. Fix test mocks to put cyWETH transfer values in amount1 (token1 side). Add equal-amounts cy/cy pool test. Closes #59 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
0212f55 to
f3073b3
Compare
In cy/cy pools, both tokens create a LiquidityChange from the same log event. The old ID (txHash + logIndex) caused the second entity to overwrite the first, losing one token's withdrawal record while still deducting its lpBalance. Extract liquidityChangeId() helper shared by V2 and V3 that appends cyToken address to the ID, ensuring uniqueness. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace single-network input with matrix strategy deploying to both flare and arbitrum-one in parallel. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
Summary
When both pool tokens are cy tokens (e.g., cysFLR/cyWETH), the same IncreaseLiquidity event matches both Transfer events. Without disambiguation, the second transfer either matches the wrong event or fails to match, leaving lpBalance at 0 for affected accounts.
Fix: check which side of the pool the cy token is on (token0 vs token1) and verify the corresponding amount matches the transfer value.
This fixes the root cause of 32/62 accounts having wrong cysFLR lpBalance in the subgraph (cyclofinance/cyclo.rewards#161).
Closes #59
Test plan
🤖 Generated with Claude Code