# Storage and types overview

### token\_t

```pascaligo
type tez_t              is unit

type fa12_token_t       is address

type fa2_token_t        is [@layout:comb] record [
  token                   : address;
  id                      : nat;
]

type token_t            is
| Tez                     of tez_t
| Fa12                    of fa12_token_t
| Fa2                     of fa2_token_t
```

### status\_auction\_t

```pascaligo
type status_auction_t   is
| Active                  of unit
| Finished                of unit
```

### auction\_t

| Field           | Type                                    | Description                                        |
| --------------- | --------------------------------------- | -------------------------------------------------- |
| status          | [status\_auction\_t](#status_auction_t) | Status of auction                                  |
| token           | [token\_t](#token_t)                    | FA1.2/FA2/TEZ token                                |
| end\_time       | timestamp                               | Time when auction will be finished                 |
| current\_bidder | address                                 | Address of a user who made current bid             |
| current\_bid    | nat                                     | Current bid                                        |
| amt             | nat                                     | Amount of tokens that that were put up for auction |

```pascaligo
type auction_t          is [@layout:comb] record [
  status                  : status_auction_t;
  token                   : token_t;
  end_time                : timestamp;
  current_bidder          : address;
  current_bid             : nat;
  amt                     : nat;
]
```

### fees\_t

| Field       | Type | Hint                            | Description                                                                                                                                                                                            |
| ----------- | ---- | ------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| dev\_fee\_f | nat  | Float value multiplied by 1e+18 | Fee that goes to the devs fund and can be [withdrawn](https://docs.quipuswap.com/smart-contracts/dex-2.0/auction-contract/entrypoints-overview/admin-entrypoints/withdraw_dev_fee) by an administrator |
| bid\_fee\_f | nat  | Float value multiplied by 1e+18 | Fee in [QuipuSwap Governance token](https://tzkt.io/KT193D4vozYnhGJQVtw7CoxxqphqUEEwK6Vb/operations/) that applies on each bid for all auctions                                                        |

```pascaligo
type fees_t             is [@layout:comb] record [
  dev_fee_f               : nat;
  bid_fee_f               : nat;
]
```

### storage\_t - main contract storage

<table><thead><tr><th width="230">Field</th><th width="217.33333333333331">Type</th><th>Hint</th><th>Description</th></tr></thead><tbody><tr><td>auctions</td><td>big_map(nat, <a href="#auction_t">auction_t</a>)</td><td></td><td>Mapping of auction IDs' to auctions</td></tr><tr><td>dev_fee_balances_f</td><td>big_map(<a href="#token_t">token_t</a>, nat)</td><td>Float value multiplied by 1e+18</td><td>Mapping of tokens to their balances that can be <a href="entrypoints-overview/admin-entrypoints/withdraw_dev_fee">withdrawn</a> by an administrator</td></tr><tr><td>public_fee_balances_f</td><td>big_map(<a href="#token_t">token_t</a>, nat)</td><td>Float value multiplied by 1e+18</td><td>Mapping of tokens to their balances for which auction can be launched (except of whitelisted tokens)</td></tr><tr><td>whitelist</td><td>set(<a href="#token_t">token_t</a>)</td><td></td><td>A set of tokens for which an auction can't be started. Can be <a href="entrypoints-overview/admin-entrypoints/update_whitelist">updated</a> by an administrator</td></tr><tr><td>quipu_token</td><td><a href="#token_t">fa2_token_t</a></td><td></td><td><a href="https://tzkt.io/KT193D4vozYnhGJQVtw7CoxxqphqUEEwK6Vb/operations/">QuipuSwap Governance token</a> address and ID</td></tr><tr><td>fees</td><td><a href="#fees_t">fees_t</a></td><td></td><td>Fees that applies to each received token</td></tr><tr><td>baker</td><td>option(key_hash)</td><td></td><td>Baker for whom all TEZ tokens on the contract were delegated. Can be <a href="entrypoints-overview/admin-entrypoints/set_baker">changed</a> by an administrator</td></tr><tr><td>admin</td><td>address</td><td></td><td>Administrator of the contract</td></tr><tr><td>pending_admin</td><td>option(address)</td><td></td><td>Pending administrator that should accept his new administrator role (if he is not <code>None</code>)</td></tr><tr><td>dex_core</td><td>address</td><td></td><td><a href="../dexcore-contract">DexCore</a> contract address</td></tr><tr><td>bid_fee_balance_f</td><td>nat</td><td>Float value multiplied by 1e+18</td><td>Bid fee balance in <a href="https://tzkt.io/KT193D4vozYnhGJQVtw7CoxxqphqUEEwK6Vb/operations/">QuipuSwap Governance token</a> that were withdrawn from each bid. Can be <a href="entrypoints-overview/admin-entrypoints/burn_bid_fee">burned</a> by an administrator</td></tr><tr><td>auctions_count</td><td>nat</td><td></td><td>Number of auctions created by all users</td></tr><tr><td>auction_duration</td><td>nat</td><td></td><td>Duration of each auction that will be created. Can be <a href="entrypoints-overview/admin-entrypoints/set_auction_duration">changed</a> by an administrator</td></tr><tr><td>min_bid</td><td>nat</td><td></td><td>Minimum possible bid in time of auction launch. Can be <a href="entrypoints-overview/admin-entrypoints/set_min_bid">changed</a> by an administrator</td></tr></tbody></table>

```pascaligo
type storage_t          is [@layout:comb] record [
  auctions                : big_map(nat, auction_t);
  dev_fee_balances_f      : big_map(token_t, nat);
  public_fee_balances_f   : big_map(token_t, nat);
  whitelist               : set(token_t);
  quipu_token             : fa2_token_t;
  fees                    : fees_t;
  baker                   : option(key_hash);
  admin                   : address;
  pending_admin           : option(address);
  dex_core                : address;
  bid_fee_balance_f       : nat;
  auctions_count          : nat;
  auction_duration        : int;
  min_bid                 : nat;
]
```

### full\_storage\_t - storage root

| Field            | Type                                           | Description                                                                                                           |
| ---------------- | ---------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- |
| storage          | [storage\_t](#storage_t-main-contract-storage) | Actual storage of the contract                                                                                        |
| auction\_lambdas | big\_map(nat, bytes)                           | Contract's lambda-methods                                                                                             |
| metadata         | big\_map(string, bytes)                        | Contract's metadata according to [TZIP-016](https://gitlab.com/tezos/tzip/-/blob/master/proposals/tzip-16/tzip-16.md) |

```pascaligo
type full_storage_t     is [@layout:comb] record [
  storage                 : storage_t;
  auction_lambdas         : big_map(nat, bytes);
  metadata                : big_map(string, bytes);
]
```
