H

Hyperswap

Permissionless cross-chain AMMs based on Uniswap and Hyperlane.

The problem Hyperswap solves

Allows users to create arbitrary UniswapV2-like pools that consist of assets on two different chains. For example, one could deploy a AVAX/ETH pool on Avalanche which holds the AVAX portion of the pool on Avalanche and the ETH portion of the pool on Ethereum. This allows for seamless swapping without having to go through token bridges.

Challenges I ran into

Figuring out how to model the state-machine associated with each transaction type (addLiquidity, removeLiquidity, swap), in an async cross-chain environment was interesting, and I had to come up with a primitive, cros-chain Sequences of events that are eventually consistent, but that also can be recovered from in case of failure. I haven't fully fleshed out the recovery part but I have thought about it and strongly believe that I can recover from any end state (but potentially gas hungry).

Hyperlane is still in its early phases so I hit a few snags and incomplete docs, but overall it was a good experience to build for it. Had to code around some of the tooling tho.

My brain can't really write anymore now, I'd rather talk about it, so hit me up on Matrix if anything.

Discussion