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