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 PrimaryMarket Info
  • Creating/Redeeming Tranches
  • Splitting/Merging Tranches

Was this helpful?

  1. Tech Support
  2. Protocol Overview

Primary Market

Getting PrimaryMarket Info

PrimaryMarket.fund() → address

The address of the fund contract.

>>> primaryMarket.fund()
'0x69c53679EC1C06f3275b64C428e8Cd069a2d3966'

Creating/Redeeming Tranches

PrimaryMarket.getCreation(uint256 underlying) → uint256

Get the amount of QUEEN created by underlying amount of the underlying asset.

>>> primaryMarket.getCreation(1000000000000000000)
'998239992407933623'

PrimaryMarket.getCreationForQ(uint256 minOutQ) → uint256

Get the amount of the underlying asset to create at least minOutQ amount of QUEEN.

  • Note that this only works with non-empty fund for simplicity.

>>> primaryMarket.getCreationForQ(1000000000000000000)
'1001763110680249269'
>>> primaryMarket.getCreation(1001763110680249269)
'1000000000000000000'

PrimaryMarket.getRedemption(uint256 inQ) → uint256, uint256

Get the amount of the underlying asset redeemed by inQ amount of QUEEN.

>>> primaryMarket.getRedemption(1000000000000000000)
underlying: '1001763110680249268'
feeQ: '0'

PrimaryMarket.getRedemptionForUnderlying(uint256 minUnderlying) → uint256

Get the amount of QUEEN to redeem at least minUnderlying amount of the underlying asset.

>>> primaryMarket.getRedemptionForUnderlying(1000000000000000000)
'998239992407933624'
>>> primaryMarket.getRedemption(998239992407933624)
underlying: '1000000000000000000'
feeQ: '0'

PrimaryMarket.redeem(address recipient, uint256 inQ, uint256 minUnderlying, uint256 version) → uint256

Redeem inQ amount of QUEEN and transfer the resulting underlying asset to recipient. It enforces the resulting underlying asset to be at least minUnderlying and the version to be the current rebalance version.

  • Note that the function would revert if there were queued redemptions that cannot be claimed at the moment.

PrimaryMarket.redeemAndUnwrap(address recipient, uint256 inQ, uint256 minUnderlying, uint256 version) → uint256

Redeem inQ amount of QUEEN, unwrap the underlying asset to its native currency, and transfer the resulting underlying asset to recipient. It enforces the resulting underlying asset to be at least minUnderlying and the version to be the current rebalance version. The underlying asset must be a wrapped token of the native currency.

  • Note that the function would revert if there were queued redemptions that cannot be claimed at the moment.

PrimaryMarket.queueRedemption(address recipient, uint256 inQ, uint256 minUnderlying, uint256 version) → uint256, uint256

Submit a redemption request for inQ amount of QUEEN. The resulting underlying asset will be claimable when the fund has enough balance to pay this redemption and all the previous ones in the queue. It enforces the resulting underlying asset to be at least minUnderlying and the version to be the current rebalance version.

PrimaryMarket.claimRedemptions(address account, uint256[] calldata indices) → uint256

Claim the underlying asset of an array of queued redemption requests by account and transfer the underlying asset to account.

PrimaryMarket.claimRedemptionsAndUnwrap(address account, uint256[] calldata indices) → uint256

Claim the underlying asset of an array of queued redemption requests by account, unwrap the underlying asset to its native currency, and transfer the underlying asset to account. The underlying asset must be a wrapped token of the native currency.

Splitting/Merging Tranches

PrimaryMarket.getSplit(uint256 inQ) → uint256

Get the amount of BISHOP and ROOK split from inQ amount of QUEEN.

>>> primaryMarket.getSplit(1000000000000000000)
'594418130555555555274'

PrimaryMarket.getSplitForB(uint256 minOutB) → uint256

Get the amount of QUEEN to split at least minOutB amount of BISHOP and ROOK.

>>> primaryMarket.getSplitForB(1000000000000000000)
'1682317460716381'
>>> primaryMarket.getSplit(1682317460716381)
'000000000000000465'

PrimaryMarket.getMerge(uint256 inB) → uint256, uint256

Get the amount of QUEEN merged from inB amount of BISHOP and ROOK.

>>> primaryMarket.getMerge(1000000000000000000)
outQ: '1680635143255664'
feeQ: '1682317460716'

PrimaryMarket.getMergeForQ(uint256 minOutQ) → uint256

Get the amount of BISHOP and ROOK to merge into at least minOutQ amount of QUEEN.

>>> primaryMarket.getMergeForQ(1000000000000000000)
'595013143699254810084'
>>> primaryMarket.getMerge(595013143699254810084)
outQ: '1000000000000000000'
feeQ: '1001001001001001'

PrimaryMarket.split(address recipient, uint256 inQ, uint256 version) → uint256

Split inQ amount of QUEEN into BISHOP and ROOK and send the resulting shares to recipient. It enforces the version to be the current rebalance version.

PrimaryMarket.merge(address recipient, uint256 inB, uint256 version) → uint256

Merge inB amount of BISHOP and ROOK into QUEEN and send the resulting shares to recipient. It enforces the version to be the current rebalance version.

PreviousFundNextPrimaryMarket Router

Last updated 1 year ago

Was this helpful?