Skip to main content
Create a fiat-backed token with one call to IB20Factory.createB20 (selector 0x62975e6a, createB20(uint8,bytes32,bytes,bytes[])) on the B20 Factory, using the STABLECOIN variant. Decimals are fixed at 6, and the token carries an immutable, self-declared currency code such as USD. The type is sealed into the token address at creation and cannot change.

Demo

The demo uses a local browser-generated account to submit real transactions on Base Vibenet. If Vibenet or its B20 features are unavailable, it automatically switches to an illustrative offline version.
New to B20? See the B20 Token Standard for the concepts and a full launch walkthrough. These samples target base-std@1505323, viem@2.55.11, and Base Foundry v1.1.1.

How the Stablecoin Variant Works

Passing STABLECOIN to createB20 writes discriminant byte 0x01 into position [10] of the token address. After the call returns:
  • decimals() returns 6 (hardcoded; you do not pass a decimals value).
  • currency() returns the immutable code you provided (for example "USD"). B20 checks the format only, not that the code is a real currency.
  • The IB20Stablecoin surface is live at that address.
  • Asset-only selectors (announce, updateUIMultiplier, batchMint) do not execute on this address.
The currency field is required and must be uppercase ASCII A to Z only. An empty code reverts MissingRequiredField; any other byte reverts InvalidCurrency.

Create and Verify the Stablecoin

The params blob is one B20StablecoinCreateParams struct, ABI-encoded as a single tuple (uint8 version, string name, string symbol, address initialAdmin, string currency) with version set to 1. The encoded bytes start with the 32-byte tuple offset 0x20; do not pass the fields as separate arguments. See Creation Param Structs. Optional initCalls run on the new token in the same transaction; the factory drops access after they complete. See the B20 token standard for the complete interface, roles, and policies.
The factory emits B20Created, and the returned token address is ready for minting.
B20 tokens are open by default. Configure roles, policies, and the supply cap during creation before issuing value.

See Also

Mint Supply

Increase circulating supply.

Restrict Who Can Hold It

Allowlist eligible holders.