The calcReserveAtRatioSwap function uses a simplified calculation for the parity reserve (lpTokenSupply / 2). This assumption may not hold true for stableswap pools, especially when the tokens have different precisions or when the pool is imbalanced. This can lead to suboptimal pricing calculations, particularly in edge cases or when the pool is far from balanced.
https://github.com/code-423n4/2024-07-basin/blob/7d5aacbb144d0ba0bc358dfde6e0cc913d25310e/src/functions/Stable2.sol#L173-L239
Replace the simplified calculation of parityReserve with a more accurate calculation that considers the amplification factor (A) and the specific dynamics of the pool. Implement a function to calculate the true parity reserve based on the current state of the pool and the amplification factor, and use this function in place of lpTokenSupply / 2.
