You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 27, 2023. It is now read-only.
Thanks for the amazing effort on this library!
When doing some comparisons to Swap events outputted for an arbitrary pair (for this example I am using 500 fee tier WETH/USDC on Optimism), I notice a very small margin of error from the output of the simulation vs what the swap log shows.
The negative amount 0 representing the output of the swap from logs.
'Amount out from internal swap' representing the result of the simulated swap.
I thought it could be due to a difference in pool state after the swap log, as the batch tick data call would hit the chain AFTER the swap log. However, I switched to a completely pool 'state' which is initialised with tick data in either direction and altered the simulation to use that data, there is still a small error. See DIFF. Is this due to just precision difference between EVM and Rust?
Am able to get 0 DIFF when the output is USDC sometimes...
2023-06-06T08:19:50.046Z INFO [verdant] Found a swap event 0x68df429f0050417cac5ebb407bbe2adcbe6aab990d9d7f65d8bc2a93f08695fe. Running sims.
2023-06-06T08:19:50.046Z INFO [cfmms::pool::uniswap_v3] SQRT PRICE FROM LOG 3374780273765172741931233
2023-06-06T08:19:50.046Z INFO [cfmms::pool::uniswap_v3] AMOUNT 0 "-1472873957491611"
2023-06-06T08:19:50.046Z INFO [cfmms::pool::uniswap_v3] AMOUNT 1 "2673712"
2023-06-06T08:19:50.047Z INFO [cfmms::pool::uniswap_v3] Current tick -201286 false
2023-06-06T08:19:50.048Z INFO [cfmms::pool::uniswap_v3] AMOUNT OUT FROM INTERNAL SWAP "1472873826317980"
2023-06-06T08:19:50.049Z INFO [cfmms::pool::uniswap_v3] DIFF "0.00000008905964446774203"```
The text was updated successfully, but these errors were encountered:
Hey thanks for opening up an issue for this. There is an issue with the UniswapV3 swap sim that this PR should fix. There are still a few outstanding issues with the PR, but I am going to merge it into a staging branch and fix them quickly so we can get this patched up.
I will bolster the tests and make sure that this patch addresses the issue.
Thanks for following up on this. I just merged the changes into main that should fix UniswapV3 swap simulation. We will need to bolster tests and validate that these changes correct any issues.
If you would like, you can help by updating the swap simulation tests to be more robust, ensuring that swap simulation is accurate. Once we have validated that the changes fix everything, I can cut a new release on crates.io.
My workload has been high lately so sorry for the delay on this. I will be working to get the tests updated and the new version published, but any help would be greatly appreciated. Let me know if you have any questions.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Hey.
Thanks for the amazing effort on this library!
When doing some comparisons to
Swap
events outputted for an arbitrary pair (for this example I am using 500 fee tier WETH/USDC on Optimism), I notice a very small margin of error from the output of the simulation vs what the swap log shows.The negative amount 0 representing the output of the swap from logs.
'Amount out from internal swap' representing the result of the simulated swap.
I thought it could be due to a difference in pool state after the swap log, as the batch tick data call would hit the chain AFTER the swap log. However, I switched to a completely pool 'state' which is initialised with tick data in either direction and altered the simulation to use that data, there is still a small error. See
DIFF
. Is this due to just precision difference between EVM and Rust?Am able to get 0
DIFF
when the output is USDC sometimes...The text was updated successfully, but these errors were encountered: