Skip to main content
SoroswapAggregator is the contract a caller actually swaps against. It holds the registry of adapters, and it splits one trade across them according to a distribution the caller supplies. Source: contracts/aggregator.

Interface

Both swap functions return Vec<Vec<i128>>: one inner vector of step amounts per protocol the trade was split across, in distribution order.

Types

DexDistribution is how the caller says “send this fraction of the trade through that protocol”. parts is a weight, not a percentage: each protocol receives amount * parts / total_parts. See Aggregator Operation for the exact formula and how the remainder is handled. A distribution may name at most MAX_DISTRIBUTION_LENGTH entries.

The adapter registry

The set of protocols the aggregator can reach is stored on chain and managed by the admin, not hardcoded:
  • update_adapters registers or replaces adapters, keyed by protocol_id.
  • remove_adapter drops one.
  • set_pause closes a protocol to new swaps without removing its registration, which is the reversible option when an underlying protocol looks unhealthy.
Every one of these is admin only. set_admin transfers that role, and upgrade replaces the aggregator’s own code with a new WASM hash.