# Token Factory

The protocol provides a minimal factory to deploy standard ERC-20 tokens and register them with the `Manager`'s standard token registry.

## Contracts

* `TokenFactory.sol` (creates standard tokens and marks them as standard in `Manager`)
* `WBStandardToken.sol` (non-upgradeable, exact-transfer ERC-20 with immutable decimals)

## TokenFactory

```solidity
constructor(address manager);

event StandardTokenCreated(
    address indexed token,
    string name,
    string symbol,
    uint8 decimals,
    uint256 initialSupply,
    address recipient
);

function createStandardToken(
    string calldata name,
    string calldata symbol,
    uint8 decimals_,
    uint256 initialSupply,
    address initialRecipient,
    address initialOwner
) external returns (address token);
```

Behavior:

* Deploys a new `WBStandardToken`
* Mints `initialSupply` to `initialRecipient`
* Transfers ownership to `initialOwner`
* Calls `Manager.setStandardToken(token, true)`
* Emits `StandardTokenCreated`

## WBStandardToken

```solidity
constructor(
    string memory name_,
    string memory symbol_,
    uint8 decimals_,
    uint256 initialSupply,
    address initialRecipient,
    address initialOwner
);

function decimals() public view returns (uint8);
```

Notes:

* Exact-transfer ERC-20 (no fees, no hooks, no rebasing)
* `decimals` is immutable and returned via override
* `Ownable`: ownership set to `initialOwner`

## Manager Integration

Standard token registry and enforcement:

```solidity
function setStandardToken(address token, bool isStandard) external onlyAdminRole;
function isStandardToken(address token) external view returns (bool);
function setEnforceStandardBaseOnRegister(bool enforce) external onlyAdminRole;

event StandardTokenUpdated(address indexed token, bool isStandard);
event StandardBaseEnforcementUpdated(bool oldEnforce, bool newEnforce);
```

When enforcement is enabled, new OrderBooks must use a BASE token marked as standard.


---

# 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://world-book.gitbook.io/worldbook/technical-documentation/token-factory.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.
