# IdeaTokenFactory

The main task of the `IdeaTokenFactory` is to manage the creation of new markets and `IdeaTokens` and storing the parameters of such.

* `addMarket`: Adds a new market. This method may only be called by the admins.
  * `string marketName`: The name of the market (e.g. *Twitter*)
  * `address nameVerifier`: The address of the `IdeaTokenNameVerifier` for this market
  * `uint baseCost`: Bonding curve parameter, see bonding curve docs for more details
  * `uint priceRise`: Bonding curve parameter, see bonding curve docs for more details
  * `uint hatchTokens`: Bonding curve parameter, see bonding curve docs for more details
  * `uint tradingFeeRate`: The percentage trading fee collected on buy and sell operations. This value is denominated by `10,000`, meaning to set a `1%` trading fee the value `100` should be passed here since `100/10,000 = 1%`
  * `uint platformFeeRate`: Same as above, just for the platform fee
  * `bool allInterestToPlatform`: If set to `true` all interest generated by the tokens in a market goes to the platform (e.g. *Twitter*) instead of being distributed to the owner of the individual token
* `addToken`: Adds a new `IdeaToken` to a market. This method can be called by anyone.
  * `string tokenName`: The name for the token
  * `uint marketID`: The market id on which the token is to be listed
  * `address lister`: The account which is seen as lister of this token. Not stored in the contract, only emitted as event

When `addToken` is called it is checked that the name for the token does not already exist for another token in that market and that the name is valid. The name validity check is performed by the `IdeaTokenNameVerifier` which is unique to each market. If all checks are successful then a new `MinimalProxy` contract is created which points to the `IdeaToken` logic contract and ownership is transfered to the `IdeaTokenExchange`.

Additionally the factory offers other utility functions to query market and token details and also three admin-only setters:

* `setTradingFee`: Changes the trading fee for a market
* `setPlatformFee`: Changes the platform fee for a market
* `setNameVerifier`: Changes the `IdeaTokenNameVerifier` for a market


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.ideamarket.io/contracts/ideatokenfactory.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
