-
Notifications
You must be signed in to change notification settings - Fork 115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UniswapV3Pool::simulate_swap_mut overdrafts pools #110
Comments
Can you share the quantities and block you are simulating on. Maybe write an example test of the scenario? |
Before I dig deeper, I suspect this might be caused by an issue with how I sync the pool state from logs. I'm running a geth node, which iiuc is sufficient for v2pools but maybe not v3? Alternatively it could be due to #105. What would be needed to support syncing v3 from a checkpoint? |
IIRC we would need to synchronize the Tick bitmaps of the v3 pools by syncing the mint/burn logs from the last synced block on the checkpoint to the chain head. Which is not currently implemented. So, the liquidity positions might be outdated when pulling from a checkpoint, and therefore could lead to overflow/underflow when syncing the mint/burn logs from the chain head onwards. |
I've been doing some digging into a specific contract: 0xbbd2d2f1c729156f128bd2401477e59256d4da9b.
|
Could it be that this check should be using >= and <=? amms-rs/src/amm/uniswap_v3/mod.rs Line 811 in 739a823
|
hmm, can you share a repro? |
amms UniswapV3Pool::simulate_swap_mut succeeds to swap from IC to Weth on a pool with very small weth balance (0x30C777EFb634759D235F3aAdBf562a4945ec7F6a), where output amount is larger than the current weth balance of the pool.
Is there a way I can verify that this is not a sync issue by inspection of the UniswapV3Pool struct?
The text was updated successfully, but these errors were encountered: