Skip to main content
Every adapter implements AdapterTrait, defined in contracts/adapters/interface. That single interface is what lets the aggregator treat Soroswap, Phoenix, Aqua and Comet the same way, and it is all you need to implement to add a protocol.

Interface

Notes on the parameters

path is the route through the underlying protocol. The first element is the input token, the last is the output token, and anything between them is an intermediate hop to trade through when no direct pair exists. bytes is the escape hatch for protocols that need something the common interface does not carry. Aqua uses it for pool hashes, which is why AdapterError has MissingPoolHashes and WrongPoolHashesLength. Adapters that need nothing extra take None. Both swap functions return the amounts at each step of the route, not just the final amount.

Errors