Skip to content
Unimod

Developer

Programmatic integration goes through three surfaces:

  • Router — the single write surface. Every mutating flow (swaps, liquidity, lending, leverage, liquidation) is one Router call; the Router opens the AMM's unlock context, handles settlement, and implements every protocol callback. ERC20 pulls go exclusively through Permit2; every mutating call takes a trailing deadline; batching via multicall.
  • Lens — the read surface, designed for eth_call: previewSwapIn / previewSwapOut, previewZapIn / previewZapOut, previewMaxBorrow, liquidityHealth, and getUserPosition. Everything a frontend or solver needs without simulation infrastructure.
  • unimod-sdk — typed TypeScript wrappers (viem) over Router writes and Lens reads.

Integration notes

  • Authorization is two-layer: Permit2 for ERC20s (approve once per token, then authorize the Router), and a Morpho-style setAuthorization on the lending contract for acting onBehalf — also available gasless via EIP-712 (setAuthorizationWithSig, replay-protected).
  • LP shares are ERC6909 claim tokens; grant the Router operator rights for collateral deposits, and wrap to ERC20 (LpShareWrapper) where an integration expects ERC20.
  • Callbacks: borrow, withdrawCollateral, and liquidate fire callbacks between state update and terminal check — this is what makes flash leverage, deleverage, and zero-capital liquidations atomic. Integrators normally consume these through the Router rather than implementing the interfaces themselves. Morpho-style free flashLoan is available on the lending contract, and the AMM's flash accounting gives V4-style free flash loans inside an unlock.
  • Roles most integrators build: solvers (explicit star routing, Lens quotes), arbitrageurs (external-price alignment — internal arbitrage does not exist on star pools), liquidation keepers (watch getUserPosition health, call liquidate — no inventory needed), and sponsors (market creation and parameterization through the registry).

Environments

The protocol is pre-release: integrate today against a local deployment (one script boots the full stack — contracts, pools, markets, bootstrap liquidity — on anvil). ABIs and deployment addresses flow from the contracts repo; the indexer/read-API and SDK track it.