Skip to main content

State Variables

Public Variables

Mappings

Stores market parameters for each deployed OrderBook. Used to validate markets during swaps.

Core Functions

initialize

One-time initialization of the Router contract.
Sets the contract owner and core component addresses. Can only be called once. Required before deploying any markets.

deployProxy

Deploys a new OrderBook market with an associated KuruAMMVault.
Market Types:
  • NO_NATIVE - Both base and quote are ERC20 tokens
  • NATIVE_IN_BASE - Native token (Monad) as base asset
  • NATIVE_IN_QUOTE - Native token (Monad) as quote asset
Deploys both OrderBook and KuruAMMVault using Create2 for deterministic addresses. Registers the market in verifiedMarket mapping. Returns the deployed OrderBook proxy address.

computeAddress

Computes the deterministic address for an OrderBook proxy.
Pre-computes the deployment address before actual deployment. Supports implementation upgrades while preserving addresses.

computeVaultAddress

Computes the deterministic address for a KuruAMMVault.
Pre-computes the vault address for a given market address. Used for planning and verification.

anyToAnySwap

Enables multi-hop swaps across different markets.
Routes swaps through multiple markets. Validates each market via verifiedMarket mapping and enforces slippage protection via _minAmountOut. Supports native token transfers when _nativeSend is true. Example: Swap TOKEN_A → Native → TOKEN_B

Events

MarketRegistered

Emitted when a new market is successfully deployed via deployProxy. Contains all market parameters and addresses for the OrderBook and KuruAMMVault.

OBImplementationUpdated

Emitted when the OrderBook implementation address is updated. Future market deployments will use the new implementation.

VaultImplementationUpdated

Emitted when the KuruAMMVault implementation address is updated. Future vault deployments will use the new implementation.

KuruRouterSwap

Emitted after a successful multi-hop swap via anyToAnySwap. Tracks the swap input/output for the entire routing path.