36 lines
1.5 KiB
Solidity
36 lines
1.5 KiB
Solidity
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
pragma solidity >=0.7.5;
|
|
pragma abicoder v2;
|
|
|
|
/// @title Router token swapping functionality
|
|
/// @notice Functions for swapping tokens via Uniswap V2
|
|
interface IV2SwapRouter {
|
|
/// @notice Swaps `amountIn` of one token for as much as possible of another token
|
|
/// @dev Setting `amountIn` to 0 will cause the contract to look up its own balance,
|
|
/// and swap the entire amount, enabling contracts to send tokens before calling this function.
|
|
/// @param amountIn The amount of token to swap
|
|
/// @param amountOutMin The minimum amount of output that must be received
|
|
/// @param path The ordered list of tokens to swap through
|
|
/// @param to The recipient address
|
|
/// @return amountOut The amount of the received token
|
|
function swapExactTokensForTokens(
|
|
uint256 amountIn,
|
|
uint256 amountOutMin,
|
|
address[] calldata path,
|
|
address to
|
|
) external payable returns (uint256 amountOut);
|
|
|
|
/// @notice Swaps as little as possible of one token for an exact amount of another token
|
|
/// @param amountOut The amount of token to swap for
|
|
/// @param amountInMax The maximum amount of input that the caller will pay
|
|
/// @param path The ordered list of tokens to swap through
|
|
/// @param to The recipient address
|
|
/// @return amountIn The amount of token to pay
|
|
function swapTokensForExactTokens(
|
|
uint256 amountOut,
|
|
uint256 amountInMax,
|
|
address[] calldata path,
|
|
address to
|
|
) external payable returns (uint256 amountIn);
|
|
}
|