# Batch Auction Mechanics

A deep-dive into the mechanics of Gnosis Batch Auctions, the smart contracts used by the Bio.xyz Launchpad.

Batch auctions are a mechanism of selling tokens to a community that helps to raise funding and gives a fair token price to all token participants. Instead of time-based price changes like traditional auctions (for example, a Dutch Auction) the price is determined by bidders' demand for tokens at different prices. This page discusses how batch auctions 1) raise funds, 2) price the token.

**Step-by-Step Guide to Gnosis Batch Auctions**

**Step-by-Step Guide to Gnosis Batch Auctions**

**Total Auctioned Tokens**: Consider a collection (or pile) of tokens that a BioDAO wants to be auctioned off - to help raise money for and distribute governance of the DAO.**Placing Bids**: Auction participants are free to bid their desired**amount**and**price**over the auction period.**Sorting Bids**: Once the auction is completed, all received bids are arranged in a specific order:First, they're sorted by their bid price from the highest to the lowest.

If there are any bids at the same price, those are further sorted based on the bid amount, from the smallest to largest.

**Finding the final clearing price**: The final clearing price is the price that exhausts the supply of all Auction Tokens. To find that final clearing price, the distribution of tokens is simulated at different potential clearing prices. This simulated distribution follows a specific method:In the

*first*iteration, tokens are distributed only to the topmost bid at its offered price.In the

*second*iteration, tokens are distributed to the top two bids but at the price of the second bid.In each iteration, we consider all bids up to and including the next highest price. If multiple bidders have bid at this price, all of them are included. The distribution for that iteration then uses the price of this latest group of bidders.

This process repeats until all tokens are distributed. The price at which all tokens are first fully distributed becomes the final clearing price.

**Distributing Tokens**:At the final clearing price, tokens are distributed from the highest to lowest bidders.

Once all tokens have been distributed, distribution stops, even if a user bid above the final bid price.

**Example Walkthrough**

**Example Walkthrough**

Consider 15 tokens are being sold by a BioDAO in a batch auction. At the end of the auction, bids are received as follows:

Bid No. | Bid Amount | Bid Price |
---|---|---|

1 | 2 | 20 |

2 | 4 | 11 |

3 | 5 | 11 |

4 | 3 | 2 |

5 | 7 | 0.5 |

6 | 5 | 0.3 |

**Clearing Price Calculation**

**Clearing Price Calculation**

The Clearing Price is the highest *BidPrice *where the following is true:

$\sum_{i=1->n}^{n} \frac{BidAmount_i}{BidPrice_i} = SellVolume > Total Auctioned Tokens$

*i*:* *A particular bidder

$BidAmount_i$:* *The total bid amount of for a given bidder above the *BidPrice*

$BidPrice_i$:* *The simulated clearing price during each iteration

$SellVolume$:* *The total amount of tokens that would be distributed at the simulated clearing price

$TotalAuctionTokens$:* *The total number of tokens being sold in the auction (15 in this example)

**Iteration 1 -> BidPrice = 20**

**Iteration 1 -> BidPrice = 20**

$SellVolume = \sum \frac{2}{20} = 0.1 < Total Auctioned Tokens = 15$

Only Bid #1 is at or above the *BidPrice* of 20. Because only 0.1 tokens would be distributed if this were the clearing price, it cannot be the final clearing price.

**Iteration 2 -> BidPrice = 11**

$SellVolume = \sum \frac{2}{11}+\frac{4}{11}+\frac{5}{11} = 1 < Total Auctioned Tokens = 15$

Bids #1-3 are at or above the *BidPrice* of 11. Because only 0.1 tokens would be distributed if this were the clearing price, it cannot be the final clearing price.

**Iteration 3 -> BidPrice = 2**

$SellVolume = \sum \frac{2}{2}+\frac{4}{2}+\frac{5}{2}+\frac{3}{2} = 7 < Total Auctioned Tokens = 15$

Bids #1-4 are at or above the *BidPrice* of 2. Because only 7 tokens would be distributed if this were the clearing price, it cannot be the final clearing price.

**Iteration 4 -> BidPrice = 0.5**

$SellVolume = \sum \frac{2}{0.5}+\frac{4}{0.5}+\frac{5}{0.5}+\frac{3}{0.5}+\frac{7}{0.5} = 42 > Total Auctioned Tokens = 15$

Bids #1-5 are at or above the *BidPrice* of 0.5. Because 42 tokens would be distributed if this were the clearing price, and this is greater than the TotalAuctionedTokens, 0.5 becomes the final clearing price.

**Final Outcome -> ClearingPrice = 0.5**

TotalAuctionedTokens = 15

Bidder 1: Receives $\frac{2}{0.5}=4$ tokens, 11 tokens left

Bidder 2: Receives $\frac{4}{0.5}=8$ tokens, 3 tokens left

Bidder 3: Should receive $\frac{5}{0.5}=10$ tokens, but there are only 3 tokens left, so Bidder 3 receives an those 3 Auction Tokens, and the remainder as a refund. To calculate the refund, we must refund that did not go towards an allocation in Auction Tokens ${10 }-3=7$. At a clearing price of 0.5, Bidder 3's refund is $7 * 0.5 = 3.5$, and spends $5-3.5=1.5$ bid tokens.

Bidder 4: Receives no Auction Tokens, only a refund of 3.

Bidder 5: Receives no Auction Tokens, only a refund of 7.

Bidder 6: Receives no Auction Tokens, only a refund of 5.

The total amount of funding received by the DAO is $2+4+1.5=7.5$ bid tokens.

Last updated