PS-Docs
  • 🚀Hello! PumpSpace
  • PumpSpace
    • 📊Bonding Curve
    • 👫How to Participate?
    • 👑How to Launch?
    • 💵Protocol Fees
    • 💰PumpSpace Reward
  • AquaSpace
    • ⏳Tokenomics
    • 👮‍♂️Audit Report
    • 📖Content Policy
    • 📚Terms and Conditions
  • Contract
    • Token
    • Factory
    • Router
    • Pair
  • 👥 Resources
    • PumpSpace (Website)
    • X (Twitter)
    • Telegram
    • BlueWhale (Website)
    • BlueWhale (Telegram)
Powered by GitBook
On this page
  • Address
  • Functions
  1. Contract

Router

PreviousFactoryNextPair

Last updated 2 months ago

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

📝 The contract is verified on , and its source code can be publicly viewed there.


Functions

addLiquidity

Adds liquidity to a token pair pool. If the pool does not exist, it is created via the Factory.

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.

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.

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.

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.

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.

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.

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.

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.

function getAmountsIn(
        uint256 amountOut,
        address[] calldata path 
) external view returns (uint256[] memory amounts); 
0xE8A55f6b4EE94D2DBe02e724bC23228E15a59946
Avalanche C-Chain Explorer