Leveraging on the fact that Uniswap’s spot price is the proportion of the underlying asset balances, we can work backwards the fair assets’ reserve ratio.
Together with the LP totalSupply, we can find the underlying assets’ fair reserves.
6/ The Formula !@#$%^&*()_+
Combining the Fair Asset Prices and Fair Asset Reserves, we get the following formula:
7/ This solution has already been implemented on Alpha Homora v2 contract, and we'd like to share with our community.