GenericButtonswapRouter
Inherits: IGenericButtonswapRouter
State Variables
BPS
uint256 private constant BPS = 10_000;
factory
Returns the address of the Buttonswap Factory
address public immutable override factory;
WETH
Returns the address of the WETH token
address public immutable override WETH;
Functions
ensure
modifier ensure(uint256 deadline);
receive
Only accepts ETH via fallback from the WETH contract
receive() external payable;
constructor
constructor(address _factory, address _WETH);
_swap
function _swap(address tokenIn, address tokenOut, uint256 amountIn) internal virtual returns (uint256 amountOut);
_wrapButton
function _wrapButton(address tokenIn, address tokenOut, uint256 amountIn)
internal
virtual
returns (uint256 amountOut);
_unwrapButton
function _unwrapButton(address tokenIn, address tokenOut, uint256 amountIn)
internal
virtual
returns (uint256 amountOut);
_wrapWETH
function _wrapWETH(address tokenIn, address tokenOut, uint256 amountIn) internal virtual returns (uint256 amountOut);
_unwrapWETH
function _unwrapWETH(address tokenIn, address tokenOut, uint256 amountIn)
internal
virtual
returns (uint256 amountOut);
_swapStep
function _swapStep(address tokenIn, uint256 amountIn, SwapStep calldata swapStep)
internal
virtual
returns (address tokenOut, uint256 amountOut);
swapExactTokensForTokens
function swapExactTokensForTokens(
address tokenIn,
uint256 amountIn,
uint256 amountOutMin,
SwapStep[] calldata swapSteps,
address to,
uint256 deadline
) external payable override ensure(deadline) returns (uint256[] memory amounts);
_getAmountIn
function _getAmountIn(address tokenIn, uint256 amountOut, SwapStep calldata swapStep)
internal
virtual
returns (uint256 amountIn);
_getAmountsIn
function _getAmountsIn(address firstTokenIn, uint256 amountOut, SwapStep[] calldata swapSteps)
internal
virtual
returns (uint256[] memory amounts);
swapTokensForExactTokens
function swapTokensForExactTokens(
address tokenIn,
uint256 amountOut,
uint256 amountInMax,
SwapStep[] calldata swapSteps,
address to,
uint256 deadline
) external payable override ensure(deadline) returns (uint256[] memory amounts);
addLiquidity
function addLiquidity(
AddLiquidityStep calldata addLiquidityStep,
SwapStep[] calldata swapStepsA,
SwapStep[] calldata swapStepsB,
uint16 movingAveragePrice0ThresholdBps,
address to,
uint256 deadline
) external returns (uint256 amountA, uint256 amountB, uint256 liquidity);
removeLiquidity
function removeLiquidity(
RemoveLiquidityStep calldata removeLiquidityStep,
SwapStep[] calldata swapStepsA,
SwapStep[] calldata swapStepsB,
address to,
uint256 deadline
) external returns (uint256 amountA, uint256 amountB);