Uniswap V2 is one of the most popular decentralized exchanges that relies on the Automated Market Maker (AMM) principles to facilitate interaction with decentralized pools of liquidity either by trading, or earning yield from liquidity provision. DeFi protocols like Uniswap rely on precise mathematical models to calculate user shares, distribute profits and maintain pool balance. Fundamental to these protocols is the concept of user shares — the proportional ownership of assets in a pool — an...