> For the complete documentation index, see [llms.txt](https://world-book.gitbook.io/worldbook/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://world-book.gitbook.io/worldbook/technical-documentation/token-factory.md).

# 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.
