Adapter Smart Contract Interface
The IAdapter interface defines the standard contract interface that all adapter implementations must follow. Adapters are responsible for executing swaps on specific decentralized exchanges (DEXs) and are used by the Aggregator contract to route swaps through different protocols.
For a complete list of deployed adapter contracts and their addresses across different networks, see the Smart Contract Addresses Documentation.
Functions
swap
swapExecutes a token swap through the adapter's underlying DEX integration, converting a specified amount of input tokens to output tokens with slippage protection.
Signature
function swap(
address tokenFromAddress,
uint256 tokenFromAmount,
address tokenToAddress,
uint256 tokenToAmountMin,
bytes calldata additionalParams,
address to
) external payable;Parameters
tokenFromAddress
address
The address of the token to swap from.
tokenFromAmount
uint256
The amount of the input token to swap.
tokenToAddress
address
The address of the token to receive.
tokenToAmountMin
uint256
The minimum amount of the output token to receive.
additionalParams
bytes
Additional parameters specific to the adapter's DEX integration.
to
address
The address to send the output tokens to.
Usage Notes
This function is called by the Aggregator contract during multi-hop swaps
The
additionalParamsfield allows for DEX-specific configuration (e.g., pool fees, slippage settings).For native token swaps, the function should handle
msg.valueappropriatelyThe adapter should transfer the resulting tokens to the
toaddress
Last updated

