Skip to main content
SoroswapAggregatorAdapter is the adapter for the Soroswap AMM itself. It implements AdapterTrait and forwards each swap to the SoroswapRouter. Source: contracts/adapters/soroswap.

What it does

The adapter stores two things at initialization: a protocol_id string and the protocol_address of the protocol it fronts, which for this adapter is the Soroswap router.
Calling initialize twice fails with AlreadyInitialized. Calling any other function before it fails with NotInitialized. From then on, swap_exact_tokens_for_tokens and swap_tokens_for_exact_tokens translate the aggregator’s call into the router’s equivalent and return the per-step amounts. This adapter needs no protocol-specific extras, so it ignores the trait’s optional bytes parameter, which exists for protocols like Aqua that require pool hashes.

Sibling adapters

The same trait is implemented for Phoenix, Aqua and Comet, each in its own crate under contracts/adapters. Because they share the interface, the aggregator treats all four identically and adding a protocol means writing a fifth adapter rather than changing the aggregator.