> ## Documentation Index
> Fetch the complete documentation index at: https://docs.onchainbrews.wtf/llms.txt
> Use this file to discover all available pages before exploring further.

# Minting

> Everything you need to know about minting a brew during a dutch auction

### Overview

* Each dutch auction lasts 420 blocks, starting at `1 ETH` and ending at  `.001 ETH`
* Exactly **one** mint is allowed per auction (enforced by `auctionMinted[id]`)
* If a full auction passes and no brew is minted, a new brew is generated for the next auction
* Every 10th token is auto-minted to `owner()` for the next auction and is **ineligible** for a minter  minter reward. (but can later be chosen as the random-holder to receive a reward)

### Supply Cadence

Every 420 blocks, a new brew is available for mint. Each dutch auction begins at 1 ETH and decreases linearly with each block until it reaches 0.0001 ETH.

```solidity theme={null}
/// dutch auction duration
uint256 public immutable AUCTION_INTERVAL = 420;

/// start and end price of every auction
uint256 public startPrice = 1 ether;
uint256 public endPrice   = 0.001 ether;
```

Helper functions in the contract are used to track auction progress and price information.

```solidity theme={null}
/// find out when the current auction ends
function currentAuctionEndBlock();

/// get the current mint price
function getCurrentPrice();
```

### Minting Brews

Only one brew can be minted per auction.  If a full auction concludes and no brew has been minted, a new brew is generated for a new auction. The token ID only increases when a brew is successfully minted.

```solidity theme={null}
/// track which auctions have been minted
mapping(uint256 => bool) public auctionMinted;

/// find out if the current auction has been minted
function currentAuctionMinted();
```

Minting results in the current brew being created on the Ethereum blockchain.

```solidity theme={null}
function mint()
```

Every 10th brew minted results in a bonus brew, which is sent to the `owner()` address. This mechanism was designed to ensure a meaningful supply of the collection accumulates in the custody of the contract owner over time.
