# Pool Initialization

Pools can be initialized for a given pair by using callpath index 0:

```
userCmd(1, abi.encode(
  71,        // Fixed initPool subcode  
  base,      // address
  quote,     // address
  poolIdx,   // uint256
  price      // uint128
)
```

In addition to the fixed initPool command sub-code (71), the following parameters are passed to initialize a pool:

* base - The address of the base token or virtual token
* quote - The address of the quote token or virtual token
* poolIdx - The arbitrary index of the pool type the user is swapping on.
* price - The initial price in the pool. Represented as Q64.64 square root (see [type-conventions](https://docs.ambient.finance/developers/type-conventions "mention") for description of how to represent prices)

Initializing a pool will require a permanent commitment of a small amount of base and quote tokens (based on the set `newPoolLiquidity` in the `CrocSwapDex` contract). Pool initialization will always try funding based on the user's surplus collateral. If insufficient will try to collect tokens directly.&#x20;

Therefore user must either fund their surplus collateral, approve ERC20 tokens, or send sufficient quantity in `msg.value` of the call. (See [token-transfers](https://docs.ambient.finance/developers/token-transfers "mention") for more information on these mechanics.)
