I created a constant product AMM that virtually eliminates impermanent loss on the Goerli network here (the verified contract on the testnet is here). I explain it more fully in a substack post here, but in brief, it works as follows.
The AMM allows leverage, so traders and LPs can generate short positions as well as leveraged long positions. This allows LPs to net trades against their pool positions. If there is only one LP, and she is also the only trader, her net position is constant as the price changes. By definition, this implies she would have a zero impermanent loss.
With several LPs, the objective is to incent the LP’s to monopolize arbitrage trading. To do that, the first key is giving the LP’s a cheaper trading fee. If the trading fee is 0.2% for non-LPs, the LPs will find it attractive to arb a 0.2% price difference between the AMM and the ‘true’ price, while non-LPs will not.
A second key is a mechanism for making sure LPs trade in proportion to their pool liquidity. We do not want one minor LP making all of the arbitrage trades, because that would leave the other LPs subject to the standard IL. If you give the LPs the cheap fees on buy orders only if their net ETH position is below their initial ETH position (and similar for sells), this would prevent a minority of LPs from dominating the zero-fee trading.
There is a downloadable spreadsheet there to see how this works, as well as discussion of other conditions (eg, LPs cannot add or withdraw while their LP position is open).
Comments or questions appreciated.