Execution & Order Matching

At its core, Haiko's AMM protocol is a matching engine between two groups of users: traders and liquidity providers.

It routes incoming swaps from traders to the best source of liquidity, searching across all liquidity positions and limit orders, and settles trades by transferring token balances between buyers and sellers.

Incoming swaps consume or dispense liquidity by changing the mix of base and quote tokens deposited in a market. thereby affecting the market price. You can learn more about the precise relationship between liquidity, token balances, and market prices in Liquidity Math.

Positions & Orders

To facilitate efficient matching, prices in Haiko are partitioned into price intervals called limits. Limits define valid price points at which liquidity positions and limit orders can be placed.

Limits work in the same way as Uniswap's ticks, except they have a minimum increment of 1.00001 (rather than 1.0001) to allow for more precise price points.

You can learn more about different Position Types here.

Swap Execution

Swaps are executed using a matching algorithm based on a tree data structure, optimising execution efficiency against storage rewrite costs.

Last updated