Pangea Swap
English
English
  • Introduction
  • Protocol Overview
  • Disclaimer
    • Risk & Security
    • Terms of Use
  • Updates
  • Audit
  • concentrated liquidity
    • Weakness of V2 DEXs: Low Liquidity utilization rate
    • Solution by V3 DEXs: Concentrated Liquidity
    • Concentrated Liquidity FAQ
  • Connectivity
    • Customizable Pool
  • Governance
    • STONE
      • STONE Distribution Plan
      • Tokenomics (Before)
      • Tokenomics (After)
      • Growth Fund History
    • Contribution Point NFT
  • Guide
    • SWAP
    • Add Liquidity
      • Add liquidity (Preset)
      • Add liquidity (Custom)
    • STONE Staking
    • Revenue Sharing
    • FAQ
  • Growth Partnership
    • Swapscanner
    • ISKRA
  • event
    • Promotion
  • Developers
    • Concept Overview
      • Problem : Lazy Liquidity
      • Liquidity Concentration
      • Position & Risk
      • Price Tick
      • Position NFT
      • Fees
      • Flash Loan
    • Contracts
      • Core Contracts
        • MasterDeployer
        • ConcentratedLiquidityPoolFactory
        • ConcentratedLiquidityPool
        • ConcentratedLiquidityPoolManager
        • PoolRouter
        • PoolLogger
        • AirdropDistributor
      • Contribution Point NFT
      • Price Oracle
    • Interacting with the Protocol
      • Setting up Local Test Environment
        • Test env. commands
      • Getting Pangea Pool Info
      • Creating Pangea Pool
      • Mint Position (add liquidity)
      • Burn Position (remove liquidity)
      • Claim Fee
      • Swap
  • Community
    • Website
    • Discord
    • Telegram
    • Medium
    • Twitter
    • Opensea - Position NFT
    • Opensea - CP NFT
    • GitHub
    • Testnet
    • E-mail
Powered by GitBook
On this page
  • Overview
  • Methods
  • exactInput
  • exactInputSingle
  • exactOutput
  • exactOutputSingle
  • sweep
  1. Developers
  2. Contracts
  3. Core Contracts

PoolRouter

A contract that routes tokens to be swapped in various pools of Pangea.

PreviousConcentratedLiquidityPoolManagerNextPoolLogger

Last updated 2 years ago

Overview

PoolRouter is an intermediary that allows you to swap tokens in multiple pools of Pangea. Currently supports exactInputSingle and will expand to support various swaps with exactOutput, exactOutputSingle, complexPathSwap.

Methods

exactInput

function exactInput(IRouter.ExactInputParams params) external payable returns (uint256 amountOut)

swap amountIn of one token for as much as possible of another token

Parameters

Name

Type

Description

params

IRouter.ExactInputParams

abi.encode(address tokenIn, uint256 amountIn, uint256 amountOutMinimum, address[] path, address to, bool unwrap)

IRouter.ExactInputParams Struct

Description

tokenIn

address

the input token address. If tokenIn is address(0), msg.value will be wrapped and used as input token

amountIn

uint256

the amount of input tokens to send.

amountOutMinimum

amountOutMinimum

minimum required amount of output token after swap

path

address[]

an array of pool addresses to pass through

to

address

recipient of the output tokens

unwrap

bool

unwrap if output token is wrapped klay

exactInputSingle

function exactInputSingle(IRouter.ExactInputSingleParams params) external payable returns (uint256 amountOut)

swap amountIn of one token for as much as possible of another token along the specified path

Parameters

Name

Type

Description

params

IRouter.ExactInputSingleParams

abi.encode(address tokenIn, uint256 amountIn, uint256 amountOutMinimum, address pool, address to, bool unwrap)

IRouter.ExactInputSingleParams Struct

tokenIn

address

the input token address. If tokenIn is address(0), msg.value will be wrapped and used as input token

amountIn

uint256

the amount of input token to send

amountOutMinimum

uint256

minimum required amount of output token after swap

pool

address

pool address to swap

to

address

address to receive output tokens

unwrap

bool

unwrap if output token is wrapped klay

exactOutput

function exactOutput(IRouter.ExactOutputParams params) external payable returns (uint256 amountIn)  . 

Swaps as little as possible of one token for amountOut of another token

Parameters

Name

Type

Description

params

IRouter.ExactOutputParams

abi.encode(address tokenIn, uint256 amountOut, uint256 amountInMaximum, address[] path, address to, bool unwrap)

IRouter.ExactOutputParams Struct

Description

tokenIn

address

the input token address. If tokenIn is address(0), msg.value will be wrapped and used as input token

amountOut

uint256

the amount of output tokens to receive

amountInMaximum

uint256

maximum available amount of input token for swap

path

address[]

an array of pool addresses to pass through

to

address

recipient of the output tokens

unwrap

bool

unwrap if output token is wrapped KLAY

exactOutputSingle

function exactOutputSingle(IRouter.ExactOutputSingleParams params) external payable returns (uint256 amountOut)

Swaps amountIn of one token for as much as possible of another token along the specified path

Parameters

Name

Type

Description

params

IRouter.ExactOutputSingleParams

abi.encode(address tokenIn, uint256 amountOut, uint256 amountInMaximum, address pool, address to, bool unwrap)

IRouter.ExactOutputSingleParams Struct

tokenIn

address

the input token address. If tokenIn is address(0), msg.value will be wrapped and used as input token

amountOut

uint256

the amount of input token to send

amountInMaximum

uint256

maximum available amount of input token for swap

pool

address

pool address to swap

to

address

address to receive output tokens

unwrap

bool

unwrap if output token is wrapped KLAY

sweep

function sweep(address token, uint256 amount, address recipient) external payable

Recover mistakenly sent tokens

pangea-core/PoolRouter.sol at main · pangea-protocol/pangea-coreGitHub
Logo