> For the complete documentation index, see [llms.txt](https://docs.quipuswap.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.quipuswap.com/smart-contracts/quipuswap-stable-swap-dex/factory/storage-and-types-overview.md).

# Storage and types overview

### Base types

```pascaligo
type token_id_t        is nat

type pool_id_t         is nat

type token_pool_idx_t  is nat

type fa12_token_t      is address

type fa2_token_t       is [@layout:comb] record[ 
    token_address        : address; 
    token_id             : token_id_t; 
]

type token_t           is 
| Fa12                   of fa12_token_t 
| Fa2                    of fa2_token_t

type tokens_map_t      is map(nat, token_t);
```

### Storage - main contract storage

<table><thead><tr><th width="186.35180549489237">Field</th><th width="174" align="center">Type</th><th width="233">Hint</th><th>Description</th></tr></thead><tbody><tr><td>dev_store</td><td align="center"><code>dev_storage_t</code></td><td></td><td><a data-mention href="/pages/4CwdOCT6wvSV6vXLIZoH#developer-storage">/pages/4CwdOCT6wvSV6vXLIZoH#developer-storage</a></td></tr><tr><td>init_price</td><td align="center"><code>nat</code></td><td></td><td>Amount of QUIPU tokens to be charged when deploy of DEX called.</td></tr><tr><td>burn_rate</td><td align="center"><code>nat</code></td><td>Decimal value. multiplied by <span class="math">10^6</span></td><td>Persent of QUIPU charges to be sent to zero address. </td></tr><tr><td>pools_count</td><td align="center"><code>nat</code></td><td>Counter</td><td>Amount of pools created by current contract.</td></tr><tr><td>pool_to_address</td><td align="center"><code>big_map(bytes, address)</code></td><td>Bytes - packed by <code>Bytes.pack(key)</code> where key is <code>record[ tokens=tokens; deployer=deployer]</code>  where tokens is valid <code>tokens_map_t</code> (sorted tokens) and deployer is address of user that deployed DEX contract.</td><td>Mapping that allows finding pool address by packed bytes of record with fields <code>tokens</code> of <code>tokens_map_t</code> type and <code>deployer</code> of <code>address</code>.</td></tr><tr><td>quipu_token</td><td align="center"><code>fa2_token_t</code></td><td></td><td>QUIPU token address and token ID</td></tr><tr><td>quipu_rewards</td><td align="center"><code>nat</code></td><td></td><td>Collected QUIPU tokens from deploy (without sent to zero address).</td></tr><tr><td>whitelist</td><td align="center"><code>set(address)</code></td><td></td><td>set of addresses that allowed to deploy without QUIPU charges.</td></tr></tbody></table>

```pascaligo
type inner_store_t      is [@layout:comb] record[
  dev_store               : dev_storage_t;
  init_price              : nat; (* Pool creation price in QUIPU token *)
  burn_rate               : nat; (* Percent of QUIPU tokens to be burned *)
  pools_count             : nat;
  pool_to_address         : big_map(bytes, address);
  quipu_token             : fa2_token_t;
  quipu_rewards           : nat;
  whitelist               : set(address);
]
```

### Full storage type - storage root

<table><thead><tr><th width="183.44565217391303">Field</th><th width="170" align="center">Type</th><th width="150">Hint</th><th>Description</th></tr></thead><tbody><tr><td>storage</td><td align="center"><code>inner_store_t</code></td><td><a data-mention href="#storage-main-contract-storage">#storage-main-contract-storage</a></td><td>Main configuration and contract values of factory</td></tr><tr><td>admin_lambdas</td><td align="center"><code>big_map(nat, bytes)</code></td><td></td><td>Administrative lambda-methods storage</td></tr><tr><td>dex_lambdas</td><td align="center"><code>big_map(nat, bytes)</code></td><td></td><td>DEX stable swap protocol lambda-methods storage</td></tr><tr><td>token_lambdas</td><td align="center"><code>big_map(nat, bytes)</code></td><td></td><td>FA2 lambda-methods storage</td></tr><tr><td>init_func</td><td align="center"><code>option(bytes)</code></td><td></td><td>lambda function for deploying new DEX</td></tr></tbody></table>

```pascaligo
type full_storage_t     is [@layout:comb] record [
  storage                 : inner_store_t;
  admin_lambdas           : big_map(nat, bytes); (* map with admin-related functions code *)
  dex_lambdas             : big_map(nat, bytes); (* map with exchange-related functions code *)
  token_lambdas           : big_map(nat, bytes); (* map with token-related functions code *)
  init_func               : option(bytes); (* lambda function for deploying new DEX *)
]
```
