Skip to main content

Signature

IB20Factory.sol

Description

Creates a B20 token of the given variant at the deterministic address derived from (variant, msg.sender, salt). The Factory encodes the variant choice into the token address: byte [0] is 0xB2, byte [10] is the variant discriminant (0x00 for Asset, 0x01 for Stablecoin). The Factory then plants a 0xef bytecode stub at that address, the stub the node reads to recognize a live B20, seals the token’s identity (name, symbol, decimals, and variant-specific fields), emits B20Created, grants the initial admin role (skipped when address(0) is passed), and dispatches each entry in initCalls on the new token. Returns the token address. The type is chosen once. After createB20 returns, the variant encoded in the address cannot change. The Factory retains no persisted access after the call returns. During the createB20 call, factory-originated calls bypass the token’s role gates and its transfer-side policy gates (TRANSFER_SENDER_POLICY, TRANSFER_RECEIVER_POLICY, TRANSFER_EXECUTOR_POLICY). This lets initCalls perform admin setup, grantRole, updatePolicy, updateSupplyCap, bootstrap transfers, without the Factory holding any role. The bypass is not total:
  • MINT_RECEIVER_POLICY is always enforced, including for factory-originated mints. An initCalls bundle that sets a restrictive MINT_RECEIVER_POLICY and then mints to a non-authorized account reverts PolicyForbids(MINT_RECEIVER_POLICY, ...), bubbled out of createB20.
  • Pause is never bypassed. Pause defaults to nothing-paused at creation. To start paused, sequence the pause(...) call last among initCalls.
  • Token invariants are never bypassed. Supply-cap math and balance accounting always apply.
The window closes when createB20 returns.

Parameters

Returns

Reverts

Access Control

No role required. Any caller may invoke createB20. The caller’s address is part of the address derivation (variant, msg.sender, salt).

Policy Interaction

No direct policy interaction at the Factory level. Policy gates on the new token are enforced during initCalls as described in the bootstrap window rules above.

Example

Usage Example