Haiko Docs
  • Introducing Haiko
  • Security & Audits
  • protocol
    • Vaults
      • Solvers (V2)
        • Replicating Solver
        • Reversion Solver
      • Strategies (V1)
        • Replicating Strategy
        • Building A Strategy
    • AMM
      • Execution & Order Matching
      • Position Types
      • Order Types
      • Market Schemas
      • Fees & Rewards
  • info
    • User Guides
      • Introduction to Starknet
      • Connect Starknet Wallet
      • Haiko Interface
      • Depositing to a Vault
    • DeFi Spring
    • Leaderboard
    • Listing on Haiko
    • Links
    • Glossary
  • Developers
    • Deployments
    • Interfaces
    • Events
      • MarketManager (AMM)
      • ReplicatingStrategy
      • SolverComponent
      • ReplicatingSolver
    • Advanced Concepts
      • Liquidity Math
      • Limits
      • Data Encoding
  • Media Kit
  • Contact Us
Powered by GitBook
On this page
  • Positions & Orders
  • Swap Execution
  1. protocol
  2. AMM

Execution & Order Matching

Last updated 8 months ago

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 .

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 , 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 .

Swap Execution

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

Liquidity Math
ticks
here