Integration options

Madhouse offers two primary integration approaches, each suited to different use cases:

REST API Integration (Recommended for most applications)

The REST API provides a simple, high-level interface that returns optimized swap routes along with pre-built transaction calldata. This approach is ideal for:

  • Web applications and mobile apps requiring quick integration

  • Trading interfaces that want to abstract away routing complexity

  • Applications that don't need direct smart contract interaction

Key benefits: No need to understand routing algorithms, automatic gas optimization, and simplified error handling. The API handles all the complexity of multi-hop swaps and route splitting.

Direct Smart Contract Integration (For advanced use cases)

The Aggregator contract allows you to submit swaps directly on-chain with custom routes, adapters, and optional integrator fees. This approach is best for:

  • DeFi protocols integrating swaps into their smart contracts

  • Applications that need custom routing logic or specialized execution

  • Integrators wanting to earn fees on swap volume

  • MEV bots and arbitrage strategies requiring atomic execution

The key benefits are maximum flexibility, composability with other DeFi protocols, and the ability to earn protocol fees as an integrator.

Last updated