Aperture-Finance / uniswap-v3-automation-sdk

Other
17 stars 8 forks source link

Unified helper for tx, swap info, and price impact #150

Closed gnarlycow closed 4 months ago

gnarlycow commented 6 months ago

Currently we have getRebalanceTx to generate the tx, and another getRebalanceSwapInfo to generate swap info and price impact. Frontend calls these separately, so the tx may be generated from a different blockchain state than swap info / price impact. As a result, the tx that user signs may not be consistent with the displayed swap info and price impact.

The same goes for optimal mint and optimal increase liquidity.

We should provide a unified helper that generates tx, swap info, and price impact all generated from the same block number.

gnarlycow commented 6 months ago

Since tx generation may require auth params like permitInfo while swap data / price impact is a mere simulation that doesn't require these, what we can do is to create a version of generateXXXTx that takes the specified swapData and amount0Min/amount1Min, and simply populates calldata according to these params.

lanceaper commented 4 months ago

done with solver integration https://github.com/Aperture-Finance/uniswap-v3-automation-sdk/pull/234