Tranchess Docs
Website
  • ♟️Welcome to Tranchess
  • FAQ
    • 🎯Turbo and Stable
      • QUEEN
      • Turbo
      • Stable
      • Swap and LPs
      • Upon maturity
      • Staked ETH Yield Enhancement
        • Primary Market
          • turYETH and staYETH (Turbo and Stable)
        • Swap
    • ⚓Asset-Tracking and Liquid Staking
      • General
        • Create & Redeem
      • Liquid Staking
        • Liquid Staking - Ethereum
        • BNB Fund
      • Instant Swap
        • Instant Swap - Ethereum
        • Instant Swap - BNB Chain
        • Tranchess Swap (V1)
      • Rebalance
        • History Rebalance Record
    • CHESS
    • veChess
    • Governance
    • Roadmap
      • Milestone Timeline
    • Media Kit
  • Product Retirement Tracker
    • Intro: Transition Updates
    • Timeline & Milestones
    • User Guides
  • Tech Support
    • Protocol Overview
      • Fund
      • Primary Market
      • PrimaryMarket Router
      • StableSwap Router
      • Node Operator Registry
      • Governance & Crosschain
    • Node Operator
      • The Mechanics of qETH
        • An example for Node Operators
      • Node Operator Manual
        • Functions to Read Node Operator Information
    • Contracts
      • Tranchess on Scroll
      • Tranchess on Ethereum
      • Tranchess on BNB Chain
      • [Archive]Tranchess V1 Contracts
  • Whitepaper
    • DISCLAIMERS
  • Links
  • Tranchess
  • Governance Forum
  • GitHub
  • Medium
  • Twitter
  • Discord
  • Telegram
  • TranchessWiki
  • Bug Bounty
Powered by GitBook
On this page
  • Getting StableSwap Info
  • Making Exchanges

Was this helpful?

  1. Tech Support
  2. Protocol Overview

StableSwap Router

Getting StableSwap Info

SwapRouter.getSwap(address baseToken, address quoteToken) → IStableSwap

Getter for the swap instance for the given token pair.

>>> swapRouter.getSwap()
outQ: '1680635143255664'
feeQ: '1682317460716'

SwapRouter.getAmountsOut(uint256 amount, address[] path) → uint256[], IStableSwap[], bool[]

Calculate all subsequent maximum output amounts of the asset given reserves following the path of token addresses given an input asset amount.

SwapRouter.getAmountsIn(uint256 amount, address[] path) → uint256[], IStableSwap[], bool[]

Calculate all subsequent minimum input amounts of the asset given reserves following the path of token addresses given an output asset amount.

Making Exchanges

SwapRouter.addLiquidity(address baseAddress, address quoteAddress, uint256 baseIn, uint256 quoteIn, uint256 minLpOut, uint256 version, uint256 deadline)

Deposit baseIn amount of baseAddress and quoteIn amount of quoteAddress to StableSwap pool of baseAddress and quoteAddress. It enforces the resulting LP token to be at least minLpOut, the version to be the current rebalance version, and the Unix timestamp deadline after which the transaction will revert.

SwapRouter.swapExactTokensForTokens(uint256 amountIn, uint256 minAmountOut, address[] path, address recipient, address staking, uint256[] versions, uint256 deadline) → uint256[]

Swap the exact amountIn of input tokens for as many output tokens as possible for recipient, along the route determined by path. The first element of path is the input token, the last is the output token, and any intermediate elements represent intermediate pairs to trade through. If staking is non-zero address, it further stakes the resulting output token to staking contract for recipient. It enforces the resulting output token to be at least minAmountOut, every versions to be the current rebalance version, and the Unix timestamp deadline after which the transaction will revert.

SwapRouter.swapTokensForExactTokens(uint256 amountOut, uint256 maxAmountIn, address[] path, address recipient, address staking, uint256[] versions, uint256 deadline) → uint256[]

Receive the exact amountOut of output tokens for as few input tokens as possible for recipient, along the route determined by path. The first element of path is the input token, the last is the output token, and any intermediate elements represent intermediate pairs to trade through. If staking is non-zero address, it further stakes the resulting output token to staking contract for recipient. It enforces the resulting input token to be at most maxAmountIn, every versions to be the current rebalance version, and the Unix timestamp deadline after which the transaction will revert.

SwapRouter.swapExactTokensForTokensUnwrap(uint256 amountIn, uint256 minAmountOut, address[] path, address recipient, uint256[] versions, uint256 deadline) → uint256[]

Swap the exact amountIn of input tokens for as many output tokens as possible andunwrap the output tokens for recipient, along the route determined by path. The first element of path is the input token, the last is the output token, and any intermediate elements represent intermediate pairs to trade through. It enforces the resulting output token to be at least minAmountOut, every versions to be the current rebalance version, and the Unix timestamp deadline after which the transaction will revert.

SwapRouter.swapTokensForExactTokensUnwrap(uint256 amountOut, uint256 maxAmountIn, address[] path, address recipient, uint256[] versions, uint256 deadline) → uint256[]

Receive the exact amountOut of output tokens for as few input tokens as possible and unwrap the output tokens for for recipient, along the route determined by path. The first element of path is the input token, the last is the output token, and any intermediate elements represent intermediate pairs to trade through. It enforces the resulting input token to be at most maxAmountIn, every versions to be the current rebalance version, and the Unix timestamp deadline after which the transaction will revert.

PreviousPrimaryMarket RouterNextNode Operator Registry

Last updated 1 year ago

Was this helpful?