> For the complete documentation index, see [llms.txt](https://bloxxa-1.gitbook.io/bloxxa-guide/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://bloxxa-1.gitbook.io/bloxxa-guide/technical-guide/markdown/sale.md).

# Sale

To create a sale contract, you need to enter the address of an already existing token. After successful payment and contract deployment, it can be used to conduct sales.

To start a sale, call the **createSale()** function, which accepts the following arguments:

* **saleNumber** — the round number of the sale.
* **startDate** — the start date of the round (in Unix epoch format).
* **endDate** — the end date of the round (in Unix epoch format).
* **tokenPrice** — the price of the token (can be changed later).
* **pool** — the total number of tokens available for sale.
* **max** — the maximum number of tokens a single user can purchase.
* **min** — the minimum purchase amount.

To buy tokens, call the **buyTokens(saleNumber, amount)** function.

**Additional Functions:**

* **getUserTokens(userAddress)** — get the number of tokens a user has.
* **getAllUsersToken(saleNumber)** — get the tokens of all users in a specific sale round.
* **setPrice(saleNumber, newPrice)** — change the token price.
* **setEndTime(saleNumber, newTime)** — change the round's end time.
* **setStartTime(saleNumber, newTime)** — change the round's start time.
* **setToken(newToken)** — change the token used for the sale.
