> For the complete documentation index, see [llms.txt](https://docs.tranchess.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.tranchess.com/tech-support/protocol-overview/primarymarket-router.md).

# PrimaryMarket Router

## Creating/Splitting/Staking Tranches

#### `PrimaryMarketRouter.create(address recipient, uint256 underlying, uint256 minOutQ, uint256 version) → uint256`

Create QUEEN with `underlying` amount of underlying asset for `recipient`. It enforces the resulting QUEEN to be at least `minOutQ` and the `version` to be the current rebalance version.

#### `PrimaryMarketRouter.createAndStake(uint256 underlying, uint256 minOutQ, address staking, uint256 version)`

Create QUEEN with `underlying` amount of underlying asset and stake the QUEEN to `staking` contract for `msg.sender`. It enforces the resulting QUEEN to be at least `minOutQ` and the `version` to be the current rebalance version.

#### `PrimaryMarketRouter.createSplitAndStake(uint256 underlying, uint256 minOutQ, address router, address quoteAddress, uint256 minLpOut, address staking, uint256 version)`

Create QUEEN with `underlying` amount of underlying asset, split QUEEN into BISHOP and ROOK, stake the resulting BISHOP to StableSwap (found by querying `router` contract with BISHOP address and `quoteAddress`) for LP tokens. If `staking` is non-zero address, it further stakes the resulting ROOK to `staking` contract for `msg.sender`. It enforces the resulting LP token to be at least `minLpOut` and the `version` to be the current rebalance version.

#### `PrimaryMarketRouter.splitAndStake(uint256 inQ, address router, address quoteAddress, uint256 minLpOut, address staking, uint256 version)`

Split `inQ` amount of QUEEN into BISHOP and ROOK, stake the resulting BISHOP to StableSwap (found by querying `router` contract with BISHOP address and `quoteAddress`) for LP tokens. If `staking` is non-zero address, it further stakes the resulting ROOK to `staking` contract for `msg.sender`. It enforces the resulting LP token to be at least `minLpOut` and the `version` to be the current rebalance version.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.tranchess.com/tech-support/protocol-overview/primarymarket-router.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
