> For the complete documentation index, see [llms.txt](https://docs.ideamarket.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ideamarket.io/contracts/ideatokenfactory.md).

# 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
