The Router smart contract serves as the primary interface for interacting with the PumpSpace decentralized exchange. It handles token swaps, adding/removing liquidity, and routing logic through the Factory and Pair contracts.
Address
Functions
addLiquidity
Adds liquidity to a token pair pool. If the pool does not exist, it is created via the Factory.
Copy function addLiquidity(
address tokenA,
address tokenB,
uint256 amountADesired,
uint256 amountBDesired,
uint256 amountAMin,
uint256 amountBMin,
address to,
uint256 deadline
) external returns (uint256 amountA, uint256 amountB, uint256 liquidity);
addLiquidityETH
Adds liquidity to a token-ETH pool. If the pool doesn't exist, it is created via the Factory.
Copy function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
) external payable returns (uint256 amountToken, uint256 amountETH,uint256 liquidity);
removeLiquidity
Removes liquidity from a token pair pool, returning the underlying tokens.
Copy function removeLiquidity(
address tokenA,
address tokenB,
uint256 liquidity,
uint256 amountAMin,
uint256 amountBMin,
address to,
uint256 deadline
) external returns (uint256 amountA, uint256 amountB);
removeLiquidityETH
Removes liquidity from a token-ETH pool, returning both token and ETH to the user.
Copy function removeLiquidityETH(
address token,
uint256 liquidity,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
) external returns (uint256 amountToken, uint256 amountETH);
swapExactTokensForTokens
Swaps an exact amount of tokens for another token through one or more pools.
Copy function swapExactTokensForTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external returns (uint256[] memory amounts);
swapExactETHForTokens
Swaps an exact amount of ETH for as many output tokens as possible.
Copy function swapExactETHForTokens(
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external payable returns (uint256[] memory amounts);
swapExactTokensForETH
Swaps an exact amount of tokens for as much ETH as possible.
Copy function swapExactTokensForETH(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external returns (uint256[] memory amounts);
getAmountsOut
Given an input amount and token path, returns the expected output amounts at each swap step.
Copy function getAmountsOut(
uint256 amountIn,
address[] calldata path
) external view returns (uint256[] memory amounts);
getAmountsIn
Given a desired output amount and token path, returns the required input amounts at each swap step.
Copy function getAmountsIn(
uint256 amountOut,
address[] calldata path
) external view returns (uint256[] memory amounts);