# 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: 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:

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

The question should be specific, self-contained, and written in natural language.
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.
